]> git.saurik.com Git - wxWidgets.git/blame - src/common/spinctrlcmn.cpp
Make code reading BMP files more robust.
[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
41fb3475 6// RCS-ID: $Id$
3c778901
VZ
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
fa951ebd
VZ
29#if wxUSE_SPINCTRL
30
ce7fe42e
VZ
31wxDEFINE_EVENT(wxEVT_SPINCTRL, wxSpinEvent);
32wxDEFINE_EVENT(wxEVT_SPINCTRLDOUBLE, wxSpinDoubleEvent);
3c778901 33
28953245
SC
34// ----------------------------------------------------------------------------
35// XTI
36// ----------------------------------------------------------------------------
37
38wxDEFINE_FLAGS( wxSpinCtrlStyle )
39wxBEGIN_FLAGS( wxSpinCtrlStyle )
40// new style border flags, we put them first to
41// use them for streaming out
42wxFLAGS_MEMBER(wxBORDER_SIMPLE)
43wxFLAGS_MEMBER(wxBORDER_SUNKEN)
44wxFLAGS_MEMBER(wxBORDER_DOUBLE)
45wxFLAGS_MEMBER(wxBORDER_RAISED)
46wxFLAGS_MEMBER(wxBORDER_STATIC)
47wxFLAGS_MEMBER(wxBORDER_NONE)
48
49// old style border flags
50wxFLAGS_MEMBER(wxSIMPLE_BORDER)
51wxFLAGS_MEMBER(wxSUNKEN_BORDER)
52wxFLAGS_MEMBER(wxDOUBLE_BORDER)
53wxFLAGS_MEMBER(wxRAISED_BORDER)
54wxFLAGS_MEMBER(wxSTATIC_BORDER)
55wxFLAGS_MEMBER(wxBORDER)
56
57// standard window styles
58wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
59wxFLAGS_MEMBER(wxCLIP_CHILDREN)
60wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
61wxFLAGS_MEMBER(wxWANTS_CHARS)
62wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
63wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
64wxFLAGS_MEMBER(wxVSCROLL)
65wxFLAGS_MEMBER(wxHSCROLL)
66
67wxFLAGS_MEMBER(wxSP_HORIZONTAL)
68wxFLAGS_MEMBER(wxSP_VERTICAL)
69wxFLAGS_MEMBER(wxSP_ARROW_KEYS)
70wxFLAGS_MEMBER(wxSP_WRAP)
71wxEND_FLAGS( wxSpinCtrlStyle )
72
e765d7ee 73wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl, "wx/spinctrl.h")
28953245
SC
74
75wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl)
76wxEVENT_RANGE_PROPERTY( Spin, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxSpinEvent )
77
ce7fe42e
VZ
78wxEVENT_PROPERTY( Updated, wxEVT_SPINCTRL, wxCommandEvent )
79wxEVENT_PROPERTY( TextUpdated, wxEVT_TEXT, wxCommandEvent )
80wxEVENT_PROPERTY( TextEnter, wxEVT_TEXT_ENTER, wxCommandEvent )
28953245
SC
81
82wxPROPERTY( ValueString, wxString, SetValue, GetValue, \
83 wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group")) ;
84wxPROPERTY( Value, int, SetValue, GetValue, 0, 0 /*flags*/, \
85 wxT("Helpstring"), wxT("group"))
cfa7a6e2
VZ
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
28953245
SC
90wxPROPERTY_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 */
97wxEND_PROPERTIES_TABLE()
98
99wxEMPTY_HANDLERS_TABLE(wxSpinCtrl)
100
101wxCONSTRUCTOR_6( wxSpinCtrl, wxWindow*, Parent, wxWindowID, Id, \
102 wxString, ValueString, wxPoint, Position, \
103 wxSize, Size, long, WindowStyle )
104
105
9e565667
VZ
106wxString 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
fa951ebd 119#endif // wxUSE_SPINCTRL