]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/dialog.cpp
minor cleanup
[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 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #ifndef WX_PRECOMP
28 #include "wx/dialog.h"
29 #include "wx/utils.h"
30 #include "wx/frame.h"
31 #include "wx/app.h"
32 #include "wx/settings.h"
33 #include "wx/intl.h"
34 #include "wx/log.h"
35 #endif
36
37 #include "wx/log.h"
38 #include "wx/evtloop.h"
39 #include "wx/ptr_scpd.h"
40
41 // ----------------------------------------------------------------------------
42 // wxWin macros
43 // ----------------------------------------------------------------------------
44
45 #if wxUSE_EXTENDED_RTTI
46 WX_DEFINE_FLAGS( wxDialogStyle )
47
48 wxBEGIN_FLAGS( wxDialogStyle )
49 // new style border flags, we put them first to
50 // use them for streaming out
51 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
52 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
53 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
54 wxFLAGS_MEMBER(wxBORDER_RAISED)
55 wxFLAGS_MEMBER(wxBORDER_STATIC)
56 wxFLAGS_MEMBER(wxBORDER_NONE)
57
58 // old style border flags
59 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
60 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
61 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
62 wxFLAGS_MEMBER(wxRAISED_BORDER)
63 wxFLAGS_MEMBER(wxSTATIC_BORDER)
64 wxFLAGS_MEMBER(wxNO_BORDER)
65
66 // standard window styles
67 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
68 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
69
70 // dialog styles
71 wxFLAGS_MEMBER(wxWS_EX_VALIDATE_RECURSIVELY)
72 wxFLAGS_MEMBER(wxSTAY_ON_TOP)
73 wxFLAGS_MEMBER(wxCAPTION)
74 wxFLAGS_MEMBER(wxTHICK_FRAME)
75 wxFLAGS_MEMBER(wxSYSTEM_MENU)
76 wxFLAGS_MEMBER(wxRESIZE_BORDER)
77 wxFLAGS_MEMBER(wxRESIZE_BOX)
78 wxFLAGS_MEMBER(wxCLOSE_BOX)
79 wxFLAGS_MEMBER(wxMAXIMIZE_BOX)
80 wxFLAGS_MEMBER(wxMINIMIZE_BOX)
81 wxEND_FLAGS( wxDialogStyle )
82
83 IMPLEMENT_DYNAMIC_CLASS_XTI(wxDialog, wxTopLevelWindow,"wx/dialog.h")
84
85 wxBEGIN_PROPERTIES_TABLE(wxDialog)
86 wxPROPERTY( Title, wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
87 wxPROPERTY_FLAGS( WindowStyle , wxDialogStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
88 wxEND_PROPERTIES_TABLE()
89
90 wxBEGIN_HANDLERS_TABLE(wxDialog)
91 wxEND_HANDLERS_TABLE()
92
93 wxCONSTRUCTOR_6( wxDialog , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle)
94
95 #else
96 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
97 #endif
98
99 BEGIN_EVENT_TABLE(wxDialog, wxDialogBase)
100 EVT_BUTTON(wxID_OK, wxDialog::OnOK)
101 EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
102 EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
103
104 EVT_CLOSE(wxDialog::OnCloseWindow)
105 END_EVENT_TABLE()
106
107 // ----------------------------------------------------------------------------
108 // wxDialogModalData
109 // ----------------------------------------------------------------------------
110
111 // this is simply a container for any data we need to implement modality which
112 // allows us to avoid changing wxDialog each time the implementation changes
113 class wxDialogModalData
114 {
115 public:
116 wxDialogModalData(wxDialog *dialog) : m_evtLoop(dialog) { }
117
118 void RunLoop()
119 {
120 m_evtLoop.Run();
121 }
122
123 void ExitLoop()
124 {
125 m_evtLoop.Exit();
126 }
127
128 private:
129 wxModalEventLoop m_evtLoop;
130 };
131
132 wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData);
133
134 // ============================================================================
135 // implementation
136 // ============================================================================
137
138 // ----------------------------------------------------------------------------
139 // wxDialog construction
140 // ----------------------------------------------------------------------------
141
142 void wxDialog::Init()
143 {
144 }
145
146 bool wxDialog::Create(wxWindow *parent,
147 wxWindowID id,
148 const wxString& title,
149 const wxPoint& pos,
150 const wxSize& size,
151 long style,
152 const wxString& name)
153 {
154 return false;
155 }
156
157 wxDialog::~wxDialog()
158 {
159 }
160
161 // ----------------------------------------------------------------------------
162 // showing the dialogs
163 // ----------------------------------------------------------------------------
164
165 wxWindow *wxDialog::FindSuitableParent() const
166 {
167 return NULL;
168 }
169
170 bool wxDialog::Show(bool show)
171 {
172 return false;
173 }
174
175 void wxDialog::Raise()
176 {
177 }
178
179 // show dialog modally
180 int wxDialog::ShowModal()
181 {
182 return -1;
183 }
184
185 void wxDialog::EndModal(int retCode)
186 {
187 }
188
189 // ----------------------------------------------------------------------------
190 // wxWin event handlers
191 // ----------------------------------------------------------------------------
192
193 // Standard buttons
194 void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event))
195 {
196 }
197
198 void wxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
199 {
200 }
201
202 void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
203 {
204 }
205
206 void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
207 {
208 }