From 4dcaf11a7b5189be78e52e1412febd7689a959f8 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 27 Jul 1999 20:23:13 +0000 Subject: [PATCH] Small distrib updates, tried to find a bug in html which was somewhere else, added wxYield() call to wxBeginBusyCursor() which should make the cursor appear immediately, corrected wxMiniFrame so that clicking on the titlebar makes it come to the front Used CreateBase() in all controls git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/gtk/install.txt | 9 ++++++ docs/gtk/readme.txt | 3 +- docs/motif2/install.txt | 20 ++++++++++++++ include/wx/gtk/window.h | 5 ++-- include/wx/gtk1/window.h | 5 ++-- include/wx/html/htmlcell.h | 10 +++---- include/wx/html/htmldefs.h | 2 +- include/wx/html/htmlfilter.h | 5 ++-- include/wx/html/htmlhelp.h | 15 +++++----- src/gtk/bmpbuttn.cpp | 15 +++++----- src/gtk/button.cpp | 13 +++++---- src/gtk/checkbox.cpp | 11 ++++---- src/gtk/choice.cpp | 14 ++++++---- src/gtk/combobox.cpp | 11 ++++---- src/gtk/cursor.cpp | 3 ++ src/gtk/dialog.cpp | 7 ++++- src/gtk/filedlg.cpp | 8 +++++- src/gtk/frame.cpp | 8 ++++-- src/gtk/gauge.cpp | 53 ++++++++++++++++++------------------ src/gtk/listbox.cpp | 11 ++++---- src/gtk/mdi.cpp | 7 ++++- src/gtk/menu.cpp | 16 +++++++++-- src/gtk/minifram.cpp | 2 ++ src/gtk/notebook.cpp | 8 +++++- src/gtk/radiobox.cpp | 11 ++++---- src/gtk/radiobut.cpp | 16 +++++------ src/gtk/scrolbar.cpp | 11 ++++---- src/gtk/slider.cpp | 11 ++++---- src/gtk/spinbutt.cpp | 9 ++++-- src/gtk/statbmp.cpp | 11 ++++++-- src/gtk/statbox.cpp | 7 ++++- src/gtk/statline.cpp | 7 ++++- src/gtk/stattext.cpp | 11 +++++--- src/gtk/tbargtk.cpp | 7 ++++- src/gtk/textctrl.cpp | 10 ++++--- src/gtk/window.cpp | 30 ++++++++++---------- src/gtk1/bmpbuttn.cpp | 15 +++++----- src/gtk1/button.cpp | 13 +++++---- src/gtk1/checkbox.cpp | 11 ++++---- src/gtk1/choice.cpp | 14 ++++++---- src/gtk1/combobox.cpp | 11 ++++---- src/gtk1/cursor.cpp | 3 ++ src/gtk1/dialog.cpp | 7 ++++- src/gtk1/filedlg.cpp | 8 +++++- src/gtk1/frame.cpp | 8 ++++-- src/gtk1/gauge.cpp | 53 ++++++++++++++++++------------------ src/gtk1/listbox.cpp | 11 ++++---- src/gtk1/mdi.cpp | 7 ++++- src/gtk1/menu.cpp | 16 +++++++++-- src/gtk1/minifram.cpp | 2 ++ src/gtk1/notebook.cpp | 8 +++++- src/gtk1/radiobox.cpp | 11 ++++---- src/gtk1/radiobut.cpp | 16 +++++------ src/gtk1/scrolbar.cpp | 11 ++++---- src/gtk1/slider.cpp | 11 ++++---- src/gtk1/spinbutt.cpp | 9 ++++-- src/gtk1/statbmp.cpp | 11 ++++++-- src/gtk1/statbox.cpp | 7 ++++- src/gtk1/statline.cpp | 7 ++++- src/gtk1/stattext.cpp | 11 +++++--- src/gtk1/tbargtk.cpp | 7 ++++- src/gtk1/textctrl.cpp | 10 ++++--- src/gtk1/window.cpp | 30 ++++++++++---------- src/html/htmlcell.cpp | 18 ++++-------- src/html/htmlfilter.cpp | 11 ++++---- src/html/htmlhelp.cpp | 5 ++-- 66 files changed, 472 insertions(+), 292 deletions(-) diff --git a/docs/gtk/install.txt b/docs/gtk/install.txt index cbc7f33ed8..091e743a96 100644 --- a/docs/gtk/install.txt +++ b/docs/gtk/install.txt @@ -27,6 +27,15 @@ make install ldconfig exit +You may also want to try to edit the wrongly created libtool script +in your build directory, if you need shared libraries on Unix. The +wrong entries are something like + archive_cmds="\$LD -shared .... + archive_expsym_cmds="\$LD -shared .... +which should be something like + archive_cmds="\$CC -shared .... + archive_expsym_cmds="\$CC -shared .... + If you want to remove wxWindows on Unix you can do this: su diff --git a/docs/gtk/readme.txt b/docs/gtk/readme.txt index 3d7eeeebef..4cb90c7518 100644 --- a/docs/gtk/readme.txt +++ b/docs/gtk/readme.txt @@ -26,7 +26,8 @@ at Julian Smart's homepage at: Information on how to install can be found in the file INSTALL.txt, but if you cannot wait, this should work on -many systems (when using GTK 1.0 read the INSTALL.txt): +many systems (when using GTK 1.0 or when not using Linux +read the INSTALL.txt): ./configure make diff --git a/docs/motif2/install.txt b/docs/motif2/install.txt index fce5b02109..ecd1befffd 100644 --- a/docs/motif2/install.txt +++ b/docs/motif2/install.txt @@ -16,6 +16,26 @@ make install ldconfig exit +On all other Unices (maybe except *BSD), shared libraries are not supported +out of the box due to the utter stupidity of libtool, so you'll have to do +this instead: + +./configure --enable-static --disable-shared +make +su +make install +ldconfig +exit + +You may also want to try to edit the wrongly created libtool script +in your build directory, if you need shared libraries on Unix. The +wrong entries are something like + archive_cmds="\$LD -shared .... + archive_expsym_cmds="\$LD -shared .... +which should be something like + archive_cmds="\$CC -shared .... + archive_expsym_cmds="\$CC -shared .... + If you want to remove wxWindows on Unix you can do this: su diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index fbbc2b18c1..63d0569d6f 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -120,9 +120,8 @@ public: /* For compatibility across platforms (not in event table) */ void OnIdle(wxIdleEvent& WXUNUSED(event)) {}; - /* used by all classes in the widget creation process */ - void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, - const wxSize &size, long style, const wxString &name ); + /* used by all window classes in the widget creation process */ + bool PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size ); void PostCreation(); /* internal addition of child windows. differs from class diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index fbbc2b18c1..63d0569d6f 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -120,9 +120,8 @@ public: /* For compatibility across platforms (not in event table) */ void OnIdle(wxIdleEvent& WXUNUSED(event)) {}; - /* used by all classes in the widget creation process */ - void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, - const wxSize &size, long style, const wxString &name ); + /* used by all window classes in the widget creation process */ + bool PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size ); void PostCreation(); /* internal addition of child windows. differs from class diff --git a/include/wx/html/htmlcell.h b/include/wx/html/htmlcell.h index 23293c93b0..87a3e040d7 100644 --- a/include/wx/html/htmlcell.h +++ b/include/wx/html/htmlcell.h @@ -12,16 +12,16 @@ #define __HTMLCELL_H__ #ifdef __GNUG__ -#pragma interface +#pragma interface "htmlcell.h" #endif #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML -#include -#include -#include +#include "wx/html/htmltag.h" +#include "wx/html/htmldefs.h" +#include "wx/window.h" class wxHtmlCell; class wxHtmlContainerCell; diff --git a/include/wx/html/htmldefs.h b/include/wx/html/htmldefs.h index 9db261d089..955b4456fd 100644 --- a/include/wx/html/htmldefs.h +++ b/include/wx/html/htmldefs.h @@ -11,8 +11,8 @@ #define __HTMLDEFS_H__ #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML //-------------------------------------------------------------------------------- // ALIGNMENTS diff --git a/include/wx/html/htmlfilter.h b/include/wx/html/htmlfilter.h index 19c31b9209..100b31d8b5 100644 --- a/include/wx/html/htmlfilter.h +++ b/include/wx/html/htmlfilter.h @@ -11,13 +11,14 @@ #define __HTMLFILTER_H__ #ifdef __GNUG__ -#pragma interface +#pragma interface "htmlfilter.h" #endif #include "wx/defs.h" + #if wxUSE_HTML -#include +#include "wx/filesys.h" //-------------------------------------------------------------------------------- diff --git a/include/wx/html/htmlhelp.h b/include/wx/html/htmlhelp.h index 6e56bc5815..509e363c67 100644 --- a/include/wx/html/htmlhelp.h +++ b/include/wx/html/htmlhelp.h @@ -11,18 +11,19 @@ #define __HTMLHELP_H__ #ifdef __GNUG__ -#pragma interface +#pragma interface "htmlhelp.h" #endif #include "wx/defs.h" + #if wxUSE_HTML -#include -#include -#include -#include -#include -#include +#include "wx/window.h" +#include "wx/config.h" +#include "wx/splitter.h" +#include "wx/notebook.h" +#include "wx/listctrl.h" +#include "wx/html/htmlwin.h" diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 7bfc477e35..71975f8af9 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -118,13 +118,12 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi m_needParent = TRUE; m_acceptsFocus = TRUE; - wxSize newSize = size; - - PreCreation( parent, id, pos, newSize, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxBitmapButton creation failed") ); + return FALSE; + } m_bitmap = bitmap; m_disabled = bitmap; @@ -142,6 +141,8 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi if (m_bitmap.Ok()) { + wxSize newSize = size; + GdkBitmap *mask = (GdkBitmap *) NULL; if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); GtkWidget *pixmap = gtk_pixmap_new( m_bitmap.GetPixmap(), mask ); diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index ad9b36f8da..dc7dd01c59 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -75,13 +75,13 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, m_needParent = TRUE; m_acceptsFocus = TRUE; - wxSize newSize = size; + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxButton creation failed") ); + return FALSE; + } - PreCreation( parent, id, pos, newSize, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif // wxUSE_VALIDATORS m_widget = gtk_button_new_with_label( "" ); @@ -92,6 +92,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, SetLabel(label); + wxSize newSize = size; if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label.mbc_str() ); if (newSize.y == -1) newSize.y = 26; SetSize( newSize.x, newSize.y ); diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 75cf233c65..af1d2592c3 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -72,11 +72,12 @@ bool wxCheckBox::Create(wxWindow *parent, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxCheckBox creation failed") ); + return FALSE; + } wxControl::SetLabel( label ); diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index f8801312bd..ae4a6e9fce 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -38,7 +38,8 @@ extern bool g_blockEventsOnDrag; static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice ) { - if (g_isIdle) wxapp_install_idle_handler(); + if (g_isIdle) + wxapp_install_idle_handler(); if (!choice->m_hasVMT) return; @@ -71,11 +72,12 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, m_acceptsFocus = TRUE; #endif - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxChoice creation failed") ); + return FALSE; + } m_widget = gtk_option_menu_new(); diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 102ce9b224..da4657688f 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -101,11 +101,12 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxComboBox creation failed") ); + return FALSE; + } m_widget = gtk_combo_new(); diff --git a/src/gtk/cursor.cpp b/src/gtk/cursor.cpp index 9335e8c837..4876e3f8d3 100644 --- a/src/gtk/cursor.cpp +++ b/src/gtk/cursor.cpp @@ -13,6 +13,7 @@ #endif #include "wx/cursor.h" +#include "wx/utils.h" #include "gdk/gdk.h" @@ -170,6 +171,8 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) gs_savedCursor = g_globalCursor; wxSetCursor( wxCursor(wxCURSOR_WATCH) ); + + wxYield(); } bool wxIsBusy() diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index fe199dd6de..bed7d500ff 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -248,7 +248,12 @@ bool wxDialog::Create( wxWindow *parent, m_needParent = FALSE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxDialog creation failed") ); + return FALSE; + } m_insertCallback = (wxInsertChildFunction) wxInsertChildInDialog; diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 086a593ef5..f2c2c99011 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -116,7 +116,13 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, { m_needParent = FALSE; - PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); + if (!PreCreation( parent, pos, wxDefaultSize ) || + !CreateBase( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, wxDefaultValidator, _T("filedialog") )) + { + wxFAIL_MSG( _T("wxXX creation failed") ); + return; + } + m_message = message; m_path = _T(""); m_fileName = defaultFileName; diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index c0ebd7fe34..78247575e7 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -224,7 +224,6 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) decor |= GDK_DECOR_RESIZEH; } - gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor); gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func); @@ -361,7 +360,12 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, m_needParent = FALSE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxFrame creation failed") ); + return FALSE; + } m_title = title; diff --git a/src/gtk/gauge.cpp b/src/gtk/gauge.cpp index e176cbe194..35d9ad6f37 100644 --- a/src/gtk/gauge.cpp +++ b/src/gtk/gauge.cpp @@ -28,59 +28,60 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) { - m_needParent = TRUE; + m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxGauge creation failed") ); + return FALSE; + } - m_rangeMax = range; - m_gaugePos = 0; - m_useProgressBar = TRUE; + m_rangeMax = range; + m_gaugePos = 0; + m_useProgressBar = TRUE; - m_widget = gtk_progress_bar_new(); + m_widget = gtk_progress_bar_new(); - m_parent->DoAddChild( this ); + m_parent->DoAddChild( this ); - PostCreation(); + PostCreation(); - Show( TRUE ); + Show( TRUE ); - return TRUE; + return TRUE; } void wxGauge::SetRange( int r ) { - m_rangeMax = r; - if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; + m_rangeMax = r; + if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; - gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); + gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); } void wxGauge::SetValue( int pos ) { - m_gaugePos = pos; - if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; + m_gaugePos = pos; + if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; - gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); + gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); } -int wxGauge::GetRange(void) const +int wxGauge::GetRange() const { - return m_rangeMax; + return m_rangeMax; } -int wxGauge::GetValue(void) const +int wxGauge::GetValue() const { - return m_gaugePos; + return m_gaugePos; } void wxGauge::ApplyWidgetStyle() { - SetWidgetStyle(); - gtk_widget_set_style( m_widget, m_widgetStyle ); + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); } #endif diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 0b62dcb261..d99c53a4b5 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -244,11 +244,12 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxListBox creation failed") ); + return FALSE; + } m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL ); if (style & wxLB_ALWAYS_SB) diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index 13c558712a..0b98599d59 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -409,7 +409,12 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI; - PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" ); + if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) || + !CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, _T("wxMDIClientWindow") )) + { + wxFAIL_MSG( _T("wxMDIClientWindow creation failed") ); + return FALSE; + } m_widget = gtk_notebook_new(); diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 64c2b57e44..b41ead44f4 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -39,7 +39,12 @@ wxMenuBar::wxMenuBar( long style ) m_needParent = FALSE; m_style = style; - PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, style, "menu" ); + if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) || + !CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, _T("menubar") )) + { + wxFAIL_MSG( _T("wxMenuBar creation failed") ); + return; + } m_menus.DeleteContents( TRUE ); @@ -72,8 +77,13 @@ wxMenuBar::wxMenuBar() m_needParent = FALSE; m_style = 0; - PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" ); - + if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) || + !CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("menubar") )) + { + wxFAIL_MSG( _T("wxMenuBar creation failed") ); + return; + } + m_menus.DeleteContents( TRUE ); /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */ diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp index ee93f8546c..9da9393c89 100644 --- a/src/gtk/minifram.cpp +++ b/src/gtk/minifram.cpp @@ -163,6 +163,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton if (win->m_isDragging) return TRUE; + gdk_window_raise( win->m_widget->window ); + gdk_pointer_grab( widget->window, FALSE, (GdkEventMask) (GDK_BUTTON_PRESS_MASK | diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 6102168a49..6cac1f9135 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -220,7 +220,13 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, m_acceptsFocus = TRUE; m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxNoteBook creation failed") ); + return FALSE; + } + m_widget = gtk_notebook_new(); diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index e1977ab2a4..5328d1565d 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -85,11 +85,12 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxRadioBox creation failed") ); + return FALSE; + } m_widget = gtk_frame_new( title.mbc_str() ); diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index 3550885060..f7771f4ea6 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -63,17 +63,14 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab { m_acceptsFocus = TRUE; m_needParent = TRUE; - - wxSize newSize = size; - - PreCreation( parent, id, pos, newSize, style, name ); - m_isRadioButton = TRUE; - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxRadioButton creation failed") ); + return FALSE; + } if (HasFlag(wxRB_GROUP)) { @@ -111,6 +108,7 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab SetLabel(label); + wxSize newSize = size; if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() ); if (newSize.y == -1) newSize.y = 26; SetSize( newSize.x, newSize.y ); diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index a2f96c9a33..56cc1d6d58 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -137,11 +137,12 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxScrollBar creation failed") ); + return FALSE; + } m_oldPos = 0.0; diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index b2f0bccefc..5d115ba3b8 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -98,11 +98,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, m_acceptsFocus = TRUE; m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxSlider creation failed") ); + return FALSE; + } m_oldPos = 0.0; diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 4847cc4de5..31a244d6c3 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -98,9 +98,12 @@ bool wxSpinButton::Create(wxWindow *parent, if (new_size.y == -1) new_size.y = 30; - PreCreation( parent, id, pos, new_size, style, name ); - -// SetValidator( validator ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxXX creation failed") ); + return FALSE; + } m_oldPos = 0.0; diff --git a/src/gtk/statbmp.cpp b/src/gtk/statbmp.cpp index e46ae8134d..f9e6700b8f 100644 --- a/src/gtk/statbmp.cpp +++ b/src/gtk/statbmp.cpp @@ -58,14 +58,19 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi { m_needParent = TRUE; - wxSize newSize = size; - - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxXX creation failed") ); + return FALSE; + } m_bitmap = bitmap; if (m_bitmap.Ok()) { + wxSize newSize = size; + GdkBitmap *mask = (GdkBitmap *) NULL; if ( m_bitmap.GetMask() ) mask = m_bitmap.GetMask()->GetBitmap(); diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index 84fd9673ff..d39006cda7 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -41,7 +41,12 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label { m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxStaticBox creation failed") ); + return FALSE; + } m_isStaticBox = TRUE; diff --git a/src/gtk/statline.cpp b/src/gtk/statline.cpp index 98bb5f04b5..fda6826dc6 100644 --- a/src/gtk/statline.cpp +++ b/src/gtk/statline.cpp @@ -41,7 +41,12 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, { m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxStaticLine creation failed") ); + return FALSE; + } if ( IsVertical() ) m_widget = gtk_vseparator_new(); diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index 194fb3da08..c0c6dd3e5f 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -48,9 +48,12 @@ bool wxStaticText::Create(wxWindow *parent, { m_needParent = TRUE; - wxSize newSize = size; - - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxXX creation failed") ); + return FALSE; + } // notice that we call the base class version which will just remove the // '&' characters from the string, but not set the label's text to it @@ -77,9 +80,9 @@ bool wxStaticText::Create(wxWindow *parent, GtkRequisition req; (* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req ); + wxSize newSize = size; if (newSize.x == -1) newSize.x = req.width; if (newSize.y == -1) newSize.y = req.height; - SetSize( newSize.x, newSize.y ); m_parent->DoAddChild( this ); diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 0a92bc7c37..0f90b72a74 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -147,7 +147,12 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, { m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxToolBar creation failed") ); + return FALSE; + } m_tools.DeleteContents( TRUE ); diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index ccb6dce12b..04809dc193 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -114,11 +114,13 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxTextCtrl creation failed") ); + return FALSE; + } -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif // wxUSE_VALIDATORS m_vScrollbarVisible = FALSE; diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index a2d7b7536f..bfdc8bcc81 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1821,7 +1821,12 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxWindow creation failed") ); + return FALSE; + } m_insertCallback = wxInsertChildInWindow; @@ -2002,27 +2007,22 @@ wxWindow::~wxWindow() } } -void wxWindow::PreCreation( wxWindow *parent, - wxWindowID id, - const wxPoint &pos, - const wxSize &size, - long style, - const wxString &name ) +bool wxWindow::PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size ) { - wxASSERT_MSG( !m_needParent || parent, _T("Need complete parent.") ); - - if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) - { - wxFAIL_MSG(_T("window creation failed")); - } + wxCHECK_MSG( !m_needParent || parent, FALSE, _T("Need complete parent.") ); + /* this turns -1 into 20 so that a minimal window is + visible even although -1,-1 has been given as the + size of the window. the same trick is used in other + ports and should make debugging easier */ m_width = WidthDefault(size.x); m_height = HeightDefault(size.y); m_x = (int)pos.x; m_y = (int)pos.y; - if (!parent) /* some reasonable defaults */ + /* some reasonable defaults */ + if (!parent) { if (m_x == -1) { @@ -2035,6 +2035,8 @@ void wxWindow::PreCreation( wxWindow *parent, if (m_y < 10) m_y = 10; } } + + return TRUE; } void wxWindow::PostCreation() diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index 7bfc477e35..71975f8af9 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -118,13 +118,12 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi m_needParent = TRUE; m_acceptsFocus = TRUE; - wxSize newSize = size; - - PreCreation( parent, id, pos, newSize, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxBitmapButton creation failed") ); + return FALSE; + } m_bitmap = bitmap; m_disabled = bitmap; @@ -142,6 +141,8 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi if (m_bitmap.Ok()) { + wxSize newSize = size; + GdkBitmap *mask = (GdkBitmap *) NULL; if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); GtkWidget *pixmap = gtk_pixmap_new( m_bitmap.GetPixmap(), mask ); diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index ad9b36f8da..dc7dd01c59 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -75,13 +75,13 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, m_needParent = TRUE; m_acceptsFocus = TRUE; - wxSize newSize = size; + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxButton creation failed") ); + return FALSE; + } - PreCreation( parent, id, pos, newSize, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif // wxUSE_VALIDATORS m_widget = gtk_button_new_with_label( "" ); @@ -92,6 +92,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, SetLabel(label); + wxSize newSize = size; if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label.mbc_str() ); if (newSize.y == -1) newSize.y = 26; SetSize( newSize.x, newSize.y ); diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index 75cf233c65..af1d2592c3 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -72,11 +72,12 @@ bool wxCheckBox::Create(wxWindow *parent, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxCheckBox creation failed") ); + return FALSE; + } wxControl::SetLabel( label ); diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index f8801312bd..ae4a6e9fce 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -38,7 +38,8 @@ extern bool g_blockEventsOnDrag; static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice ) { - if (g_isIdle) wxapp_install_idle_handler(); + if (g_isIdle) + wxapp_install_idle_handler(); if (!choice->m_hasVMT) return; @@ -71,11 +72,12 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, m_acceptsFocus = TRUE; #endif - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxChoice creation failed") ); + return FALSE; + } m_widget = gtk_option_menu_new(); diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 102ce9b224..da4657688f 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -101,11 +101,12 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxComboBox creation failed") ); + return FALSE; + } m_widget = gtk_combo_new(); diff --git a/src/gtk1/cursor.cpp b/src/gtk1/cursor.cpp index 9335e8c837..4876e3f8d3 100644 --- a/src/gtk1/cursor.cpp +++ b/src/gtk1/cursor.cpp @@ -13,6 +13,7 @@ #endif #include "wx/cursor.h" +#include "wx/utils.h" #include "gdk/gdk.h" @@ -170,6 +171,8 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) gs_savedCursor = g_globalCursor; wxSetCursor( wxCursor(wxCURSOR_WATCH) ); + + wxYield(); } bool wxIsBusy() diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index fe199dd6de..bed7d500ff 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -248,7 +248,12 @@ bool wxDialog::Create( wxWindow *parent, m_needParent = FALSE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxDialog creation failed") ); + return FALSE; + } m_insertCallback = (wxInsertChildFunction) wxInsertChildInDialog; diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 086a593ef5..f2c2c99011 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -116,7 +116,13 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, { m_needParent = FALSE; - PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); + if (!PreCreation( parent, pos, wxDefaultSize ) || + !CreateBase( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, wxDefaultValidator, _T("filedialog") )) + { + wxFAIL_MSG( _T("wxXX creation failed") ); + return; + } + m_message = message; m_path = _T(""); m_fileName = defaultFileName; diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index c0ebd7fe34..78247575e7 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -224,7 +224,6 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) decor |= GDK_DECOR_RESIZEH; } - gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor); gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func); @@ -361,7 +360,12 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, m_needParent = FALSE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxFrame creation failed") ); + return FALSE; + } m_title = title; diff --git a/src/gtk1/gauge.cpp b/src/gtk1/gauge.cpp index e176cbe194..35d9ad6f37 100644 --- a/src/gtk1/gauge.cpp +++ b/src/gtk1/gauge.cpp @@ -28,59 +28,60 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) { - m_needParent = TRUE; + m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxGauge creation failed") ); + return FALSE; + } - m_rangeMax = range; - m_gaugePos = 0; - m_useProgressBar = TRUE; + m_rangeMax = range; + m_gaugePos = 0; + m_useProgressBar = TRUE; - m_widget = gtk_progress_bar_new(); + m_widget = gtk_progress_bar_new(); - m_parent->DoAddChild( this ); + m_parent->DoAddChild( this ); - PostCreation(); + PostCreation(); - Show( TRUE ); + Show( TRUE ); - return TRUE; + return TRUE; } void wxGauge::SetRange( int r ) { - m_rangeMax = r; - if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; + m_rangeMax = r; + if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; - gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); + gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); } void wxGauge::SetValue( int pos ) { - m_gaugePos = pos; - if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; + m_gaugePos = pos; + if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; - gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); + gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); } -int wxGauge::GetRange(void) const +int wxGauge::GetRange() const { - return m_rangeMax; + return m_rangeMax; } -int wxGauge::GetValue(void) const +int wxGauge::GetValue() const { - return m_gaugePos; + return m_gaugePos; } void wxGauge::ApplyWidgetStyle() { - SetWidgetStyle(); - gtk_widget_set_style( m_widget, m_widgetStyle ); + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); } #endif diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 0b62dcb261..d99c53a4b5 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -244,11 +244,12 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxListBox creation failed") ); + return FALSE; + } m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL ); if (style & wxLB_ALWAYS_SB) diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index 13c558712a..0b98599d59 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -409,7 +409,12 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI; - PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" ); + if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) || + !CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, _T("wxMDIClientWindow") )) + { + wxFAIL_MSG( _T("wxMDIClientWindow creation failed") ); + return FALSE; + } m_widget = gtk_notebook_new(); diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 64c2b57e44..b41ead44f4 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -39,7 +39,12 @@ wxMenuBar::wxMenuBar( long style ) m_needParent = FALSE; m_style = style; - PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, style, "menu" ); + if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) || + !CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, _T("menubar") )) + { + wxFAIL_MSG( _T("wxMenuBar creation failed") ); + return; + } m_menus.DeleteContents( TRUE ); @@ -72,8 +77,13 @@ wxMenuBar::wxMenuBar() m_needParent = FALSE; m_style = 0; - PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" ); - + if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) || + !CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("menubar") )) + { + wxFAIL_MSG( _T("wxMenuBar creation failed") ); + return; + } + m_menus.DeleteContents( TRUE ); /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */ diff --git a/src/gtk1/minifram.cpp b/src/gtk1/minifram.cpp index ee93f8546c..9da9393c89 100644 --- a/src/gtk1/minifram.cpp +++ b/src/gtk1/minifram.cpp @@ -163,6 +163,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton if (win->m_isDragging) return TRUE; + gdk_window_raise( win->m_widget->window ); + gdk_pointer_grab( widget->window, FALSE, (GdkEventMask) (GDK_BUTTON_PRESS_MASK | diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 6102168a49..6cac1f9135 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -220,7 +220,13 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, m_acceptsFocus = TRUE; m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxNoteBook creation failed") ); + return FALSE; + } + m_widget = gtk_notebook_new(); diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index e1977ab2a4..5328d1565d 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -85,11 +85,12 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxRadioBox creation failed") ); + return FALSE; + } m_widget = gtk_frame_new( title.mbc_str() ); diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index 3550885060..f7771f4ea6 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -63,17 +63,14 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab { m_acceptsFocus = TRUE; m_needParent = TRUE; - - wxSize newSize = size; - - PreCreation( parent, id, pos, newSize, style, name ); - m_isRadioButton = TRUE; - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxRadioButton creation failed") ); + return FALSE; + } if (HasFlag(wxRB_GROUP)) { @@ -111,6 +108,7 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab SetLabel(label); + wxSize newSize = size; if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() ); if (newSize.y == -1) newSize.y = 26; SetSize( newSize.x, newSize.y ); diff --git a/src/gtk1/scrolbar.cpp b/src/gtk1/scrolbar.cpp index a2f96c9a33..56cc1d6d58 100644 --- a/src/gtk1/scrolbar.cpp +++ b/src/gtk1/scrolbar.cpp @@ -137,11 +137,12 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxScrollBar creation failed") ); + return FALSE; + } m_oldPos = 0.0; diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index b2f0bccefc..5d115ba3b8 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -98,11 +98,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, m_acceptsFocus = TRUE; m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxSlider creation failed") ); + return FALSE; + } m_oldPos = 0.0; diff --git a/src/gtk1/spinbutt.cpp b/src/gtk1/spinbutt.cpp index 4847cc4de5..31a244d6c3 100644 --- a/src/gtk1/spinbutt.cpp +++ b/src/gtk1/spinbutt.cpp @@ -98,9 +98,12 @@ bool wxSpinButton::Create(wxWindow *parent, if (new_size.y == -1) new_size.y = 30; - PreCreation( parent, id, pos, new_size, style, name ); - -// SetValidator( validator ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxXX creation failed") ); + return FALSE; + } m_oldPos = 0.0; diff --git a/src/gtk1/statbmp.cpp b/src/gtk1/statbmp.cpp index e46ae8134d..f9e6700b8f 100644 --- a/src/gtk1/statbmp.cpp +++ b/src/gtk1/statbmp.cpp @@ -58,14 +58,19 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi { m_needParent = TRUE; - wxSize newSize = size; - - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxXX creation failed") ); + return FALSE; + } m_bitmap = bitmap; if (m_bitmap.Ok()) { + wxSize newSize = size; + GdkBitmap *mask = (GdkBitmap *) NULL; if ( m_bitmap.GetMask() ) mask = m_bitmap.GetMask()->GetBitmap(); diff --git a/src/gtk1/statbox.cpp b/src/gtk1/statbox.cpp index 84fd9673ff..d39006cda7 100644 --- a/src/gtk1/statbox.cpp +++ b/src/gtk1/statbox.cpp @@ -41,7 +41,12 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label { m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxStaticBox creation failed") ); + return FALSE; + } m_isStaticBox = TRUE; diff --git a/src/gtk1/statline.cpp b/src/gtk1/statline.cpp index 98bb5f04b5..fda6826dc6 100644 --- a/src/gtk1/statline.cpp +++ b/src/gtk1/statline.cpp @@ -41,7 +41,12 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, { m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxStaticLine creation failed") ); + return FALSE; + } if ( IsVertical() ) m_widget = gtk_vseparator_new(); diff --git a/src/gtk1/stattext.cpp b/src/gtk1/stattext.cpp index 194fb3da08..c0c6dd3e5f 100644 --- a/src/gtk1/stattext.cpp +++ b/src/gtk1/stattext.cpp @@ -48,9 +48,12 @@ bool wxStaticText::Create(wxWindow *parent, { m_needParent = TRUE; - wxSize newSize = size; - - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxXX creation failed") ); + return FALSE; + } // notice that we call the base class version which will just remove the // '&' characters from the string, but not set the label's text to it @@ -77,9 +80,9 @@ bool wxStaticText::Create(wxWindow *parent, GtkRequisition req; (* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req ); + wxSize newSize = size; if (newSize.x == -1) newSize.x = req.width; if (newSize.y == -1) newSize.y = req.height; - SetSize( newSize.x, newSize.y ); m_parent->DoAddChild( this ); diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 0a92bc7c37..0f90b72a74 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -147,7 +147,12 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, { m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxToolBar creation failed") ); + return FALSE; + } m_tools.DeleteContents( TRUE ); diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index ccb6dce12b..04809dc193 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -114,11 +114,13 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, m_needParent = TRUE; m_acceptsFocus = TRUE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxTextCtrl creation failed") ); + return FALSE; + } -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif // wxUSE_VALIDATORS m_vScrollbarVisible = FALSE; diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index a2d7b7536f..bfdc8bcc81 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1821,7 +1821,12 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxWindow creation failed") ); + return FALSE; + } m_insertCallback = wxInsertChildInWindow; @@ -2002,27 +2007,22 @@ wxWindow::~wxWindow() } } -void wxWindow::PreCreation( wxWindow *parent, - wxWindowID id, - const wxPoint &pos, - const wxSize &size, - long style, - const wxString &name ) +bool wxWindow::PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size ) { - wxASSERT_MSG( !m_needParent || parent, _T("Need complete parent.") ); - - if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) - { - wxFAIL_MSG(_T("window creation failed")); - } + wxCHECK_MSG( !m_needParent || parent, FALSE, _T("Need complete parent.") ); + /* this turns -1 into 20 so that a minimal window is + visible even although -1,-1 has been given as the + size of the window. the same trick is used in other + ports and should make debugging easier */ m_width = WidthDefault(size.x); m_height = HeightDefault(size.y); m_x = (int)pos.x; m_y = (int)pos.y; - if (!parent) /* some reasonable defaults */ + /* some reasonable defaults */ + if (!parent) { if (m_x == -1) { @@ -2035,6 +2035,8 @@ void wxWindow::PreCreation( wxWindow *parent, if (m_y < 10) m_y = 10; } } + + return TRUE; } void wxWindow::PostCreation() diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index 945753865b..1019e1367f 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -6,14 +6,12 @@ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// - #ifdef __GNUG__ -#pragma implementation +#pragma implementation "htmlcell.h" #endif -#include +#include "wx/wxprec.h" -#include "wx/defs.h" #if wxUSE_HTML #ifdef __BORDLANDC__ @@ -21,16 +19,14 @@ #endif #ifndef WXPRECOMP -#include +#include "wx/wx.h" #endif -#include -#include +#include "wx/html/htmlcell.h" +#include "wx/html/htmlwin.h" #include - - //----------------------------------------------------------------------------- // wxHtmlCell //----------------------------------------------------------------------------- @@ -71,10 +67,6 @@ void wxHtmlWordCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) - - - - //----------------------------------------------------------------------------- // wxHtmlContainerCell //----------------------------------------------------------------------------- diff --git a/src/html/htmlfilter.cpp b/src/html/htmlfilter.cpp index ba3f0a84e4..1bdccd5b17 100644 --- a/src/html/htmlfilter.cpp +++ b/src/html/htmlfilter.cpp @@ -8,12 +8,11 @@ #ifdef __GNUG__ -#pragma implementation +#pragma implementation "htmlfilter.h" #endif -#include +#include "wx/wxprec.h" -#include "wx/defs.h" #if wxUSE_HTML #ifdef __BORDLANDC__ @@ -21,11 +20,11 @@ #endif #ifndef WXPRECOMP -#include +#include "wx/wx.h" #endif -#include -#include +#include "wx/html/htmlfilter.h" +#include "wx/html/htmlwin.h" /* diff --git a/src/html/htmlhelp.cpp b/src/html/htmlhelp.cpp index a208ea5caf..0f8c8c9084 100644 --- a/src/html/htmlhelp.cpp +++ b/src/html/htmlhelp.cpp @@ -7,12 +7,11 @@ #ifdef __GNUG__ -#pragma implementation +#pragma implementation "htmlhelp.h" #endif -#include +#include "wx/wxprec.h" -#include "wx/defs.h" #if wxUSE_HTML #ifdef __BORDLANDC__ -- 2.45.2