fixed menu titles handling after wxID_SEPARATOR change

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28230 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-07-13 16:24:46 +00:00
parent e70ba80d53
commit 9959e2b6aa
2 changed files with 78 additions and 60 deletions

View File

@@ -46,6 +46,9 @@
#define ACCEL_OBJ_CAST(obj) GTK_OBJECT(obj)
#endif
// we use normal item but with a special id for the menu title
static const int wxGTK_TITLE_ID = -3;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
@@ -639,6 +642,12 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
wxMenuItem* item = menu->FindChildItem( id );
wxCHECK_RET( item, wxT("error in menu item callback") );
if ( item->GetId() == wxGTK_TITLE_ID )
{
// ignore events from the menu title
return;
}
if (item->IsCheckable())
{
bool isReallyChecked = item->IsChecked(),
@@ -983,7 +992,7 @@ void wxMenu::Init()
// Tearoffs are entries, just like separators. So if we want this
// menu to be a tear-off one, we just append a tearoff entry
// immediately.
if(m_style & wxMENU_TEAROFF)
if ( m_style & wxMENU_TEAROFF )
{
GtkWidget *tearoff = gtk_tearoff_menu_item_new();
@@ -993,9 +1002,9 @@ void wxMenu::Init()
m_prevRadio = NULL;
// append the title as the very first entry if we have it
if ( !!m_title )
if ( !m_title.empty() )
{
Append(-2, m_title);
Append(wxGTK_TITLE_ID, m_title);
AppendSeparator();
}
}

View File

@@ -46,6 +46,9 @@
#define ACCEL_OBJ_CAST(obj) GTK_OBJECT(obj)
#endif
// we use normal item but with a special id for the menu title
static const int wxGTK_TITLE_ID = -3;
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
@@ -639,6 +642,12 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
wxMenuItem* item = menu->FindChildItem( id );
wxCHECK_RET( item, wxT("error in menu item callback") );
if ( item->GetId() == wxGTK_TITLE_ID )
{
// ignore events from the menu title
return;
}
if (item->IsCheckable())
{
bool isReallyChecked = item->IsChecked(),
@@ -983,7 +992,7 @@ void wxMenu::Init()
// Tearoffs are entries, just like separators. So if we want this
// menu to be a tear-off one, we just append a tearoff entry
// immediately.
if(m_style & wxMENU_TEAROFF)
if ( m_style & wxMENU_TEAROFF )
{
GtkWidget *tearoff = gtk_tearoff_menu_item_new();
@@ -993,9 +1002,9 @@ void wxMenu::Init()
m_prevRadio = NULL;
// append the title as the very first entry if we have it
if ( !!m_title )
if ( !m_title.empty() )
{
Append(-2, m_title);
Append(wxGTK_TITLE_ID, m_title);
AppendSeparator();
}
}