diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h index 490d00170f..bfbad63e7a 100644 --- a/include/wx/gtk/frame.h +++ b/include/wx/gtk/frame.h @@ -103,7 +103,6 @@ public: // implementation virtual void GtkOnSize( int x, int y, int width, int height ); - virtual wxPoint GetClientAreaOrigin() const; void DoMenuUpdates(); void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin); virtual void OnInternalIdle(); @@ -115,6 +114,7 @@ public: wxString m_title; wxIcon m_icon; int m_miniEdge,m_miniTitle; + GtkWidget *m_mainWidget; protected: virtual void DoSetSize(int x, int y, diff --git a/include/wx/gtk/mdi.h b/include/wx/gtk/mdi.h index d49600fa0a..8d08ef3afa 100644 --- a/include/wx/gtk/mdi.h +++ b/include/wx/gtk/mdi.h @@ -150,7 +150,7 @@ class wxMDIChildFrame: public wxFrame wxString GetTitle() const { return m_title; } // no maximize etc - virtual void Maximize(void) {} + virtual void Maximize(bool WXUNUSED(maximize)) {} virtual void Restore(void) {} void OnActivate( wxActivateEvent &event ); diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index f2a65b8fa1..6520054034 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -403,14 +403,12 @@ public: // implementation - virtual wxPoint GetClientAreaOrigin() const; - virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ); - bool HasVMT(); + /* I don't want users to override what's done in OnIdle */ virtual void OnInternalIdle(); - // For compatibility across platforms (not in event table) + /* For compatibility across platforms (not in event table) */ void OnIdle(wxIdleEvent& WXUNUSED(event)) {}; /* used by all classes in the widget creation process */ diff --git a/include/wx/gtk1/frame.h b/include/wx/gtk1/frame.h index 490d00170f..bfbad63e7a 100644 --- a/include/wx/gtk1/frame.h +++ b/include/wx/gtk1/frame.h @@ -103,7 +103,6 @@ public: // implementation virtual void GtkOnSize( int x, int y, int width, int height ); - virtual wxPoint GetClientAreaOrigin() const; void DoMenuUpdates(); void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin); virtual void OnInternalIdle(); @@ -115,6 +114,7 @@ public: wxString m_title; wxIcon m_icon; int m_miniEdge,m_miniTitle; + GtkWidget *m_mainWidget; protected: virtual void DoSetSize(int x, int y, diff --git a/include/wx/gtk1/mdi.h b/include/wx/gtk1/mdi.h index d49600fa0a..8d08ef3afa 100644 --- a/include/wx/gtk1/mdi.h +++ b/include/wx/gtk1/mdi.h @@ -150,7 +150,7 @@ class wxMDIChildFrame: public wxFrame wxString GetTitle() const { return m_title; } // no maximize etc - virtual void Maximize(void) {} + virtual void Maximize(bool WXUNUSED(maximize)) {} virtual void Restore(void) {} void OnActivate( wxActivateEvent &event ); diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index f2a65b8fa1..6520054034 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -403,14 +403,12 @@ public: // implementation - virtual wxPoint GetClientAreaOrigin() const; - virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ); - bool HasVMT(); + /* I don't want users to override what's done in OnIdle */ virtual void OnInternalIdle(); - // For compatibility across platforms (not in event table) + /* For compatibility across platforms (not in event table) */ void OnIdle(wxIdleEvent& WXUNUSED(event)) {}; /* used by all classes in the widget creation process */ diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index bfa0f65baa..06351fb9a2 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -97,6 +97,50 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC return FALSE; } +//----------------------------------------------------------------------------- +// InsertChild for wxFrame +//----------------------------------------------------------------------------- + +/* Callback for wxFrame. This very strange beast has to be used because + * C++ has no virtual methods in a constructor. We have to emulate a + * virtual function here as wxWindows requires different ways to insert + * a child in container classes. */ + +static void wxInsertChildInFrame( wxWindow* parent, wxWindow* child ) +{ + if (wxIS_KIND_OF(child,wxToolBar) || wxIS_KIND_OF(child,wxMenuBar)) + { + /* these are outside the client area */ + wxFrame* frame = (wxFrame*) parent; + gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget), + GTK_WIDGET(child->m_widget), + child->m_x, + child->m_y ); + } + else + { + /* these are inside the client area */ + gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow), + GTK_WIDGET(child->m_widget), + child->m_x, + child->m_y ); + } + + gtk_widget_set_usize( GTK_WIDGET(child->m_widget), + child->m_width, + child->m_height ); + + /* resize on OnInternalIdle */ + parent->m_sizeSet = FALSE; + + if (parent->m_windowStyle & wxTAB_TRAVERSAL) + { + /* we now allow a window to get the focus as long as it + doesn't have any children. */ + GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS ); + } +} + //----------------------------------------------------------------------------- // wxFrame //----------------------------------------------------------------------------- @@ -145,6 +189,8 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, PreCreation( parent, id, pos, size, style, name ); m_title = title; + + m_insertCallback = wxInsertChildInFrame; GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; @@ -159,11 +205,18 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this ); + /* m_mainWidget holds the toolbar, the menubar and the client area */ + m_mainWidget = gtk_myfixed_new(); + gtk_widget_show( m_mainWidget ); + GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS ); + gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget ); + gtk_widget_realize( m_mainWidget ); + + /* m_wxwindow only represents the client area without toolbar and menubar */ m_wxwindow = gtk_myfixed_new(); gtk_widget_show( m_wxwindow ); GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); - - gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); + gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow ); if (m_parent) m_parent->AddChild( this ); @@ -233,7 +286,7 @@ bool wxFrame::Show( bool show ) { /* by calling GtkOnSize here, we don't have to call either after showing the frame, which would entail - much ugly flicker nor from within the size_allocate + 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 ); @@ -251,24 +304,6 @@ bool wxFrame::Destroy() return TRUE; } -wxPoint wxFrame::GetClientAreaOrigin() const -{ - wxPoint pt( m_miniEdge, m_miniEdge + m_miniTitle ); - if (m_frameMenuBar) - { - int h = 0; - m_frameMenuBar->GetSize( (int*)NULL, &h ); - pt.y += h; - } - if (m_frameToolBar) - { - int h = 0; - m_frameToolBar->GetSize( (int*)NULL, &h ); - pt.y += h; - } - return pt; -} - void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); @@ -404,10 +439,13 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; - /* this emulates the new wxMSW behaviour of placing all - * frame-subwindows (menu, toolbar..) on one native window + /* I revert back to wxGTK's original behaviour. m_mainWidget holds the + * menubar, the toolbar and the client area, which is represented by + * m_wxwindow. * this hurts in the eye, but I don't want to call SetSize() * because I don't want to call any non-native functions here. */ + + int client_area_y_offset = 0; if (m_frameMenuBar) { @@ -420,8 +458,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_frameMenuBar->m_width = ww; m_frameMenuBar->m_height = hh; - gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy ); + gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameMenuBar->m_widget, xx, yy ); gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh ); + + client_area_y_offset += hh; } if (m_frameToolBar) @@ -437,14 +477,19 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_frameToolBar->m_height = hh; m_frameToolBar->m_width = ww; - gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy ); + gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy ); gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh ); + + client_area_y_offset += hh; } + + gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_wxwindow, 0, client_area_y_offset ); + gtk_widget_set_usize( m_wxwindow, m_width, m_height-client_area_y_offset ); if (m_frameStatusBar) { int xx = 0 + m_miniEdge; - int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge; + int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset; int ww = m_width - 2*m_miniEdge; int hh = wxSTATUS_HEIGHT; @@ -564,7 +609,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar ) if (m_frameMenuBar->m_parent != this) { m_frameMenuBar->m_parent = this; - gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), + gtk_myfixed_put( GTK_MYFIXED(m_mainWidget), m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y ); /* an mdi child menu bar might be underneath */ diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index a83c194439..5adc32e77e 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -184,13 +184,6 @@ static void draw_frame( GtkWidget *widget, wxWindow *win ) dx += widget->allocation.x; dy += widget->allocation.y; } - else - if (win->m_parent) - { - wxPoint pt(win->m_parent->GetClientAreaOrigin()); - dx += pt.x; - dy += pt.y; - } if (win->m_windowStyle & wxRAISED_BORDER) { @@ -706,10 +699,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton } } - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - event.SetEventObject( win ); gs_timeLastClick = gdk_event->time; @@ -816,10 +805,6 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto } } - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - event.SetEventObject( win ); if (win->GetEventHandler()->ProcessEvent( event )) @@ -927,10 +912,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion } } - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - event.SetEventObject( win ); if (win->GetEventHandler()->ProcessEvent( event )) @@ -1064,10 +1045,6 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ event.m_x = (long)x; event.m_y = (long)y; - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - if (win->GetEventHandler()->ProcessEvent( event )) { gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_event" ); @@ -1118,10 +1095,6 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ event.m_x = (long)x; event.m_y = (long)y; - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - if (win->GetEventHandler()->ProcessEvent( event )) { gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_event" ); @@ -1345,11 +1318,6 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child ) child->m_width, child->m_height ); - if (wxIS_KIND_OF(parent,wxFrame)) - { - parent->m_sizeSet = FALSE; - } - if (parent->m_windowStyle & wxTAB_TRAVERSAL) { /* we now allow a window to get the focus as long as it @@ -1869,21 +1837,6 @@ void wxWindow::PrepareDC( wxDC &WXUNUSED(dc) ) // are we to set fonts here ? } -wxPoint wxWindow::GetClientAreaOrigin() const -{ - return wxPoint(0,0); -} - -void wxWindow::AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ) -{ - if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent()) - { - wxPoint pt(GetParent()->GetClientAreaOrigin()); - x += pt.x; - y += pt.y; - } -} - void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid window" ); @@ -1940,15 +1893,13 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) /* the default button has a border around it */ int border = 5; - wxPoint pt( m_parent->GetClientAreaOrigin() ); - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x-border, m_y+pt.y-border ); + 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 ); } else { - wxPoint pt( m_parent->GetClientAreaOrigin() ); - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y ); + 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 ); @@ -2139,10 +2090,6 @@ void wxWindow::ClientToScreen( int *x, int *y ) } } - wxPoint pt(GetClientAreaOrigin()); - org_x += pt.x; - org_y += pt.y; - if (x) *x += org_x; if (y) *y += org_y; } @@ -2170,10 +2117,6 @@ void wxWindow::ScreenToClient( int *x, int *y ) } } - wxPoint pt(GetClientAreaOrigin()); - org_x -= pt.x; - org_y -= pt.y; - if (x) *x -= org_x; if (y) *y -= org_y; } diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index bfa0f65baa..06351fb9a2 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -97,6 +97,50 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC return FALSE; } +//----------------------------------------------------------------------------- +// InsertChild for wxFrame +//----------------------------------------------------------------------------- + +/* Callback for wxFrame. This very strange beast has to be used because + * C++ has no virtual methods in a constructor. We have to emulate a + * virtual function here as wxWindows requires different ways to insert + * a child in container classes. */ + +static void wxInsertChildInFrame( wxWindow* parent, wxWindow* child ) +{ + if (wxIS_KIND_OF(child,wxToolBar) || wxIS_KIND_OF(child,wxMenuBar)) + { + /* these are outside the client area */ + wxFrame* frame = (wxFrame*) parent; + gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget), + GTK_WIDGET(child->m_widget), + child->m_x, + child->m_y ); + } + else + { + /* these are inside the client area */ + gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow), + GTK_WIDGET(child->m_widget), + child->m_x, + child->m_y ); + } + + gtk_widget_set_usize( GTK_WIDGET(child->m_widget), + child->m_width, + child->m_height ); + + /* resize on OnInternalIdle */ + parent->m_sizeSet = FALSE; + + if (parent->m_windowStyle & wxTAB_TRAVERSAL) + { + /* we now allow a window to get the focus as long as it + doesn't have any children. */ + GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS ); + } +} + //----------------------------------------------------------------------------- // wxFrame //----------------------------------------------------------------------------- @@ -145,6 +189,8 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, PreCreation( parent, id, pos, size, style, name ); m_title = title; + + m_insertCallback = wxInsertChildInFrame; GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; @@ -159,11 +205,18 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this ); + /* m_mainWidget holds the toolbar, the menubar and the client area */ + m_mainWidget = gtk_myfixed_new(); + gtk_widget_show( m_mainWidget ); + GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS ); + gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget ); + gtk_widget_realize( m_mainWidget ); + + /* m_wxwindow only represents the client area without toolbar and menubar */ m_wxwindow = gtk_myfixed_new(); gtk_widget_show( m_wxwindow ); GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); - - gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); + gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow ); if (m_parent) m_parent->AddChild( this ); @@ -233,7 +286,7 @@ bool wxFrame::Show( bool show ) { /* by calling GtkOnSize here, we don't have to call either after showing the frame, which would entail - much ugly flicker nor from within the size_allocate + 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 ); @@ -251,24 +304,6 @@ bool wxFrame::Destroy() return TRUE; } -wxPoint wxFrame::GetClientAreaOrigin() const -{ - wxPoint pt( m_miniEdge, m_miniEdge + m_miniTitle ); - if (m_frameMenuBar) - { - int h = 0; - m_frameMenuBar->GetSize( (int*)NULL, &h ); - pt.y += h; - } - if (m_frameToolBar) - { - int h = 0; - m_frameToolBar->GetSize( (int*)NULL, &h ); - pt.y += h; - } - return pt; -} - void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); @@ -404,10 +439,13 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; - /* this emulates the new wxMSW behaviour of placing all - * frame-subwindows (menu, toolbar..) on one native window + /* I revert back to wxGTK's original behaviour. m_mainWidget holds the + * menubar, the toolbar and the client area, which is represented by + * m_wxwindow. * this hurts in the eye, but I don't want to call SetSize() * because I don't want to call any non-native functions here. */ + + int client_area_y_offset = 0; if (m_frameMenuBar) { @@ -420,8 +458,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_frameMenuBar->m_width = ww; m_frameMenuBar->m_height = hh; - gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy ); + gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameMenuBar->m_widget, xx, yy ); gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh ); + + client_area_y_offset += hh; } if (m_frameToolBar) @@ -437,14 +477,19 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_frameToolBar->m_height = hh; m_frameToolBar->m_width = ww; - gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy ); + gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy ); gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh ); + + client_area_y_offset += hh; } + + gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_wxwindow, 0, client_area_y_offset ); + gtk_widget_set_usize( m_wxwindow, m_width, m_height-client_area_y_offset ); if (m_frameStatusBar) { int xx = 0 + m_miniEdge; - int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge; + int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset; int ww = m_width - 2*m_miniEdge; int hh = wxSTATUS_HEIGHT; @@ -564,7 +609,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar ) if (m_frameMenuBar->m_parent != this) { m_frameMenuBar->m_parent = this; - gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), + gtk_myfixed_put( GTK_MYFIXED(m_mainWidget), m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y ); /* an mdi child menu bar might be underneath */ diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index a83c194439..5adc32e77e 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -184,13 +184,6 @@ static void draw_frame( GtkWidget *widget, wxWindow *win ) dx += widget->allocation.x; dy += widget->allocation.y; } - else - if (win->m_parent) - { - wxPoint pt(win->m_parent->GetClientAreaOrigin()); - dx += pt.x; - dy += pt.y; - } if (win->m_windowStyle & wxRAISED_BORDER) { @@ -706,10 +699,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton } } - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - event.SetEventObject( win ); gs_timeLastClick = gdk_event->time; @@ -816,10 +805,6 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto } } - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - event.SetEventObject( win ); if (win->GetEventHandler()->ProcessEvent( event )) @@ -927,10 +912,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion } } - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - event.SetEventObject( win ); if (win->GetEventHandler()->ProcessEvent( event )) @@ -1064,10 +1045,6 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ event.m_x = (long)x; event.m_y = (long)y; - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - if (win->GetEventHandler()->ProcessEvent( event )) { gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_event" ); @@ -1118,10 +1095,6 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ event.m_x = (long)x; event.m_y = (long)y; - wxPoint pt(win->GetClientAreaOrigin()); - event.m_x -= pt.x; - event.m_y -= pt.y; - if (win->GetEventHandler()->ProcessEvent( event )) { gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_event" ); @@ -1345,11 +1318,6 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child ) child->m_width, child->m_height ); - if (wxIS_KIND_OF(parent,wxFrame)) - { - parent->m_sizeSet = FALSE; - } - if (parent->m_windowStyle & wxTAB_TRAVERSAL) { /* we now allow a window to get the focus as long as it @@ -1869,21 +1837,6 @@ void wxWindow::PrepareDC( wxDC &WXUNUSED(dc) ) // are we to set fonts here ? } -wxPoint wxWindow::GetClientAreaOrigin() const -{ - return wxPoint(0,0); -} - -void wxWindow::AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ) -{ - if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent()) - { - wxPoint pt(GetParent()->GetClientAreaOrigin()); - x += pt.x; - y += pt.y; - } -} - void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid window" ); @@ -1940,15 +1893,13 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) /* the default button has a border around it */ int border = 5; - wxPoint pt( m_parent->GetClientAreaOrigin() ); - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x-border, m_y+pt.y-border ); + 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 ); } else { - wxPoint pt( m_parent->GetClientAreaOrigin() ); - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y ); + 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 ); @@ -2139,10 +2090,6 @@ void wxWindow::ClientToScreen( int *x, int *y ) } } - wxPoint pt(GetClientAreaOrigin()); - org_x += pt.x; - org_y += pt.y; - if (x) *x += org_x; if (y) *y += org_y; } @@ -2170,10 +2117,6 @@ void wxWindow::ScreenToClient( int *x, int *y ) } } - wxPoint pt(GetClientAreaOrigin()); - org_x -= pt.x; - org_y -= pt.y; - if (x) *x -= org_x; if (y) *y -= org_y; }