]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/spinctrl.h
use custom selection colours in wxHtmlListBox again (restores functionality broken...
[wxWidgets.git] / include / wx / gtk / spinctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: spinctrl.h
3 // Purpose: wxSpinCtrl class
4 // Author: Robert Roebling
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GTK_SPINCTRL_H_
12 #define _WX_GTK_SPINCTRL_H_
13
14 //-----------------------------------------------------------------------------
15 // wxSpinCtrl
16 //-----------------------------------------------------------------------------
17
18 class WXDLLIMPEXP_CORE wxSpinCtrl : public wxControl
19 {
20 public:
21 wxSpinCtrl();
22 wxSpinCtrl(wxWindow *parent,
23 wxWindowID id = -1,
24 const wxString& value = wxEmptyString,
25 const wxPoint& pos = wxDefaultPosition,
26 const wxSize& size = wxDefaultSize,
27 long style = wxSP_ARROW_KEYS,
28 int min = 0, int max = 100, int initial = 0,
29 const wxString& name = _T("wxSpinCtrl"))
30 {
31 Create(parent, id, value, pos, size, style, min, max, initial, name);
32 }
33
34 bool Create(wxWindow *parent,
35 wxWindowID id = -1,
36 const wxString& value = wxEmptyString,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 long style = wxSP_ARROW_KEYS,
40 int min = 0, int max = 100, int initial = 0,
41 const wxString& name = _T("wxSpinCtrl"));
42
43 void SetValue(const wxString& text);
44 void SetSelection(long from, long to);
45
46 virtual int GetValue() const;
47 virtual void SetValue( int value );
48 virtual void SetRange( int minVal, int maxVal );
49 virtual int GetMin() const;
50 virtual int GetMax() const;
51
52 static wxVisualAttributes
53 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
54
55 // implementation
56 void OnChar( wxKeyEvent &event );
57
58 int m_pos;
59
60 protected:
61 void GtkDisableEvents() const;
62 void GtkEnableEvents() const;
63
64 virtual wxSize DoGetBestSize() const;
65 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
66
67 // Widgets that use the style->base colour for the BG colour should
68 // override this and return true.
69 virtual bool UseGTKStyleBase() const { return true; }
70
71 private:
72 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
73 DECLARE_EVENT_TABLE()
74 };
75
76 #endif // _WX_GTK_SPINCTRL_H_