const int wxSTATUS_HEIGHT = 25;
const int wxPLACE_HOLDER = 0;
+//-----------------------------------------------------------------------------
+// idle system
+//-----------------------------------------------------------------------------
+
+extern void wxapp_install_idle_handler();
+extern bool g_isIdle;
+
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern wxList wxPendingDelete;
+//-----------------------------------------------------------------------------
+// debug
+//-----------------------------------------------------------------------------
+
+#ifdef __WXDEBUG__
+
+extern void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window );
+
+#endif
+
//-----------------------------------------------------------------------------
// "size_allocate"
//-----------------------------------------------------------------------------
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{
+ if (g_isIdle) wxapp_install_idle_handler();
+
if (!win->HasVMT()) return;
/*
static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrame *win )
{
+ if (g_isIdle) wxapp_install_idle_handler();
+
/*
printf( "OnDelete from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
+ if (g_isIdle) wxapp_install_idle_handler();
+
if (!win->HasVMT()) return;
win->m_menuBarDetached = FALSE;
static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
+ if (g_isIdle) wxapp_install_idle_handler();
+
if (!win->HasVMT()) return;
win->m_menuBarDetached = TRUE;
static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
+ if (g_isIdle) wxapp_install_idle_handler();
+
if (!win->HasVMT()) return;
win->m_toolBarDetached = FALSE;
static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSED(child), wxFrame *win )
{
+ if (g_isIdle) wxapp_install_idle_handler();
+
if (!win->HasVMT()) return;
win->m_toolBarDetached = TRUE;
static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
{
+ if (g_isIdle) wxapp_install_idle_handler();
+
if (!win->HasVMT()) return FALSE;
win->m_x = event->x;
static gint
gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win )
{
+ if (g_isIdle) wxapp_install_idle_handler();
+
/* all this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. not tested. */
long decor = (long) GDK_DECOR_ALL;
win->SetIcon( icon );
}
+ /* we set the focus to the child that accepts the focus. this
+ doesn't really have to be done in "realize" but why not? */
+ wxNode *node = win->m_children.First();
+ while (node)
+ {
+ wxWindow *child = (wxWindow*) node->Data();
+ if (child->AcceptsFocus())
+ {
+ child->SetFocus();
+ break;
+ }
+
+ node = node->Next();
+ }
+
return FALSE;
}
m_widget = gtk_window_new( win_type );
+#ifdef __WXDEBUG__
+ debug_focus_in( m_widget, _T("wxFrame::m_widget"), name );
+#endif
+
gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
+#ifdef __WXDEBUG__
+ debug_focus_in( m_mainWidget, _T("wxFrame::m_mainWidget"), name );
+#endif
+
/* m_wxwindow only represents the client area without toolbar and menubar */
m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow );
gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow );
- /* we allow the frame to get the focus as otherwise no
- keye vents will get sent to it. the point with this is
- that the menu's key accelerators work by interceting
- key events here */
- GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
- GTK_WIDGET_SET_FLAGS (m_wxwindow, GTK_HAS_FOCUS);
+#ifdef __WXDEBUG__
+ debug_focus_in( m_wxwindow, _T("wxFrame::m_wxwindow"), name );
+#endif
+
+ /* we donm't allow the frame to get the focus as otherwise
+ the frame will grabit at arbitrary fcous changes. */
+ GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
if (m_parent) m_parent->AddChild( this );
{
if ((m_x != old_x) || (m_y != old_y))
{
- /* m_sizeSet = FALSE; */
- gtk_widget_set_uposition( m_widget, m_x, m_y );
+ /* we set the size here and in gtk_frame_map_callback */
+ gtk_widget_set_uposition( m_widget, m_x, m_y );
}
}
void wxFrame::OnInternalIdle()
{
- if (!m_sizeSet)
+ if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
GtkOnSize( m_x, m_y, m_width, m_height );
DoMenuUpdates();
{
/* support for native key accelerators indicated by underscroes */
#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
- gtk_accel_group_attach( m_frameMenuBar->m_accel, GTK_OBJECT(m_wxwindow));
-#endif
+ gtk_accel_group_attach( m_frameMenuBar->m_accel, GTK_OBJECT(m_widget));
+#endif
wxNode *node = m_frameMenuBar->GetMenus().First();
while (node)