wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-07-05 12:21:13 +00:00
parent 84dc000666
commit 9804d5404a
13 changed files with 66 additions and 46 deletions

View File

@@ -158,6 +158,7 @@ All (GUI):
- Added support for tabs in wxRichTextCtrl (Ashish More). - Added support for tabs in wxRichTextCtrl (Ashish More).
- Fixed problem with zoom setting in print preview. - Fixed problem with zoom setting in print preview.
- Moved wxRichTextCtrl from the advanced library to its own. - Moved wxRichTextCtrl from the advanced library to its own.
- wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls.
wxMSW: wxMSW:

View File

@@ -46,7 +46,7 @@ See also \helpref{window styles overview}{windowstyles}.
On Windows XP, the default theme paints a gradient on the notebook's pages. On Windows XP, the default theme paints a gradient on the notebook's pages.
If you wish to suppress this theme, for aesthetic or performance reasons, If you wish to suppress this theme, for aesthetic or performance reasons,
there are three ways of doing it. You can use wxNB\_NOPAGETHEME to disable there are three ways of doing it. You can use wxNB\_NOPAGETHEME to disable
themed drawing for a particular notebook, you can call {\tt wxSystemOptions::SetOption} themed drawing for a particular notebook, you can call {\tt wxSystemOptions::SetOption}
to disable it for the whole application, or you can disable it for individual to disable it for the whole application, or you can disable it for individual
pages by using {\tt SetBackgroundColour}. pages by using {\tt SetBackgroundColour}.
@@ -283,11 +283,11 @@ inside the tab is returned as well.
\docparam{flags}{Return value for detailed information. One of the following values: \docparam{flags}{Return value for detailed information. One of the following values:
\twocolwidtha{7cm} \twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxNB\_HITTEST\_NOWHERE}}{There was no tab under this point.} \twocolitem{{\bf wxBK\_HITTEST\_NOWHERE}}{There was no tab under this point.}
\twocolitem{{\bf wxNB\_HITTEST\_ONICON}}{The point was over an icon (currently wxMSW only).} \twocolitem{{\bf wxBK\_HITTEST\_ONICON}}{The point was over an icon (currently wxMSW only).}
\twocolitem{{\bf wxNB\_HITTEST\_ONLABEL}}{The point was over a label (currently wxMSW only).} \twocolitem{{\bf wxBK\_HITTEST\_ONLABEL}}{The point was over a label (currently wxMSW only).}
\twocolitem{{\bf wxNB\_HITTEST\_ONITEM}}{The point was over an item, but not on the label or icon.} \twocolitem{{\bf wxBK\_HITTEST\_ONITEM}}{The point was over an item, but not on the label or icon.}
\twocolitem{{\bf wxNB\_HITTEST\_ONPAGE}}{The point was over a currently selected page, not over any tab. Note that this flag is present only if {\tt wxNOT\_FOUND} is returned.} \twocolitem{{\bf wxBK\_HITTEST\_ONPAGE}}{The point was over a currently selected page, not over any tab. Note that this flag is present only if {\tt wxNOT\_FOUND} is returned.}
\end{twocollist} \end{twocollist}
} }

View File

