]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/dialog.cpp
1b415a94658eccac905e5b496bae56214f725522
[wxWidgets.git] / src / palmos / dialog.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/dialog.cpp
3 // Purpose: wxDialog class
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/12/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 "dialog.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 #ifndef WX_PRECOMP
32 #include "wx/dialog.h"
33 #include "wx/utils.h"
34 #include "wx/frame.h"
35 #include "wx/app.h"
36 #include "wx/settings.h"
37 #include "wx/intl.h"
38 #include "wx/log.h"
39 #endif
40
41 #include "wx/log.h"
42 #include "wx/evtloop.h"
43 #include "wx/ptr_scpd.h"
44
45 // ----------------------------------------------------------------------------
46 // wxWin macros
47 // ----------------------------------------------------------------------------
48
49 #if wxUSE_EXTENDED_RTTI
50 WX_DEFINE_FLAGS( wxDialogStyle )
51
52 wxBEGIN_FLAGS( wxDialogStyle )
53 // new style border flags, we put them first to
54 // use them for streaming out
55 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
56 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
57 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
58 wxFLAGS_MEMBER(wxBORDER_RAISED)
59 wxFLAGS_MEMBER(wxBORDER_STATIC)
60 wxFLAGS_MEMBER(wxBORDER_NONE)
61
62 // old style border flags
63 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
64 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
65 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
66 wxFLAGS_MEMBER(wxRAISED_BORDER)
67 wxFLAGS_MEMBER(wxSTATIC_BORDER)
68 wxFLAGS_MEMBER(wxNO_BORDER)
69
70 // standard window styles
71 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
72 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
73
74 // dialog styles
75 wxFLAGS_MEMBER(wxWS_EX_VALIDATE_RECURSIVELY)
76 wxFLAGS_MEMBER(wxSTAY_ON_TOP)
77 wxFLAGS_MEMBER(wxCAPTION)
78 wxFLAGS_MEMBER(wxTHICK_FRAME)
79 wxFLAGS_MEMBER(wxSYSTEM_MENU)
80 wxFLAGS_MEMBER(wxRESIZE_BORDER)
81 wxFLAGS_MEMBER(wxRESIZE_BOX)
82 wxFLAGS_MEMBER(wxCLOSE_BOX)
83 wxFLAGS_MEMBER(wxMAXIMIZE_BOX)
84 wxFLAGS_MEMBER(wxMINIMIZE_BOX)
85 wxEND_FLAGS( wxDialogStyle )
86
87 IMPLEMENT_DYNAMIC_CLASS_XTI(wxDialog, wxTopLevelWindow,"wx/dialog.h")
88
89 wxBEGIN_PROPERTIES_TABLE(wxDialog)
90 wxPROPERTY( Title, wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
91 wxPROPERTY_FLAGS( WindowStyle , wxDialogStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
92 wxEND_PROPERTIES_TABLE()
93
94 wxBEGIN_HANDLERS_TABLE(wxDialog)
95 wxEND_HANDLERS_TABLE()
96
97 wxCONSTRUCTOR_6( wxDialog , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle)
98
99 #else
100 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
101 #endif
102
103 BEGIN_EVENT_TABLE(wxDialog, wxDialogBase)
104 EVT_BUTTON(wxID_OK, wxDialog::OnOK)
105 EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
106 EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
107
108 EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
109
110 EVT_CLOSE(wxDialog::OnCloseWindow)
111 END_EVENT_TABLE()
112
113 // ----------------------------------------------------------------------------
114 // wxDialogModalData
115 // ----------------------------------------------------------------------------
116
117 // this is simply a container for any data we need to implement modality which
118 // allows us to avoid changing wxDialog each time the implementation changes
119 class wxDialogModalData
120 {
121 public:
122 wxDialogModalData(wxDialog *dialog) : m_evtLoop(dialog) { }
123
124 void RunLoop()
125 {
126 m_evtLoop.Run();
127 }
128
129 void ExitLoop()
130 {
131 m_evtLoop.Exit();
132 }
133
134 private:
135 wxModalEventLoop m_evtLoop;
136 };
137
138 wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData);
139
140 // ============================================================================
141 // implementation
142 // ============================================================================
143
144 // ----------------------------------------------------------------------------
145 // wxDialog construction
146 // ----------------------------------------------------------------------------
147
148 void wxDialog::Init()
149 {
150 }
151
152 bool wxDialog::Create(wxWindow *parent,
153 wxWindowID id,
154 const wxString& title,
155 const wxPoint& pos,
156 const wxSize& size,
157 long style,
158 const wxString& name)
159 {
160 return false;
161 }
162
163 // deprecated ctor
164 wxDialog::wxDialog(wxWindow *parent,
165 const wxString& title,
166 bool WXUNUSED(modal),
167 int x,
168 int y,
169 int w,
170 int h,
171 long style,
172 const wxString& name)
173 {
174 }
175
176 void wxDialog::SetModal(bool WXUNUSED(flag))
177 {
178 }
179
180 wxDialog::~wxDialog()
181 {
182 }
183
184 // ----------------------------------------------------------------------------
185 // showing the dialogs
186 // ----------------------------------------------------------------------------
187
188 bool wxDialog::IsModalShowing() const
189 {
190 return false;
191 }
192
193 wxWindow *wxDialog::FindSuitableParent() const
194 {
195 return NULL;
196 }
197
198 bool wxDialog::Show(bool show)
199 {
200 return false;
201 }
202
203 void wxDialog::Raise()
204 {
205 }
206
207 // show dialog modally
208 int wxDialog::ShowModal()
209 {
210 return -1;
211 }
212
213 void wxDialog::EndModal(int retCode)
214 {
215 }
216
217 // ----------------------------------------------------------------------------
218 // wxWin event handlers
219 // ----------------------------------------------------------------------------
220
221 // Standard buttons
222 void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event))
223 {
224 }
225
226 void wxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
227 {
228 }
229
230 void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
231 {
232 }
233
234 void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
235 {
236 }
237
238 void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
239 {
240 }
241
242 // ---------------------------------------------------------------------------
243 // dialog window proc
244 // ---------------------------------------------------------------------------
245
246 WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
247 {
248 return false;
249 }
250
251 #if wxUSE_CTL3D
252
253 // Define for each class of dialog and control
254 WXHBRUSH wxDialog::OnCtlColor(WXHDC WXUNUSED(pDC),
255 WXHWND WXUNUSED(pWnd),
256 WXUINT WXUNUSED(nCtlColor),
257 WXUINT message,
258 WXWPARAM wParam,
259 WXLPARAM lParam)
260 {
261 return (WXHBRUSH)Ctl3dCtlColorEx(message, wParam, lParam);
262 }
263
264 #endif // wxUSE_CTL3D
265