]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
VTK wrapper of vtkRenderWindow for wxPython. Tested on MSW so far.
[wxWidgets.git] / src / common / wincmn.cpp
index ccba8e7c5370a7fddc60655c643d672706ffb163..18e1821bfc1ae89d2c64a2f2a48d245c432d5cda 100644 (file)
@@ -37,6 +37,7 @@
     #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
@@ -118,8 +119,11 @@ void wxWindowBase::InitBase()
 
     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;
 
@@ -154,7 +158,13 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent,
                               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
@@ -344,6 +354,7 @@ void wxWindowBase::Centre(int direction)
         yNew += posParent.y;
     }
 
+    // move the centre of this window to this position
     Move(xNew, yNew);
 }
 
@@ -427,7 +438,7 @@ bool wxWindowBase::Enable(bool enable)
 
 bool wxWindowBase::IsTopLevel() const
 {
-    return wxDynamicCast(this, wxFrame) || wxDynamicCast(this, wxDialog);
+    return FALSE;
 }
 
 // ----------------------------------------------------------------------------
@@ -589,6 +600,18 @@ void wxWindowBase::SetCaret(wxCaret *caret)
 // 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 )
@@ -599,6 +622,7 @@ void wxWindowBase::SetValidator(const wxValidator& validator)
     if ( m_windowValidator )
         m_windowValidator->SetWindow(this) ;
 }
+#  endif // __VISAGECPP__
 #endif // wxUSE_VALIDATORS
 
 // ----------------------------------------------------------------------------
@@ -895,14 +919,14 @@ bool wxWindowBase::Layout()
 {
     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);
@@ -914,7 +938,7 @@ bool wxWindowBase::Layout()
     DoPhase(1);           // Just one phase need if no sizers involved
     DoPhase(2);
     SetConstraintSizes(); // Recursively set the real window sizes
-    
+
     return TRUE;
 }
 
@@ -1160,42 +1184,44 @@ void wxWindowBase::GetPositionConstraint(int *x, int *y) const
 // 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
     }
 }