]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/control.cpp
Reenable wxPalmOS status bar after recent changes. Start transition from faked drawin...
[wxWidgets.git] / src / palmos / control.cpp
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: palmos/control.cpp
3// Purpose: wxControl class
4// Author: William Osborne
5// Modified by:
6// Created: 10/13/04
7// RCS-ID: $Id:
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "control.h"
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28 #pragma hdrstop
29#endif
30
31#if wxUSE_CONTROLS
32
33#ifndef WX_PRECOMP
34 #include "wx/event.h"
35 #include "wx/app.h"
36 #include "wx/dcclient.h"
37 #include "wx/log.h"
38 #include "wx/settings.h"
39#endif
40
41#include "wx/control.h"
42
43// ----------------------------------------------------------------------------
44// wxWin macros
45// ----------------------------------------------------------------------------
46
47IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
48
49BEGIN_EVENT_TABLE(wxControl, wxWindow)
50 EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground)
51END_EVENT_TABLE()
52
53// ============================================================================
54// wxControl implementation
55// ============================================================================
56
57// ----------------------------------------------------------------------------
58// wxControl ctor/dtor
59// ----------------------------------------------------------------------------
60
61wxControl::~wxControl()
62{
63 m_isBeingDeleted = TRUE;
64}
65
66// ----------------------------------------------------------------------------
67// control window creation
68// ----------------------------------------------------------------------------
69
70bool wxControl::Create(wxWindow *parent,
71 wxWindowID id,
72 const wxPoint& pos,
73 const wxSize& size,
74 long style,
75 const wxValidator& wxVALIDATOR_PARAM(validator),
76 const wxString& name)
77{
78 if ( !wxWindow::Create(parent, id, pos, size, style, name) )
79 return FALSE;
80
81#if wxUSE_VALIDATORS
82 SetValidator(validator);
83#endif
84
85 return TRUE;
86}
87
88bool wxControl::MSWCreateControl(const wxChar *classname,
89 const wxString& label,
90 const wxPoint& pos,
91 const wxSize& size)
92{
93 WXDWORD exstyle;
94 WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), &exstyle);
95
96 return MSWCreateControl(classname, msStyle, pos, size, label, exstyle);
97}
98
99bool wxControl::MSWCreateControl(const wxChar *classname,
100 WXDWORD style,
101 const wxPoint& pos,
102 const wxSize& size,
103 const wxString& label,
104 WXDWORD exstyle)
105{
106 return TRUE;
107}
108
109// ----------------------------------------------------------------------------
110// various accessors
111// ----------------------------------------------------------------------------
112
113wxBorder wxControl::GetDefaultBorder() const
114{
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;
119}
120
121WXDWORD wxControl::MSWGetStyle(long style, WXDWORD *exstyle) const
122{
123 return 0;
124}
125
126wxSize wxControl::DoGetBestSize() const
127{
128 return wxSize(16, 16);
129}
130
131/* static */ wxVisualAttributes
132wxControl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
133{
134 wxVisualAttributes attrs;
135
136 // old school (i.e. not "common") controls use the standard dialog font
137 // by default
138 attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
139
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);
145
146 return attrs;
147}
148
149// another version for the "composite", i.e. non simple controls
150/* static */ wxVisualAttributes
151wxControl::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(variant))
152{
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);
157
158 return attrs;
159}
160
161// ----------------------------------------------------------------------------
162// message handling
163// ----------------------------------------------------------------------------
164
165bool wxControl::ProcessCommand(wxCommandEvent& event)
166{
167 return GetEventHandler()->ProcessEvent(event);
168}
169
170#ifdef __WIN95__
171bool wxControl::MSWOnNotify(int idCtrl,
172 WXLPARAM lParam,
173 WXLPARAM* result)
174{
175}
176#endif // Win95
177
178void wxControl::OnEraseBackground(wxEraseEvent& event)
179{
180}
181
182WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
183#if wxUSE_CTL3D
184 WXUINT message,
185 WXWPARAM wParam,
186 WXLPARAM lParam
187#else
188 WXUINT WXUNUSED(message),
189 WXWPARAM WXUNUSED(wParam),
190 WXLPARAM WXUNUSED(lParam)
191#endif
192 )
193{
194 return (WXHBRUSH)0;
195}
196
197// ---------------------------------------------------------------------------
198// global functions
199// ---------------------------------------------------------------------------
200
201#endif // wxUSE_CONTROLS