fix for casting from GtkScrolledWindow to GtkWindow: don't call

gtk_window_set_geometry_hints for MDI children


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@6920 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-03-24 14:04:46 +00:00
parent 5f5083ca69
commit eb118c55fd
4 changed files with 130 additions and 132 deletions

View File

@@ -216,7 +216,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *ev
if (!win->m_hasVMT)
return FALSE;
#if (GTK_MINOR_VERSION > 0)
int x = 0;
int y = 0;
@@ -283,7 +283,7 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win )
func |= GDK_FUNC_RESIZE;
decor |= GDK_DECOR_RESIZEH;
}
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
}
@@ -475,7 +475,7 @@ bool wxFrame::Create( wxWindow *parent,
if ((m_x != -1) || (m_y != -1))
gtk_widget_set_uposition( m_widget, m_x, m_y );
gtk_widget_set_usize( m_widget, m_width, m_height );
/* we cannot set MWM hints and icons before the widget has
been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
@@ -535,7 +535,7 @@ void wxFrame::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width)
{
wxFAIL_MSG( wxT("DoMoveWindow called for wxFrame") );
}
void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
@@ -738,23 +738,22 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
/* set size hints */
gint flag = 0; // GDK_HINT_POS;
if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
geom.min_width = m_minWidth;
geom.min_height = m_minHeight;
geom.max_width = m_maxWidth;
geom.max_height = m_maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
(GdkWindowHints) flag );
if (m_mainWidget)
{
/* set size hints */
gint flag = 0; // GDK_HINT_POS;
if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
geom.min_width = m_minWidth;
geom.min_height = m_minHeight;
geom.max_width = m_maxWidth;
geom.max_height = m_maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
(GdkWindowHints) flag );
/* I revert back to wxGTK's original behaviour. m_mainWidget holds the
* menubar, the toolbar and the client area, which is represented by
@@ -926,7 +925,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
}
gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget );
gtk_widget_ref( m_frameMenuBar->m_widget );
gtk_widget_unparent( m_frameMenuBar->m_widget );

View File

@@ -47,13 +47,13 @@ extern wxList wxPendingDelete;
// "switch_page"
//-----------------------------------------------------------------------------
static void
static void
gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
GtkNotebookPage *page,
gint WXUNUSED(page_num),
wxMDIParentFrame *parent )
gint WXUNUSED(page_num),
wxMDIParentFrame *parent )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
// send deactivate event to old child
@@ -65,9 +65,9 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
event1.SetEventObject( child);
child->GetEventHandler()->ProcessEvent( event1 );
}
// send activate event to new child
wxMDIClientWindow *client_window = parent->GetClientWindow();
if (!client_window)
return;
@@ -79,16 +79,16 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
{
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
if (child_frame->m_page == page)
{
{
child = child_frame;
break;
}
break;
}
node = node->Next();
}
if (!child)
return;
wxActivateEvent event2( wxEVT_ACTIVATE, TRUE, child->GetId() );
event2.SetEventObject( child);
child->GetEventHandler()->ProcessEvent( event2 );
@@ -150,8 +150,8 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
menu_bar->m_y = 0;
menu_bar->m_width = m_width;
menu_bar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
}
@@ -180,29 +180,29 @@ void wxMDIParentFrame::OnInternalIdle()
while (node)
{
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
wxMenuBar *menu_bar = child_frame->m_menuBar;
wxMenuBar *menu_bar = child_frame->m_menuBar;
if (child_frame->m_menuBar)
{
if (child_frame == active_child_frame)
{
if (menu_bar->Show(TRUE))
{
menu_bar->m_width = m_width;
menu_bar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
menu_bar->SetInvokingWindow( child_frame );
}
if (menu_bar->Show(TRUE))
{
menu_bar->m_width = m_width;
menu_bar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
menu_bar->SetInvokingWindow( child_frame );
}
visible_child_menu = TRUE;
}
else
{
if (menu_bar->Show(FALSE))
{
menu_bar->UnsetInvokingWindow( child_frame );
}
}
{
if (menu_bar->Show(FALSE))
{
menu_bar->UnsetInvokingWindow( child_frame );
}
}
}
node = node->Next();
}
@@ -212,21 +212,21 @@ void wxMDIParentFrame::OnInternalIdle()
(m_frameMenuBar->IsShown() == visible_child_menu))
{
if (visible_child_menu)
{
{
m_frameMenuBar->Show( FALSE );
m_frameMenuBar->UnsetInvokingWindow( this );
}
else
{
m_frameMenuBar->UnsetInvokingWindow( this );
}
else
{
m_frameMenuBar->Show( TRUE );
m_frameMenuBar->SetInvokingWindow( this );
m_frameMenuBar->m_width = m_width;
m_frameMenuBar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
m_frameMenuBar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
}
m_frameMenuBar->SetInvokingWindow( this );
m_frameMenuBar->m_width = m_width;
m_frameMenuBar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
m_frameMenuBar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
}
}
}
@@ -360,8 +360,8 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
m_menuBar->SetParent( mdi_frame );
/* insert the invisible menu bar into the _parent_ mdi frame */
gtk_pizza_put( GTK_PIZZA(mdi_frame->m_mainWidget),
m_menuBar->m_widget,
gtk_pizza_put( GTK_PIZZA(mdi_frame->m_mainWidget),
m_menuBar->m_widget,
0, 0, mdi_frame->m_width, wxMENU_HEIGHT );
}
}
@@ -380,7 +380,7 @@ void wxMDIChildFrame::Activate()
gtk_notebook_set_page( notebook, pageno );
#else
// the only way I can see to do this under gtk+ 1.0.X would
// be to keep track of page numbers, start at first and
// be to keep track of page numbers, start at first and
// do "next" enough times to get to this page number - messy
// - J. Russell Smyth
#endif
@@ -464,7 +464,7 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("wxMDIClientWindow") ))
{
wxFAIL_MSG( wxT("wxMDIClientWindow creation failed") );
return FALSE;
return FALSE;
}
m_widget = gtk_notebook_new();
@@ -483,4 +483,4 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
return TRUE;
}
#endif
#endif // wxUSE_MDI_ARCHITECTURE

