// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "univmenuitem.h"
#pragma implementation "univmenu.h"
#endif
{
public:
wxPopupMenuWindow(wxWindow *parent, wxMenu *menu);
-
+
~wxPopupMenuWindow();
// override the base class version to select the first item initially
// set the current node and item withotu refreshing anything
void SetCurrent(wxMenuItemList::compatibility_iterator node);
+ virtual bool SetCurrent(bool doit = true){return wxPopupTransientWindow::SetCurrent(doit);};
// change the current item refreshing the old and new items
void ChangeCurrent(wxMenuItemList::compatibility_iterator node);
else
{
// return FALSE;
-
+
return wxEvtHandler::ProcessEvent(event);
}
}
#if wxUSE_STL
SetCurrent(wxMenuItemList::compatibility_iterator());
#else
- SetCurrent(NULL);
+ SetCurrent((wxwxMenuItemListNode *)NULL);
#endif
}
: m_menu->GetMenuItems().GetLast();
}
-wxMenuItemList::compatibility_iterator
+wxMenuItemList::compatibility_iterator
wxPopupMenuWindow::GetPrevNode(wxMenuItemList::compatibility_iterator node) const
{
if ( node )
: m_menu->GetMenuItems().GetFirst();
}
-wxMenuItemList::compatibility_iterator
+wxMenuItemList::compatibility_iterator
wxPopupMenuWindow::GetNextNode(wxMenuItemList::compatibility_iterator node) const
{
if ( node )
if ( item == GetCurrentItem() )
flags |= wxCONTROL_SELECTED;
+ wxBitmap bmp;
+
+ if ( !item->IsEnabled() )
+ {
+ bmp = item->GetDisabledBitmap();
+ }
+
+ if ( !bmp.Ok() )
+ {
+ // strangely enough, for unchecked item we use the
+ // "checked" bitmap because this is the default one - this
+ // explains this strange boolean expression
+ bmp = item->GetBitmap(!item->IsCheckable() || item->IsChecked());
+ }
+
rend->DrawMenuItem
(
dc,
gi,
item->GetLabel(),
item->GetAccelString(),
- // strangely enough, for unchecked item we use the
- // "checked" bitmap because this is the default one - this
- // explains this strange boolean expression
- item->GetBitmap(!item->IsCheckable() || item->IsChecked()),
+ bmp,
flags,
item->GetAccelIndex()
);
// close all menus
DismissAndNotify();
-
+
menu->ClickItem(item);
}
wxPopupMenuWindow *win = menu->m_popupMenu;
wxCHECK_MSG( win, FALSE, _T("parent menu not shown?") );
-
+
pos = ClientToScreen(pos);
if ( win->GetMenuItemFromPoint(win->ScreenToClient(pos)) )
{
m_startRadioGroup = -1;
}
-bool wxMenu::DoAppend(wxMenuItem *item)
+wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{
+ #if 0
+ // not used at all
bool check = FALSE;
+ #endif
if ( item->GetKind() == wxITEM_RADIO )
{
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
{
}
if ( !wxMenuBase::DoAppend(item) )
- return FALSE;
+ return NULL;
OnItemAdded(item);
- return TRUE;
+ return item;
}
-bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
+wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
{
if ( !wxMenuBase::DoInsert(pos, item) )
- return FALSE;
+ return NULL;
OnItemAdded(item);
- return TRUE;
+ return item;
}
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
// We are a submenu of a menu of a menubar
if (menu->GetMenuBar())
return menu->GetMenuBar();
-
+
win = menu->GetInvokingWindow();
if ( win )
break;
// we're probably going to crash in the caller anyhow, but try to detect
// this error as soon as possible
wxASSERT_MSG( win, _T("menu without any associated window?") );
-
+
// also remember it in this menu so that we don't have to search for it the
// next time
wxConstCast(this, wxMenu)->m_invokingWindow = win;
wxCHECK_RET( m_invokingWindow, _T("what kind of menu is this?") );
m_invokingWindow->DismissPopupMenu();
-
+
// Why reset it here? We need it for sending the event to...
// SetInvokingWindow(NULL);
}
{
m_popupMenu->SelectFirst();
}
-
+
// the geometry might have changed since the last time we were shown, so
// always resize
m_popupMenu->SetClientSize(GetGeometryInfo().GetSize());
// not applicabled
isChecked = -1;
}
-
+
return SendEvent(item->GetId(), isChecked);
}
m_radioGroup.start = -1;
m_isRadioGroupStart = FALSE;
+ m_bmpDisabled = wxNullBitmap;
+
UpdateAccelInfo();
}
m_menuShown = NULL;
m_shouldShowMenu = FALSE;
-
- m_windowStyle |= wxNO_FULL_REPAINT_ON_RESIZE;
}
void wxMenuBar::Attach(wxFrame *frame)
#endif // 0
menu->SetInvokingWindow(this);
-
+
// wxLogDebug( "Name of invoking window %s", menu->GetInvokingWindow()->GetName().c_str() );
-
+
menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0, 0));
// this is not very useful if the menu was popped up because of the mouse
void wxWindow::DismissPopupMenu()
{
wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") );
-
+
ms_evtLoopPopup->Exit();
}