]> git.saurik.com Git - wxWidgets.git/blame - include/wx/palmos/spinctrl.h
Use correct reload flags on all platforms to avoid compilation errors
[wxWidgets.git] / include / wx / palmos / spinctrl.h
CommitLineData
ffecfa5a 1////////////////////////////////////////////////////////////////////////////
e1d63b79 2// Name: wx/palmos/spinctrl.h
ffecfa5a 3// Purpose: wxSpinCtrl class declaration for Palm OS
e1d63b79 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/13/04
e1d63b79 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PALMOS_SPINCTRL_H_
13#define _WX_PALMOS_SPINCTRL_H_
14
ffecfa5a
JS
15#include "wx/spinbutt.h" // the base class
16
17#include "wx/dynarray.h"
18
b5dbe15d 19class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
ffecfa5a
JS
20WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins);
21
22// ----------------------------------------------------------------------------
23// Under Win32, wxSpinCtrl is a wxSpinButton with a buddy (as MSDN docs call
24// it) text window whose contents is automatically updated when the spin
25// control is clicked.
26// ----------------------------------------------------------------------------
27
53a2db12 28class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton
ffecfa5a
JS
29{
30public:
31 wxSpinCtrl() { }
32
33 wxSpinCtrl(wxWindow *parent,
34 wxWindowID id = -1,
35 const wxString& value = wxEmptyString,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
38 long style = wxSP_ARROW_KEYS,
39 int min = 0, int max = 100, int initial = 0,
9a83f860 40 const wxString& name = wxT("wxSpinCtrl"))
ffecfa5a
JS
41 {
42 Create(parent, id, value, pos, size, style, min, max, initial, name);
43 }
44
45 bool Create(wxWindow *parent,
46 wxWindowID id = -1,
47 const wxString& value = wxEmptyString,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = wxSP_ARROW_KEYS,
51 int min = 0, int max = 100, int initial = 0,
9a83f860 52 const wxString& name = wxT("wxSpinCtrl"));
ffecfa5a
JS
53
54 // a wxTextCtrl-like method (but we can't have GetValue returning wxString
55 // because the base class already has one returning int!)
56 void SetValue(const wxString& text);
57
58 // another wxTextCtrl-like method
59 void SetSelection(long from, long to);
60
61 // implementation only from now on
62 // -------------------------------
63
64 virtual ~wxSpinCtrl();
65
66 virtual void SetValue(int val) { wxSpinButton::SetValue(val); }
67 virtual int GetValue() const;
68 virtual bool SetFont(const wxFont &font);
69 virtual void SetFocus();
70
71 virtual bool Enable(bool enable = TRUE);
72 virtual bool Show(bool show = TRUE);
73
74 // wxSpinButton doesn't accept focus, but we do
75 virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); }
76
77 // for internal use only
78
79 // get the subclassed window proc of the buddy text
80 WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; }
81
82 // return the spinctrl object whose buddy is the given window or NULL
83 static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy);
84
85 // process a WM_COMMAND generated by the buddy text control
86 bool ProcessTextCommand(WXWORD cmd, WXWORD id);
87
88protected:
89 virtual void DoGetPosition(int *x, int *y) const;
90 virtual void DoMoveWindow(int x, int y, int width, int height);
91 virtual wxSize DoGetBestSize() const;
92 virtual void DoGetSize(int *width, int *height) const;
93
94 // the handler for wxSpinButton events
95 void OnSpinChange(wxSpinEvent& event);
96
97 // Handle processing of special keys
98 void OnChar(wxKeyEvent& event);
99 void OnSetFocus(wxFocusEvent& event);
100
101 // the data for the "buddy" text ctrl
102 WXHWND m_hwndBuddy;
103 WXFARPROC m_wndProcBuddy;
104
105 // all existing wxSpinCtrls - this allows to find the one corresponding to
106 // the given buddy window in GetSpinForTextCtrl()
107 static wxArraySpins ms_allSpins;
108
109private:
110 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
111 DECLARE_EVENT_TABLE()
c0c133e1 112 wxDECLARE_NO_COPY_CLASS(wxSpinCtrl);
ffecfa5a
JS
113};
114
115#endif // _WX_PALMOS_SPINCTRL_H_
116
117