From 82b978d70d9a0e58502c7d24ffebd462c5924c3c Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 1 May 2004 22:46:38 +0000 Subject: [PATCH] Reverted last change git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27045 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/private.h | 34 --------------- include/wx/gtk1/private.h | 34 --------------- src/gtk/toplevel.cpp | 19 ++++----- src/gtk/window.cpp | 90 +++++++++++++++++++-------------------- src/gtk1/toplevel.cpp | 19 ++++----- src/gtk1/window.cpp | 90 +++++++++++++++++++-------------------- 6 files changed, 108 insertions(+), 178 deletions(-) diff --git a/include/wx/gtk/private.h b/include/wx/gtk/private.h index 50d0825501..d63519da52 100644 --- a/include/wx/gtk/private.h +++ b/include/wx/gtk/private.h @@ -131,39 +131,5 @@ inline wxEventType GtkScrollWinTypeToWx(guint scrollType) wxEVT_SCROLLWIN_TOP - wxEVT_SCROLL_TOP; } - - -// In wxGTK2 the wxMessageDialog is not a real wxDialog, instead a -// gtk_message_dialog is created, shown and destroyed inside the ShowModal() -// call. Since its m_widget will always be NULL there would normally be lots -// of wxCHECK asserts triggered by calling base class methods that are valid -// calls (or just ignored) on other wx ports. Using these macros instead of -// wxCHECK will silence those asserts if the window is a wxMessageDialog and -// will let the method doing the check just be ignored in that case. If it's -// not a wxMessageDialog then it behaves just like before. -// -// NOTE: Once more native dialogs are used then this will need to be -// generalized a bit, perhaps with a IsNativeGTKDialog method or -// something... - -#if wxUSE_MSGDLG && defined(__WXGTK20__) && !defined(__WXGPE__) -#define wxCHECK_VALID_WIDGET(rc) \ - if (!(m_widget != NULL)) { \ - if (!wxIsKindOf(this, wxMessageDialog)) { wxFAIL_MSG(wxT("invalid window")); } \ - return rc; \ - } - -#define wxCHECK_VALID_WIDGET_RET() \ - if (!(m_widget != NULL)) { \ - if (!wxIsKindOf(this, wxMessageDialog)) { wxFAIL_MSG(wxT("invalid window")); } \ - return; \ - } - -#else // not wxGTK2, so just use wxCHECK -#define wxCHECK_VALID_WIDGET(rc) wxCHECK_MSG( (m_widget != NULL), rc, wxT("invalid window") ) -#define wxCHECK_VALID_WIDGET_RET() wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); -#endif - - #endif // _WX_GTK_PRIVATE_H_ diff --git a/include/wx/gtk1/private.h b/include/wx/gtk1/private.h index 50d0825501..d63519da52 100644 --- a/include/wx/gtk1/private.h +++ b/include/wx/gtk1/private.h @@ -131,39 +131,5 @@ inline wxEventType GtkScrollWinTypeToWx(guint scrollType) wxEVT_SCROLLWIN_TOP - wxEVT_SCROLL_TOP; } - - -// In wxGTK2 the wxMessageDialog is not a real wxDialog, instead a -// gtk_message_dialog is created, shown and destroyed inside the ShowModal() -// call. Since its m_widget will always be NULL there would normally be lots -// of wxCHECK asserts triggered by calling base class methods that are valid -// calls (or just ignored) on other wx ports. Using these macros instead of -// wxCHECK will silence those asserts if the window is a wxMessageDialog and -// will let the method doing the check just be ignored in that case. If it's -// not a wxMessageDialog then it behaves just like before. -// -// NOTE: Once more native dialogs are used then this will need to be -// generalized a bit, perhaps with a IsNativeGTKDialog method or -// something... - -#if wxUSE_MSGDLG && defined(__WXGTK20__) && !defined(__WXGPE__) -#define wxCHECK_VALID_WIDGET(rc) \ - if (!(m_widget != NULL)) { \ - if (!wxIsKindOf(this, wxMessageDialog)) { wxFAIL_MSG(wxT("invalid window")); } \ - return rc; \ - } - -#define wxCHECK_VALID_WIDGET_RET() \ - if (!(m_widget != NULL)) { \ - if (!wxIsKindOf(this, wxMessageDialog)) { wxFAIL_MSG(wxT("invalid window")); } \ - return; \ - } - -#else // not wxGTK2, so just use wxCHECK -#define wxCHECK_VALID_WIDGET(rc) wxCHECK_MSG( (m_widget != NULL), rc, wxT("invalid window") ) -#define wxCHECK_VALID_WIDGET_RET() wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); -#endif - - #endif // _WX_GTK_PRIVATE_H_ diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 75371738e9..b4a0ed8489 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -30,7 +30,6 @@ #include "wx/log.h" #include "wx/dialog.h" -#include "wx/msgdlg.h" #include "wx/control.h" #include "wx/app.h" #include "wx/dcclient.h" @@ -580,7 +579,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) bool wxTopLevelWindowGTK::Show( bool show ) { - wxCHECK_VALID_WIDGET(FALSE); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); if (show && !m_sizeSet) { @@ -602,8 +601,8 @@ void wxTopLevelWindowGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXU void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxCHECK_VALID_WIDGET_RET(); - + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + // this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") ); @@ -689,8 +688,8 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const { - wxCHECK_VALID_WIDGET_RET(); - + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + wxWindow::DoGetClientSize( width, height ); if (height) { @@ -705,7 +704,7 @@ void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const void wxTopLevelWindowGTK::DoSetClientSize( int width, int height ) { - wxCHECK_VALID_WIDGET_RET(); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); DoSetSize(-1, -1, width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0); @@ -861,8 +860,8 @@ void wxTopLevelWindowGTK::OnInternalIdle() void wxTopLevelWindowGTK::SetTitle( const wxString &title ) { - wxCHECK_VALID_WIDGET_RET(); - + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + m_title = title; gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) ); } @@ -889,7 +888,7 @@ void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon ) void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) { - wxCHECK_VALID_WIDGET_RET(); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); GdkWindow* window = m_widget->window; wxTopLevelWindowBase::SetIcons( icons ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 62834cbe2f..ddf29e51e6 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2818,8 +2818,8 @@ bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const w void wxWindowGTK::PostCreation() { - wxCHECK_VALID_WIDGET_RET(); - + wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); + if (m_wxwindow) { if (!m_noExpose) @@ -2954,7 +2954,7 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget ) bool wxWindowGTK::Destroy() { - wxCHECK_VALID_WIDGET(FALSE); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); m_hasVMT = FALSE; @@ -2968,7 +2968,7 @@ void wxWindowGTK::DoMoveWindow(int x, int y, int width, int height) void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxCHECK_VALID_WIDGET_RET(); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); wxASSERT_MSG( (m_parent != NULL), wxT("wxWindowGTK::SetSize requires parent.\n") ); /* @@ -3149,7 +3149,7 @@ void wxWindowGTK::OnInternalIdle() void wxWindowGTK::DoGetSize( int *width, int *height ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (width) (*width) = m_width; if (height) (*height) = m_height; @@ -3157,8 +3157,8 @@ void wxWindowGTK::DoGetSize( int *width, int *height ) const void wxWindowGTK::DoSetClientSize( int width, int height ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + if (!m_wxwindow) { SetSize( width, height ); @@ -3220,7 +3220,7 @@ void wxWindowGTK::DoSetClientSize( int width, int height ) void wxWindowGTK::DoGetClientSize( int *width, int *height ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (!m_wxwindow) { @@ -3292,7 +3292,7 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const void wxWindowGTK::DoGetPosition( int *x, int *y ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); int dx = 0; int dy = 0; @@ -3309,7 +3309,7 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const void wxWindowGTK::DoClientToScreen( int *x, int *y ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (!m_widget->window) return; @@ -3338,7 +3338,7 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const void wxWindowGTK::DoScreenToClient( int *x, int *y ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (!m_widget->window) return; @@ -3367,7 +3367,7 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const bool wxWindowGTK::Show( bool show ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); if (!wxWindowBase::Show(show)) { @@ -3407,8 +3407,8 @@ static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable) bool wxWindowGTK::Enable( bool enable ) { - wxCHECK_VALID_WIDGET(FALSE); - + wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + if (!wxWindowBase::Enable(enable)) { // nothing to do @@ -3426,7 +3426,7 @@ bool wxWindowGTK::Enable( bool enable ) int wxWindowGTK::GetCharHeight() const { - wxCHECK_VALID_WIDGET(12); + wxCHECK_MSG( (m_widget != NULL), 12, wxT("invalid window") ); wxFont font = GetFont(); wxCHECK_MSG( font.Ok(), 12, wxT("invalid font") ); @@ -3460,7 +3460,7 @@ int wxWindowGTK::GetCharHeight() const int wxWindowGTK::GetCharWidth() const { - wxCHECK_VALID_WIDGET(8); + wxCHECK_MSG( (m_widget != NULL), 8, wxT("invalid window") ); wxFont font = GetFont(); wxCHECK_MSG( font.Ok(), 8, wxT("invalid font") ); @@ -3561,7 +3561,7 @@ void wxWindowGTK::GetTextExtent( const wxString& string, void wxWindowGTK::SetFocus() { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); if ( m_hasFocus ) { @@ -3620,7 +3620,7 @@ bool wxWindowGTK::AcceptsFocus() const bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); wxWindowGTK *oldParent = m_parent, *newParent = (wxWindowGTK *)newParentBase; @@ -3671,8 +3671,8 @@ void wxWindowGTK::DoAddChild(wxWindowGTK *child) void wxWindowGTK::Raise() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + if (!m_widget->window) return; gdk_window_raise( m_widget->window ); @@ -3680,8 +3680,8 @@ void wxWindowGTK::Raise() void wxWindowGTK::Lower() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + if (!m_widget->window) return; gdk_window_lower( m_widget->window ); @@ -3689,7 +3689,7 @@ void wxWindowGTK::Lower() bool wxWindowGTK::SetCursor( const wxCursor &cursor ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); if (cursor == m_cursor) return FALSE; @@ -3705,8 +3705,8 @@ bool wxWindowGTK::SetCursor( const wxCursor &cursor ) void wxWindowGTK::WarpPointer( int x, int y ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + // We provide this function ourselves as it is // missing in GDK (top of this file). @@ -3977,8 +3977,8 @@ void wxWindowGTK::GtkSendPaintEvents() void wxWindowGTK::ClearBackground() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + #ifndef __WXGTK20__ if (m_wxwindow && m_wxwindow->window) { @@ -4032,7 +4032,7 @@ void wxWindowGTK::GtkSetBackgroundColour( const wxColour &colour ) bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); if (!wxWindowBase::SetBackgroundColour(colour)) return FALSE; @@ -4074,7 +4074,7 @@ void wxWindowGTK::GtkSetForegroundColour( const wxColour &colour ) bool wxWindowGTK::SetForegroundColour( const wxColour &colour ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); if (!wxWindowBase::SetForegroundColour(colour)) { @@ -4307,7 +4307,7 @@ extern "C" void wxPopupMenuPositionCallback( GtkMenu *menu, bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); wxCHECK_MSG( menu != NULL, FALSE, wxT("invalid popup-menu") ); @@ -4354,8 +4354,8 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) void wxWindowGTK::SetDropTarget( wxDropTarget *dropTarget ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + GtkWidget *dnd_widget = GetConnectWidget(); if (m_dropTarget) m_dropTarget->UnregisterWidget( dnd_widget ); @@ -4408,8 +4408,8 @@ bool wxWindowGTK::SetFont( const wxFont &font ) void wxWindowGTK::DoCaptureMouse() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + GdkWindow *window = (GdkWindow*) NULL; if (m_wxwindow) window = GTK_PIZZA(m_wxwindow)->bin_window; @@ -4437,8 +4437,8 @@ void wxWindowGTK::DoCaptureMouse() void wxWindowGTK::DoReleaseMouse() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( g_captureWindow, wxT("can't release mouse - not captured") ); g_captureWindow = (wxWindowGTK*) NULL; @@ -4469,8 +4469,8 @@ bool wxWindowGTK::IsRetained() const void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, int range, bool refresh ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); m_hasScrolling = TRUE; @@ -4532,7 +4532,7 @@ void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, void wxWindowGTK::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); @@ -4584,8 +4584,8 @@ void wxWindowGTK::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) int wxWindowGTK::GetScrollThumb( int orient ) const { - wxCHECK_VALID_WIDGET(0); - + wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") ); + wxCHECK_MSG( m_wxwindow != NULL, 0, wxT("window needs client area for scrolling") ); if (orient == wxHORIZONTAL) @@ -4596,7 +4596,7 @@ int wxWindowGTK::GetScrollThumb( int orient ) const int wxWindowGTK::GetScrollPos( int orient ) const { - wxCHECK_VALID_WIDGET(0); + wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") ); wxCHECK_MSG( m_wxwindow != NULL, 0, wxT("window needs client area for scrolling") ); @@ -4608,7 +4608,7 @@ int wxWindowGTK::GetScrollPos( int orient ) const int wxWindowGTK::GetScrollRange( int orient ) const { - wxCHECK_VALID_WIDGET(0); + wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") ); wxCHECK_MSG( m_wxwindow != NULL, 0, wxT("window needs client area for scrolling") ); @@ -4620,8 +4620,8 @@ int wxWindowGTK::GetScrollRange( int orient ) const void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); // No scrolling requested. diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index 75371738e9..b4a0ed8489 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -30,7 +30,6 @@ #include "wx/log.h" #include "wx/dialog.h" -#include "wx/msgdlg.h" #include "wx/control.h" #include "wx/app.h" #include "wx/dcclient.h" @@ -580,7 +579,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style ) bool wxTopLevelWindowGTK::Show( bool show ) { - wxCHECK_VALID_WIDGET(FALSE); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); if (show && !m_sizeSet) { @@ -602,8 +601,8 @@ void wxTopLevelWindowGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXU void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxCHECK_VALID_WIDGET_RET(); - + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + // this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") ); @@ -689,8 +688,8 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const { - wxCHECK_VALID_WIDGET_RET(); - + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + wxWindow::DoGetClientSize( width, height ); if (height) { @@ -705,7 +704,7 @@ void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const void wxTopLevelWindowGTK::DoSetClientSize( int width, int height ) { - wxCHECK_VALID_WIDGET_RET(); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); DoSetSize(-1, -1, width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0); @@ -861,8 +860,8 @@ void wxTopLevelWindowGTK::OnInternalIdle() void wxTopLevelWindowGTK::SetTitle( const wxString &title ) { - wxCHECK_VALID_WIDGET_RET(); - + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + m_title = title; gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) ); } @@ -889,7 +888,7 @@ void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon ) void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) { - wxCHECK_VALID_WIDGET_RET(); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); GdkWindow* window = m_widget->window; wxTopLevelWindowBase::SetIcons( icons ); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 62834cbe2f..ddf29e51e6 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2818,8 +2818,8 @@ bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const w void wxWindowGTK::PostCreation() { - wxCHECK_VALID_WIDGET_RET(); - + wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); + if (m_wxwindow) { if (!m_noExpose) @@ -2954,7 +2954,7 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget ) bool wxWindowGTK::Destroy() { - wxCHECK_VALID_WIDGET(FALSE); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); m_hasVMT = FALSE; @@ -2968,7 +2968,7 @@ void wxWindowGTK::DoMoveWindow(int x, int y, int width, int height) void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxCHECK_VALID_WIDGET_RET(); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); wxASSERT_MSG( (m_parent != NULL), wxT("wxWindowGTK::SetSize requires parent.\n") ); /* @@ -3149,7 +3149,7 @@ void wxWindowGTK::OnInternalIdle() void wxWindowGTK::DoGetSize( int *width, int *height ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (width) (*width) = m_width; if (height) (*height) = m_height; @@ -3157,8 +3157,8 @@ void wxWindowGTK::DoGetSize( int *width, int *height ) const void wxWindowGTK::DoSetClientSize( int width, int height ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + if (!m_wxwindow) { SetSize( width, height ); @@ -3220,7 +3220,7 @@ void wxWindowGTK::DoSetClientSize( int width, int height ) void wxWindowGTK::DoGetClientSize( int *width, int *height ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (!m_wxwindow) { @@ -3292,7 +3292,7 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const void wxWindowGTK::DoGetPosition( int *x, int *y ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); int dx = 0; int dy = 0; @@ -3309,7 +3309,7 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const void wxWindowGTK::DoClientToScreen( int *x, int *y ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (!m_widget->window) return; @@ -3338,7 +3338,7 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const void wxWindowGTK::DoScreenToClient( int *x, int *y ) const { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (!m_widget->window) return; @@ -3367,7 +3367,7 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const bool wxWindowGTK::Show( bool show ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); if (!wxWindowBase::Show(show)) { @@ -3407,8 +3407,8 @@ static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable) bool wxWindowGTK::Enable( bool enable ) { - wxCHECK_VALID_WIDGET(FALSE); - + wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); + if (!wxWindowBase::Enable(enable)) { // nothing to do @@ -3426,7 +3426,7 @@ bool wxWindowGTK::Enable( bool enable ) int wxWindowGTK::GetCharHeight() const { - wxCHECK_VALID_WIDGET(12); + wxCHECK_MSG( (m_widget != NULL), 12, wxT("invalid window") ); wxFont font = GetFont(); wxCHECK_MSG( font.Ok(), 12, wxT("invalid font") ); @@ -3460,7 +3460,7 @@ int wxWindowGTK::GetCharHeight() const int wxWindowGTK::GetCharWidth() const { - wxCHECK_VALID_WIDGET(8); + wxCHECK_MSG( (m_widget != NULL), 8, wxT("invalid window") ); wxFont font = GetFont(); wxCHECK_MSG( font.Ok(), 8, wxT("invalid font") ); @@ -3561,7 +3561,7 @@ void wxWindowGTK::GetTextExtent( const wxString& string, void wxWindowGTK::SetFocus() { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); if ( m_hasFocus ) { @@ -3620,7 +3620,7 @@ bool wxWindowGTK::AcceptsFocus() const bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); wxWindowGTK *oldParent = m_parent, *newParent = (wxWindowGTK *)newParentBase; @@ -3671,8 +3671,8 @@ void wxWindowGTK::DoAddChild(wxWindowGTK *child) void wxWindowGTK::Raise() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + if (!m_widget->window) return; gdk_window_raise( m_widget->window ); @@ -3680,8 +3680,8 @@ void wxWindowGTK::Raise() void wxWindowGTK::Lower() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + if (!m_widget->window) return; gdk_window_lower( m_widget->window ); @@ -3689,7 +3689,7 @@ void wxWindowGTK::Lower() bool wxWindowGTK::SetCursor( const wxCursor &cursor ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); if (cursor == m_cursor) return FALSE; @@ -3705,8 +3705,8 @@ bool wxWindowGTK::SetCursor( const wxCursor &cursor ) void wxWindowGTK::WarpPointer( int x, int y ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + // We provide this function ourselves as it is // missing in GDK (top of this file). @@ -3977,8 +3977,8 @@ void wxWindowGTK::GtkSendPaintEvents() void wxWindowGTK::ClearBackground() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + #ifndef __WXGTK20__ if (m_wxwindow && m_wxwindow->window) { @@ -4032,7 +4032,7 @@ void wxWindowGTK::GtkSetBackgroundColour( const wxColour &colour ) bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); if (!wxWindowBase::SetBackgroundColour(colour)) return FALSE; @@ -4074,7 +4074,7 @@ void wxWindowGTK::GtkSetForegroundColour( const wxColour &colour ) bool wxWindowGTK::SetForegroundColour( const wxColour &colour ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); if (!wxWindowBase::SetForegroundColour(colour)) { @@ -4307,7 +4307,7 @@ extern "C" void wxPopupMenuPositionCallback( GtkMenu *menu, bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) { - wxCHECK_VALID_WIDGET(FALSE); + wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") ); wxCHECK_MSG( menu != NULL, FALSE, wxT("invalid popup-menu") ); @@ -4354,8 +4354,8 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) void wxWindowGTK::SetDropTarget( wxDropTarget *dropTarget ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + GtkWidget *dnd_widget = GetConnectWidget(); if (m_dropTarget) m_dropTarget->UnregisterWidget( dnd_widget ); @@ -4408,8 +4408,8 @@ bool wxWindowGTK::SetFont( const wxFont &font ) void wxWindowGTK::DoCaptureMouse() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + GdkWindow *window = (GdkWindow*) NULL; if (m_wxwindow) window = GTK_PIZZA(m_wxwindow)->bin_window; @@ -4437,8 +4437,8 @@ void wxWindowGTK::DoCaptureMouse() void wxWindowGTK::DoReleaseMouse() { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( g_captureWindow, wxT("can't release mouse - not captured") ); g_captureWindow = (wxWindowGTK*) NULL; @@ -4469,8 +4469,8 @@ bool wxWindowGTK::IsRetained() const void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, int range, bool refresh ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); m_hasScrolling = TRUE; @@ -4532,7 +4532,7 @@ void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible, void wxWindowGTK::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) { - wxCHECK_VALID_WIDGET_RET(); + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); @@ -4584,8 +4584,8 @@ void wxWindowGTK::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) int wxWindowGTK::GetScrollThumb( int orient ) const { - wxCHECK_VALID_WIDGET(0); - + wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") ); + wxCHECK_MSG( m_wxwindow != NULL, 0, wxT("window needs client area for scrolling") ); if (orient == wxHORIZONTAL) @@ -4596,7 +4596,7 @@ int wxWindowGTK::GetScrollThumb( int orient ) const int wxWindowGTK::GetScrollPos( int orient ) const { - wxCHECK_VALID_WIDGET(0); + wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") ); wxCHECK_MSG( m_wxwindow != NULL, 0, wxT("window needs client area for scrolling") ); @@ -4608,7 +4608,7 @@ int wxWindowGTK::GetScrollPos( int orient ) const int wxWindowGTK::GetScrollRange( int orient ) const { - wxCHECK_VALID_WIDGET(0); + wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") ); wxCHECK_MSG( m_wxwindow != NULL, 0, wxT("window needs client area for scrolling") ); @@ -4620,8 +4620,8 @@ int wxWindowGTK::GetScrollRange( int orient ) const void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) { - wxCHECK_VALID_WIDGET_RET(); - + wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); // No scrolling requested. -- 2.45.2