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
This commit is contained in:
Robert Roebling
1999-07-27 20:23:13 +00:00
parent 813c20a67e
commit 4dcaf11a7b
66 changed files with 472 additions and 292 deletions

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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();

View File

@@ -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();

View File

@@ -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()

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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)

View File

@@ -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();

View File

@@ -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. */

View File

@@ -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 |

View File

@@ -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();

View File

@@ -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() );

View File

@@ -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 );

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();

View File

@@ -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;

View File

@@ -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();

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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;

View File

@@ -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()