fill in flags parameter of HitTest() for all book controls; added new wxNB_HITTEST_ONPAGE bit
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -287,6 +287,7 @@ inside the tab is returned as well.
|
|||||||
\twocolitem{{\bf wxNB\_HITTEST\_ONICON}}{The point was over an icon (currently wxMSW only).}
|
\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\_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\_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.}
|
||||||
\end{twocollist}
|
\end{twocollist}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,7 +32,8 @@ enum
|
|||||||
wxNB_HITTEST_NOWHERE = 1, // not on tab
|
wxNB_HITTEST_NOWHERE = 1, // not on tab
|
||||||
wxNB_HITTEST_ONICON = 2, // on icon
|
wxNB_HITTEST_ONICON = 2, // on icon
|
||||||
wxNB_HITTEST_ONLABEL = 4, // on label
|
wxNB_HITTEST_ONLABEL = 4, // on label
|
||||||
wxNB_HITTEST_ONITEM = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL
|
wxNB_HITTEST_ONITEM = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL,
|
||||||
|
wxNB_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef wxWindow wxNotebookPage; // so far, any window can be a page
|
typedef wxWindow wxNotebookPage; // so far, any window can be a page
|
||||||
|
@@ -57,6 +57,7 @@ public:
|
|||||||
const wxString& name = wxEmptyString);
|
const wxString& name = wxEmptyString);
|
||||||
|
|
||||||
|
|
||||||
|
// implement base class virtuals
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
virtual bool SetPageText(size_t n, const wxString& strText);
|
virtual bool SetPageText(size_t n, const wxString& strText);
|
||||||
virtual wxString GetPageText(size_t n) const;
|
virtual wxString GetPageText(size_t n) const;
|
||||||
@@ -72,11 +73,16 @@ public:
|
|||||||
virtual void SetImageList(wxImageList *imageList);
|
virtual void SetImageList(wxImageList *imageList);
|
||||||
|
|
||||||
virtual bool DeleteAllPages();
|
virtual bool DeleteAllPages();
|
||||||
|
virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
|
||||||
|
|
||||||
|
|
||||||
|
// methods which are not part of base wxBookctrl API
|
||||||
|
|
||||||
|
// get the underlying toolbar
|
||||||
wxToolBarBase* GetToolBar() const { return (wxToolBarBase*)m_bookctrl; }
|
wxToolBarBase* GetToolBar() const { return (wxToolBarBase*)m_bookctrl; }
|
||||||
|
|
||||||
// Not part of the wxBookctrl API, but must be called in OnIdle or
|
// must be called in OnIdle or by application to realize the toolbar and
|
||||||
// by application to realize the toolbar and select the initial page.
|
// select the initial page.
|
||||||
void Realize();
|
void Realize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -97,7 +103,7 @@ protected:
|
|||||||
bool m_needsRealizing;
|
bool m_needsRealizing;
|
||||||
|
|
||||||
// maximum bitmap size
|
// maximum bitmap size
|
||||||
wxSize m_maxBitmapSize;
|
wxSize m_maxBitmapSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of all constructors
|
// common part of all constructors
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
#include "wx/artprov.h"
|
#include "wx/artprov.h"
|
||||||
|
#include "wx/cshelp.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
#include "notebook.h"
|
#include "notebook.h"
|
||||||
|
|
||||||
#if !defined(__WXMSW__) && !defined(__WXPM__)
|
#if !defined(__WXMSW__) && !defined(__WXPM__)
|
||||||
@@ -177,7 +179,7 @@ wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MyFrame::MyFrame()
|
MyFrame::MyFrame()
|
||||||
: wxFrame(NULL, wxID_ANY, wxString(wxT("wxWidgets book controls sample")))
|
: wxFrame(NULL, wxID_ANY, wxString(wxT("wxWidgets book controls sample")))
|
||||||
{
|
{
|
||||||
#if wxUSE_NOTEBOOK
|
#if wxUSE_NOTEBOOK
|
||||||
m_type = Type_Notebook;
|
m_type = Type_Notebook;
|
||||||
@@ -224,18 +226,21 @@ MyFrame::MyFrame()
|
|||||||
menuOrient->AppendRadioItem(ID_ORIENT_LEFT, wxT("&Left\tCtrl-8"));
|
menuOrient->AppendRadioItem(ID_ORIENT_LEFT, wxT("&Left\tCtrl-8"));
|
||||||
menuOrient->AppendRadioItem(ID_ORIENT_RIGHT, wxT("&Right\tCtrl-9"));
|
menuOrient->AppendRadioItem(ID_ORIENT_RIGHT, wxT("&Right\tCtrl-9"));
|
||||||
|
|
||||||
wxMenu *menuOperations = new wxMenu;
|
wxMenu *menuPageOperations = new wxMenu;
|
||||||
menuOperations->Append(ID_ADD_PAGE, wxT("&Add page\tAlt-A"));
|
menuPageOperations->Append(ID_ADD_PAGE, wxT("&Add page\tAlt-A"));
|
||||||
menuOperations->Append(ID_INSERT_PAGE, wxT("&Insert page\tAlt-I"));
|
menuPageOperations->Append(ID_INSERT_PAGE, wxT("&Insert page\tAlt-I"));
|
||||||
menuOperations->Append(ID_DELETE_CUR_PAGE, wxT("&Delete current page\tAlt-D"));
|
menuPageOperations->Append(ID_DELETE_CUR_PAGE, wxT("&Delete current page\tAlt-D"));
|
||||||
menuOperations->Append(ID_DELETE_LAST_PAGE, wxT("D&elete last page\tAlt-L"));
|
menuPageOperations->Append(ID_DELETE_LAST_PAGE, wxT("D&elete last page\tAlt-L"));
|
||||||
menuOperations->Append(ID_NEXT_PAGE, wxT("&Next page\tAlt-N"));
|
menuPageOperations->Append(ID_NEXT_PAGE, wxT("&Next page\tAlt-N"));
|
||||||
#if wxUSE_TREEBOOK
|
#if wxUSE_TREEBOOK
|
||||||
menuOperations->AppendSeparator();
|
menuPageOperations->AppendSeparator();
|
||||||
menuOperations->Append(ID_ADD_PAGE_BEFORE, wxT("Insert page &before\tAlt-B"));
|
menuPageOperations->Append(ID_ADD_PAGE_BEFORE, wxT("Insert page &before\tAlt-B"));
|
||||||
menuOperations->Append(ID_ADD_SUB_PAGE, wxT("Add s&ub page\tAlt-U"));
|
menuPageOperations->Append(ID_ADD_SUB_PAGE, wxT("Add s&ub page\tAlt-U"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wxMenu *menuOperations = new wxMenu;
|
||||||
|
menuOperations->Append(ID_HITTEST, wxT("&Hit test\tCtrl-H"));
|
||||||
|
|
||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
menuFile->Append(wxID_ANY, wxT("&Type"), menuType, wxT("Type of control"));
|
menuFile->Append(wxID_ANY, wxT("&Type"), menuType, wxT("Type of control"));
|
||||||
menuFile->Append(wxID_ANY, wxT("&Orientation"), menuOrient, wxT("Orientation of control"));
|
menuFile->Append(wxID_ANY, wxT("&Orientation"), menuOrient, wxT("Orientation of control"));
|
||||||
@@ -248,6 +253,7 @@ MyFrame::MyFrame()
|
|||||||
|
|
||||||
wxMenuBar *menuBar = new wxMenuBar;
|
wxMenuBar *menuBar = new wxMenuBar;
|
||||||
menuBar->Append(menuFile, wxT("&File"));
|
menuBar->Append(menuFile, wxT("&File"));
|
||||||
|
menuBar->Append(menuPageOperations, wxT("&Pages"));
|
||||||
menuBar->Append(menuOperations, wxT("&Operations"));
|
menuBar->Append(menuOperations, wxT("&Operations"));
|
||||||
SetMenuBar(menuBar);
|
SetMenuBar(menuBar);
|
||||||
|
|
||||||
@@ -481,6 +487,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(ID_DELETE_LAST_PAGE, MyFrame::OnDeleteLastPage)
|
EVT_MENU(ID_DELETE_LAST_PAGE, MyFrame::OnDeleteLastPage)
|
||||||
EVT_MENU(ID_NEXT_PAGE, MyFrame::OnNextPage)
|
EVT_MENU(ID_NEXT_PAGE, MyFrame::OnNextPage)
|
||||||
|
|
||||||
|
EVT_MENU(ID_HITTEST, MyFrame::OnHitTest)
|
||||||
|
|
||||||
// Book controls
|
// Book controls
|
||||||
#if wxUSE_NOTEBOOK
|
#if wxUSE_NOTEBOOK
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnNotebook)
|
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnNotebook)
|
||||||
@@ -512,6 +520,38 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_IDLE(MyFrame::OnIdle)
|
EVT_IDLE(MyFrame::OnIdle)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void MyFrame::AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const
|
||||||
|
{
|
||||||
|
if( (flags & flag) == flag )
|
||||||
|
{
|
||||||
|
if( !flagStr.empty() )
|
||||||
|
flagStr += _T(" | ");
|
||||||
|
flagStr += flagName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnHitTest(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxBookCtrlBase * book = GetCurrentBook();
|
||||||
|
const wxPoint pt = ::wxGetMousePosition();
|
||||||
|
|
||||||
|
long flags;
|
||||||
|
int pagePos = book->HitTest( book->ScreenToClient(pt), &flags );
|
||||||
|
|
||||||
|
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") );
|
||||||
|
|
||||||
|
wxLogMessage(wxT("HitTest at (%d,%d): %d: %s"),
|
||||||
|
pt.x,
|
||||||
|
pt.y,
|
||||||
|
pagePos,
|
||||||
|
flagsStr.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnType(wxCommandEvent& event)
|
void MyFrame::OnType(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
m_type = wx_static_cast(BookType, event.GetId() - ID_BOOK_NOTEBOOK);
|
m_type = wx_static_cast(BookType, event.GetId() - ID_BOOK_NOTEBOOK);
|
||||||
@@ -562,6 +602,7 @@ void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxPanel *MyFrame::CreateNewPage() const
|
wxPanel *MyFrame::CreateNewPage() const
|
||||||
{
|
{
|
||||||
wxPanel *panel = new wxPanel(m_bookCtrl, wxID_ANY );
|
wxPanel *panel = new wxPanel(m_bookCtrl, wxID_ANY );
|
||||||
|
|
||||||
(void) new wxButton(panel, wxID_ANY, wxT("First button"), wxPoint(10, 10));
|
(void) new wxButton(panel, wxID_ANY, wxT("First button"), wxPoint(10, 10));
|
||||||
(void) new wxButton(panel, wxID_ANY, wxT("Second button"), wxPoint(50, 100));
|
(void) new wxButton(panel, wxID_ANY, wxT("Second button"), wxPoint(50, 100));
|
||||||
|
|
||||||
|
@@ -52,6 +52,8 @@ public:
|
|||||||
void OnAddSubPage(wxCommandEvent& event);
|
void OnAddSubPage(wxCommandEvent& event);
|
||||||
void OnAddPageBefore(wxCommandEvent& event);
|
void OnAddPageBefore(wxCommandEvent& event);
|
||||||
|
|
||||||
|
void OnHitTest(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnBookCtrl(wxBookCtrlBaseEvent& event);
|
void OnBookCtrl(wxBookCtrlBaseEvent& event);
|
||||||
#if wxUSE_NOTEBOOK
|
#if wxUSE_NOTEBOOK
|
||||||
void OnNotebook(wxNotebookEvent& event) { OnBookCtrl(event); }
|
void OnNotebook(wxNotebookEvent& event) { OnBookCtrl(event); }
|
||||||
@@ -83,6 +85,7 @@ private:
|
|||||||
void RecreateBook();
|
void RecreateBook();
|
||||||
wxPanel *CreateNewPage() const;
|
wxPanel *CreateNewPage() const;
|
||||||
int TranslateBookFlag(int nb, int lb, int chb, int tbk, int toolbk) const;
|
int TranslateBookFlag(int nb, int lb, int chb, int tbk, int toolbk) const;
|
||||||
|
void AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const;
|
||||||
|
|
||||||
// Sample setup
|
// Sample setup
|
||||||
enum BookType
|
enum BookType
|
||||||
@@ -139,7 +142,9 @@ enum ID_COMMANDS
|
|||||||
ID_DELETE_LAST_PAGE,
|
ID_DELETE_LAST_PAGE,
|
||||||
ID_NEXT_PAGE,
|
ID_NEXT_PAGE,
|
||||||
ID_ADD_PAGE_BEFORE,
|
ID_ADD_PAGE_BEFORE,
|
||||||
ID_ADD_SUB_PAGE
|
ID_ADD_SUB_PAGE,
|
||||||
|
|
||||||
|
ID_HITTEST
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -186,9 +186,9 @@ void wxBookCtrlBase::OnHelp(wxHelpEvent& event)
|
|||||||
page = GetPage((size_t)pagePos);
|
page = GetPage((size_t)pagePos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // event.GetOrigin() != wxHelpEvent::Origin_HelpButton
|
||||||
if ( !page )
|
|
||||||
{
|
{
|
||||||
|
// if event came from keyboard then show the current page help
|
||||||
page = GetCurrentPage();
|
page = GetCurrentPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -161,22 +161,41 @@ void wxListbook::OnSize(wxSizeEvent& event)
|
|||||||
wxBookCtrlBase::OnSize(event);
|
wxBookCtrlBase::OnSize(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListbook::HitTest(const wxPoint& pt, long * WXUNUSED(flags)) const
|
int wxListbook::HitTest(const wxPoint& pt, long *flags) const
|
||||||
{
|
{
|
||||||
int pagePos = wxNOT_FOUND;
|
int pagePos = wxNOT_FOUND;
|
||||||
|
|
||||||
const wxPoint clientPt = ClientToScreen(GetListView()->ScreenToClient(pt));
|
if ( flags )
|
||||||
|
*flags = wxNB_HITTEST_NOWHERE;
|
||||||
|
|
||||||
if ( wxRect(GetListView()->GetSize()).Inside(clientPt) )
|
// convert from listbook control coordinates to list control coordinates
|
||||||
|
const wxListView * const list = GetListView();
|
||||||
|
const wxPoint listPt = list->ScreenToClient(ClientToScreen(pt));
|
||||||
|
|
||||||
|
// is the point inside list control?
|
||||||
|
if ( wxRect(list->GetSize()).Inside(listPt) )
|
||||||
{
|
{
|
||||||
int flagsList;
|
int flagsList;
|
||||||
pagePos = GetListView()->HitTest(clientPt, flagsList);
|
pagePos = list->HitTest(listPt, flagsList);
|
||||||
|
|
||||||
if ( !(flagsList & wxLIST_HITTEST_ONITEM) )
|
if ( flags )
|
||||||
{
|
{
|
||||||
pagePos = wxNOT_FOUND;
|
if ( pagePos != wxNOT_FOUND )
|
||||||
|
*flags = 0;
|
||||||
|
|
||||||
|
if ( flagsList & (wxLIST_HITTEST_ONITEMICON |
|
||||||
|
wxLIST_HITTEST_ONITEMSTATEICON ) )
|
||||||
|
*flags |= wxNB_HITTEST_ONICON;
|
||||||
|
|
||||||
|
if ( flagsList & wxLIST_HITTEST_ONITEMLABEL )
|
||||||
|
*flags |= wxNB_HITTEST_ONLABEL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // not over list control at all
|
||||||
|
{
|
||||||
|
if ( flags && GetPageRect().Inside(pt) )
|
||||||
|
*flags |= wxNB_HITTEST_ONPAGE;
|
||||||
|
}
|
||||||
|
|
||||||
return pagePos;
|
return pagePos;
|
||||||
}
|
}
|
||||||
|
@@ -309,6 +309,39 @@ void wxToolbook::Realize()
|
|||||||
DoSize();
|
DoSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxToolbook::HitTest(const wxPoint& pt, long *flags) const
|
||||||
|
{
|
||||||
|
int pagePos = wxNOT_FOUND;
|
||||||
|
|
||||||
|
if ( flags )
|
||||||
|
*flags = wxNB_HITTEST_NOWHERE;
|
||||||
|
|
||||||
|
// convert from wxToolbook coordinates to wxToolBar ones
|
||||||
|
const wxToolBarBase * const tbar = GetToolBar();
|
||||||
|
const wxPoint tbarPt = tbar->ScreenToClient(ClientToScreen(pt));
|
||||||
|
|
||||||
|
// is the point over the toolbar?
|
||||||
|
if ( wxRect(tbar->GetSize()).Inside(tbarPt) )
|
||||||
|
{
|
||||||
|
const wxToolBarToolBase * const
|
||||||
|
tool = tbar->FindToolForPosition(tbarPt.x, tbarPt.y);
|
||||||
|
|
||||||
|
if ( tool )
|
||||||
|
{
|
||||||
|
pagePos = tbar->GetToolPos(tool->GetId());
|
||||||
|
if ( flags )
|
||||||
|
*flags = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // not over the toolbar
|
||||||
|
{
|
||||||
|
if ( flags && GetPageRect().Inside(pt) )
|
||||||
|
*flags |= wxNB_HITTEST_ONPAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pagePos;
|
||||||
|
}
|
||||||
|
|
||||||
void wxToolbook::OnIdle(wxIdleEvent& event)
|
void wxToolbook::OnIdle(wxIdleEvent& event)
|
||||||
{
|
{
|
||||||
if (m_needsRealizing)
|
if (m_needsRealizing)
|
||||||
|
@@ -723,13 +723,18 @@ void wxTreebook::OnTreeNodeExpandedCollapsed(wxTreeEvent & event)
|
|||||||
// wxTreebook geometry management
|
// wxTreebook geometry management
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int wxTreebook::HitTest(wxPoint const & pt, long * WXUNUSED(flags)) const
|
int wxTreebook::HitTest(wxPoint const & pt, long * flags) const
|
||||||
{
|
{
|
||||||
int pagePos = wxNOT_FOUND;
|
int pagePos = wxNOT_FOUND;
|
||||||
|
|
||||||
wxTreeCtrl * const tree = GetTreeCtrl();
|
if ( flags )
|
||||||
const wxPoint treePt = ClientToScreen(tree->ScreenToClient(pt));
|
*flags = wxNB_HITTEST_NOWHERE;
|
||||||
|
|
||||||
|
// convert from wxTreebook coorindates to wxTreeCtrl ones
|
||||||
|
const wxTreeCtrl * const tree = GetTreeCtrl();
|
||||||
|
const wxPoint treePt = tree->ScreenToClient(ClientToScreen(pt));
|
||||||
|
|
||||||
|
// is it over the tree?
|
||||||
if ( wxRect(tree->GetSize()).Inside(treePt) )
|
if ( wxRect(tree->GetSize()).Inside(treePt) )
|
||||||
{
|
{
|
||||||
int flagsTree;
|
int flagsTree;
|
||||||
@@ -739,6 +744,25 @@ int wxTreebook::HitTest(wxPoint const & pt, long * WXUNUSED(flags)) const
|
|||||||
{
|
{
|
||||||
pagePos = DoInternalFindPageById(id);
|
pagePos = DoInternalFindPageById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( flags )
|
||||||
|
{
|
||||||
|
if ( pagePos != wxNOT_FOUND )
|
||||||
|
*flags = 0;
|
||||||
|
|
||||||
|
if ( flagsTree & (wxTREE_HITTEST_ONITEMBUTTON |
|
||||||
|
wxTREE_HITTEST_ONITEMICON |
|
||||||
|
wxTREE_HITTEST_ONITEMSTATEICON) )
|
||||||
|
*flags |= wxNB_HITTEST_ONICON;
|
||||||
|
|
||||||
|
if ( flagsTree & wxTREE_HITTEST_ONITEMLABEL )
|
||||||
|
*flags |= wxNB_HITTEST_ONLABEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // not over the tree
|
||||||
|
{
|
||||||
|
if ( flags && GetPageRect().Inside( pt ) )
|
||||||
|
*flags |= wxNB_HITTEST_ONPAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pagePos;
|
return pagePos;
|
||||||
|
@@ -795,7 +795,22 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( flags )
|
if ( flags )
|
||||||
|
{
|
||||||
*flags = wxNB_HITTEST_NOWHERE;
|
*flags = wxNB_HITTEST_NOWHERE;
|
||||||
|
wxWindowBase * page = GetCurrentPage();
|
||||||
|
if ( page )
|
||||||
|
{
|
||||||
|
// rect origin is in notebook's parent coordinates
|
||||||
|
wxRect rect = page->GetRect();
|
||||||
|
|
||||||
|
// adjust it to the notebook's coordinates
|
||||||
|
wxPoint pos = GetPosition();
|
||||||
|
rect.x -= pos.x;
|
||||||
|
rect.y -= pos.y;
|
||||||
|
if ( rect.Inside( pt ) )
|
||||||
|
*flags |= wxNB_HITTEST_ONPAGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return wxNOT_FOUND;
|
return wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
|
@@ -818,6 +818,8 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
|
|||||||
*flags |= wxNB_HITTEST_ONICON;
|
*flags |= wxNB_HITTEST_ONICON;
|
||||||
if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL)
|
if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL)
|
||||||
*flags |= wxNB_HITTEST_ONLABEL;
|
*flags |= wxNB_HITTEST_ONLABEL;
|
||||||
|
if ( item == wxNOT_FOUND && GetPageSize().Inside(pt) )
|
||||||
|
*flags |= wxNB_HITTEST_ONPAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
Reference in New Issue
Block a user