extern wxList wxPendingDelete;
+//-----------------------------------------------------------------------------
+// debug
+//-----------------------------------------------------------------------------
+
+#ifdef __WXDEBUG__
+
+extern void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window );
+
+#endif
+
//-----------------------------------------------------------------------------
// "size_allocate"
//-----------------------------------------------------------------------------
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
- key events 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_grab_focus( m_wxwindow );
+#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 );
extern bool g_blockEventsOnDrag;
+//-----------------------------------------------------------------------------
+// debug
+//-----------------------------------------------------------------------------
+
+#ifdef __WXDEBUG__
+
+extern void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window );
+
+#endif
+
//-----------------------------------------------------------------------------
// wxNotebookPage
//-----------------------------------------------------------------------------
m_widget = gtk_notebook_new();
+#ifdef __WXDEBUG__
+ debug_focus_in( m_widget, _T("wxNotebook::m_widget"), name );
+#endif
+
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
m_idHandler = gtk_signal_connect (
m_oldPos = 0.0;
- if (style & wxSL_VERTICAL == wxSL_VERTICAL)
+ if (style & wxSL_VERTICAL)
m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
else
m_widget = gtk_vscale_new( (GtkAdjustment *) NULL );
- gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
+ if (style & wxSL_LABELS)
+ gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
+ else
+ gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
*/
+//-----------------------------------------------------------------------------
+// debug
+//-----------------------------------------------------------------------------
+
+#ifdef __WXDEBUG__
+
+static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
+ GdkEvent *WXUNUSED(event),
+ const wxChar *name )
+{
+ wxPrintf( _T("FOCUS NOW AT: ") );
+ wxPrintf( name );
+ wxPrintf( _T("\n") );
+
+ return FALSE;
+}
+
+void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window )
+{
+ wxString tmp = name;
+ tmp += _T(" FROM ");
+ tmp += window;
+
+ wxChar *s = new wxChar[tmp.Length()+1];
+
+ wxStrcpy( s, tmp );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
+ GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
+}
+
+#endif
+
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+#ifdef __WXDEBUG__
+ debug_focus_in( m_widget, _T("wxWindow::m_widget"), name );
+#endif
+
GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
+#ifdef __WXDEBUG__
+ debug_focus_in( s_window->hscrollbar, _T("wxWindow::hsrcollbar"), name );
+ debug_focus_in( s_window->vscrollbar, _T("wxWindow::vsrcollbar"), name );
+#endif
+
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
scroll_class->scrollbar_spacing = 0;
m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow );
+#ifdef __WXDEBUG__
+ debug_focus_in( m_wxwindow, _T("wxWindow::m_wxwindow"), name );
+#endif
+
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
#if (GTK_MINOR_VERSION > 0)
}
/* grab the actual focus */
- gtk_widget_grab_focus( m_wxwindow );
+// gtk_widget_grab_focus( m_wxwindow );
#if (GTK_MINOR_VERSION == 0)
// shut the viewport up
void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
{
+ /* this is commented because it also is commented
+ in wxMSW. before I get even more questions about
+ this. */
// if (GetAutoLayout()) Layout();
}
extern wxList wxPendingDelete;
+//-----------------------------------------------------------------------------
+// debug
+//-----------------------------------------------------------------------------
+
+#ifdef __WXDEBUG__
+
+extern void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window );
+
+#endif
+
//-----------------------------------------------------------------------------
// "size_allocate"
//-----------------------------------------------------------------------------
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
- key events 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_grab_focus( m_wxwindow );
+#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 );
extern bool g_blockEventsOnDrag;
+//-----------------------------------------------------------------------------
+// debug
+//-----------------------------------------------------------------------------
+
+#ifdef __WXDEBUG__
+
+extern void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window );
+
+#endif
+
//-----------------------------------------------------------------------------
// wxNotebookPage
//-----------------------------------------------------------------------------
m_widget = gtk_notebook_new();
+#ifdef __WXDEBUG__
+ debug_focus_in( m_widget, _T("wxNotebook::m_widget"), name );
+#endif
+
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
m_idHandler = gtk_signal_connect (
m_oldPos = 0.0;
- if (style & wxSL_VERTICAL == wxSL_VERTICAL)
+ if (style & wxSL_VERTICAL)
m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
else
m_widget = gtk_vscale_new( (GtkAdjustment *) NULL );
- gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
+ if (style & wxSL_LABELS)
+ gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
+ else
+ gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
*/
+//-----------------------------------------------------------------------------
+// debug
+//-----------------------------------------------------------------------------
+
+#ifdef __WXDEBUG__
+
+static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
+ GdkEvent *WXUNUSED(event),
+ const wxChar *name )
+{
+ wxPrintf( _T("FOCUS NOW AT: ") );
+ wxPrintf( name );
+ wxPrintf( _T("\n") );
+
+ return FALSE;
+}
+
+void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window )
+{
+ wxString tmp = name;
+ tmp += _T(" FROM ");
+ tmp += window;
+
+ wxChar *s = new wxChar[tmp.Length()+1];
+
+ wxStrcpy( s, tmp );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
+ GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
+}
+
+#endif
+
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+#ifdef __WXDEBUG__
+ debug_focus_in( m_widget, _T("wxWindow::m_widget"), name );
+#endif
+
GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
+#ifdef __WXDEBUG__
+ debug_focus_in( s_window->hscrollbar, _T("wxWindow::hsrcollbar"), name );
+ debug_focus_in( s_window->vscrollbar, _T("wxWindow::vsrcollbar"), name );
+#endif
+
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
scroll_class->scrollbar_spacing = 0;
m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow );
+#ifdef __WXDEBUG__
+ debug_focus_in( m_wxwindow, _T("wxWindow::m_wxwindow"), name );
+#endif
+
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
#if (GTK_MINOR_VERSION > 0)
}
/* grab the actual focus */
- gtk_widget_grab_focus( m_wxwindow );
+// gtk_widget_grab_focus( m_wxwindow );
#if (GTK_MINOR_VERSION == 0)
// shut the viewport up
void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
{
+ /* this is commented because it also is commented
+ in wxMSW. before I get even more questions about
+ this. */
// if (GetAutoLayout()) Layout();
}