]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/spinctrl.cpp
Add missing WXK constants for the control keys
[wxWidgets.git] / src / os2 / spinctrl.cpp
index a6048ce89c5a53fb413bd2ed3daa91f76509e00e..2771654ab0b9b349fa4e33c49901696894e46ee3 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        os2/spinctrl.cpp
+// Name:        src/os2/spinctrl.cpp
 // Purpose:     wxSpinCtrl class implementation for OS/2
 // Author:      David Webster
 // Modified by:
 // Purpose:     wxSpinCtrl class implementation for OS/2
 // Author:      David Webster
 // Modified by:
@@ -40,8 +40,6 @@ extern void  wxAssociateWinWithHandle( HWND         hWnd
 static WXFARPROC fnWndProcSpinCtrl = (WXFARPROC)NULL;
 wxArraySpins                        wxSpinCtrl::m_svAllSpins;
 
 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)
 BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
     EVT_CHAR(wxSpinCtrl::OnChar)
     EVT_SPIN(wxID_ANY, wxSpinCtrl::OnSpinChange)
@@ -122,19 +120,20 @@ bool wxSpinCtrl::Create( wxWindow*       pParent,
                          int             nInitial,
                          const wxString& rsName )
 {
                          int             nInitial,
                          const wxString& rsName )
 {
-    SWP                             vSwp;
-
     if (vId == wxID_ANY)
         m_windowId = NewControlId();
     else
         m_windowId = vId;
     if (vId == wxID_ANY)
         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;
 
     SetName(rsName);
     SetParent(pParent);
     m_windowStyle      = lStyle;
 
-    int                             lSstyle = 0L;
+    int lSstyle = 0L;
 
     lSstyle = WS_VISIBLE      |
               WS_TABSTOP      |
 
     lSstyle = WS_VISIBLE      |
               WS_TABSTOP      |
@@ -175,11 +174,7 @@ bool wxSpinCtrl::Create( wxWindow*       pParent,
     SetFont(*wxSMALL_FONT);
     SetXComp(0);
     SetYComp(0);
     SetFont(*wxSMALL_FONT);
     SetXComp(0);
     SetYComp(0);
-    SetSize( rPos.x
-            ,rPos.y
-            ,rSize.x
-            ,rSize.y
-           );
+    SetSize( rPos.x, rPos.y, rSize.x, rSize.y );
 
     SetRange(nMin, nMax);
     SetValue(nInitial);
 
     SetRange(nMin, nMax);
     SetValue(nInitial);
@@ -302,7 +297,7 @@ wxSpinCtrl* wxSpinCtrl::GetSpinForTextCtrl(
 
     // sanity check
     wxASSERT_MSG( pSpin->m_hWndBuddy == hWndBuddy,
 
     // 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
 
     return pSpin;
 } // end of wxSpinCtrl::GetSpinForTextCtrl
@@ -339,7 +334,7 @@ void wxSpinCtrl::OnChar (
                 InitCommandEvent(vEvent);
                 vEvent.SetString(sVal);
                 vEvent.SetInt(GetValue());
                 InitCommandEvent(vEvent);
                 vEvent.SetString(sVal);
                 vEvent.SetInt(GetValue());
-                if (GetEventHandler()->ProcessEvent(vEvent))
+                if (HandleWindowEvent(vEvent))
                     return;
                 break;
             }
                     return;
                 break;
             }
@@ -357,7 +352,7 @@ void wxSpinCtrl::OnChar (
                 vEventNav.SetDirection(!rEvent.ShiftDown());
                 vEventNav.SetWindowChange(rEvent.ControlDown());
                 vEventNav.SetEventObject(this);
                 vEventNav.SetDirection(!rEvent.ShiftDown());
                 vEventNav.SetWindowChange(rEvent.ControlDown());
                 vEventNav.SetEventObject(this);
-                if (GetParent()->GetEventHandler()->ProcessEvent(vEventNav))
+                if (GetParent()->HandleWindowEvent(vEventNav))
                     return;
             }
             break;
                     return;
             }
             break;
@@ -379,7 +374,7 @@ void wxSpinCtrl::OnSpinChange(
 
     vEvent.SetEventObject(this);
     vEvent.SetInt(rEventSpin.GetPosition());
 
     vEvent.SetEventObject(this);
     vEvent.SetInt(rEventSpin.GetPosition());
-    (void)GetEventHandler()->ProcessEvent(vEvent);
+    (void)HandleWindowEvent(vEvent);
     if (rEventSpin.GetSkipped())
     {
         vEvent.Skip();
     if (rEventSpin.GetSkipped())
     {
         vEvent.Skip();
@@ -412,7 +407,7 @@ bool wxSpinCtrl::ProcessTextCommand( WXWORD wCmd,
 
             vEvent.SetString(sVal);
             vEvent.SetInt(GetValue());
 
             vEvent.SetString(sVal);
             vEvent.SetInt(GetValue());
-            return (GetEventHandler()->ProcessEvent(vEvent));
+            return (HandleWindowEvent(vEvent));
         }
 
         case SPBN_SETFOCUS:
         }
 
         case SPBN_SETFOCUS:
@@ -423,7 +418,7 @@ bool wxSpinCtrl::ProcessTextCommand( WXWORD wCmd,
                                );
 
             vEvent.SetEventObject(this);
                                );
 
             vEvent.SetEventObject(this);
-            return(GetEventHandler()->ProcessEvent(vEvent));
+            return(HandleWindowEvent(vEvent));
         }
         default:
             break;
         }
         default:
             break;
@@ -462,7 +457,7 @@ void wxSpinCtrl::SetValue(
 {
     long                            lVal;
 
 {
     long                            lVal;
 
-    lVal = atol((char*)rsText.c_str());
+    lVal = atol(rsText.c_str());
     wxSpinButton::SetValue(lVal);
 } // end of wxSpinCtrl::SetValue
 
     wxSpinButton::SetValue(lVal);
 } // end of wxSpinCtrl::SetValue