Implement wxAuiNotebook::HitTest()
Check if point is on window or a certain tab. Closes https://github.com/wxWidgets/wxWidgets/pull/1059
This commit is contained in:
parent
089eeea3ef
commit
ab1fd56977
@ -144,6 +144,7 @@ All (GUI):
|
||||
- Adapt AUI colours to system colour changes (Daniel Kulp).
|
||||
- Fix removing and inserting pages in wxToolbook (Stefan Ziegler).
|
||||
- Fix bug in template selection in docview framework (jwiesemann).
|
||||
- Implement wxAuiNotebook::HitTest() (Sebastian Walderich).
|
||||
|
||||
wxGTK:
|
||||
|
||||
|
@ -3359,10 +3359,37 @@ void wxAuiNotebook::SetPageSize (const wxSize& WXUNUSED(size))
|
||||
wxFAIL_MSG("Not implemented for wxAuiNotebook");
|
||||
}
|
||||
|
||||
int wxAuiNotebook::HitTest (const wxPoint& WXUNUSED(pt), long* WXUNUSED(flags)) const
|
||||
int wxAuiNotebook::HitTest (const wxPoint &pt, long *flags) const
|
||||
{
|
||||
wxFAIL_MSG("Not implemented for wxAuiNotebook");
|
||||
return wxNOT_FOUND;
|
||||
wxWindow *w = NULL;
|
||||
long position = wxBK_HITTEST_NOWHERE;
|
||||
const wxAuiPaneInfoArray& all_panes = const_cast<wxAuiManager&>(m_mgr).GetAllPanes();
|
||||
const size_t pane_count = all_panes.GetCount();
|
||||
for (size_t i = 0; i < pane_count; ++i)
|
||||
{
|
||||
if (all_panes.Item(i).name == wxT("dummy"))
|
||||
continue;
|
||||
|
||||
wxTabFrame* tabframe = (wxTabFrame*) all_panes.Item(i).window;
|
||||
if (tabframe->m_tab_rect.Contains(pt))
|
||||
{
|
||||
wxPoint tabpos = tabframe->m_tabs->ScreenToClient(ClientToScreen(pt));
|
||||
if (tabframe->m_tabs->TabHitTest(tabpos.x, tabpos.y, &w))
|
||||
position = wxBK_HITTEST_ONITEM;
|
||||
break;
|
||||
}
|
||||
else if (tabframe->m_rect.Contains(pt))
|
||||
{
|
||||
w = tabframe->m_tabs->GetWindowFromIdx(tabframe->m_tabs->GetActivePage());
|
||||
if (w)
|
||||
position = wxBK_HITTEST_ONPAGE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags)
|
||||
*flags = position;
|
||||
return w ? GetPageIndex(w) : wxNOT_FOUND;
|
||||
}
|
||||
|
||||
int wxAuiNotebook::GetPageImage(size_t WXUNUSED(n)) const
|
||||
|
Loading…
Reference in New Issue
Block a user