]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/spinbutt.cpp
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     wxSpinButton 
   4 // Author:      David Webster 
   8 // Copyright:   (c) David Webster 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  13     #pragma implementation "spinbutt.h" 
  14     #pragma implementation "spinbutbase.h" 
  17 // For compilers that support precompilation, includes "wx.h". 
  18 #include "wx/wxprec.h" 
  26 // Can't resolve reference to CreateUpDownControl in 
  27 // TWIN32, but could probably use normal CreateWindow instead. 
  30 #include "wx/spinbutt.h" 
  32 IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent
, wxNotifyEvent
) 
  34 #include "wx/os2/private.h" 
  36 // ============================================================================ 
  38 // ============================================================================ 
  40 // ---------------------------------------------------------------------------- 
  42 // ---------------------------------------------------------------------------- 
  44 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton
, wxControl
) 
  46 bool wxSpinButton::Create( 
  52 , const wxString
&                   name
 
  57     m_windowStyle 
= style
; 
  61     m_windowId 
= (id 
== -1) ? NewControlId() : id
; 
  63     // TODO create spin button 
  67 wxSpinButton::~wxSpinButton() 
  71 // ---------------------------------------------------------------------------- 
  73 // ---------------------------------------------------------------------------- 
  75 wxSize 
wxSpinButton::DoGetBestSize() const 
  79     if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 ) 
  82         return wxSize(GetSystemMetrics(SM_CXVSCROLL), 
  83                       2*GetSystemMetrics(SM_CYVSCROLL)); 
  88         return wxSize(2*GetSystemMetrics(SM_CXHSCROLL), 
  89                       GetSystemMetrics(SM_CYHSCROLL)); 
  95 // ---------------------------------------------------------------------------- 
  97 // ---------------------------------------------------------------------------- 
  99 int wxSpinButton::GetValue() const 
 105 void wxSpinButton::SetValue(int val
) 
 110 void wxSpinButton::SetRange(int minVal
, int maxVal
) 
 115 bool wxSpinButton::OS2OnScroll(int orientation
, WXWORD wParam
, 
 116                                WXWORD pos
, WXHWND control
) 
 118     wxCHECK_MSG( control
, FALSE
, wxT("scrolling what?") ) 
 121     if ( wParam != SB_THUMBPOSITION ) 
 123         // probable SB_ENDSCROLL - we don't react to it 
 127     wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId); 
 128     event.SetPosition((short)pos);    // cast is important for negative values! 
 129     event.SetEventObject(this); 
 131     return GetEventHandler()->ProcessEvent(event); 
 136 bool wxSpinButton::OS2OnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM 
*result
) 
 140     LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam; 
 142     wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP 
 143                                          : wxEVT_SCROLL_LINEDOWN, 
 145     event.SetPosition(lpnmud->iPos + lpnmud->iDelta); 
 146     event.SetEventObject(this); 
 148     bool processed = GetEventHandler()->ProcessEvent(event); 
 150     *result = event.IsAllowed() ? 0 : 1; 
 157 bool wxSpinButton::OS2Command(WXUINT cmd
, WXWORD id
) 
 159     // No command messages 
 163 #endif //wxUSE_SPINBTN