1. fixed compilation after wxList::compatibility_iterator changes
2. removed #if wxUSE_STL tests which are not needed any longer 3. better fix for SetCurrent() virtual hiding: just rename the method git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -45,6 +45,8 @@
|
|||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#endif // __WXMSW__
|
#endif // __WXMSW__
|
||||||
|
|
||||||
|
typedef wxMenuItemList::compatibility_iterator wxMenuItemIter;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxMenuInfo contains all extra information about top level menus we need
|
// wxMenuInfo contains all extra information about top level menus we need
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -144,13 +146,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find the menu item at given position
|
// find the menu item at given position
|
||||||
wxMenuItemList::compatibility_iterator GetMenuItemFromPoint(const wxPoint& pt) const;
|
wxMenuItemIter GetMenuItemFromPoint(const wxPoint& pt) const;
|
||||||
|
|
||||||
// refresh the given item
|
// refresh the given item
|
||||||
void RefreshItem(wxMenuItem *item);
|
void RefreshItem(wxMenuItem *item);
|
||||||
|
|
||||||
// preselect the first item
|
// preselect the first item
|
||||||
void SelectFirst() { SetCurrent(m_menu->GetMenuItems().GetFirst()); }
|
void SelectFirst() { SetCurrentItem(m_menu->GetMenuItems().GetFirst()); }
|
||||||
|
|
||||||
// process the key event, return true if done
|
// process the key event, return true if done
|
||||||
bool ProcessKeyDown(int key);
|
bool ProcessKeyDown(int key);
|
||||||
@@ -161,8 +163,6 @@ public:
|
|||||||
// don't dismiss the popup window if the parent menu was clicked
|
// don't dismiss the popup window if the parent menu was clicked
|
||||||
virtual bool ProcessLeftDown(wxMouseEvent& event);
|
virtual bool ProcessLeftDown(wxMouseEvent& event);
|
||||||
|
|
||||||
virtual bool SetCurrent(bool doit = true) { return wxPopupTransientWindow::SetCurrent(doit); };
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// how did we perform this operation?
|
// how did we perform this operation?
|
||||||
enum InputMethod
|
enum InputMethod
|
||||||
@@ -186,11 +186,11 @@ protected:
|
|||||||
// reset the current item and node
|
// reset the current item and node
|
||||||
void ResetCurrent();
|
void ResetCurrent();
|
||||||
|
|
||||||
// set the current node and item withotu refreshing anything
|
// set the current node and item without refreshing anything
|
||||||
void SetCurrent(wxMenuItemList::compatibility_iterator node);
|
void SetCurrentItem(wxMenuItemIter node);
|
||||||
|
|
||||||
// change the current item refreshing the old and new items
|
// change the current item refreshing the old and new items
|
||||||
void ChangeCurrent(wxMenuItemList::compatibility_iterator node);
|
void ChangeCurrent(wxMenuItemIter node);
|
||||||
|
|
||||||
// activate item, i.e. call either ClickItem() or OpenSubmenu() depending
|
// activate item, i.e. call either ClickItem() or OpenSubmenu() depending
|
||||||
// on what it is, return true if something was done (i.e. it's not a
|
// on what it is, return true if something was done (i.e. it's not a
|
||||||
@@ -220,23 +220,23 @@ protected:
|
|||||||
bool HasOpenSubmenu() const { return m_hasOpenSubMenu; }
|
bool HasOpenSubmenu() const { return m_hasOpenSubMenu; }
|
||||||
|
|
||||||
// get previous node after the current one
|
// get previous node after the current one
|
||||||
wxMenuItemList::compatibility_iterator GetPrevNode() const;
|
wxMenuItemIter GetPrevNode() const;
|
||||||
|
|
||||||
// get previous node before the given one, wrapping if it's the first one
|
// get previous node before the given one, wrapping if it's the first one
|
||||||
wxMenuItemList::compatibility_iterator GetPrevNode(wxMenuItemList::compatibility_iterator node) const;
|
wxMenuItemIter GetPrevNode(wxMenuItemIter node) const;
|
||||||
|
|
||||||
// get next node after the current one
|
// get next node after the current one
|
||||||
wxMenuItemList::compatibility_iterator GetNextNode() const;
|
wxMenuItemIter GetNextNode() const;
|
||||||
|
|
||||||
// get next node after the given one, wrapping if it's the last one
|
// get next node after the given one, wrapping if it's the last one
|
||||||
wxMenuItemList::compatibility_iterator GetNextNode(wxMenuItemList::compatibility_iterator node) const;
|
wxMenuItemIter GetNextNode(wxMenuItemIter node) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the menu we show
|
// the menu we show
|
||||||
wxMenu *m_menu;
|
wxMenu *m_menu;
|
||||||
|
|
||||||
// the menu node corresponding to the current item
|
// the menu node corresponding to the current item
|
||||||
wxMenuItemList::compatibility_iterator m_nodeCurrent;
|
wxMenuItemIter m_nodeCurrent;
|
||||||
|
|
||||||
// do we currently have an opened submenu?
|
// do we currently have an opened submenu?
|
||||||
bool m_hasOpenSubMenu;
|
bool m_hasOpenSubMenu;
|
||||||
@@ -335,23 +335,19 @@ wxPopupMenuWindow::~wxPopupMenuWindow()
|
|||||||
|
|
||||||
void wxPopupMenuWindow::ResetCurrent()
|
void wxPopupMenuWindow::ResetCurrent()
|
||||||
{
|
{
|
||||||
#if wxUSE_STL
|
SetCurrentItem(wxMenuItemIter());
|
||||||
SetCurrent(wxMenuItemList::compatibility_iterator());
|
|
||||||
#else
|
|
||||||
SetCurrent((wxwxMenuItemListNode *)NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPopupMenuWindow::SetCurrent(wxMenuItemList::compatibility_iterator node)
|
void wxPopupMenuWindow::SetCurrentItem(wxMenuItemIter node)
|
||||||
{
|
{
|
||||||
m_nodeCurrent = node;
|
m_nodeCurrent = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::compatibility_iterator node)
|
void wxPopupMenuWindow::ChangeCurrent(wxMenuItemIter node)
|
||||||
{
|
{
|
||||||
if ( node != m_nodeCurrent )
|
if ( node != m_nodeCurrent )
|
||||||
{
|
{
|
||||||
wxMenuItemList::compatibility_iterator nodeOldCurrent = m_nodeCurrent;
|
wxMenuItemIter nodeOldCurrent = m_nodeCurrent;
|
||||||
|
|
||||||
m_nodeCurrent = node;
|
m_nodeCurrent = node;
|
||||||
|
|
||||||
@@ -375,15 +371,15 @@ void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::compatibility_iterator nod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItemList::compatibility_iterator wxPopupMenuWindow::GetPrevNode() const
|
wxMenuItemIter wxPopupMenuWindow::GetPrevNode() const
|
||||||
{
|
{
|
||||||
// return the last node if there had been no previously selected one
|
// return the last node if there had been no previously selected one
|
||||||
return m_nodeCurrent ? GetPrevNode(m_nodeCurrent)
|
return m_nodeCurrent ? GetPrevNode(m_nodeCurrent)
|
||||||
: m_menu->GetMenuItems().GetLast();
|
: m_menu->GetMenuItems().GetLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItemList::compatibility_iterator
|
wxMenuItemIter
|
||||||
wxPopupMenuWindow::GetPrevNode(wxMenuItemList::compatibility_iterator node) const
|
wxPopupMenuWindow::GetPrevNode(wxMenuItemIter node) const
|
||||||
{
|
{
|
||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
@@ -398,15 +394,15 @@ wxPopupMenuWindow::GetPrevNode(wxMenuItemList::compatibility_iterator node) cons
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItemList::compatibility_iterator wxPopupMenuWindow::GetNextNode() const
|
wxMenuItemIter wxPopupMenuWindow::GetNextNode() const
|
||||||
{
|
{
|
||||||
// return the first node if there had been no previously selected one
|
// return the first node if there had been no previously selected one
|
||||||
return m_nodeCurrent ? GetNextNode(m_nodeCurrent)
|
return m_nodeCurrent ? GetNextNode(m_nodeCurrent)
|
||||||
: m_menu->GetMenuItems().GetFirst();
|
: m_menu->GetMenuItems().GetFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItemList::compatibility_iterator
|
wxMenuItemIter
|
||||||
wxPopupMenuWindow::GetNextNode(wxMenuItemList::compatibility_iterator node) const
|
wxPopupMenuWindow::GetNextNode(wxMenuItemIter node) const
|
||||||
{
|
{
|
||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
@@ -509,7 +505,7 @@ void wxPopupMenuWindow::DismissAndNotify()
|
|||||||
// wxPopupMenuWindow geometry
|
// wxPopupMenuWindow geometry
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxMenuItemList::compatibility_iterator
|
wxMenuItemIter
|
||||||
wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const
|
wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const
|
||||||
{
|
{
|
||||||
// we only use the y coord normally, but still check x in case the point is
|
// we only use the y coord normally, but still check x in case the point is
|
||||||
@@ -517,7 +513,7 @@ wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const
|
|||||||
if ( wxWindow::HitTest(pt) == wxHT_WINDOW_INSIDE )
|
if ( wxWindow::HitTest(pt) == wxHT_WINDOW_INSIDE )
|
||||||
{
|
{
|
||||||
wxCoord y = 0;
|
wxCoord y = 0;
|
||||||
for ( wxMenuItemList::compatibility_iterator node = m_menu->GetMenuItems().GetFirst();
|
for ( wxMenuItemIter node = m_menu->GetMenuItems().GetFirst();
|
||||||
node;
|
node;
|
||||||
node = node->GetNext() )
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
@@ -531,11 +527,7 @@ wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_STL
|
return wxMenuItemIter();
|
||||||
return wxMenuItemList::compatibility_iterator();
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -569,7 +561,7 @@ void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer)
|
|||||||
|
|
||||||
wxCoord y = 0;
|
wxCoord y = 0;
|
||||||
const wxMenuGeometryInfo& gi = m_menu->GetGeometryInfo();
|
const wxMenuGeometryInfo& gi = m_menu->GetGeometryInfo();
|
||||||
for ( wxMenuItemList::compatibility_iterator node = m_menu->GetMenuItems().GetFirst();
|
for ( wxMenuItemIter node = m_menu->GetMenuItems().GetFirst();
|
||||||
node;
|
node;
|
||||||
node = node->GetNext() )
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
@@ -729,7 +721,7 @@ bool wxPopupMenuWindow::ProcessLeftDown(wxMouseEvent& event)
|
|||||||
|
|
||||||
void wxPopupMenuWindow::OnLeftUp(wxMouseEvent& event)
|
void wxPopupMenuWindow::OnLeftUp(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
wxMenuItemList::compatibility_iterator node = GetMenuItemFromPoint(event.GetPosition());
|
wxMenuItemIter node = GetMenuItemFromPoint(event.GetPosition());
|
||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
ActivateItem(node->GetData(), WithMouse);
|
ActivateItem(node->GetData(), WithMouse);
|
||||||
@@ -763,7 +755,7 @@ void wxPopupMenuWindow::OnMouseMove(wxMouseEvent& event)
|
|||||||
|
|
||||||
void wxPopupMenuWindow::ProcessMouseMove(const wxPoint& pt)
|
void wxPopupMenuWindow::ProcessMouseMove(const wxPoint& pt)
|
||||||
{
|
{
|
||||||
wxMenuItemList::compatibility_iterator node = GetMenuItemFromPoint(pt);
|
wxMenuItemIter node = GetMenuItemFromPoint(pt);
|
||||||
|
|
||||||
// don't reset current to NULL here, we only do it when the mouse leaves
|
// don't reset current to NULL here, we only do it when the mouse leaves
|
||||||
// the window (see below)
|
// the window (see below)
|
||||||
@@ -854,11 +846,7 @@ void wxPopupMenuWindow::OnMouseLeave(wxMouseEvent& event)
|
|||||||
|
|
||||||
if ( resetCurrent )
|
if ( resetCurrent )
|
||||||
{
|
{
|
||||||
#if wxUSE_STL
|
ChangeCurrent(wxMenuItemIter());
|
||||||
ChangeCurrent(wxMenuItemList::compatibility_iterator());
|
|
||||||
#else
|
|
||||||
ChangeCurrent(NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,9 +924,8 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key)
|
|||||||
{
|
{
|
||||||
bool up = key == WXK_UP;
|
bool up = key == WXK_UP;
|
||||||
|
|
||||||
wxMenuItemList::compatibility_iterator nodeStart = up ? GetPrevNode()
|
wxMenuItemIter nodeStart = up ? GetPrevNode() : GetNextNode(),
|
||||||
: GetNextNode(),
|
node = nodeStart;
|
||||||
node = nodeStart;
|
|
||||||
while ( node && node->GetData()->IsSeparator() )
|
while ( node && node->GetData()->IsSeparator() )
|
||||||
{
|
{
|
||||||
node = up ? GetPrevNode(node) : GetNextNode(node);
|
node = up ? GetPrevNode(node) : GetNextNode(node);
|
||||||
@@ -947,11 +934,7 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key)
|
|||||||
{
|
{
|
||||||
// nothing but separators and disabled items in this
|
// nothing but separators and disabled items in this
|
||||||
// menu, break out
|
// menu, break out
|
||||||
#if wxUSE_STL
|
node = wxMenuItemIter();
|
||||||
node = wxMenuItemList::compatibility_iterator();
|
|
||||||
#else
|
|
||||||
node = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,7 +968,7 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key)
|
|||||||
// we want to start from the item after this one because
|
// we want to start from the item after this one because
|
||||||
// if we're already on the item with the given accel we want to
|
// if we're already on the item with the given accel we want to
|
||||||
// go to the next one, not to stay in place
|
// go to the next one, not to stay in place
|
||||||
wxMenuItemList::compatibility_iterator nodeStart = GetNextNode();
|
wxMenuItemIter nodeStart = GetNextNode();
|
||||||
|
|
||||||
// do we have more than one item with this accel?
|
// do we have more than one item with this accel?
|
||||||
bool notUnique = false;
|
bool notUnique = false;
|
||||||
@@ -995,12 +978,8 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key)
|
|||||||
|
|
||||||
// loop through all items searching for the item with this
|
// loop through all items searching for the item with this
|
||||||
// accel
|
// accel
|
||||||
wxMenuItemList::compatibility_iterator node = nodeStart,
|
wxMenuItemIter nodeFound,
|
||||||
#if wxUSE_STL
|
node = nodeStart;
|
||||||
nodeFound = wxMenuItemList::compatibility_iterator();
|
|
||||||
#else
|
|
||||||
nodeFound = NULL;
|
|
||||||
#endif
|
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
item = node->GetData();
|
item = node->GetData();
|
||||||
@@ -1163,7 +1142,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
|
|||||||
{
|
{
|
||||||
// we need to update its end item
|
// we need to update its end item
|
||||||
item->SetRadioGroupStart(m_startRadioGroup);
|
item->SetRadioGroupStart(m_startRadioGroup);
|
||||||
wxMenuItemList::compatibility_iterator node = GetMenuItems().Item(m_startRadioGroup);
|
wxMenuItemIter node = GetMenuItems().Item(m_startRadioGroup);
|
||||||
|
|
||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
@@ -1448,7 +1427,7 @@ bool wxMenu::ProcessAccelEvent(const wxKeyEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// try our submenus
|
// try our submenus
|
||||||
for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
|
for ( wxMenuItemIter node = GetMenuItems().GetFirst();
|
||||||
node;
|
node;
|
||||||
node = node->GetNext() )
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
@@ -1636,7 +1615,7 @@ void wxMenuItem::Check(bool check)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// also uncheck all the other items in this radio group
|
// also uncheck all the other items in this radio group
|
||||||
wxMenuItemList::compatibility_iterator node = items.Item(start);
|
wxMenuItemIter node = items.Item(start);
|
||||||
for ( int n = start; n <= end && node; n++ )
|
for ( int n = start; n <= end && node; n++ )
|
||||||
{
|
{
|
||||||
if ( n != pos )
|
if ( n != pos )
|
||||||
|
Reference in New Issue
Block a user