]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/spinbutt.cpp
42fb9e768d17f6a9ce67d019db97c9822f1656a5
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     wxSpinButton 
   4 // Author:      David Webster 
   8 // Copyright:   (c) David Webster 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 // For compilers that support precompilation, includes "wx.h". 
  13 #include "wx/wxprec.h" 
  20 // Can't resolve reference to CreateUpDownControl in 
  21 // TWIN32, but could probably use normal CreateWindow instead. 
  24 #include "wx/spinbutt.h" 
  25 #include "wx/os2/private.h" 
  27 // ============================================================================ 
  29 // ============================================================================ 
  31 // ---------------------------------------------------------------------------- 
  33 // ---------------------------------------------------------------------------- 
  35 #if !USE_SHARED_LIBRARY 
  36 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton
, wxControl
) 
  39 bool wxSpinButton::Create( 
  45 , const wxString
&                   name
 
  50     m_windowStyle 
= style
; 
  57     m_windowId 
= (id 
== -1) ? NewControlId() : id
; 
  59     // TODO create spin button 
  63 wxSpinButton::~wxSpinButton() 
  67 // ---------------------------------------------------------------------------- 
  69 // ---------------------------------------------------------------------------- 
  71 wxSize 
wxSpinButton::DoGetBestSize() 
  75     if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 ) 
  78         return wxSize(GetSystemMetrics(SM_CXVSCROLL), 
  79                       2*GetSystemMetrics(SM_CYVSCROLL)); 
  84         return wxSize(2*GetSystemMetrics(SM_CXHSCROLL), 
  85                       GetSystemMetrics(SM_CYHSCROLL)); 
  91 // ---------------------------------------------------------------------------- 
  93 // ---------------------------------------------------------------------------- 
  95 int wxSpinButton::GetValue() const 
 101 void wxSpinButton::SetValue(int val
) 
 106 void wxSpinButton::SetRange(int minVal
, int maxVal
) 
 111 bool wxSpinButton::OS2OnScroll(int orientation
, WXWORD wParam
, 
 112                                WXWORD pos
, WXHWND control
) 
 114     wxCHECK_MSG( control
, FALSE
, wxT("scrolling what?") ) 
 117     if ( wParam != SB_THUMBPOSITION ) 
 119         // probable SB_ENDSCROLL - we don't react to it 
 123     wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId); 
 124     event.SetPosition((short)pos);    // cast is important for negative values! 
 125     event.SetEventObject(this); 
 127     return GetEventHandler()->ProcessEvent(event); 
 132 bool wxSpinButton::OS2OnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM 
*result
) 
 136     LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam; 
 138     wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP 
 139                                          : wxEVT_SCROLL_LINEDOWN, 
 141     event.SetPosition(lpnmud->iPos + lpnmud->iDelta); 
 142     event.SetEventObject(this); 
 144     bool processed = GetEventHandler()->ProcessEvent(event); 
 146     *result = event.IsAllowed() ? 0 : 1; 
 153 bool wxSpinButton::MSWCommand(WXUINT cmd
, WXWORD id
) 
 155     // No command messages