View File

@@ -216,7 +216,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *ev
if (!win->m_hasVMT)
return FALSE;
#if (GTK_MINOR_VERSION > 0)
int x = 0;
int y = 0;
@@ -283,7 +283,7 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win )
func |= GDK_FUNC_RESIZE;
decor |= GDK_DECOR_RESIZEH;
}
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
}
@@ -475,7 +475,7 @@ bool wxFrame::Create( wxWindow *parent,
if ((m_x != -1) || (m_y != -1))
gtk_widget_set_uposition( m_widget, m_x, m_y );
gtk_widget_set_usize( m_widget, m_width, m_height );
/* we cannot set MWM hints and icons before the widget has
been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
@@ -535,7 +535,7 @@ void wxFrame::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width)
{
wxFAIL_MSG( wxT("DoMoveWindow called for wxFrame") );
}
void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
@@ -738,23 +738,22 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
/* set size hints */
gint flag = 0; // GDK_HINT_POS;
if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
geom.min_width = m_minWidth;
geom.min_height = m_minHeight;
geom.max_width = m_maxWidth;
geom.max_height = m_maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
(GdkWindowHints) flag );
if (m_mainWidget)
{
/* set size hints */
gint flag = 0; // GDK_HINT_POS;
if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
geom.min_width = m_minWidth;
geom.min_height = m_minHeight;
geom.max_width = m_maxWidth;
geom.max_height = m_maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
(GdkWindowHints) flag );
/* I revert back to wxGTK's original behaviour. m_mainWidget holds the
* menubar, the toolbar and the client area, which is represented by
@@ -926,7 +925,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
}
gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget );
gtk_widget_ref( m_frameMenuBar->m_widget );
gtk_widget_unparent( m_frameMenuBar->m_widget );

View File

@@ -47,13 +47,13 @@ extern wxList wxPendingDelete;
// "switch_page"
//-----------------------------------------------------------------------------
static void
static void
gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
GtkNotebookPage *page,
gint WXUNUSED(page_num),
wxMDIParentFrame *parent )
gint WXUNUSED(page_num),
wxMDIParentFrame *parent )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
// send deactivate event to old child
@@ -65,9 +65,9 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
event1.SetEventObject( child);
child->GetEventHandler()->ProcessEvent( event1 );
}
// send activate event to new child
wxMDIClientWindow *client_window = parent->GetClientWindow();
if (!client_window)
return;
@@ -79,16 +79,16 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
{
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
if (child_frame->m_page == page)
{
{
child = child_frame;
break;
}
break;
}
node = node->Next();
}
if (!child)
return;
wxActivateEvent event2( wxEVT_ACTIVATE, TRUE, child->GetId() );
event2.SetEventObject( child);
child->GetEventHandler()->ProcessEvent( event2 );
@@ -150,8 +150,8 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
menu_bar->m_y = 0;
menu_bar->m_width = m_width;
menu_bar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
}
@@ -180,29 +180,29 @@ void wxMDIParentFrame::OnInternalIdle()
while (node)
{
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
wxMenuBar *menu_bar = child_frame->m_menuBar;
wxMenuBar *menu_bar = child_frame->m_menuBar;
if (child_frame->m_menuBar)
{
if (child_frame == active_child_frame)
{
if (menu_bar->Show(TRUE))
{
menu_bar->m_width = m_width;
menu_bar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
menu_bar->SetInvokingWindow( child_frame );
}
if (menu_bar->Show(TRUE))
{
menu_bar->m_width = m_width;
menu_bar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
menu_bar->SetInvokingWindow( child_frame );
}
visible_child_menu = TRUE;
}
else
{
if (menu_bar->Show(FALSE))
{
menu_bar->UnsetInvokingWindow( child_frame );
}
}
{
if (menu_bar->Show(FALSE))
{
menu_bar->UnsetInvokingWindow( child_frame );
}
}
}
node = node->Next();
}
@@ -212,21 +212,21 @@ void wxMDIParentFrame::OnInternalIdle()
(m_frameMenuBar->IsShown() == visible_child_menu))
{
if (visible_child_menu)
{
{
m_frameMenuBar->Show( FALSE );
m_frameMenuBar->UnsetInvokingWindow( this );
}
else
{
m_frameMenuBar->UnsetInvokingWindow( this );
}
else
{
m_frameMenuBar->Show( TRUE );
m_frameMenuBar->SetInvokingWindow( this );
m_frameMenuBar->m_width = m_width;
m_frameMenuBar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
m_frameMenuBar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
}
m_frameMenuBar->SetInvokingWindow( this );
m_frameMenuBar->m_width = m_width;
m_frameMenuBar->m_height = wxMENU_HEIGHT;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
m_frameMenuBar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
}
}
}
@@ -360,8 +360,8 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
m_menuBar->SetParent( mdi_frame );
/* insert the invisible menu bar into the _parent_ mdi frame */
gtk_pizza_put( GTK_PIZZA(mdi_frame->m_mainWidget),
m_menuBar->m_widget,
gtk_pizza_put( GTK_PIZZA(mdi_frame->m_mainWidget),
m_menuBar->m_widget,
0, 0, mdi_frame->m_width, wxMENU_HEIGHT );
}
}
@@ -380,7 +380,7 @@ void wxMDIChildFrame::Activate()
gtk_notebook_set_page( notebook, pageno );
#else
// the only way I can see to do this under gtk+ 1.0.X would
// be to keep track of page numbers, start at first and
// be to keep track of page numbers, start at first and
// do "next" enough times to get to this page number - messy
// - J. Russell Smyth
#endif
@@ -464,7 +464,7 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("wxMDIClientWindow") ))
{
wxFAIL_MSG( wxT("wxMDIClientWindow creation failed") );
return FALSE;
return FALSE;
}
m_widget = gtk_notebook_new();
@@ -483,4 +483,4 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
return TRUE;
}
#endif
#endif // wxUSE_MDI_ARCHITECTURE