From: Włodzimierz Skiba Date: Wed, 5 Jul 2006 12:21:13 +0000 (+0000) Subject: wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9804d5404a9607cda3d08ec8225f52f78b78bc72?ds=inline 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 --- diff --git a/docs/changes.txt b/docs/changes.txt index 518391a689..a06114daed 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -158,6 +158,7 @@ All (GUI): - Added support for tabs in wxRichTextCtrl (Ashish More). - Fixed problem with zoom setting in print preview. - Moved wxRichTextCtrl from the advanced library to its own. +- wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls. wxMSW: diff --git a/docs/latex/wx/notebook.tex b/docs/latex/wx/notebook.tex index b7ca119732..5b38276454 100644 --- a/docs/latex/wx/notebook.tex +++ b/docs/latex/wx/notebook.tex @@ -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. 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 -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 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: \twocolwidtha{7cm} \begin{twocollist}\itemsep=0pt -\twocolitem{{\bf wxNB\_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 wxNB\_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 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\_NOWHERE}}{There was no tab under this point.} +\twocolitem{{\bf wxBK\_HITTEST\_ONICON}}{The point was over an icon (currently wxMSW only).} +\twocolitem{{\bf wxBK\_HITTEST\_ONLABEL}}{The point was over a label (currently wxMSW only).} +\twocolitem{{\bf wxBK\_HITTEST\_ONITEM}}{The point was over an item, but not on the label or icon.} +\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} } diff --git a/include/wx/bookctrl.h b/include/wx/bookctrl.h index 4cea68ba31..50b6dcdf13 100644 --- a/include/wx/bookctrl.h +++ b/include/wx/bookctrl.h @@ -27,6 +27,20 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages); 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 // ---------------------------------------------------------------------------- diff --git a/include/wx/notebook.h b/include/wx/notebook.h index bb36c49302..88551e2f23 100644 --- a/include/wx/notebook.h +++ b/include/wx/notebook.h @@ -26,16 +26,21 @@ // 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 { - wxNB_HITTEST_NOWHERE = 1, // not on tab - wxNB_HITTEST_ONICON = 2, // on icon - wxNB_HITTEST_ONLABEL = 4, // on label - wxNB_HITTEST_ONITEM = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL, - wxNB_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page + wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE, + wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON, + wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL, + wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM, + wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE }; +#endif // WXWIN_COMPATIBILITY_2_6 + typedef wxWindow wxNotebookPage; // so far, any window can be a page extern WXDLLEXPORT_DATA(const wxChar) wxNotebookNameStr[]; diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index 6adfd7ef7c..4149cd884a 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -584,10 +584,10 @@ void MyFrame::OnHitTest(wxCommandEvent& WXUNUSED(event)) wxString flagsStr; - AddFlagStrIfFlagPresent( flagsStr, flags, wxNB_HITTEST_NOWHERE, _T("wxNB_HITTEST_NOWHERE") ); - AddFlagStrIfFlagPresent( flagsStr, flags, wxNB_HITTEST_ONICON, _T("wxNB_HITTEST_ONICON") ); - AddFlagStrIfFlagPresent( flagsStr, flags, wxNB_HITTEST_ONLABEL, _T("wxNB_HITTEST_ONLABEL") ); - AddFlagStrIfFlagPresent( flagsStr, flags, wxNB_HITTEST_ONPAGE, _T("wxNB_HITTEST_ONPAGE") ); + AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_NOWHERE, _T("wxBK_HITTEST_NOWHERE") ); + AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONICON, _T("wxBK_HITTEST_ONICON") ); + AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONLABEL, _T("wxBK_HITTEST_ONLABEL") ); + AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONPAGE, _T("wxBK_HITTEST_ONPAGE") ); wxLogMessage(wxT("HitTest at (%d,%d): %d: %s"), pt.x, diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index c29bf85131..67059a7197 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -166,7 +166,7 @@ int wxListbook::HitTest(const wxPoint& pt, long *flags) const int pagePos = wxNOT_FOUND; if ( flags ) - *flags = wxNB_HITTEST_NOWHERE; + *flags = wxBK_HITTEST_NOWHERE; // convert from listbook control coordinates to list control coordinates const wxListView * const list = GetListView(); @@ -185,16 +185,16 @@ int wxListbook::HitTest(const wxPoint& pt, long *flags) const if ( flagsList & (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMSTATEICON ) ) - *flags |= wxNB_HITTEST_ONICON; + *flags |= wxBK_HITTEST_ONICON; if ( flagsList & wxLIST_HITTEST_ONITEMLABEL ) - *flags |= wxNB_HITTEST_ONLABEL; + *flags |= wxBK_HITTEST_ONLABEL; } } else // not over list control at all { if ( flags && GetPageRect().Inside(pt) ) - *flags |= wxNB_HITTEST_ONPAGE; + *flags |= wxBK_HITTEST_ONPAGE; } return pagePos; diff --git a/src/generic/toolbkg.cpp b/src/generic/toolbkg.cpp index 0822ab0ae8..0ae9b0b607 100644 --- a/src/generic/toolbkg.cpp +++ b/src/generic/toolbkg.cpp @@ -95,7 +95,7 @@ bool wxToolbook::Create(wxWindow *parent, orient = wxTB_VERTICAL; // TODO: make more configurable - + #if defined(__WXMAC__) && wxUSE_TOOLBAR && wxUSE_BMPBUTTON if (style & wxBK_BUTTONBAR) { @@ -314,7 +314,7 @@ int wxToolbook::HitTest(const wxPoint& pt, long *flags) const int pagePos = wxNOT_FOUND; if ( flags ) - *flags = wxNB_HITTEST_NOWHERE; + *flags = wxBK_HITTEST_NOWHERE; // convert from wxToolbook coordinates to wxToolBar ones const wxToolBarBase * const tbar = GetToolBar(); @@ -330,13 +330,13 @@ int wxToolbook::HitTest(const wxPoint& pt, long *flags) const { pagePos = tbar->GetToolPos(tool->GetId()); if ( flags ) - *flags = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL; + *flags = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL; } } else // not over the toolbar { if ( flags && GetPageRect().Inside(pt) ) - *flags |= wxNB_HITTEST_ONPAGE; + *flags |= wxBK_HITTEST_ONPAGE; } return pagePos; diff --git a/src/generic/treebkg.cpp b/src/generic/treebkg.cpp index fcf10b9d35..b93e0b3d89 100644 --- a/src/generic/treebkg.cpp +++ b/src/generic/treebkg.cpp @@ -728,7 +728,7 @@ int wxTreebook::HitTest(wxPoint const & pt, long * flags) const int pagePos = wxNOT_FOUND; if ( flags ) - *flags = wxNB_HITTEST_NOWHERE; + *flags = wxBK_HITTEST_NOWHERE; // convert from wxTreebook coorindates to wxTreeCtrl ones const wxTreeCtrl * const tree = GetTreeCtrl(); @@ -753,16 +753,16 @@ int wxTreebook::HitTest(wxPoint const & pt, long * flags) const if ( flagsTree & (wxTREE_HITTEST_ONITEMBUTTON | wxTREE_HITTEST_ONITEMICON | wxTREE_HITTEST_ONITEMSTATEICON) ) - *flags |= wxNB_HITTEST_ONICON; + *flags |= wxBK_HITTEST_ONICON; if ( flagsTree & wxTREE_HITTEST_ONITEMLABEL ) - *flags |= wxNB_HITTEST_ONLABEL; + *flags |= wxBK_HITTEST_ONLABEL; } } else // not over the tree { if ( flags && GetPageRect().Inside( pt ) ) - *flags |= wxNB_HITTEST_ONPAGE; + *flags |= wxBK_HITTEST_ONPAGE; } return pagePos; diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 25efc437f8..b8dfb49c81 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -778,15 +778,15 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const 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) ) { - *flags = wxNB_HITTEST_ONLABEL; + *flags = wxBK_HITTEST_ONLABEL; } else { - *flags = wxNB_HITTEST_ONITEM; + *flags = wxBK_HITTEST_ONITEM; } } @@ -796,7 +796,7 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const if ( flags ) { - *flags = wxNB_HITTEST_NOWHERE; + *flags = wxBK_HITTEST_NOWHERE; wxWindowBase * page = GetCurrentPage(); if ( page ) { @@ -808,7 +808,7 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const rect.x -= pos.x; rect.y -= pos.y; if ( rect.Inside( pt ) ) - *flags |= wxNB_HITTEST_ONPAGE; + *flags |= wxBK_HITTEST_ONPAGE; } } diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 4f08d0c1d5..ffa2e2a428 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -780,15 +780,15 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const 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) ) { - *flags = wxNB_HITTEST_ONLABEL; + *flags = wxBK_HITTEST_ONLABEL; } else { - *flags = wxNB_HITTEST_ONITEM; + *flags = wxBK_HITTEST_ONITEM; } } @@ -797,7 +797,7 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const } if ( flags ) - *flags = wxNB_HITTEST_NOWHERE; + *flags = wxBK_HITTEST_NOWHERE; return wxNOT_FOUND; } diff --git a/src/mac/carbon/notebmac.cpp b/src/mac/carbon/notebmac.cpp index 3764fd37ce..414bc978f9 100644 --- a/src/mac/carbon/notebmac.cpp +++ b/src/mac/carbon/notebmac.cpp @@ -376,9 +376,9 @@ int wxNotebook::HitTest(const wxPoint& pt, long * flags) const // we cannot differentiate better if (resultV >= 0) - *flags |= wxNB_HITTEST_ONLABEL; + *flags |= wxBK_HITTEST_ONLABEL; else - *flags |= wxNB_HITTEST_NOWHERE; + *flags |= wxBK_HITTEST_NOWHERE; } return resultV; diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 97e0049061..a7fcdfa202 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -814,15 +814,15 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const *flags = 0; if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE) - *flags |= wxNB_HITTEST_NOWHERE; + *flags |= wxBK_HITTEST_NOWHERE; if ((hitTestInfo.flags & TCHT_ONITEM) == TCHT_ONITEM) - *flags |= wxNB_HITTEST_ONITEM; + *flags |= wxBK_HITTEST_ONITEM; if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON) - *flags |= wxNB_HITTEST_ONICON; + *flags |= wxBK_HITTEST_ONICON; if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL) - *flags |= wxNB_HITTEST_ONLABEL; + *flags |= wxBK_HITTEST_ONLABEL; if ( item == wxNOT_FOUND && GetPageSize().Inside(pt) ) - *flags |= wxNB_HITTEST_ONPAGE; + *flags |= wxBK_HITTEST_ONPAGE; } return item; diff --git a/src/univ/notebook.cpp b/src/univ/notebook.cpp index 407dc958ae..4fe59855e8 100644 --- a/src/univ/notebook.cpp +++ b/src/univ/notebook.cpp @@ -585,7 +585,7 @@ void wxNotebook::DoDraw(wxControlRenderer *renderer) int wxNotebook::HitTest(const wxPoint& pt, long *flags) const { if ( flags ) - *flags = wxNB_HITTEST_NOWHERE; + *flags = wxBK_HITTEST_NOWHERE; // first check that it is in this window at all if ( !GetClientRect().Inside(pt) ) @@ -631,7 +631,7 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const if ( flags ) { // TODO: be more precise - *flags = wxNB_HITTEST_ONITEM; + *flags = wxBK_HITTEST_ONITEM; } return n;