@@ -27,6 +27,20 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages);
class WXDLLEXPORT wxImageList; class WXDLLEXPORT wxImageList;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// wxBookCtrl hit results
enum
{
wxBK_HITTEST_NOWHERE = 1, // not on tab
wxBK_HITTEST_ONICON = 2, // on icon
wxBK_HITTEST_ONLABEL = 4, // on label
wxBK_HITTEST_ONITEM = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL,
wxBK_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxBookCtrlBase // wxBookCtrlBase
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -26,16 +26,21 @@
// constants // constants
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxNotebook hit results #if WXWIN_COMPATIBILITY_2_6
// wxNotebook hit results, use wxBK_HITTEST so other book controls can share them
// if wxUSE_NOTEBOOK is disabled
enum enum
{ {
wxNB_HITTEST_NOWHERE = 1, // not on tab wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE,
wxNB_HITTEST_ONICON = 2, // on icon wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON,
wxNB_HITTEST_ONLABEL = 4, // on label wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL,
wxNB_HITTEST_ONITEM = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL, wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM,
wxNB_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE
}; };
#endif // WXWIN_COMPATIBILITY_2_6
typedef wxWindow wxNotebookPage; // so far, any window can be a page typedef wxWindow wxNotebookPage; // so far, any window can be a page
extern WXDLLEXPORT_DATA(const wxChar) wxNotebookNameStr[]; extern WXDLLEXPORT_DATA(const wxChar) wxNotebookNameStr[];

View File

@@ -584,10 +584,10 @@ void MyFrame::OnHitTest(wxCommandEvent& WXUNUSED(event))
wxString flagsStr; wxString flagsStr;
AddFlagStrIfFlagPresent( flagsStr, flags, wxNB_HITTEST_NOWHERE, _T("wxNB_HITTEST_NOWHERE") ); AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_NOWHERE, _T("wxBK_HITTEST_NOWHERE") );
AddFlagStrIfFlagPresent( flagsStr, flags, wxNB_HITTEST_ONICON, _T("wxNB_HITTEST_ONICON") ); AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONICON, _T("wxBK_HITTEST_ONICON") );
AddFlagStrIfFlagPresent( flagsStr, flags, wxNB_HITTEST_ONLABEL, _T("wxNB_HITTEST_ONLABEL") ); AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONLABEL, _T("wxBK_HITTEST_ONLABEL") );
AddFlagStrIfFlagPresent( flagsStr, flags, wxNB_HITTEST_ONPAGE, _T("wxNB_HITTEST_ONPAGE") ); AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONPAGE, _T("wxBK_HITTEST_ONPAGE") );
wxLogMessage(wxT("HitTest at (%d,%d): %d: %s"), wxLogMessage(wxT("HitTest at (%d,%d): %d: %s"),
pt.x, pt.x,

View File

@@ -166,7 +166,7 @@ int wxListbook::HitTest(const wxPoint& pt, long *flags) const
int pagePos = wxNOT_FOUND; int pagePos = wxNOT_FOUND;
if ( flags ) if ( flags )
*flags = wxNB_HITTEST_NOWHERE; *flags = wxBK_HITTEST_NOWHERE;
// convert from listbook control coordinates to list control coordinates // convert from listbook control coordinates to list control coordinates
const wxListView * const list = GetListView(); const wxListView * const list = GetListView();
@@ -185,16 +185,16 @@ int wxListbook::HitTest(const wxPoint& pt, long *flags) const
if ( flagsList & (wxLIST_HITTEST_ONITEMICON | if ( flagsList & (wxLIST_HITTEST_ONITEMICON |
wxLIST_HITTEST_ONITEMSTATEICON ) ) wxLIST_HITTEST_ONITEMSTATEICON ) )
*flags |= wxNB_HITTEST_ONICON; *flags |= wxBK_HITTEST_ONICON;
if ( flagsList & wxLIST_HITTEST_ONITEMLABEL ) if ( flagsList & wxLIST_HITTEST_ONITEMLABEL )
*flags |= wxNB_HITTEST_ONLABEL; *flags |= wxBK_HITTEST_ONLABEL;
} }
} }
else // not over list control at all else // not over list control at all
{ {
if ( flags && GetPageRect().Inside(pt) ) if ( flags && GetPageRect().Inside(pt) )
*flags |= wxNB_HITTEST_ONPAGE; *flags |= wxBK_HITTEST_ONPAGE;
} }
return pagePos; return pagePos;

View File

