]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/control.cpp
c4360886e7d9753eb0ad9ad76ccb891a7a2ea655
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/control.cpp
3 // Purpose: wxControl class
4 // Author: William Osborne - minimal working wxPalmOS port
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::PalmCreateControl(ControlStyleType style
,
91 const wxString
& label
,
95 FormType
* form
= FrmGetActiveForm ();
96 m_control
= CtlNewControl (
113 form
= FrmGetActiveForm ();
114 m_objectIndex
= FrmGetObjectIndex(form
, id
);
119 // ----------------------------------------------------------------------------
121 // ----------------------------------------------------------------------------
123 wxBorder
wxControl::GetDefaultBorder() const
125 // we want to automatically give controls a sunken style (confusingly,
126 // it may not really mean sunken at all as we map it to WS_EX_CLIENTEDGE
127 // which is not sunken at all under Windows XP -- rather, just the default)
128 return wxBORDER_SUNKEN
;
131 wxSize
wxControl::DoGetBestSize() const
133 return wxSize(16, 16);
136 bool wxControl::Enable(bool enable
)
138 if( m_control
== NULL
)
140 if( IsEnabled() == enable
)
142 CtlSetEnabled( m_control
, enable
);
146 bool wxControl::IsEnabled() const
148 if( m_control
== NULL
)
150 return CtlEnabled(m_control
);
153 bool wxControl::IsShown() const
155 return StatGetAttribute ( statAttrBarVisible
, NULL
);
158 bool wxControl::Show( bool show
)
161 FrmShowObject(FrmGetActiveForm(), m_objectIndex
);
163 FrmHideObject(FrmGetActiveForm(), m_objectIndex
);
167 /* static */ wxVisualAttributes
168 wxControl::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
170 wxVisualAttributes attrs
;
172 // old school (i.e. not "common") controls use the standard dialog font
174 attrs
.font
= wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
);
176 // most, or at least many, of the controls use the same colours as the
177 // buttons -- others will have to override this (and possibly simply call
178 // GetCompositeControlsDefaultAttributes() from their versions)
179 attrs
.colFg
= wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT
);
180 attrs
.colBg
= wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE
);
185 // another version for the "composite", i.e. non simple controls
186 /* static */ wxVisualAttributes
187 wxControl::GetCompositeControlsDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
189 wxVisualAttributes attrs
;
190 attrs
.font
= wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
);
191 attrs
.colFg
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT
);
192 attrs
.colBg
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW
);
197 // ----------------------------------------------------------------------------
199 // ----------------------------------------------------------------------------
201 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
203 return GetEventHandler()->ProcessEvent(event
);
206 void wxControl::OnEraseBackground(wxEraseEvent
& event
)
210 WXHBRUSH
wxControl::OnCtlColor(WXHDC pDC
, WXHWND
WXUNUSED(pWnd
), WXUINT
WXUNUSED(nCtlColor
),
216 WXUINT
WXUNUSED(message
),
217 WXWPARAM
WXUNUSED(wParam
),
218 WXLPARAM
WXUNUSED(lParam
)
225 // ---------------------------------------------------------------------------
227 // ---------------------------------------------------------------------------
229 #endif // wxUSE_CONTROLS