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