@@ -95,7 +95,7 @@ bool wxToolbook::Create(wxWindow *parent,
orient = wxTB_VERTICAL; orient = wxTB_VERTICAL;
// TODO: make more configurable // TODO: make more configurable
#if defined(__WXMAC__) && wxUSE_TOOLBAR && wxUSE_BMPBUTTON #if defined(__WXMAC__) && wxUSE_TOOLBAR && wxUSE_BMPBUTTON
if (style & wxBK_BUTTONBAR) if (style & wxBK_BUTTONBAR)
{ {
@@ -314,7 +314,7 @@ int wxToolbook::HitTest(const wxPoint& pt, long *flags) const
int pagePos = wxNOT_FOUND; int pagePos = wxNOT_FOUND;
if ( flags ) if ( flags )
*flags = wxNB_HITTEST_NOWHERE; *flags = wxBK_HITTEST_NOWHERE;
// convert from wxToolbook coordinates to wxToolBar ones // convert from wxToolbook coordinates to wxToolBar ones
const wxToolBarBase * const tbar = GetToolBar(); const wxToolBarBase * const tbar = GetToolBar();
@@ -330,13 +330,13 @@ int wxToolbook::HitTest(const wxPoint& pt, long *flags) const
{ {
pagePos = tbar->GetToolPos(tool->GetId()); pagePos = tbar->GetToolPos(tool->GetId());
if ( flags ) if ( flags )
*flags = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL; *flags = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL;
} }
} }
else // not over the toolbar else // not over the toolbar
{ {
if ( flags && GetPageRect().Inside(pt) ) if ( flags && GetPageRect().Inside(pt) )
*flags |= wxNB_HITTEST_ONPAGE; *flags |= wxBK_HITTEST_ONPAGE;
} }
return pagePos; return pagePos;

View File

@@ -728,7 +728,7 @@ int wxTreebook::HitTest(wxPoint const & pt, long * flags) const
int pagePos = wxNOT_FOUND; int pagePos = wxNOT_FOUND;
if ( flags ) if ( flags )
*flags = wxNB_HITTEST_NOWHERE; *flags = wxBK_HITTEST_NOWHERE;
// convert from wxTreebook coorindates to wxTreeCtrl ones // convert from wxTreebook coorindates to wxTreeCtrl ones
const wxTreeCtrl * const tree = GetTreeCtrl(); const wxTreeCtrl * const tree = GetTreeCtrl();
@@ -753,16 +753,16 @@ int wxTreebook::HitTest(wxPoint const & pt, long * flags) const
if ( flagsTree & (wxTREE_HITTEST_ONITEMBUTTON | if ( flagsTree & (wxTREE_HITTEST_ONITEMBUTTON |
wxTREE_HITTEST_ONITEMICON | wxTREE_HITTEST_ONITEMICON |
wxTREE_HITTEST_ONITEMSTATEICON) ) wxTREE_HITTEST_ONITEMSTATEICON) )
*flags |= wxNB_HITTEST_ONICON; *flags |= wxBK_HITTEST_ONICON;
if ( flagsTree & wxTREE_HITTEST_ONITEMLABEL ) if ( flagsTree & wxTREE_HITTEST_ONITEMLABEL )
*flags |= wxNB_HITTEST_ONLABEL; *flags |= wxBK_HITTEST_ONLABEL;
} }
} }
else // not over the tree else // not over the tree
{ {
if ( flags && GetPageRect().Inside( pt ) ) if ( flags && GetPageRect().Inside( pt ) )
*flags |= wxNB_HITTEST_ONPAGE; *flags |= wxBK_HITTEST_ONPAGE;
} }
return pagePos; return pagePos;

View File

@@ -778,15 +778,15 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
if ( pixmap && IsPointInsideWidget(pt, pixmap, x, y) ) if ( pixmap && IsPointInsideWidget(pt, pixmap, x, y) )
{ {
*flags = wxNB_HITTEST_ONICON; *flags = wxBK_HITTEST_ONICON;
} }
else if ( IsPointInsideWidget(pt, GTK_WIDGET(nb_page->m_label), x, y) ) else if ( IsPointInsideWidget(pt, GTK_WIDGET(nb_page->m_label), x, y) )
{ {
*flags = wxNB_HITTEST_ONLABEL; *flags = wxBK_HITTEST_ONLABEL;
} }
else else
{ {
*flags = wxNB_HITTEST_ONITEM; *flags = wxBK_HITTEST_ONITEM;
} }
} }
@@ -796,7 +796,7 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
if ( flags ) if ( flags )
{ {
*flags = wxNB_HITTEST_NOWHERE; *flags = wxBK_HITTEST_NOWHERE;
wxWindowBase * page = GetCurrentPage(); wxWindowBase * page = GetCurrentPage();
if ( page ) if ( page )
{ {
@@ -808,7 +808,7 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
rect.x -= pos.x; rect.x -= pos.x;
rect.y -= pos.y; rect.y -= pos.y;
if ( rect.Inside( pt ) ) if ( rect.Inside( pt ) )
*flags |= wxNB_HITTEST_ONPAGE; *flags |= wxBK_HITTEST_ONPAGE;
} }
} }

