]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/control.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/control.cpp
3 // Purpose: wxControl class
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 "control.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
36 #include "wx/dcclient.h"
38 #include "wx/settings.h"
41 #include "wx/control.h"
43 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
47 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
49 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
50 EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground
)
53 // ============================================================================
54 // wxControl implementation
55 // ============================================================================
57 // ----------------------------------------------------------------------------
58 // wxControl ctor/dtor
59 // ----------------------------------------------------------------------------
61 wxControl::~wxControl()
63 m_isBeingDeleted
= TRUE
;
66 // ----------------------------------------------------------------------------
67 // control window creation
68 // ----------------------------------------------------------------------------
70 bool wxControl::Create(wxWindow
*parent
,
75 const wxValidator
& wxVALIDATOR_PARAM(validator
),
78 if ( !wxWindow::Create(parent
, id
, pos
, size
, style
, name
) )
82 SetValidator(validator
);
88 bool wxControl::MSWCreateControl(const wxChar
*classname
,
89 const wxString
& label
,
94 WXDWORD msStyle
= MSWGetStyle(GetWindowStyle(), &exstyle
);
96 return MSWCreateControl(classname
, msStyle
, pos
, size
, label
, exstyle
);
99 bool wxControl::MSWCreateControl(const wxChar
*classname
,
103 const wxString
& label
,
109 // ----------------------------------------------------------------------------
111 // ----------------------------------------------------------------------------
113 wxBorder
wxControl::GetDefaultBorder() const
115 // we want to automatically give controls a sunken style (confusingly,
116 // it may not really mean sunken at all as we map it to WS_EX_CLIENTEDGE
117 // which is not sunken at all under Windows XP -- rather, just the default)
118 return wxBORDER_SUNKEN
;
121 WXDWORD
wxControl::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
126 wxSize
wxControl::DoGetBestSize() const
128 return wxSize(16, 16);
131 /* static */ wxVisualAttributes
132 wxControl::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
134 wxVisualAttributes attrs
;
136 // old school (i.e. not "common") controls use the standard dialog font
138 attrs
.font
= wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
);
140 // most, or at least many, of the controls use the same colours as the
141 // buttons -- others will have to override this (and possibly simply call
142 // GetCompositeControlsDefaultAttributes() from their versions)
143 attrs
.colFg
= wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT
);
144 attrs
.colBg
= wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE
);
149 // another version for the "composite", i.e. non simple controls
150 /* static */ wxVisualAttributes
151 wxControl::GetCompositeControlsDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
153 wxVisualAttributes attrs
;
154 attrs
.font
= wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
);
155 attrs
.colFg
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT
);
156 attrs
.colBg
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW
);
161 // ----------------------------------------------------------------------------
163 // ----------------------------------------------------------------------------
165 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
167 return GetEventHandler()->ProcessEvent(event
);
171 bool wxControl::MSWOnNotify(int idCtrl
,
178 void wxControl::OnEraseBackground(wxEraseEvent
& event
)
182 WXHBRUSH
wxControl::OnCtlColor(WXHDC pDC
, WXHWND
WXUNUSED(pWnd
), WXUINT
WXUNUSED(nCtlColor
),
188 WXUINT
WXUNUSED(message
),
189 WXWPARAM
WXUNUSED(wParam
),
190 WXLPARAM
WXUNUSED(lParam
)
197 // ---------------------------------------------------------------------------
199 // ---------------------------------------------------------------------------
201 #endif // wxUSE_CONTROLS