#include "wx/window.h"
#include "wx/checkbox.h"
#include "wx/radiobut.h"
+ #include "wx/textctrl.h"
#include "wx/settings.h"
#include "wx/dialog.h"
#endif //WX_PRECOMP
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_BTNFACE);
m_foregroundColour = *wxBLACK; // TODO take this from sys settings too?
+#ifndef __WXMAC__
m_font = *wxSWISS_FONT; // and this?
-
+#else
+ m_font = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
+#endif
// no style bits
m_windowStyle = 0;
const wxPoint& WXUNUSED(pos),
const wxSize& WXUNUSED(size),
long style,
+#if wxUSE_VALIDATORS
+# if defined(__VISAGECPP__)
+ const wxValidator* validator,
+# else
const wxValidator& validator,
+# endif
+#endif
const wxString& name)
{
// m_isWindow is set to TRUE in wxWindowBase::Init() as well as many other
bool wxWindowBase::IsTopLevel() const
{
- return wxDynamicCast(this, wxFrame) || wxDynamicCast(this, wxDialog);
+ return FALSE;
}
// ----------------------------------------------------------------------------
// validators
// ----------------------------------------------------------------------------
+# if defined(__VISAGECPP__)
+void wxWindowBase::SetValidator(const wxValidator* validator)
+{
+ if ( m_windowValidator )
+ delete m_windowValidator;
+
+ m_windowValidator = (wxValidator *)validator->Clone();
+
+ if ( m_windowValidator )
+ m_windowValidator->SetWindow(this) ;
+}
+# else
void wxWindowBase::SetValidator(const wxValidator& validator)
{
if ( m_windowValidator )
if ( m_windowValidator )
m_windowValidator->SetWindow(this) ;
}
+# endif // __VISAGECPP__
#endif // wxUSE_VALIDATORS
// ----------------------------------------------------------------------------
{
int w, h;
GetClientSize(&w, &h);
-
+
// If there is a sizer, use it instead of the constraints
if ( GetSizer() )
{
GetSizer()->SetDimension( 0, 0, w, h );
return TRUE;
}
-
+
if ( GetConstraints() )
{
GetConstraints()->width.SetValue(w);
DoPhase(1); // Just one phase need if no sizers involved
DoPhase(2);
SetConstraintSizes(); // Recursively set the real window sizes
-
+
return TRUE;
}
// of control classes.
void wxWindowBase::UpdateWindowUI()
{
- wxWindowID id = GetId();
- if ( id > 0 )
+ wxUpdateUIEvent event(GetId());
+ event.m_eventObject = this;
+
+ if ( GetEventHandler()->ProcessEvent(event) )
{
- wxUpdateUIEvent event(id);
- event.m_eventObject = this;
+ if ( event.GetSetEnabled() )
+ Enable(event.GetEnabled());
- if ( GetEventHandler()->ProcessEvent(event) )
+ if ( event.GetSetText() )
{
- if ( event.GetSetEnabled() )
- Enable(event.GetEnabled());
-
- if ( event.GetSetText() )
+ wxControl *control = wxDynamicCast(this, wxControl);
+ if ( control )
{
- wxControl *control = wxDynamicCast(this, wxControl);
- if ( control )
+ wxTextCtrl *text = wxDynamicCast(control, wxTextCtrl);
+ if ( text )
+ text->SetValue(event.GetText());
+ else
control->SetLabel(event.GetText());
}
+ }
#if wxUSE_CHECKBOX
- wxCheckBox *checkbox = wxDynamicCast(this, wxCheckBox);
- if ( checkbox )
- {
- if ( event.GetSetChecked() )
- checkbox->SetValue(event.GetChecked());
- }
+ wxCheckBox *checkbox = wxDynamicCast(this, wxCheckBox);
+ if ( checkbox )
+ {
+ if ( event.GetSetChecked() )
+ checkbox->SetValue(event.GetChecked());
+ }
#endif // wxUSE_CHECKBOX
#if wxUSE_RADIOBUTTON
- wxRadioButton *radiobtn = wxDynamicCast(this, wxRadioButton);
- if ( radiobtn )
- {
- if ( event.GetSetChecked() )
- radiobtn->SetValue(event.GetChecked());
- }
-#endif // wxUSE_RADIOBUTTON
+ wxRadioButton *radiobtn = wxDynamicCast(this, wxRadioButton);
+ if ( radiobtn )
+ {
+ if ( event.GetSetChecked() )
+ radiobtn->SetValue(event.GetChecked());
}
+#endif // wxUSE_RADIOBUTTON
}
}