View File

@@ -780,15 +780,15 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
if ( pixmap && IsPointInsideWidget(pt, pixmap, x, y) ) if ( pixmap && IsPointInsideWidget(pt, pixmap, x, y) )
{ {
*flags = wxNB_HITTEST_ONICON; *flags = wxBK_HITTEST_ONICON;
} }
else if ( IsPointInsideWidget(pt, GTK_WIDGET(nb_page->m_label), x, y) ) else if ( IsPointInsideWidget(pt, GTK_WIDGET(nb_page->m_label), x, y) )
{ {
*flags = wxNB_HITTEST_ONLABEL; *flags = wxBK_HITTEST_ONLABEL;
} }
else else
{ {
*flags = wxNB_HITTEST_ONITEM; *flags = wxBK_HITTEST_ONITEM;
} }
} }
@@ -797,7 +797,7 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
} }
if ( flags ) if ( flags )
*flags = wxNB_HITTEST_NOWHERE; *flags = wxBK_HITTEST_NOWHERE;
return wxNOT_FOUND; return wxNOT_FOUND;
} }

View File

@@ -376,9 +376,9 @@ int wxNotebook::HitTest(const wxPoint& pt, long * flags) const
// we cannot differentiate better // we cannot differentiate better
if (resultV >= 0) if (resultV >= 0)
*flags |= wxNB_HITTEST_ONLABEL; *flags |= wxBK_HITTEST_ONLABEL;
else else
*flags |= wxNB_HITTEST_NOWHERE; *flags |= wxBK_HITTEST_NOWHERE;
} }
return resultV; return resultV;

View File

@@ -814,15 +814,15 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
*flags = 0; *flags = 0;
if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE) if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE)
*flags |= wxNB_HITTEST_NOWHERE; *flags |= wxBK_HITTEST_NOWHERE;
if ((hitTestInfo.flags & TCHT_ONITEM) == TCHT_ONITEM) if ((hitTestInfo.flags & TCHT_ONITEM) == TCHT_ONITEM)
*flags |= wxNB_HITTEST_ONITEM; *flags |= wxBK_HITTEST_ONITEM;
if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON) if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON)
*flags |= wxNB_HITTEST_ONICON; *flags |= wxBK_HITTEST_ONICON;
if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL) if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL)
*flags |= wxNB_HITTEST_ONLABEL; *flags |= wxBK_HITTEST_ONLABEL;
if ( item == wxNOT_FOUND && GetPageSize().Inside(pt) ) if ( item == wxNOT_FOUND && GetPageSize().Inside(pt) )
*flags |= wxNB_HITTEST_ONPAGE; *flags |= wxBK_HITTEST_ONPAGE;
} }
return item; return item;

View File

@@ -585,7 +585,7 @@ void wxNotebook::DoDraw(wxControlRenderer *renderer)
int wxNotebook::HitTest(const wxPoint& pt, long *flags) const int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
{ {
if ( flags ) if ( flags )
*flags = wxNB_HITTEST_NOWHERE; *flags = wxBK_HITTEST_NOWHERE;
// first check that it is in this window at all // first check that it is in this window at all
if ( !GetClientRect().Inside(pt) ) if ( !GetClientRect().Inside(pt) )
@@ -631,7 +631,7 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
if ( flags ) if ( flags )
{ {
// TODO: be more precise // TODO: be more precise
*flags = wxNB_HITTEST_ONITEM; *flags = wxBK_HITTEST_ONITEM;
} }
return n; return n;