]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/spinctrl.cpp
Rewrite wxExecute() implementation under Unix.
[wxWidgets.git] / src / os2 / spinctrl.cpp
index 2aeef5f3d78cd26f6a432c0b9483500f10115c66..a826c0957dde3b056f732d817d040514428f92e5 100644 (file)
@@ -40,8 +40,6 @@ extern void  wxAssociateWinWithHandle( HWND         hWnd
 static WXFARPROC fnWndProcSpinCtrl = (WXFARPROC)NULL;
 wxArraySpins                        wxSpinCtrl::m_svAllSpins;
 
-IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
-
 BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
     EVT_CHAR(wxSpinCtrl::OnChar)
     EVT_SPIN(wxID_ANY, wxSpinCtrl::OnSpinChange)
@@ -126,8 +124,11 @@ bool wxSpinCtrl::Create( wxWindow*       pParent,
         m_windowId = NewControlId();
     else
         m_windowId = vId;
-    m_backgroundColour = pParent->GetBackgroundColour();
-    m_foregroundColour = pParent->GetForegroundColour();
+    if (pParent)
+    {
+        m_backgroundColour = pParent->GetBackgroundColour();
+        m_foregroundColour = pParent->GetForegroundColour();
+    }
     SetName(rsName);
     SetParent(pParent);
     m_windowStyle      = lStyle;
@@ -296,7 +297,7 @@ wxSpinCtrl* wxSpinCtrl::GetSpinForTextCtrl(
 
     // sanity check
     wxASSERT_MSG( pSpin->m_hWndBuddy == hWndBuddy,
-                  _T("wxSpinCtrl has incorrect buddy HWND!") );
+                  wxT("wxSpinCtrl has incorrect buddy HWND!") );
 
     return pSpin;
 } // end of wxSpinCtrl::GetSpinForTextCtrl
@@ -325,7 +326,7 @@ void wxSpinCtrl::OnChar (
     {
         case WXK_RETURN:
             {
-                wxCommandEvent              vEvent( wxEVT_COMMAND_TEXT_ENTER
+                wxCommandEvent              vEvent( wxEVT_TEXT_ENTER
                                                    ,m_windowId
                                                   );
                 wxString                    sVal = wxGetWindowText(m_hWndBuddy);
@@ -333,7 +334,7 @@ void wxSpinCtrl::OnChar (
                 InitCommandEvent(vEvent);
                 vEvent.SetString(sVal);
                 vEvent.SetInt(GetValue());
-                if (GetEventHandler()->ProcessEvent(vEvent))
+                if (HandleWindowEvent(vEvent))
                     return;
                 break;
             }
@@ -351,7 +352,7 @@ void wxSpinCtrl::OnChar (
                 vEventNav.SetDirection(!rEvent.ShiftDown());
                 vEventNav.SetWindowChange(rEvent.ControlDown());
                 vEventNav.SetEventObject(this);
-                if (GetParent()->GetEventHandler()->ProcessEvent(vEventNav))
+                if (GetParent()->HandleWindowEvent(vEventNav))
                     return;
             }
             break;
@@ -367,13 +368,13 @@ void wxSpinCtrl::OnSpinChange(
   wxSpinEvent&                      rEventSpin
 )
 {
-    wxCommandEvent                  vEvent( wxEVT_COMMAND_SPINCTRL_UPDATED
+    wxCommandEvent                  vEvent( wxEVT_SPINCTRL
                                            ,GetId()
                                           );
 
     vEvent.SetEventObject(this);
     vEvent.SetInt(rEventSpin.GetPosition());
-    (void)GetEventHandler()->ProcessEvent(vEvent);
+    (void)HandleWindowEvent(vEvent);
     if (rEventSpin.GetSkipped())
     {
         vEvent.Skip();
@@ -399,14 +400,14 @@ bool wxSpinCtrl::ProcessTextCommand( WXWORD wCmd,
     {
         case SPBN_CHANGE:
         {
-            wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED, GetId() );
+            wxCommandEvent vEvent( wxEVT_TEXT, GetId() );
             vEvent.SetEventObject(this);
 
             wxString sVal = wxGetWindowText(m_hWndBuddy);
 
             vEvent.SetString(sVal);
             vEvent.SetInt(GetValue());
-            return (GetEventHandler()->ProcessEvent(vEvent));
+            return (HandleWindowEvent(vEvent));
         }
 
         case SPBN_SETFOCUS:
@@ -417,7 +418,7 @@ bool wxSpinCtrl::ProcessTextCommand( WXWORD wCmd,
                                );
 
             vEvent.SetEventObject(this);
-            return(GetEventHandler()->ProcessEvent(vEvent));
+            return(HandleWindowEvent(vEvent));
         }
         default:
             break;