]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/spinctrl.h
added macros to avoid code repetition when defining comparison operators; use them...
[wxWidgets.git] / include / wx / gtk / spinctrl.h
CommitLineData
738f9e5a
RR
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
65571936 8// Licence: wxWindows licence
738f9e5a
RR
9/////////////////////////////////////////////////////////////////////////////
10
0416c418
PC
11#ifndef _WX_GTK_SPINCTRL_H_
12#define _WX_GTK_SPINCTRL_H_
a075e27b 13
738f9e5a 14//-----------------------------------------------------------------------------
ce89fdd2 15// wxSpinCtrl
738f9e5a
RR
16//-----------------------------------------------------------------------------
17
20123d49 18class WXDLLIMPEXP_CORE wxSpinCtrl : public wxControl
738f9e5a
RR
19{
20public:
7f81dfa1 21 wxSpinCtrl();
738f9e5a
RR
22 wxSpinCtrl(wxWindow *parent,
23 wxWindowID id = -1,
ce89fdd2 24 const wxString& value = wxEmptyString,
738f9e5a
RR
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 {
ce89fdd2 31 Create(parent, id, value, pos, size, style, min, max, initial, name);
738f9e5a
RR
32 }
33
34 bool Create(wxWindow *parent,
35 wxWindowID id = -1,
ce89fdd2 36 const wxString& value = wxEmptyString,
738f9e5a
RR
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
ce89fdd2 43 void SetValue(const wxString& text);
f8f9ec55 44 void SetSelection(long from, long to);
ce89fdd2 45
738f9e5a
RR
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
9d522606
RD
52 static wxVisualAttributes
53 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
54
ce89fdd2 55 // implementation
da048e3d
RR
56 void OnChar( wxKeyEvent &event );
57
07f5b19a
RR
58 void GtkDisableEvents();
59 void GtkEnableEvents();
738f9e5a 60
7f81dfa1 61 int m_pos;
738f9e5a 62
9d9b7755
VZ
63protected:
64 virtual wxSize DoGetBestSize() const;
ef5c70f9 65 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
9d9b7755 66
9d522606
RD
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
738f9e5a
RR
71private:
72 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
da048e3d 73 DECLARE_EVENT_TABLE()
738f9e5a
RR
74};
75
0416c418 76#endif // _WX_GTK_SPINCTRL_H_