X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/96d5ab4d29e72d9d272dd6ada7d07318e9d2607e..c127177f8dc31dbe99764852b8dbcc047d3ad826:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index ecc4c6101f..004495d7ba 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -121,11 +121,38 @@ */ -//------------------------------------------------------------------------- -// constants -//------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// 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]; -#define FRAME_BORDER_WIDTH 2 + wxStrcpy( s, tmp ); + + gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event", + GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s ); +} + +#endif //----------------------------------------------------------------------------- // data @@ -134,6 +161,7 @@ extern wxList wxPendingDelete; extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnScroll; +extern bool g_isIdle; static bool g_capturing = FALSE; static wxWindow *g_focusWindow = (wxWindow*) NULL; @@ -141,6 +169,15 @@ static wxWindow *g_focusWindow = (wxWindow*) NULL; the last click here */ static guint32 gs_timeLastClick = 0; +//----------------------------------------------------------------------------- +// idle system +//----------------------------------------------------------------------------- + +extern void wxapp_install_idle_handler(); +extern bool g_isIdle; + +#if (GTK_MINOR_VERSION > 0) + //----------------------------------------------------------------------------- // local code (see below) //----------------------------------------------------------------------------- @@ -151,7 +188,7 @@ static void draw_frame( GtkWidget *widget, wxWindow *win ) int dw = 0; int dh = 0; - + if (win->m_hasScrolling) { GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget); @@ -160,8 +197,8 @@ static void draw_frame( GtkWidget *widget, wxWindow *win ) /* GtkWidget *hscrollbar = scroll_window->hscrollbar; GtkWidget *vscrollbar = scroll_window->vscrollbar; - - we use this instead: range.slider_width = 11 + 2*2pts edge + + we use this instead: range.slider_width = 11 + 2*2pts edge */ if (scroll_window->vscrollbar_visible) @@ -176,7 +213,7 @@ static void draw_frame( GtkWidget *widget, wxWindow *win ) dw += scroll_class->scrollbar_spacing; } } - + int dx = 0; int dy = 0; if (GTK_WIDGET_NO_WINDOW (widget)) @@ -184,25 +221,25 @@ static void draw_frame( GtkWidget *widget, wxWindow *win ) dx += widget->allocation.x; dy += widget->allocation.y; } - + if (win->m_windowStyle & wxRAISED_BORDER) { - gtk_draw_shadow( widget->style, + gtk_draw_shadow( widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, dx, dy, win->m_width-dw, win->m_height-dh ); return; - } - + } + if (win->m_windowStyle & wxSUNKEN_BORDER) { - gtk_draw_shadow( widget->style, + gtk_draw_shadow( widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, - dx, dy, + dx, dy, win->m_width-dw, win->m_height-dh ); return; } @@ -227,12 +264,16 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU draw_frame( widget, win ); } +#endif + //----------------------------------------------------------------------------- // "expose_event" of m_wxwindow //----------------------------------------------------------------------------- static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return; win->m_updateRegion.Union( gdk_event->area.x, @@ -262,6 +303,8 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return; win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height ); @@ -279,14 +322,16 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; /* - printf( "OnKeyPress from " ); + wxPrintf( _T("OnKeyPress from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) - printf( win->GetClassInfo()->GetClassName() ); - printf( ".\n" ); + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( _T(".\n") ); */ long key_code = 0; @@ -399,27 +444,27 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e } // win is a control: tab can be propagated up - if ( (!ret) && + if ( (!ret) && ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) && ((win->m_windowStyle & wxTE_PROCESS_TAB) == 0)) { wxNavigationKeyEvent new_event; /* GDK reports GDK_ISO_Left_Tab for SHIFT-TAB */ new_event.SetDirection( (gdk_event->keyval == GDK_Tab) ); - /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */ + /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */ new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) ); new_event.SetCurrentFocus( win ); ret = win->GetEventHandler()->ProcessEvent( new_event ); } - if ( (!ret) && + if ( (!ret) && (gdk_event->keyval == GDK_Escape) ) { wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL); new_event.SetEventObject( win ); ret = win->GetEventHandler()->ProcessEvent( new_event ); } - + /* Damn, I forgot why this didn't work, but it didn't work. @@ -458,6 +503,8 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; @@ -574,6 +621,15 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + +/* + wxPrintf( _T("1) OnButtonPress from ") ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( _T(".\n") ); +*/ + if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnScroll) return TRUE; @@ -587,20 +643,31 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton gtk_widget_grab_focus (win->m_wxwindow); /* - printf( "GrabFocus from " ); + wxPrintf( _T("GrabFocus from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) - printf( win->GetClassInfo()->GetClassName() ); - printf( ".\n" ); + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( _T(".\n") ); */ } +/* + else + { + wxPrintf( _T("No GrabFocus from ") ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + wxPrintf( win->GetClassInfo()->GetClassName() ); + if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) + wxPrintf( _T(" because it already has") ); + wxPrintf( _T(".\n") ); + } +*/ } /* - printf( "OnButtonPress from " ); + wxPrintf( _T("2) OnButtonPress from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) - printf( win->GetClassInfo()->GetClassName() ); - printf( ".\n" ); + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( _T(".\n") ); */ wxEventType event_type = wxEVT_LEFT_DOWN; @@ -718,6 +785,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnScroll) return FALSE; @@ -822,6 +891,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnScroll) return FALSE; @@ -929,6 +1000,8 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; @@ -950,12 +1023,12 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED( /* - printf( "OnSetFocus from " ); + wxPrintf( _T("OnSetFocus from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) - printf( win->GetClassInfo()->GetClassName() ); - printf( " " ); - printf( WXSTRINGCAST win->GetLabel() ); - printf( ".\n" ); + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( _T(" ") ); + wxPrintf( win->GetLabel() ); + wxPrintf( _T(".\n") ); */ wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); @@ -966,7 +1039,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED( gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" ); return TRUE; } - + return FALSE; } @@ -976,9 +1049,11 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED( static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; - + if (win->m_wxwindow) { if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) @@ -986,10 +1061,12 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED } /* - printf( "OnKillFocus from " ); + wxPrintf( _T("OnKillFocus from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) - printf( win->GetClassInfo()->GetClassName() ); - printf( ".\n" ); + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( _T(" ") ); + wxPrintf( win->GetLabel() ); + wxPrintf( _T(".\n") ); */ wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); @@ -1000,7 +1077,7 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" ); return TRUE; } - + return FALSE; } @@ -1010,13 +1087,15 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; - + if (widget->window != gdk_event->window) return FALSE; - if ((widget->window) && (win->m_cursor)) - gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() ); + if ((widget->window) && (win->m_cursor.Ok())) + gdk_window_set_cursor( widget->window, win->m_cursor.GetCursor() ); /* printf( "OnEnter from " ); @@ -1050,7 +1129,7 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_event" ); return TRUE; } - + return FALSE; } @@ -1060,12 +1139,14 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; if (widget->window != gdk_event->window) return FALSE; - - if ((widget->window) && (win->m_cursor)) + + if (widget->window) gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); /* @@ -1100,7 +1181,7 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_event" ); return TRUE; } - + return FALSE; } @@ -1110,6 +1191,8 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (g_blockEventsOnDrag) return; /* @@ -1158,6 +1241,8 @@ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow * static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (g_blockEventsOnDrag) return; /* @@ -1206,6 +1291,8 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow * static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (g_blockEventsOnDrag) return; /* @@ -1231,6 +1318,8 @@ static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + if (g_blockEventsOnDrag) return; /* @@ -1258,6 +1347,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget), GdkEventButton *WXUNUSED(gdk_event), wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); + // don't test here as we can release the mouse while being over // a different window then the slider // @@ -1277,6 +1368,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, GdkEventButton *WXUNUSED(gdk_event), wxWindow *win ) { + if (g_isIdle) wxapp_install_idle_handler(); // don't test here as we can release the mouse while being over // a different window then the slider @@ -1296,6 +1388,46 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, return FALSE; } +//----------------------------------------------------------------------------- +// "realize" from m_widget +//----------------------------------------------------------------------------- + +/* we cannot set colours, fonts and cursors before the widget has + been realized, so we do this directly after realization */ + +static gint +gtk_window_realized_callback( GtkWidget *widget, wxWindow *win ) +{ + if (g_isIdle) wxapp_install_idle_handler(); + + if (win->m_font != *wxSWISS_FONT) + { + wxFont font( win->m_font ); + win->m_font = wxNullFont; + win->SetFont( font ); + } + + if (win->m_backgroundColour != wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE )) + { + wxColour bg( win->m_backgroundColour ); + win->m_backgroundColour = wxNullColour; + win->SetBackgroundColour( bg ); + } + + if (win->m_foregroundColour != *wxBLACK) + { + wxColour fg( win->m_foregroundColour ); + win->m_foregroundColour = wxNullColour; + win->SetForegroundColour( fg ); + } + + wxCursor cursor( win->m_cursor ); + win->m_cursor = wxNullCursor; + win->SetCursor( cursor ); + + return FALSE; +} + //----------------------------------------------------------------------------- // InsertChild for wxWindow. //----------------------------------------------------------------------------- @@ -1373,7 +1505,7 @@ void wxWindow::Init() m_windowId = -1; - m_cursor = (wxCursor *) NULL; + m_cursor = *wxSTANDARD_CURSOR; m_font = *wxSWISS_FONT; m_windowStyle = 0; m_windowName = "noname"; @@ -1436,15 +1568,24 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - wxASSERT_MSG( m_isWindow, "Init() must have been called before!" ); + wxASSERT_MSG( m_isWindow, _T("Init() must have been called before!") ); PreCreation( parent, id, pos, size, style, name ); 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; @@ -1458,8 +1599,12 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, m_wxwindow = gtk_myfixed_new(); +#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) GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow); @@ -1492,10 +1637,10 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, } #endif + /* we always allow a window to get the focus as long as it + doesn't have any children. */ if (m_windowStyle & wxTAB_TRAVERSAL) { - /* we now allow a window to get the focus as long as it - doesn't have any children. */ GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); m_acceptsFocus = FALSE; } @@ -1505,6 +1650,12 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, m_acceptsFocus = TRUE; } + /* grab the actual focus */ +// gtk_widget_grab_focus( m_wxwindow ); + + gtk_widget_show( m_wxwindow ); + + #if (GTK_MINOR_VERSION == 0) // shut the viewport up gtk_viewport_set_hadjustment( viewport, (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) ); @@ -1557,8 +1708,6 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, gtk_signal_connect(GTK_OBJECT(m_vAdjust), "changed", (GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this ); - gtk_widget_show( m_wxwindow ); - if (m_parent) m_parent->AddChild( this ); (m_parent->m_insertCallback)( m_parent, this ); @@ -1595,7 +1744,7 @@ wxWindow::~wxWindow() DestroyChildren(); if (m_parent) m_parent->RemoveChild( this ); - + if (m_widgetStyle) gtk_style_unref( m_widgetStyle ); if (m_scrollGC) gdk_gc_unref( m_scrollGC ); @@ -1604,8 +1753,6 @@ wxWindow::~wxWindow() if (m_widget) gtk_widget_destroy( m_widget ); - if (m_cursor) delete m_cursor; - DeleteRelatedConstraints(); if (m_constraints) { @@ -1615,7 +1762,7 @@ wxWindow::~wxWindow() delete m_constraints; m_constraints = (wxLayoutConstraints *) NULL; } - + if (m_windowSizer) { delete m_windowSizer; @@ -1643,7 +1790,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - wxASSERT_MSG( (!m_needParent) || (parent), "Need complete parent." ); + wxASSERT_MSG( (!m_needParent) || (parent), _T("Need complete parent.") ); m_widget = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL; @@ -1686,7 +1833,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, m_sizeSet = FALSE; - m_cursor = new wxCursor( wxCURSOR_ARROW ); + m_cursor = *wxSTANDARD_CURSOR; m_font = *wxSWISS_FONT; m_backgroundColour = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ); m_foregroundColour = *wxBLACK; @@ -1729,8 +1876,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, void wxWindow::PostCreation() { - wxASSERT_MSG( (m_widget != NULL), "invalid window" ); - + wxASSERT_MSG( (m_widget != NULL), _T("invalid window") ); + if (m_wxwindow) { /* these get reported to wxWindows -> wxPaintEvent */ @@ -1739,23 +1886,25 @@ void wxWindow::PostCreation() gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this ); - + +#if (GTK_MINOR_VERSION > 0) /* these are called when the "sunken" or "raised" borders are drawn */ gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event", GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this ); gtk_signal_connect( GTK_OBJECT(m_widget), "draw", GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this ); +#endif } - ConnectWidget( GetConnectWidget() ); - - /* we force the creation of wxFrame and wxDialog in the respective code */ - if (m_parent) gtk_widget_realize( m_widget ); + GtkWidget *connect_widget = GetConnectWidget(); - if (m_wxwindow) gtk_widget_realize( m_wxwindow ); + ConnectWidget( connect_widget ); - SetCursor( *wxSTANDARD_CURSOR ); + /* we cannot set colours, fonts and cursors before the widget has + been realized, so we do this directly after realization */ + gtk_signal_connect( GTK_OBJECT(connect_widget), "realize", + GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this ); m_hasVMT = TRUE; } @@ -1797,7 +1946,7 @@ bool wxWindow::HasVMT() bool wxWindow::Close( bool force ) { - wxASSERT_MSG( (m_widget != NULL), "invalid window" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid window") ); wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); event.SetEventObject(this); @@ -1810,7 +1959,7 @@ bool wxWindow::Close( bool force ) bool wxWindow::Destroy() { - wxASSERT_MSG( (m_widget != NULL), "invalid window" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid window") ); m_hasVMT = FALSE; delete this; @@ -1839,8 +1988,8 @@ void wxWindow::PrepareDC( wxDC &WXUNUSED(dc) ) void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxASSERT_MSG( (m_widget != NULL), "invalid window" ); - wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid window") ); + wxASSERT_MSG( (m_parent != NULL), _T("wxWindow::SetSize requires parent.\n") ); if (m_resizing) return; /* I don't like recursions */ m_resizing = TRUE; @@ -1892,7 +2041,7 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { /* the default button has a border around it */ int border = 5; - + gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x-border, m_y-border ); gtk_widget_set_usize( m_widget, m_width+2*border, m_height+2*border ); @@ -1902,7 +2051,17 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x, m_y ); if ((old_width != m_width) || (old_height != m_height)) - gtk_widget_set_usize( m_widget, m_width, m_height ); + { +/* + GtkAllocation alloc; + alloc.x = m_x; + alloc.y = m_y; + alloc.width = m_width; + alloc.height = m_height; + gtk_widget_size_allocate( m_widget, &alloc ); +*/ + gtk_widget_set_usize( m_widget, m_width, m_height ); + } } } @@ -1922,7 +2081,7 @@ void wxWindow::OnInternalIdle() void wxWindow::GetSize( int *width, int *height ) const { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); if (width) (*width) = m_width; if (height) (*height) = m_height; @@ -1930,7 +2089,7 @@ void wxWindow::GetSize( int *width, int *height ) const void wxWindow::DoSetClientSize( int width, int height ) { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); if (!m_wxwindow) { @@ -1972,8 +2131,8 @@ void wxWindow::DoSetClientSize( int width, int height ) /* GtkWidget *hscrollbar = scroll_window->hscrollbar; GtkWidget *vscrollbar = scroll_window->vscrollbar; - - we use this instead: range.slider_width = 11 + 2*2pts edge + + we use this instead: range.slider_width = 11 + 2*2pts edge */ if (scroll_window->vscrollbar_visible) @@ -1995,7 +2154,7 @@ void wxWindow::DoSetClientSize( int width, int height ) void wxWindow::GetClientSize( int *width, int *height ) const { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); if (!m_wxwindow) { @@ -2037,8 +2196,8 @@ void wxWindow::GetClientSize( int *width, int *height ) const /* GtkWidget *hscrollbar = scroll_window->hscrollbar; GtkWidget *vscrollbar = scroll_window->vscrollbar; - - we use this instead: range.slider_width = 11 + 2*2pts edge + + we use this instead: range.slider_width = 11 + 2*2pts edge */ if (scroll_window->vscrollbar_visible) @@ -2061,7 +2220,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const void wxWindow::GetPosition( int *x, int *y ) const { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); if (x) (*x) = m_x; if (y) (*y) = m_y; @@ -2069,7 +2228,9 @@ void wxWindow::GetPosition( int *x, int *y ) const void wxWindow::ClientToScreen( int *x, int *y ) { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); + + if (!m_widget->window) return; GdkWindow *source = (GdkWindow *) NULL; if (m_wxwindow) @@ -2096,7 +2257,9 @@ void wxWindow::ClientToScreen( int *x, int *y ) void wxWindow::ScreenToClient( int *x, int *y ) { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); + + if (!m_widget->window) return; GdkWindow *source = (GdkWindow *) NULL; if (m_wxwindow) @@ -2123,7 +2286,7 @@ void wxWindow::ScreenToClient( int *x, int *y ) void wxWindow::Centre( int direction ) { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); int x = m_x; int y = m_y; @@ -2147,7 +2310,7 @@ void wxWindow::Centre( int direction ) void wxWindow::Fit() { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); int maxX = 0; int maxY = 0; @@ -2169,7 +2332,7 @@ void wxWindow::Fit() void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) ) { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); m_minWidth = minW; m_minHeight = minH; @@ -2179,12 +2342,15 @@ void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSE 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(); } bool wxWindow::Show( bool show ) { - wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" ); + wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") ); if (show == m_isShown) return TRUE; @@ -2200,7 +2366,7 @@ bool wxWindow::Show( bool show ) void wxWindow::Enable( bool enable ) { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); m_isEnabled = enable; @@ -2210,9 +2376,9 @@ void wxWindow::Enable( bool enable ) int wxWindow::GetCharHeight() const { - wxCHECK_MSG( (m_widget != NULL), 12, "invalid window" ); + wxCHECK_MSG( (m_widget != NULL), 12, _T("invalid window") ); - wxCHECK_MSG( m_font.Ok(), 12, "invalid font" ); + wxCHECK_MSG( m_font.Ok(), 12, _T("invalid font") ); GdkFont *font = m_font.GetInternalFont( 1.0 ); @@ -2221,9 +2387,9 @@ int wxWindow::GetCharHeight() const int wxWindow::GetCharWidth() const { - wxCHECK_MSG( (m_widget != NULL), 8, "invalid window" ); + wxCHECK_MSG( (m_widget != NULL), 8, _T("invalid window") ); - wxCHECK_MSG( m_font.Ok(), 8, "invalid font" ); + wxCHECK_MSG( m_font.Ok(), 8, _T("invalid font") ); GdkFont *font = m_font.GetInternalFont( 1.0 ); @@ -2236,10 +2402,10 @@ void wxWindow::GetTextExtent( const wxString& string, int *x, int *y, wxFont fontToUse = m_font; if (theFont) fontToUse = *theFont; - wxCHECK_RET( fontToUse.Ok(), "invalid font" ); + wxCHECK_RET( fontToUse.Ok(), _T("invalid font") ); GdkFont *font = fontToUse.GetInternalFont( 1.0 ); - if (x) (*x) = gdk_string_width( font, string ); + if (x) (*x) = gdk_string_width( font, string.mbc_str() ); if (y) (*y) = font->ascent + font->descent; if (descent) (*descent) = font->descent; if (externalLeading) (*externalLeading) = 0; // ?? @@ -2275,7 +2441,7 @@ void wxWindow::OnKeyDown( wxKeyEvent &event ) void wxWindow::SetFocus() { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); GtkWidget *connect_widget = GetConnectWidget(); if (connect_widget) @@ -2306,15 +2472,15 @@ bool wxWindow::AcceptsFocus() const void wxWindow::AddChild( wxWindow *child ) { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); - wxCHECK_RET( (child != NULL), "invalid child" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); + wxCHECK_RET( (child != NULL), _T("invalid child") ); m_children.Append( child ); } wxWindow *wxWindow::ReParent( wxWindow *newParent ) { - wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, "invalid window" ); + wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, _T("invalid window") ); wxWindow *oldParent = GetParent(); @@ -2349,14 +2515,18 @@ int wxWindow::GetReturnCode() void wxWindow::Raise() { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); + + if (!m_widget->window) return; if (m_widget) gdk_window_raise( m_widget->window ); } void wxWindow::Lower() { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); + + if (!m_widget->window) return; if (m_widget) gdk_window_lower( m_widget->window ); } @@ -2405,7 +2575,7 @@ wxValidator *wxWindow::GetValidator() void wxWindow::SetValidator( const wxValidator& validator ) { if (m_windowValidator) delete m_windowValidator; - m_windowValidator = validator.Clone(); + m_windowValidator = (wxValidator*)validator.Clone(); if (m_windowValidator) m_windowValidator->SetWindow(this); } @@ -2447,23 +2617,24 @@ wxWindowID wxWindow::GetId() const void wxWindow::SetCursor( const wxCursor &cursor ) { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); if (cursor.Ok()) { - if (cursor == *m_cursor) return; - *m_cursor = cursor; + if (cursor == m_cursor) return; + m_cursor = cursor; } else { - *m_cursor = *wxSTANDARD_CURSOR; + m_cursor = *wxSTANDARD_CURSOR; } - if ((m_widget) && (m_widget->window)) - gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() ); + if (!m_widget->window) return; + + gdk_window_set_cursor( m_widget->window, m_cursor.GetCursor() ); if ((m_wxwindow) && (m_wxwindow->window)) - gdk_window_set_cursor( m_wxwindow->window, m_cursor->GetCursor() ); + gdk_window_set_cursor( m_wxwindow->window, m_cursor.GetCursor() ); } void wxWindow::WarpPointer( int WXUNUSED(x), int WXUNUSED(y) ) @@ -2473,7 +2644,9 @@ void wxWindow::WarpPointer( int WXUNUSED(x), int WXUNUSED(y) ) void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) { - wxCHECK_RET( (m_widget != NULL), "invalid window" ); + wxCHECK_RET( (m_widget != NULL), _T("invalid window") ); + + if (!m_widget->window) return; if (eraseBackground && m_wxwindow && m_wxwindow->window) { @@ -2538,7 +2711,9 @@ bool wxWindow::IsExposed( const wxRect& rect ) const void wxWindow::Clear() { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); + + if (!m_widget->window) return; if (m_wxwindow && m_wxwindow->window) { @@ -2576,9 +2751,9 @@ void wxWindow::SetToolTip( wxToolTip *tip ) m_toolTip->Apply( this ); } -void wxWindow::ApplyToolTip( GtkTooltips *tips, const char *tip ) +void wxWindow::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) { - gtk_tooltips_set_tip( tips, GetConnectWidget(), tip, (gchar*) NULL ); + gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConv_current->cWX2MB(tip), (gchar*) NULL ); } #endif // wxUSE_TOOLTIPS @@ -2589,25 +2764,28 @@ wxColour wxWindow::GetBackgroundColour() const void wxWindow::SetBackgroundColour( const wxColour &colour ) { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); if (m_backgroundColour == colour) return; m_backgroundColour = colour; if (!m_backgroundColour.Ok()) return; + GtkWidget *connect_widget = GetConnectWidget(); + if (!connect_widget->window) return; + if (m_wxwindow && m_wxwindow->window) { /* wxMSW doesn't clear the window here. I don't do that - either to provide compatibility. call Clear() to do + either to provide compatibility. call Clear() to do the job. */ - + m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_wxwindow->window ) ); gdk_window_set_background( m_wxwindow->window, m_backgroundColour.GetColor() ); } wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ); - + if (sysbg.Red() == colour.Red() && sysbg.Green() == colour.Green() && sysbg.Blue() == colour.Blue()) @@ -2629,13 +2807,15 @@ wxColour wxWindow::GetForegroundColour() const void wxWindow::SetForegroundColour( const wxColour &colour ) { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); if (m_foregroundColour == colour) return; m_foregroundColour = colour; if (!m_foregroundColour.Ok()) return; + if (!m_widget->window) return; + wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ); if (sysbg.Red() == colour.Red() && sysbg.Green() == colour.Green() && @@ -2697,7 +2877,7 @@ void wxWindow::ApplyWidgetStyle() bool wxWindow::Validate() { - wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); + wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") ); wxNode *node = m_children.First(); while (node) @@ -2714,7 +2894,7 @@ bool wxWindow::Validate() bool wxWindow::TransferDataToWindow() { - wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); + wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") ); wxNode *node = m_children.First(); while (node) @@ -2733,7 +2913,7 @@ bool wxWindow::TransferDataToWindow() bool wxWindow::TransferDataFromWindow() { - wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); + wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") ); wxNode *node = m_children.First(); while (node) @@ -2760,7 +2940,7 @@ void wxWindow::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) ) void wxWindow::InitDialog() { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); wxInitDialogEvent event(GetId()); event.SetEventObject( this ); @@ -2794,9 +2974,9 @@ static void pop_pos_callback( GtkMenu *menu, gint *x, gint *y, wxWindow *win ) bool wxWindow::PopupMenu( wxMenu *menu, int x, int y ) { - wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); + wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") ); - wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" ); + wxCHECK_MSG( menu != NULL, FALSE, _T("invalid popup-menu") ); SetInvokingWindow( menu, this ); @@ -2821,7 +3001,7 @@ bool wxWindow::PopupMenu( wxMenu *menu, int x, int y ) void wxWindow::SetDropTarget( wxDropTarget *dropTarget ) { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); GtkWidget *dnd_widget = GetConnectWidget(); @@ -2856,15 +3036,17 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window ) void wxWindow::SetFont( const wxFont &font ) { - wxCHECK_RET( m_widget != NULL, "invalid window" ); - + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); + if (m_font == font) return; - + if (((wxFont*)&font)->Ok()) m_font = font; else m_font = *wxSWISS_FONT; + if (!m_widget->window) return; + wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ); if (sysbg.Red() == m_backgroundColour.Red() && sysbg.Green() == m_backgroundColour.Green() && @@ -2892,9 +3074,11 @@ long wxWindow::GetWindowStyleFlag() const void wxWindow::CaptureMouse() { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); + + wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") ); - wxCHECK_RET( g_capturing == FALSE, "CaptureMouse called twice" ); + if (!m_widget->window) return; GtkWidget *connect_widget = GetConnectWidget(); gtk_grab_add( connect_widget ); @@ -2911,9 +3095,11 @@ void wxWindow::CaptureMouse() void wxWindow::ReleaseMouse() { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); + + wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") ); - wxCHECK_RET( g_capturing == TRUE, "ReleaseMouse called twice" ); + if (!m_widget->window) return; GtkWidget *connect_widget = GetConnectWidget(); gtk_grab_remove( connect_widget ); @@ -2986,9 +3172,9 @@ wxWindow *wxWindow::FindWindow( const wxString& name ) void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, int range, bool refresh ) { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); - wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" ); + wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") ); m_hasScrolling = TRUE; @@ -3041,7 +3227,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_vAdjust->page_size = fthumb; } - if (m_wxwindow->window) + if (m_wxwindow) { if (orient == wxHORIZONTAL) gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); @@ -3054,9 +3240,9 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); - wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" ); + wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") ); if (orient == wxHORIZONTAL) { @@ -3093,9 +3279,9 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) int wxWindow::GetScrollThumb( int orient ) const { - wxCHECK_MSG( m_widget != NULL, 0, "invalid window" ); + wxCHECK_MSG( m_widget != NULL, 0, _T("invalid window") ); - wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" ); + wxCHECK_MSG( m_wxwindow != NULL, 0, _T("window needs client area for scrolling") ); if (orient == wxHORIZONTAL) return (int)(m_hAdjust->page_size+0.5); @@ -3105,9 +3291,9 @@ int wxWindow::GetScrollThumb( int orient ) const int wxWindow::GetScrollPos( int orient ) const { - wxCHECK_MSG( m_widget != NULL, 0, "invalid window" ); + wxCHECK_MSG( m_widget != NULL, 0, _T("invalid window") ); - wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" ); + wxCHECK_MSG( m_wxwindow != NULL, 0, _T("window needs client area for scrolling") ); if (orient == wxHORIZONTAL) return (int)(m_hAdjust->value+0.5); @@ -3117,9 +3303,9 @@ int wxWindow::GetScrollPos( int orient ) const int wxWindow::GetScrollRange( int orient ) const { - wxCHECK_MSG( m_widget != NULL, 0, "invalid window" ); + wxCHECK_MSG( m_widget != NULL, 0, _T("invalid window") ); - wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" ); + wxCHECK_MSG( m_wxwindow != NULL, 0, _T("window needs client area for scrolling") ); if (orient == wxHORIZONTAL) return (int)(m_hAdjust->upper+0.5); @@ -3129,9 +3315,9 @@ int wxWindow::GetScrollRange( int orient ) const void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) { - wxCHECK_RET( m_widget != NULL, "invalid window" ); + wxCHECK_RET( m_widget != NULL, _T("invalid window") ); - wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" ); + wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") ); wxNode *node = m_children.First(); while (node) @@ -3348,6 +3534,7 @@ bool wxWindow::Layout() GetSizer()->LayoutPhase1(&noChanges); GetSizer()->LayoutPhase2(&noChanges); GetSizer()->SetConstraintSizes(); // Recursively set the real window sizes + return TRUE; } else @@ -3482,21 +3669,21 @@ void wxWindow::SetConstraintSizes(bool recurse) } else if (constr) { - char *windowClass = this->GetClassInfo()->GetClassName(); + wxChar *windowClass = this->GetClassInfo()->GetClassName(); wxString winName; - if (GetName() == "") - winName = "unnamed"; + if (GetName() == _T("")) + winName = _T("unnamed"); else winName = GetName(); - wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n", - (const char *)windowClass, - (const char *)winName); - if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" ); - if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" ); - if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" ); - if (!constr->height.GetDone()) wxLogDebug( " unsatisfied 'height' constraint.\n" ); - wxLogDebug( "Please check constraints: try adding AsIs() constraints.\n" ); + wxLogDebug( _T("Constraint(s) not satisfied for window of type %s, name %s:\n"), + (const wxChar *)windowClass, + (const wxChar *)winName); + if (!constr->left.GetDone()) wxLogDebug( _T(" unsatisfied 'left' constraint.\n") ); + if (!constr->right.GetDone()) wxLogDebug( _T(" unsatisfied 'right' constraint.\n") ); + if (!constr->width.GetDone()) wxLogDebug( _T(" unsatisfied 'width' constraint.\n") ); + if (!constr->height.GetDone()) wxLogDebug( _T(" unsatisfied 'height' constraint.\n") ); + wxLogDebug( _T("Please check constraints: try adding AsIs() constraints.\n") ); } if (recurse)