fix for menu separator
wxGlCanvas works again (but flickers) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -597,9 +597,23 @@ void wxMenu::AppendSeparator()
|
|||||||
wxMenuItem *mitem = new wxMenuItem();
|
wxMenuItem *mitem = new wxMenuItem();
|
||||||
mitem->SetId(ID_SEPARATOR);
|
mitem->SetId(ID_SEPARATOR);
|
||||||
|
|
||||||
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
|
GtkItemFactoryEntry entry;
|
||||||
|
entry.path = "/sep";
|
||||||
|
entry.callback = (GtkItemFactoryCallback) NULL;
|
||||||
|
entry.callback_action = 0;
|
||||||
|
entry.item_type = "<Separator>";
|
||||||
|
entry.accelerator = (gchar*) NULL;
|
||||||
|
|
||||||
|
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
|
||||||
|
|
||||||
|
/* this will be wrong for more than one separator. do we care? */
|
||||||
|
GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, "<main>/sep" );
|
||||||
|
#else
|
||||||
GtkWidget *menuItem = gtk_menu_item_new();
|
GtkWidget *menuItem = gtk_menu_item_new();
|
||||||
gtk_menu_append( GTK_MENU(m_menu), menuItem );
|
gtk_menu_append( GTK_MENU(m_menu), menuItem );
|
||||||
gtk_widget_show( menuItem );
|
gtk_widget_show( menuItem );
|
||||||
|
#endif
|
||||||
|
|
||||||
mitem->SetMenuItem(menuItem);
|
mitem->SetMenuItem(menuItem);
|
||||||
m_items.Append( mitem );
|
m_items.Append( mitem );
|
||||||
|
@@ -2002,9 +2002,6 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int old_width = m_width;
|
|
||||||
int old_height = m_height;
|
|
||||||
|
|
||||||
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
|
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
|
||||||
{
|
{
|
||||||
if (x != -1) m_x = x;
|
if (x != -1) m_x = x;
|
||||||
|
@@ -597,9 +597,23 @@ void wxMenu::AppendSeparator()
|
|||||||
wxMenuItem *mitem = new wxMenuItem();
|
wxMenuItem *mitem = new wxMenuItem();
|
||||||
mitem->SetId(ID_SEPARATOR);
|
mitem->SetId(ID_SEPARATOR);
|
||||||
|
|
||||||
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
|
GtkItemFactoryEntry entry;
|
||||||
|
entry.path = "/sep";
|
||||||
|
entry.callback = (GtkItemFactoryCallback) NULL;
|
||||||
|
entry.callback_action = 0;
|
||||||
|
entry.item_type = "<Separator>";
|
||||||
|
entry.accelerator = (gchar*) NULL;
|
||||||
|
|
||||||
|
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
|
||||||
|
|
||||||
|
/* this will be wrong for more than one separator. do we care? */
|
||||||
|
GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, "<main>/sep" );
|
||||||
|
#else
|
||||||
GtkWidget *menuItem = gtk_menu_item_new();
|
GtkWidget *menuItem = gtk_menu_item_new();
|
||||||
gtk_menu_append( GTK_MENU(m_menu), menuItem );
|
gtk_menu_append( GTK_MENU(m_menu), menuItem );
|
||||||
gtk_widget_show( menuItem );
|
gtk_widget_show( menuItem );
|
||||||
|
#endif
|
||||||
|
|
||||||
mitem->SetMenuItem(menuItem);
|
mitem->SetMenuItem(menuItem);
|
||||||
m_items.Append( mitem );
|
m_items.Append( mitem );
|
||||||
|
@@ -2002,9 +2002,6 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int old_width = m_width;
|
|
||||||
int old_height = m_height;
|
|
||||||
|
|
||||||
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
|
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
|
||||||
{
|
{
|
||||||
if (x != -1) m_x = x;
|
if (x != -1) m_x = x;
|
||||||
|
@@ -208,7 +208,7 @@ bool wxGLCanvas::Create( wxWindow *parent, wxWindowID id,
|
|||||||
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
|
||||||
GTK_WIDGET_SET_FLAGS( m_glWidget, GTK_CAN_FOCUS );
|
GTK_WIDGET_SET_FLAGS( m_glWidget, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), m_glWidget, 0, 0 );
|
gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), m_glWidget, 0, 0, m_width, m_height );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_glWidget), "expose_event",
|
gtk_signal_connect( GTK_OBJECT(m_glWidget), "expose_event",
|
||||||
GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
|
||||||
@@ -316,22 +316,19 @@ void wxGLCanvas::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
|
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
|
||||||
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
|
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
|
||||||
|
|
||||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x, m_y );
|
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
|
||||||
|
m_widget,
|
||||||
|
m_x,
|
||||||
|
m_y,
|
||||||
|
m_width,
|
||||||
|
m_height );
|
||||||
|
|
||||||
if ((old_width != m_width) || (old_height != m_height))
|
gtk_myfixed_set_size( GTK_MYFIXED(m_wxwindow),
|
||||||
{
|
m_glWidget,
|
||||||
gtk_widget_set_usize( m_widget, m_width, m_height );
|
m_x,
|
||||||
|
m_y,
|
||||||
gtk_widget_set_usize( m_glWidget, m_width, m_height );
|
m_width,
|
||||||
|
m_height );
|
||||||
GtkAllocation allo;
|
|
||||||
allo.x = 0;
|
|
||||||
allo.y = 0;
|
|
||||||
allo.width = m_width;
|
|
||||||
allo.height = m_height;
|
|
||||||
gtk_widget_size_allocate( m_glWidget, &allo );
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sizeSet = TRUE;
|
m_sizeSet = TRUE;
|
||||||
|
Reference in New Issue
Block a user