fix asserts for dropdown items

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46655 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-06-22 20:18:33 +00:00
parent 8c714e065c
commit 7062497fde

View File

@@ -137,6 +137,7 @@ public:
wxFAIL_MSG( _T("unknown toolbar child type") );
// fall through
case wxITEM_DROPDOWN:
case wxITEM_NORMAL:
return GTK_TOOLBAR_CHILD_BUTTON;
}
@@ -518,19 +519,16 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
}
int posGtk = 0;
if (pos > 0)
if ( pos > 0 )
{
size_t i;
for (i = 0; i < pos; i++)
for ( size_t i = 0; i < pos; i++ )
{
posGtk++;
// if we have a dropdown menu, we use 2 GTK tools
// internally
// if we have a dropdown menu, we use 2 GTK tools internally
wxToolBarToolsList::compatibility_iterator node = m_tools.Item( i );
wxToolBarTool *tool = (wxToolBarTool*) node->GetData();
if (tool->IsButton() && (tool->GetKind() == wxITEM_DROPDOWN))
if ( tool->IsButton() && (tool->GetKind() == wxITEM_DROPDOWN) )
posGtk++;
}
}
@@ -612,7 +610,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
if (GetWindowStyle() & wxTB_FLAT)
gtk_button_set_relief( GTK_BUTTON(dropdown), GTK_RELIEF_NONE );
GTK_WIDGET_UNSET_FLAGS (dropdown, GTK_CAN_FOCUS);
GTK_WIDGET_UNSET_FLAGS (dropdown, GTK_CAN_FOCUS);
gtk_widget_show( dropdown );
g_signal_connect (dropdown, "enter_notify_event",