#include "wx/toplevel.h"
#ifndef WX_PRECOMP
+ #include "wx/frame.h"
+ #include "wx/icon.h"
#include "wx/log.h"
#include "wx/app.h"
- #include "wx/dcclient.h"
- #include "wx/dialog.h"
- #include "wx/timer.h"
- #include "wx/settings.h"
- #include "wx/control.h"
#endif
#include "wx/gtk/private.h"
#include "wx/evtloop.h"
-#include <glib.h>
-#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#include "wx/gtk/win_gtk.h"
GdkEvent *WXUNUSED(event),
wxTopLevelWindowGTK *win )
{
- if (g_isIdle)
- wxapp_install_idle_handler();
+ // don't need to install idle handler, its done from "event" signal
switch ( g_sendActivateEvent )
{
GdkEventFocus *WXUNUSED(gdk_event),
wxTopLevelWindowGTK *win )
{
- if (g_isIdle)
- wxapp_install_idle_handler();
+ // don't need to install idle handler, its done from "event" signal
// if the focus goes out of our app alltogether, OnIdle() will send
// wxActivateEvent, otherwise gtk_window_focus_in_callback() will reset
//-----------------------------------------------------------------------------
extern "C" {
-static gboolean gtk_frame_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUSED(d), wxWindow *WXUNUSED(win) )
+static gboolean gtk_frame_focus_callback( GtkWidget *WXUNUSED(widget),
+ GtkDirectionType WXUNUSED(d),
+ wxWindow *WXUNUSED(win) )
{
if (g_isIdle)
wxapp_install_idle_handler();
// This disables GTK's tab traversal
- g_signal_stop_emission_by_name (widget, "focus");
return TRUE;
}
}
(int)alloc->height );
*/
+ // Tell the wxWindow class about the new size
win->m_width = alloc->width;
win->m_height = alloc->height;
+
+ if (win->m_mainWidget)
+ GTK_PIZZA(win->m_mainWidget)->m_width = win->m_width;
+
win->GtkUpdateSize();
}
}
GdkEvent *WXUNUSED(event),
wxTopLevelWindowGTK *win )
{
- if (g_isIdle)
- wxapp_install_idle_handler();
+ // don't need to install idle handler, its done from "event" signal
if (win->IsEnabled() &&
(g_openDialogs == 0 || (win->GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) ||
GdkEventConfigure *WXUNUSED(event),
wxTopLevelWindowGTK *win )
{
- if (g_isIdle)
- wxapp_install_idle_handler();
+ // don't need to install idle handler, its done from "event" signal
if (!win->m_hasVMT || !win->IsShown())
return FALSE;
GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
+ GTK_PIZZA(m_mainWidget)->m_width = m_width;
+
if (m_miniEdge == 0) // wxMiniFrame has its own version.
{
// For m_mainWidget themes
G_CALLBACK (gtk_frame_focus_out_callback), this);
// decorations
- if ((m_miniEdge > 0) || (style & wxSIMPLE_BORDER) || (style & wxNO_BORDER))
+ if ((style & wxSIMPLE_BORDER) || (style & wxNO_BORDER))
+ {
+ m_gdkDecor = 0;
+ m_gdkFunc = 0;
+ }
+ else
+ if (m_miniEdge > 0)
{
m_gdkDecor = 0;
m_gdkFunc = 0;
+
+ if ((style & wxRESIZE_BORDER) != 0)
+ m_gdkFunc |= GDK_FUNC_RESIZE;
}
else
{
much ugly flicker or from within the size_allocate
handler, because GTK 1.1.X forbids that. */
- GtkOnSize( m_x, m_y, m_width, m_height );
+ GtkOnSize();
}
// This seems no longer to be needed and the call
}
if (width != -1) m_width = width;
if (height != -1) m_height = height;
+
+ if (m_mainWidget)
+ GTK_PIZZA(m_mainWidget)->m_width = m_width;
/*
if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
- wxWindow::DoGetClientSize( width, height );
if (height)
{
- // mini edge
- *height -= m_miniEdge*2 + m_miniTitle;
+ *height = m_height - 2 * m_miniEdge + m_miniTitle;
+ if (*height < 0)
+ *height = 0;
}
if (width)
{
- *width -= m_miniEdge*2;
+ *width = m_width - 2 * m_miniEdge;
+ if (*width < 0)
+ *width = 0;
}
}
width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0);
}
-void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
- int width, int height )
+void wxTopLevelWindowGTK::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;
if ( m_wxwindow == NULL ) return;
- m_width = width;
- m_height = height;
-
/* wxMDIChildFrame derives from wxFrame but it _is_ a wxWindow as it uses
wxWindow::Create to create it's GTK equivalent. m_mainWidget is only
set in wxFrame::Create so it is used to check what kind of frame we
int client_y = m_miniEdge + m_miniTitle;
int client_w = m_width - 2*m_miniEdge;
int client_h = m_height - 2*m_miniEdge - m_miniTitle;
+ if (client_w < 0)
+ client_w = 0;
+ if (client_h < 0)
+ client_h = 0;
+ // Let the parent perform the resize
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
m_wxwindow,
client_x, client_y, client_w, client_h );
{
if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
{
- GtkOnSize( m_x, m_y, m_width, m_height );
+ GtkOnSize();
// we'll come back later
if (g_isIdle)