/////////////////////////////////////////////////////////////////////////////
-// Name: frame.cpp
+// Name: src/gtk/frame.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
// ============================================================================
// declarations
// ============================================================================
// headers
// ----------------------------------------------------------------------------
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
-
-#include "wx/defs.h"
-
#include "wx/frame.h"
-#include "wx/dialog.h"
-#include "wx/control.h"
-#include "wx/app.h"
-#include "wx/menu.h"
-#if wxUSE_TOOLBAR
+
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/dcclient.h"
+ #include "wx/menu.h"
+ #include "wx/dialog.h"
+ #include "wx/control.h"
#include "wx/toolbar.h"
-#endif
-#if wxUSE_STATUSBAR
#include "wx/statusbr.h"
-#endif
-#include "wx/dcclient.h"
+#endif // WX_PRECOMP
#include <glib.h>
#include "wx/gtk/private.h"
const int wxSTATUS_HEIGHT = 25;
const int wxPLACE_HOLDER = 0;
-// ----------------------------------------------------------------------------
-// idle system
-// ----------------------------------------------------------------------------
-
-extern void wxapp_install_idle_handler();
-extern bool g_isIdle;
-
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
wxToolBar *toolBar = (wxToolBar*) child;
if (toolBar->GetWindowStyle() & wxTB_DOCKABLE)
{
- gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_attached",
- GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
-
- gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_detached",
- GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
+ g_signal_connect (toolBar->m_widget, "child_attached",
+ G_CALLBACK (gtk_toolbar_attached_callback),
+ parent);
+ g_signal_connect (toolBar->m_widget, "child_detached",
+ G_CALLBACK (gtk_toolbar_detached_callback),
+ parent);
}
}
#endif // wxUSE_TOOLBAR
child->m_width,
child->m_height );
}
-
- // Resize on OnInternalIdle
- parent->GtkUpdateSize();
}
// ----------------------------------------------------------------------------
wxTopLevelWindow::DoSetClientSize( width, height );
}
-void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
- int width, int height )
+void wxFrame::GtkOnSize()
{
- // due to a bug in gtk, x,y are always 0
- // m_x = x;
- // m_y = y;
-
// avoid recursions
if (m_resizing) return;
m_resizing = true;
// this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
- m_width = width;
- m_height = height;
-
// space occupied by m_frameToolBar and m_frameMenuBar
int client_area_x_offset = 0,
client_area_y_offset = 0;
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge;
+ if (ww < 0)
+ ww = 0;
int hh = m_menuBarHeight;
if (m_menuBarDetached) hh = wxPLACE_HOLDER;
m_frameMenuBar->m_x = xx;
ww = m_toolBarDetached ? wxPLACE_HOLDER
: m_frameToolBar->m_width;
hh = m_height - 2*m_miniEdge;
+ if (hh < 0)
+ hh = 0;
client_area_x_offset += ww;
}
int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
int client_w = m_width - client_area_x_offset - 2*m_miniEdge;
int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
+ if (client_w < 0)
+ client_w = 0;
+ if (client_h < 0)
+ client_h = 0;
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
m_wxwindow,
client_x, client_y, client_w, client_h );
int xx = 0 + m_miniEdge;
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset;
int ww = m_width - 2*m_miniEdge;
+ if (ww < 0)
+ ww = 0;
int hh = wxSTATUS_HEIGHT;
m_frameStatusBar->m_x = xx;
m_frameStatusBar->m_y = yy;
gtk_pizza_set_size( GTK_PIZZA(m_wxwindow),
m_frameStatusBar->m_widget,
xx, yy, ww, hh );
- gtk_widget_draw( m_frameStatusBar->m_widget, (GdkRectangle*) NULL );
}
#endif // wxUSE_STATUSBAR
if (m_frameMenuBar->GetWindowStyle() & wxMB_DOCKABLE)
{
- gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
- GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
+ g_signal_handlers_disconnect_by_func (m_frameMenuBar->m_widget,
+ (gpointer) gtk_menu_attached_callback,
+ this);
- gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
- GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
+ g_signal_handlers_disconnect_by_func (m_frameMenuBar->m_widget,
+ (gpointer) gtk_menu_detached_callback,
+ this);
}
gtk_widget_ref( m_frameMenuBar->m_widget );
if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
{
- gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
- GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
-
- gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
- GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
+ g_signal_connect (menuBar->m_widget, "child_attached",
+ G_CALLBACK (gtk_menu_attached_callback),
+ this);
+ g_signal_connect (menuBar->m_widget, "child_detached",
+ G_CALLBACK (gtk_menu_detached_callback),
+ this);
}
gtk_widget_show( m_frameMenuBar->m_widget );