projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make it possible to change the text of the item being edited from OnBeginLabelEdit()
[wxWidgets.git]
/
src
/
univ
/
menu.cpp
diff --git
a/src/univ/menu.cpp
b/src/univ/menu.cpp
index 0ebba81d1978767532dfe5bab40cfd88f726da66..8e3957ddf7677f603a95f49075076ef17a89def2 100644
(file)
--- a/
src/univ/menu.cpp
+++ b/
src/univ/menu.cpp
@@
-75,7
+75,7
@@
public:
m_width = 0;
}
m_width = 0;
}
- void SetEnabled(bool enabled =
TRUE
) { m_isEnabled = enabled; }
+ void SetEnabled(bool enabled =
true
) { m_isEnabled = enabled; }
// accessors
// accessors
@@
-136,7
+136,7
@@
public:
virtual void OnDismiss();
// called when a submenu is dismissed
virtual void OnDismiss();
// called when a submenu is dismissed
- void OnSubmenuDismiss(
) { m_hasOpenSubMenu = FALSE; }
+ void OnSubmenuDismiss(
bool dismissParent);
// get the currently selected item (may be NULL)
wxMenuItem *GetCurrentItem() const
// get the currently selected item (may be NULL)
wxMenuItem *GetCurrentItem() const
@@
-153,7
+153,7
@@
public:
// preselect the first item
void SelectFirst() { SetCurrent(m_menu->GetMenuItems().GetFirst()); }
// preselect the first item
void SelectFirst() { SetCurrent(m_menu->GetMenuItems().GetFirst()); }
- // process the key event, return
TRUE
if done
+ // process the key event, return
true
if done
bool ProcessKeyDown(int key);
// process mouse move event
bool ProcessKeyDown(int key);
// process mouse move event
@@
-190,7
+190,7
@@
protected:
void ChangeCurrent(wxMenuItemList::compatibility_iterator node);
// activate item, i.e. call either ClickItem() or OpenSubmenu() depending
void ChangeCurrent(wxMenuItemList::compatibility_iterator node);
// 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
// separator...)
bool ActivateItem(wxMenuItem *item, InputMethod how = WithKeyboard);
// separator...)
bool ActivateItem(wxMenuItem *item, InputMethod how = WithKeyboard);
@@
-258,7
+258,7
@@
public:
}
else
{
}
else
{
- // return
FALSE
;
+ // return
false
;
return wxEvtHandler::ProcessEvent(event);
}
return wxEvtHandler::ProcessEvent(event);
}
@@
-304,7
+304,7
@@
END_EVENT_TABLE()
wxPopupMenuWindow::wxPopupMenuWindow(wxWindow *parent, wxMenu *menu)
{
m_menu = menu;
wxPopupMenuWindow::wxPopupMenuWindow(wxWindow *parent, wxMenu *menu)
{
m_menu = menu;
- m_hasOpenSubMenu =
FALSE
;
+ m_hasOpenSubMenu =
false
;
ResetCurrent();
ResetCurrent();
@@
-358,7
+358,7
@@
void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::compatibility_iterator nod
if ( item->IsSubMenu() && item->GetSubMenu()->IsShown() )
{
item->GetSubMenu()->Dismiss();
if ( item->IsSubMenu() && item->GetSubMenu()->IsShown() )
{
item->GetSubMenu()->Dismiss();
- OnSubmenuDismiss();
+ OnSubmenuDismiss(
false
);
}
RefreshItem(item);
}
RefreshItem(item);
@@
-463,7
+463,7
@@
void wxPopupMenuWindow::Dismiss()
wxCHECK_RET( win, _T("opened submenu is not opened?") );
win->Dismiss();
wxCHECK_RET( win, _T("opened submenu is not opened?") );
win->Dismiss();
- OnSubmenuDismiss();
+ OnSubmenuDismiss(
false
);
}
wxPopupTransientWindow::Dismiss();
}
wxPopupTransientWindow::Dismiss();
@@
-473,7
+473,16
@@
void wxPopupMenuWindow::OnDismiss()
{
// when we are dismissed because the user clicked elsewhere or we lost
// focus in any other way, hide the parent menu as well
{
// when we are dismissed because the user clicked elsewhere or we lost
// focus in any other way, hide the parent menu as well
- HandleDismiss(TRUE);
+ HandleDismiss(true);
+}
+
+void wxPopupMenuWindow::OnSubmenuDismiss(bool dismissParent)
+{
+ m_hasOpenSubMenu = false;
+
+ // we are closing whole menu so remove current highlight
+ if ( dismissParent )
+ ResetCurrent();
}
void wxPopupMenuWindow::HandleDismiss(bool dismissParent)
}
void wxPopupMenuWindow::HandleDismiss(bool dismissParent)
@@
-486,7
+495,7
@@
void wxPopupMenuWindow::HandleDismiss(bool dismissParent)
void wxPopupMenuWindow::DismissAndNotify()
{
Dismiss();
void wxPopupMenuWindow::DismissAndNotify()
{
Dismiss();
- HandleDismiss(
TRUE
);
+ HandleDismiss(
true
);
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
@@
-648,7
+657,7
@@
void wxPopupMenuWindow::OpenSubmenu(wxMenuItem *item, InputMethod how)
wxSize(m_menu->GetGeometryInfo().GetSize().x, 0),
how == WithKeyboard /* preselect first item then */);
wxSize(m_menu->GetGeometryInfo().GetSize().x, 0),
how == WithKeyboard /* preselect first item then */);
- m_hasOpenSubMenu =
TRUE
;
+ m_hasOpenSubMenu =
true
;
}
bool wxPopupMenuWindow::ActivateItem(wxMenuItem *item, InputMethod how)
}
bool wxPopupMenuWindow::ActivateItem(wxMenuItem *item, InputMethod how)
@@
-656,7
+665,7
@@
bool wxPopupMenuWindow::ActivateItem(wxMenuItem *item, InputMethod how)
// don't activate disabled items
if ( !item || !item->IsEnabled() )
{
// don't activate disabled items
if ( !item || !item->IsEnabled() )
{
- return
FALSE
;
+ return
false
;
}
// normal menu items generate commands, submenus can be opened and
}
// normal menu items generate commands, submenus can be opened and
@@
-671,10
+680,10
@@
bool wxPopupMenuWindow::ActivateItem(wxMenuItem *item, InputMethod how)
}
else // separator, can't activate
{
}
else // separator, can't activate
{
- return
FALSE
;
+ return
false
;
}
}
- return
TRUE
;
+ return
true
;
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
@@
-696,19
+705,19
@@
bool wxPopupMenuWindow::ProcessLeftDown(wxMouseEvent& event)
{
wxPopupMenuWindow *win = menu->m_popupMenu;
{
wxPopupMenuWindow *win = menu->m_popupMenu;
- wxCHECK_MSG( win,
FALSE
, _T("parent menu not shown?") );
+ wxCHECK_MSG( win,
false
, _T("parent menu not shown?") );
pos = ClientToScreen(pos);
if ( win->GetMenuItemFromPoint(win->ScreenToClient(pos)) )
{
// eat the event
pos = ClientToScreen(pos);
if ( win->GetMenuItemFromPoint(win->ScreenToClient(pos)) )
{
// eat the event
- return
TRUE
;
+ return
true
;
}
//else: it is outside the parent menu as well, do dismiss this one
}
}
}
//else: it is outside the parent menu as well, do dismiss this one
}
}
- return
FALSE
;
+ return
false
;
}
void wxPopupMenuWindow::OnLeftUp(wxMouseEvent& event)
}
void wxPopupMenuWindow::OnLeftUp(wxMouseEvent& event)
@@
-833,7
+842,7
@@
void wxPopupMenuWindow::OnMouseLeave(wxMouseEvent& event)
else
{
// this menu is the last opened
else
{
// this menu is the last opened
- resetCurrent =
TRUE
;
+ resetCurrent =
true
;
}
if ( resetCurrent )
}
if ( resetCurrent )
@@
-866,14
+875,14
@@
bool wxPopupMenuWindow::ProcessKeyDown(int key)
// to open it inspit of this)
if ( HasOpenSubmenu() )
{
// to open it inspit of this)
if ( HasOpenSubmenu() )
{
- wxCHECK_MSG( CanOpen(item),
FALSE
,
+ wxCHECK_MSG( CanOpen(item),
false
,
_T("has open submenu but another item selected?") );
if ( item->GetSubMenu()->ProcessKeyDown(key) )
_T("has open submenu but another item selected?") );
if ( item->GetSubMenu()->ProcessKeyDown(key) )
- return
TRUE
;
+ return
true
;
}
}
- bool processed =
TRUE
;
+ bool processed =
true
;
// handle the up/down arrows, home, end, esc and return here, pass the
// left/right arrows to the menu bar except when the right arrow can be
// handle the up/down arrows, home, end, esc and return here, pass the
// left/right arrows to the menu bar except when the right arrow can be
@@
-885,7
+894,7
@@
bool wxPopupMenuWindow::ProcessKeyDown(int key)
// menubar
if ( !m_menu->GetParent() )
{
// menubar
if ( !m_menu->GetParent() )
{
- processed =
FALSE
;
+ processed =
false
;
break;
}
break;
}
@@
-894,7
+903,7
@@
bool wxPopupMenuWindow::ProcessKeyDown(int key)
case WXK_ESCAPE:
// close just this menu
Dismiss();
case WXK_ESCAPE:
// close just this menu
Dismiss();
- HandleDismiss(
FALSE
);
+ HandleDismiss(
false
);
break;
case WXK_RETURN:
break;
case WXK_RETURN:
@@
-939,7
+948,7
@@
bool wxPopupMenuWindow::ProcessKeyDown(int key)
}
else
{
}
else
{
- processed =
FALSE
;
+ processed =
false
;
}
}
break;
}
}
break;
@@
-952,13
+961,13
@@
bool wxPopupMenuWindow::ProcessKeyDown(int key)
}
else
{
}
else
{
- processed =
FALSE
;
+ processed =
false
;
}
break;
default:
// look for the menu item starting with this letter
}
break;
default:
// look for the menu item starting with this letter
- if ( wxIsalnum(key) )
+ if ( wxIsalnum(
(wxChar)
key) )
{
// 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
{
// 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
@@
-966,10
+975,10
@@
bool wxPopupMenuWindow::ProcessKeyDown(int key)
wxMenuItemList::compatibility_iterator nodeStart = GetNextNode();
// do we have more than one item with this accel?
wxMenuItemList::compatibility_iterator nodeStart = GetNextNode();
// do we have more than one item with this accel?
- bool notUnique =
FALSE
;
+ bool notUnique =
false
;
// translate everything to lower case before comparing
// translate everything to lower case before comparing
- wxChar chAccel = wxTolower(key);
+ wxChar chAccel =
(wxChar)
wxTolower(key);
// loop through all items searching for the item with this
// accel
// loop through all items searching for the item with this
// accel
@@
-998,7
+1007,7
@@
bool wxPopupMenuWindow::ProcessKeyDown(int key)
}
else // we already had found such item
{
}
else // we already had found such item
{
- notUnique =
TRUE
;
+ notUnique =
true
;
// no need to continue further, we won't find
// anything we don't already know
// no need to continue further, we won't find
// anything we don't already know
@@
-1031,12
+1040,12
@@
bool wxPopupMenuWindow::ProcessKeyDown(int key)
//else: just select it but don't activate as the user might
// have wanted to activate another item
//else: just select it but don't activate as the user might
// have wanted to activate another item
- // skip "processed =
FALSE
" below
+ // skip "processed =
false
" below
break;
}
}
break;
}
}
- processed =
FALSE
;
+ processed =
false
;
}
return processed;
}
return processed;
@@
-1124,11
+1133,6
@@
void wxMenu::EndRadioGroup()
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{
- #if 0
- // not used at all
- bool check = FALSE;
- #endif
-
if ( item->GetKind() == wxITEM_RADIO )
{
int count = GetMenuItemCount();
if ( item->GetKind() == wxITEM_RADIO )
{
int count = GetMenuItemCount();
@@
-1141,12
+1145,6
@@
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
// for now it has just one element
item->SetAsRadioGroupStart();
item->SetRadioGroupEnd(m_startRadioGroup);
// for now it has just one element
item->SetAsRadioGroupStart();
item->SetRadioGroupEnd(m_startRadioGroup);
-
- // ensure that we have a checked item in the radio group
- #if 0
- // not used at all
- check = TRUE;
- #endif
}
else // extend the current radio group
{
}
else // extend the current radio group
{
@@
-1235,10
+1233,10
@@
void wxMenu::Detach()
wxWindow *wxMenu::GetRootWindow() const
{
wxWindow *wxMenu::GetRootWindow() const
{
- if (
m_menuBar
)
+ if (
GetMenuBar()
)
{
// simple case - a normal menu attached to the menubar
{
// simple case - a normal menu attached to the menubar
- return
m_menuBar
;
+ return
GetMenuBar()
;
}
// we're a popup menu but the trouble is that only the top level popup menu
}
// we're a popup menu but the trouble is that only the top level popup menu
@@
-1318,7
+1316,7
@@
void wxMenu::OnDismiss(bool dismissParent)
wxPopupMenuWindow *win = m_menuParent->m_popupMenu;
if ( win )
{
wxPopupMenuWindow *win = m_menuParent->m_popupMenu;
if ( win )
{
- win->OnSubmenuDismiss();
+ win->OnSubmenuDismiss(
true
);
}
else
{
}
else
{
@@
-1330,7
+1328,7
@@
void wxMenu::OnDismiss(bool dismissParent)
{
// dismissParent is recursive
m_menuParent->Dismiss();
{
// dismissParent is recursive
m_menuParent->Dismiss();
- m_menuParent->OnDismiss(
TRUE
);
+ m_menuParent->OnDismiss(
true
);
}
}
else // no parent menu
}
}
else // no parent menu
@@
-1396,7
+1394,7
@@
void wxMenu::Dismiss()
bool wxMenu::ProcessKeyDown(int key)
{
bool wxMenu::ProcessKeyDown(int key)
{
- wxCHECK_MSG( m_popupMenu,
FALSE
,
+ wxCHECK_MSG( m_popupMenu,
false
,
_T("can't process key events if not shown") );
return m_popupMenu->ProcessKeyDown(key);
_T("can't process key events if not shown") );
return m_popupMenu->ProcessKeyDown(key);
@@
-1447,12
+1445,12
@@
bool wxMenu::ProcessAccelEvent(const wxKeyEvent& event)
// try its elements
if ( item->GetSubMenu()->ProcessAccelEvent(event) )
{
// try its elements
if ( item->GetSubMenu()->ProcessAccelEvent(event) )
{
- return
TRUE
;
+ return
true
;
}
}
}
}
}
}
- return
FALSE
;
+ return
false
;
}
void wxMenu::AddAccelFor(wxMenuItem *item)
}
void wxMenu::AddAccelFor(wxMenuItem *item)
@@
-1494,10
+1492,10
@@
wxMenuItem::wxMenuItem(wxMenu *parentMenu,
: wxMenuItemBase(parentMenu, id, text, help, kind, subMenu)
{
m_posY =
: wxMenuItemBase(parentMenu, id, text, help, kind, subMenu)
{
m_posY =
- m_height =
-1
;
+ m_height =
wxDefaultCoord
;
m_radioGroup.start = -1;
m_radioGroup.start = -1;
- m_isRadioGroupStart =
FALSE
;
+ m_isRadioGroupStart =
false
;
m_bmpDisabled = wxNullBitmap;
m_bmpDisabled = wxNullBitmap;
@@
-1630,7
+1628,7
@@
void wxMenuItem::Check(bool check)
{
if ( n != pos )
{
{
if ( n != pos )
{
- node->GetData()->m_isChecked =
FALSE
;
+ node->GetData()->m_isChecked =
false
;
}
node = node->GetNext();
}
}
node = node->GetNext();
}
@@
-1646,7
+1644,7
@@
void wxMenuItem::Check(bool check)
void wxMenuItem::SetAsRadioGroupStart()
{
void wxMenuItem::SetAsRadioGroupStart()
{
- m_isRadioGroupStart =
TRUE
;
+ m_isRadioGroupStart =
true
;
}
void wxMenuItem::SetRadioGroupStart(int start)
}
void wxMenuItem::SetRadioGroupStart(int start)
@@
-1677,7
+1675,15
@@
void wxMenuBar::Init()
m_menuShown = NULL;
m_menuShown = NULL;
- m_shouldShowMenu = FALSE;
+ m_shouldShowMenu = false;
+}
+
+wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
+{
+ Init();
+
+ for (size_t i = 0; i < n; ++i )
+ Append(menus[i], titles[i]);
}
void wxMenuBar::Attach(wxFrame *frame)
}
void wxMenuBar::Attach(wxFrame *frame)
@@
-1701,14
+1707,14
@@
void wxMenuBar::Attach(wxFrame *frame)
else // not created yet, do it now
{
// we have no way to return the error from here anyhow :-(
else // not created yet, do it now
{
// we have no way to return the error from here anyhow :-(
- (void)Create(frame,
-1
);
+ (void)Create(frame,
wxID_ANY
);
SetCursor(wxCURSOR_ARROW);
SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT));
// calculate and set our height (it won't be changed any more)
SetCursor(wxCURSOR_ARROW);
SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT));
// calculate and set our height (it won't be changed any more)
- SetSize(
-1
, GetBestSize().y);
+ SetSize(
wxDefaultCoord
, GetBestSize().y);
}
// remember the last frame which had us to avoid unnecessarily reparenting
}
// remember the last frame which had us to avoid unnecessarily reparenting
@@
-1743,14
+1749,14
@@
bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
{
if ( !wxMenuBarBase::Insert(pos, menu, title) )
bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
{
if ( !wxMenuBarBase::Insert(pos, menu, title) )
- return
FALSE
;
+ return
false
;
wxMenuInfo *info = new wxMenuInfo(title);
m_menuInfos.Insert(info, pos);
RefreshAllItemsAfter(pos);
wxMenuInfo *info = new wxMenuInfo(title);
m_menuInfos.Insert(info, pos);
RefreshAllItemsAfter(pos);
- return
TRUE
;
+ return
true
;
}
wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
}
wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
@@
-1814,7
+1820,7
@@
void wxMenuBar::EnableTop(size_t pos, bool enable)
bool wxMenuBar::IsEnabledTop(size_t pos) const
{
bool wxMenuBar::IsEnabledTop(size_t pos) const
{
- wxCHECK_MSG( pos < GetCount(),
FALSE
, _T("invalid index in IsEnabledTop") );
+ wxCHECK_MSG( pos < GetCount(),
false
, _T("invalid index in IsEnabledTop") );
return m_menuInfos[pos].IsEnabled();
}
return m_menuInfos[pos].IsEnabled();
}
@@
-1834,7
+1840,7
@@
void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
wxString wxMenuBar::GetLabelTop(size_t pos) const
{
wxString wxMenuBar::GetLabelTop(size_t pos) const
{
- wxCHECK_MSG( pos < GetCount(),
_T("")
, _T("invalid index in GetLabelTop") );
+ wxCHECK_MSG( pos < GetCount(),
wxEmptyString
, _T("invalid index in GetLabelTop") );
return m_menuInfos[pos].GetLabel();
}
return m_menuInfos[pos].GetLabel();
}
@@
-2025,7
+2031,7
@@
void wxMenuBar::DoSelectMenu(size_t pos)
if ( IsShowingMenu() )
{
// restore m_shouldShowMenu flag after DismissMenu() which resets
if ( IsShowingMenu() )
{
// restore m_shouldShowMenu flag after DismissMenu() which resets
- // it to
FALSE
+ // it to
false
bool old = m_shouldShowMenu;
DismissMenu();
bool old = m_shouldShowMenu;
DismissMenu();
@@
-2094,14
+2100,14
@@
void wxMenuBar::OnLeftDown(wxMouseEvent& event)
}
else // on item
{
}
else // on item
{
-
wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::OnLeftDown"));
+ wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::OnLeftDown"));
CaptureMouse();
// show it as selected
RefreshItem((size_t)m_current);
// show the menu
CaptureMouse();
// show it as selected
RefreshItem((size_t)m_current);
// show the menu
- PopupCurrentMenu(
FALSE
/* don't select first item - as Windows does */);
+ PopupCurrentMenu(
false
/* don't select first item - as Windows does */);
}
}
}
}
}
}
@@
-2128,7
+2134,7
@@
bool wxMenuBar::ProcessMouseEvent(const wxPoint& pt)
static wxPoint s_ptLast;
if ( pt == s_ptLast )
{
static wxPoint s_ptLast;
if ( pt == s_ptLast )
{
- return
FALSE
;
+ return
false
;
}
s_ptLast = pt;
}
s_ptLast = pt;
@@
-2137,7
+2143,7
@@
bool wxMenuBar::ProcessMouseEvent(const wxPoint& pt)
int currentNew = GetMenuFromPoint(pt);
if ( (currentNew == -1) || (currentNew == m_current) )
{
int currentNew = GetMenuFromPoint(pt);
if ( (currentNew == -1) || (currentNew == m_current) )
{
- return
FALSE
;
+ return
false
;
}
// select the new active item
}
// select the new active item
@@
-2148,10
+2154,10
@@
bool wxMenuBar::ProcessMouseEvent(const wxPoint& pt)
if ( m_shouldShowMenu && !m_menuShown)
{
// open the new menu if the old one we closed had been opened
if ( m_shouldShowMenu && !m_menuShown)
{
// open the new menu if the old one we closed had been opened
- PopupCurrentMenu(
FALSE
/* don't select first item - as Windows does */);
+ PopupCurrentMenu(
false
/* don't select first item - as Windows does */);
}
}
- return
TRUE
;
+ return
true
;
}
void wxMenuBar::OnKeyDown(wxKeyEvent& event)
}
void wxMenuBar::OnKeyDown(wxKeyEvent& event)
@@
-2187,7
+2193,7
@@
void wxMenuBar::OnKeyDown(wxKeyEvent& event)
// the menu when up/down one is
switch ( key )
{
// the menu when up/down one is
switch ( key )
{
- case WXK_
MENU
:
+ case WXK_
ALT
:
// Alt must be processed at wxWindow level too
event.Skip();
// fall through
// Alt must be processed at wxWindow level too
event.Skip();
// fall through
@@
-2295,7
+2301,7
@@
void wxMenuBar::OnKeyDown(wxKeyEvent& event)
int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const
{
int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const
{
- if ( !wxIsalnum(key) )
+ if ( !wxIsalnum(
(wxChar)
key) )
{
// we only support letters/digits as accels
return -1;
{
// we only support letters/digits as accels
return -1;
@@
-2303,10
+2309,10
@@
int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const
// do we have more than one item with this accel?
if ( unique )
// do we have more than one item with this accel?
if ( unique )
- *unique =
TRUE
;
+ *unique =
true
;
// translate everything to lower case before comparing
// translate everything to lower case before comparing
- wxChar chAccel = wxTolower(key);
+ wxChar chAccel =
(wxChar)
wxTolower(key);
// the index of the item with this accel
int idxFound = -1;
// the index of the item with this accel
int idxFound = -1;
@@
-2343,7
+2349,7
@@
int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const
else // we already had found such item
{
if ( unique )
else // we already had found such item
{
if ( unique )
- *unique =
FALSE
;
+ *unique =
false
;
// no need to continue further, we won't find
// anything we don't already know
// no need to continue further, we won't find
// anything we don't already know
@@
-2384,13
+2390,13
@@
bool wxMenuBar::ProcessAccelEvent(const wxKeyEvent& event)
if ( node->GetData()->ProcessAccelEvent(event) )
{
// menu processed it
if ( node->GetData()->ProcessAccelEvent(event) )
{
// menu processed it
- return
TRUE
;
+ return
true
;
}
}
}
// not found
}
}
}
// not found
- return
FALSE
;
+ return
false
;
}
#endif // wxUSE_ACCEL
}
#endif // wxUSE_ACCEL
@@
-2407,7
+2413,7
@@
void wxMenuBar::PopupCurrentMenu(bool selectFirst)
wxASSERT_MSG( !m_menuShown, _T("shouldn't show two menus at once!") );
// in any case, we should show it - even if we won't
wxASSERT_MSG( !m_menuShown, _T("shouldn't show two menus at once!") );
// in any case, we should show it - even if we won't
- m_shouldShowMenu =
TRUE
;
+ m_shouldShowMenu =
true
;
if ( IsEnabledTop(m_current) )
{
if ( IsEnabledTop(m_current) )
{
@@
-2422,6
+2428,8
@@
void wxMenuBar::PopupCurrentMenu(bool selectFirst)
// item, not to the right of it
wxRect rectItem = GetItemRect(m_current);
// item, not to the right of it
wxRect rectItem = GetItemRect(m_current);
+ m_menuShown->SetInvokingWindow(m_frameLast);
+
m_menuShown->Popup(ClientToScreen(rectItem.GetPosition()),
wxSize(0, rectItem.GetHeight()),
selectFirst);
m_menuShown->Popup(ClientToScreen(rectItem.GetPosition()),
wxSize(0, rectItem.GetHeight()),
selectFirst);
@@
-2445,7
+2453,7
@@
void wxMenuBar::DismissMenu()
void wxMenuBar::OnDismissMenu(bool dismissMenuBar)
{
void wxMenuBar::OnDismissMenu(bool dismissMenuBar)
{
- m_shouldShowMenu =
FALSE
;
+ m_shouldShowMenu =
false
;
m_menuShown = NULL;
if ( dismissMenuBar )
{
m_menuShown = NULL;
if ( dismissMenuBar )
{
@@
-2485,7
+2493,7
@@
wxEventLoop *wxWindow::ms_evtLoopPopup = NULL;
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
{
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
{
- wxCHECK_MSG( !ms_evtLoopPopup,
FALSE
,
+ wxCHECK_MSG( !ms_evtLoopPopup,
false
,
_T("can't show more than one popup menu at a time") );
#ifdef __WXMSW__
_T("can't show more than one popup menu at a time") );
#ifdef __WXMSW__
@@
-2515,7
+2523,7
@@
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
// wxLogDebug( "Name of invoking window %s", menu->GetInvokingWindow()->GetName().c_str() );
// wxLogDebug( "Name of invoking window %s", menu->GetInvokingWindow()->GetName().c_str() );
- menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0,
0));
+ menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0,0));
// this is not very useful if the menu was popped up because of the mouse
// click but I think it is nice to do when it appears because of a key
// this is not very useful if the menu was popped up because of the mouse
// click but I think it is nice to do when it appears because of a key
@@
-2535,7
+2543,7
@@
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
ms_evtLoopPopup = NULL;
// remove the handler
ms_evtLoopPopup = NULL;
// remove the handler
- PopEventHandler(
TRUE
/* delete it */);
+ PopEventHandler(
true
/* delete it */);
menu->SetInvokingWindow(NULL);
menu->SetInvokingWindow(NULL);
@@
-2543,7
+2551,7
@@
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
SetCursor(cursorOld);
#endif // __WXMSW__
SetCursor(cursorOld);
#endif // __WXMSW__
- return
TRUE
;
+ return
true
;
}
void wxWindow::DismissPopupMenu()
}
void wxWindow::DismissPopupMenu()