]> git.saurik.com Git - wxWidgets.git/blob - src/common/spinctrlcmn.cpp
Fix bug in Unix wxFileSystemWatcher implementation when watch is deleted.
[wxWidgets.git] / src / common / spinctrlcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/spinctrlcmn.cpp
3 // Purpose: define wxSpinCtrl event types
4 // Author: Peter Most
5 // Created: 01.11.08
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008-2009 wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #include "wx/spinbutt.h"
27 #include "wx/spinctrl.h"
28
29 #if wxUSE_SPINCTRL
30
31 wxDEFINE_EVENT(wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEvent);
32 wxDEFINE_EVENT(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, wxSpinDoubleEvent);
33
34 // ----------------------------------------------------------------------------
35 // XTI
36 // ----------------------------------------------------------------------------
37
38 wxDEFINE_FLAGS( wxSpinCtrlStyle )
39 wxBEGIN_FLAGS( wxSpinCtrlStyle )
40 // new style border flags, we put them first to
41 // use them for streaming out
42 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
43 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
44 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
45 wxFLAGS_MEMBER(wxBORDER_RAISED)
46 wxFLAGS_MEMBER(wxBORDER_STATIC)
47 wxFLAGS_MEMBER(wxBORDER_NONE)
48
49 // old style border flags
50 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
51 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
52 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
53 wxFLAGS_MEMBER(wxRAISED_BORDER)
54 wxFLAGS_MEMBER(wxSTATIC_BORDER)
55 wxFLAGS_MEMBER(wxBORDER)
56
57 // standard window styles
58 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
59 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
60 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
61 wxFLAGS_MEMBER(wxWANTS_CHARS)
62 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
63 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
64 wxFLAGS_MEMBER(wxVSCROLL)
65 wxFLAGS_MEMBER(wxHSCROLL)
66
67 wxFLAGS_MEMBER(wxSP_HORIZONTAL)
68 wxFLAGS_MEMBER(wxSP_VERTICAL)
69 wxFLAGS_MEMBER(wxSP_ARROW_KEYS)
70 wxFLAGS_MEMBER(wxSP_WRAP)
71 wxEND_FLAGS( wxSpinCtrlStyle )
72
73 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl, "wx/spinctrl.h")
74
75 wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl)
76 wxEVENT_RANGE_PROPERTY( Spin, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxSpinEvent )
77
78 wxEVENT_PROPERTY( Updated, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEvent )
79 wxEVENT_PROPERTY( TextUpdated, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEvent )
80 wxEVENT_PROPERTY( TextEnter, wxEVT_COMMAND_TEXT_ENTER, wxCommandEvent )
81
82 wxPROPERTY( ValueString, wxString, SetValue, GetValue, \
83 wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group")) ;
84 wxPROPERTY( Value, int, SetValue, GetValue, 0, 0 /*flags*/, \
85 wxT("Helpstring"), wxT("group"))
86 #if 0
87 wxPROPERTY( Min, int, SetMin, GetMin, 0, 0 /*flags*/, wxT("Helpstring"), wxT("group") )
88 wxPROPERTY( Max, int, SetMax, GetMax, 0, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
89 #endif
90 wxPROPERTY_FLAGS( WindowStyle, wxSpinCtrlStyle, long, SetWindowStyleFlag, \
91 GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
92 wxT("Helpstring"), wxT("group")) // style
93 /*
94 TODO PROPERTIES
95 style wxSP_ARROW_KEYS
96 */
97 wxEND_PROPERTIES_TABLE()
98
99 wxEMPTY_HANDLERS_TABLE(wxSpinCtrl)
100
101 wxCONSTRUCTOR_6( wxSpinCtrl, wxWindow*, Parent, wxWindowID, Id, \
102 wxString, ValueString, wxPoint, Position, \
103 wxSize, Size, long, WindowStyle )
104
105
106 wxString wxPrivate::wxSpinCtrlFormatAsHex(long val, long maxVal)
107 {
108 // We format the value like this is for compatibility with (native
109 // behaviour of) wxMSW
110 wxString text;
111 if ( maxVal < 0x10000 )
112 text.Printf(wxS("0x%04lx"), val);
113 else
114 text.Printf(wxS("0x%08lx"), val);
115
116 return text;
117 }
118
119 #endif // wxUSE_SPINCTRL