1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/button.cpp
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by: Wlodzimierz ABX Skiba - native wxButton implementation
8 // Copyright: (c) William Osborne, Wlodzimierz Skiba
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 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
47 #if wxUSE_EXTENDED_RTTI
49 WX_DEFINE_FLAGS( wxButtonStyle
)
51 wxBEGIN_FLAGS( wxButtonStyle
)
52 // new style border flags, we put them first to
53 // use them for streaming out
54 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
55 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
56 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
57 wxFLAGS_MEMBER(wxBORDER_RAISED
)
58 wxFLAGS_MEMBER(wxBORDER_STATIC
)
59 wxFLAGS_MEMBER(wxBORDER_NONE
)
61 // old style border flags
62 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
63 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
64 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
65 wxFLAGS_MEMBER(wxRAISED_BORDER
)
66 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
67 wxFLAGS_MEMBER(wxBORDER
)
69 // standard window styles
70 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
71 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
72 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
73 wxFLAGS_MEMBER(wxWANTS_CHARS
)
74 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
75 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
76 wxFLAGS_MEMBER(wxVSCROLL
)
77 wxFLAGS_MEMBER(wxHSCROLL
)
79 wxFLAGS_MEMBER(wxBU_LEFT
)
80 wxFLAGS_MEMBER(wxBU_RIGHT
)
81 wxFLAGS_MEMBER(wxBU_TOP
)
82 wxFLAGS_MEMBER(wxBU_BOTTOM
)
83 wxFLAGS_MEMBER(wxBU_EXACTFIT
)
84 wxEND_FLAGS( wxButtonStyle
)
86 IMPLEMENT_DYNAMIC_CLASS_XTI(wxButton
, wxControl
,"wx/button.h")
88 wxBEGIN_PROPERTIES_TABLE(wxButton
)
89 wxEVENT_PROPERTY( Click
, wxEVT_COMMAND_BUTTON_CLICKED
, wxCommandEvent
)
91 wxPROPERTY( Font
, wxFont
, SetFont
, GetFont
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
92 wxPROPERTY( Label
, wxString
, SetLabel
, GetLabel
, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
94 wxPROPERTY_FLAGS( WindowStyle
, wxButtonStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
96 wxEND_PROPERTIES_TABLE()
98 wxBEGIN_HANDLERS_TABLE(wxButton
)
99 wxEND_HANDLERS_TABLE()
101 wxCONSTRUCTOR_6( wxButton
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Label
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
105 IMPLEMENT_DYNAMIC_CLASS(wxButton
, wxControl
)
108 // this macro tries to adjust the default button height to a reasonable value
109 // using the char height as the base
110 #define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10)
112 // ============================================================================
114 // ============================================================================
116 // ----------------------------------------------------------------------------
117 // creation/destruction
118 // ----------------------------------------------------------------------------
120 bool wxButton::Create(wxWindow
*parent
,
122 const wxString
& label
,
126 const wxValidator
& validator
,
127 const wxString
& name
)
129 wxControl::PalmCreateControl(buttonCtl
, parent
, id
, label
, pos
, size
);
133 wxButton::~wxButton()
137 // ----------------------------------------------------------------------------
138 // size management including autosizing
139 // ----------------------------------------------------------------------------
141 wxSize
wxButton::DoGetBestSize() const
147 wxSize
wxButtonBase::GetDefaultSize()
152 void wxButton::SetDefault()
156 void wxButton::SetTmpDefault()
160 void wxButton::UnsetTmpDefault()
166 wxButton::SetDefaultStyle(wxButton
*btn
, bool on
)
170 // ----------------------------------------------------------------------------
172 // ----------------------------------------------------------------------------
174 bool wxButton::SendClickEvent()
179 void wxButton::Command(wxCommandEvent
& event
)
183 #endif // wxUSE_BUTTON