]> git.saurik.com Git - wxWidgets.git/blame - src/os2/spinbutt.cpp
Don't create a bitmap with dimensions <= 0...
[wxWidgets.git] / src / os2 / spinbutt.cpp
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: spinbutt.cpp
3// Purpose: wxSpinButton
409c9842 4// Author: David Webster
0e320a79 5// Modified by:
409c9842 6// Created: 10/15/99
0e320a79 7// RCS-ID: $Id$
409c9842
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
1c85008f
SN
12#ifdef __GNUG__
13 #pragma implementation "spinbutt.h"
14 #pragma implementation "spinbutbase.h"
15#endif
16
409c9842
DW
17// For compilers that support precompilation, includes "wx.h".
18#include "wx/wxprec.h"
19
20
21#ifndef WX_PRECOMP
22 #include "wx/wx.h"
0e320a79 23#endif
7e99520b 24#if wxUSE_SPINBTN
0e320a79 25
409c9842
DW
26// Can't resolve reference to CreateUpDownControl in
27// TWIN32, but could probably use normal CreateWindow instead.
28
29
0e320a79 30#include "wx/spinbutt.h"
3bfbab1e
SN
31
32IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
33
409c9842
DW
34#include "wx/os2/private.h"
35
36// ============================================================================
37// implementation
38// ============================================================================
39
40// ----------------------------------------------------------------------------
41// wxWin macros
42// ----------------------------------------------------------------------------
0e320a79 43
0e320a79 44IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
0e320a79 45
409c9842
DW
46bool wxSpinButton::Create(
47 wxWindow* parent
48, wxWindowID id
49, const wxPoint& pos
50, const wxSize& size
51, long style
52, const wxString& name
53)
0e320a79
DW
54{
55 SetName(name);
56
57 m_windowStyle = style;
58
59 SetParent(parent);
60
0e320a79
DW
61 m_windowId = (id == -1) ? NewControlId() : id;
62
63 // TODO create spin button
64 return FALSE;
65}
66
67wxSpinButton::~wxSpinButton()
68{
69}
70
409c9842
DW
71// ----------------------------------------------------------------------------
72// size calculation
73// ----------------------------------------------------------------------------
74
e78c4d50 75wxSize wxSpinButton::DoGetBestSize() const
409c9842
DW
76{
77 // TODO:
78/*
79 if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 )
80 {
81 // vertical control
82 return wxSize(GetSystemMetrics(SM_CXVSCROLL),
83 2*GetSystemMetrics(SM_CYVSCROLL));
84 }
85 else
86 {
87 // horizontal control
88 return wxSize(2*GetSystemMetrics(SM_CXHSCROLL),
89 GetSystemMetrics(SM_CYHSCROLL));
90 }
91*/
92 return wxSize(0, 0);
93}
94
95// ----------------------------------------------------------------------------
0e320a79 96// Attributes
409c9842 97// ----------------------------------------------------------------------------
0e320a79
DW
98
99int wxSpinButton::GetValue() const
100{
409c9842 101 // TODO
0e320a79
DW
102 return 0;
103}
104
105void wxSpinButton::SetValue(int val)
106{
409c9842 107 // TODO
0e320a79
DW
108}
109
110void wxSpinButton::SetRange(int minVal, int maxVal)
111{
409c9842 112 // TODO
0e320a79
DW
113}
114
409c9842
DW
115bool wxSpinButton::OS2OnScroll(int orientation, WXWORD wParam,
116 WXWORD pos, WXHWND control)
117{
118 wxCHECK_MSG( control, FALSE, wxT("scrolling what?") )
119// TODO:
120/*
121 if ( wParam != SB_THUMBPOSITION )
122 {
123 // probable SB_ENDSCROLL - we don't react to it
124 return FALSE;
125 }
126
127 wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
128 event.SetPosition((short)pos); // cast is important for negative values!
129 event.SetEventObject(this);
130
131 return GetEventHandler()->ProcessEvent(event);
132*/
133 return FALSE;
134}
135
136bool wxSpinButton::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
137{
138 // TODO:
139/*
140 LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam;
141
142 wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP
143 : wxEVT_SCROLL_LINEDOWN,
144 m_windowId);
145 event.SetPosition(lpnmud->iPos + lpnmud->iDelta);
146 event.SetEventObject(this);
0e320a79 147
409c9842
DW
148 bool processed = GetEventHandler()->ProcessEvent(event);
149
150 *result = event.IsAllowed() ? 0 : 1;
151
152 return processed;
153*/
154 return FALSE;
155}
156
04701dd9 157bool wxSpinButton::OS2Command(WXUINT cmd, WXWORD id)
0e320a79 158{
409c9842
DW
159 // No command messages
160 return FALSE;
0e320a79
DW
161}
162
7e99520b 163#endif //wxUSE_SPINBTN