1 /////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/button.cpp
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "button.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
35 #include "wx/button.h"
38 #include "wx/bmpbuttn.h"
39 #include "wx/settings.h"
40 #include "wx/dcscreen.h"
43 #include "wx/palmos/private.h"
45 // ----------------------------------------------------------------------------
47 // ----------------------------------------------------------------------------
49 #if wxUSE_EXTENDED_RTTI
51 WX_DEFINE_FLAGS( wxButtonStyle
)
53 wxBEGIN_FLAGS( wxButtonStyle
)
54 // new style border flags, we put them first to
55 // use them for streaming out
56 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
57 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
58 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
59 wxFLAGS_MEMBER(wxBORDER_RAISED
)
60 wxFLAGS_MEMBER(wxBORDER_STATIC
)
61 wxFLAGS_MEMBER(wxBORDER_NONE
)
63 // old style border flags
64 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
65 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
66 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
67 wxFLAGS_MEMBER(wxRAISED_BORDER
)
68 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
69 wxFLAGS_MEMBER(wxBORDER
)
71 // standard window styles
72 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
73 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
74 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
75 wxFLAGS_MEMBER(wxWANTS_CHARS
)
76 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
77 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
78 wxFLAGS_MEMBER(wxVSCROLL
)
79 wxFLAGS_MEMBER(wxHSCROLL
)
81 wxFLAGS_MEMBER(wxBU_LEFT
)
82 wxFLAGS_MEMBER(wxBU_RIGHT
)
83 wxFLAGS_MEMBER(wxBU_TOP
)
84 wxFLAGS_MEMBER(wxBU_BOTTOM
)
85 wxFLAGS_MEMBER(wxBU_EXACTFIT
)
86 wxEND_FLAGS( wxButtonStyle
)
88 IMPLEMENT_DYNAMIC_CLASS_XTI(wxButton
, wxControl
,"wx/button.h")
90 wxBEGIN_PROPERTIES_TABLE(wxButton
)
91 wxEVENT_PROPERTY( Click
, wxEVT_COMMAND_BUTTON_CLICKED
, wxCommandEvent
)
93 wxPROPERTY( Font
, wxFont
, SetFont
, GetFont
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
94 wxPROPERTY( Label
, wxString
, SetLabel
, GetLabel
, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
96 wxPROPERTY_FLAGS( WindowStyle
, wxButtonStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
98 wxEND_PROPERTIES_TABLE()
100 wxBEGIN_HANDLERS_TABLE(wxButton
)
101 wxEND_HANDLERS_TABLE()
103 wxCONSTRUCTOR_6( wxButton
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Label
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
107 IMPLEMENT_DYNAMIC_CLASS(wxButton
, wxControl
)
110 // this macro tries to adjust the default button height to a reasonable value
111 // using the char height as the base
112 #define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10)
114 // ============================================================================
116 // ============================================================================
118 // ----------------------------------------------------------------------------
119 // creation/destruction
120 // ----------------------------------------------------------------------------
122 bool wxButton::Create(wxWindow
*parent
,
124 const wxString
& label
,
128 const wxValidator
& validator
,
129 const wxString
& name
)
131 // remember about stock IDs
135 wxButton::~wxButton()
139 // ----------------------------------------------------------------------------
141 // ----------------------------------------------------------------------------
143 WXDWORD
wxButton::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
148 // ----------------------------------------------------------------------------
149 // size management including autosizing
150 // ----------------------------------------------------------------------------
152 wxSize
wxButton::DoGetBestSize() const
158 wxSize
wxButtonBase::GetDefaultSize()
163 void wxButton::SetDefault()
167 void wxButton::SetTmpDefault()
171 void wxButton::UnsetTmpDefault()
177 wxButton::SetDefaultStyle(wxButton
*btn
, bool on
)
181 // ----------------------------------------------------------------------------
183 // ----------------------------------------------------------------------------
185 bool wxButton::SendClickEvent()
190 void wxButton::Command(wxCommandEvent
& event
)
194 // ----------------------------------------------------------------------------
195 // event/message handlers
196 // ----------------------------------------------------------------------------
198 bool wxButton::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
203 #endif // wxUSE_BUTTON