]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/dialog.cpp
osx-cocoa updates
[wxWidgets.git] / src / palmos / dialog.cpp
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/palmos/dialog.cpp
3// Purpose: wxDialog class
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/12/04
e2731512 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
ffecfa5a
JS
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
e4db172a
WS
27#include "wx/dialog.h"
28
ffecfa5a 29#ifndef WX_PRECOMP
ffecfa5a
JS
30 #include "wx/utils.h"
31 #include "wx/frame.h"
32 #include "wx/app.h"
33 #include "wx/settings.h"
34 #include "wx/intl.h"
35 #include "wx/log.h"
36#endif
37
ffecfa5a
JS
38#include "wx/evtloop.h"
39#include "wx/ptr_scpd.h"
40
41// ----------------------------------------------------------------------------
42// wxWin macros
43// ----------------------------------------------------------------------------
44
45#if wxUSE_EXTENDED_RTTI
46WX_DEFINE_FLAGS( wxDialogStyle )
47
48wxBEGIN_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)
1c067fe3 74#if WXWIN_COMPATIBILITY_2_6
ffecfa5a 75 wxFLAGS_MEMBER(wxTHICK_FRAME)
1c067fe3 76#endif // WXWIN_COMPATIBILITY_2_6
ffecfa5a
JS
77 wxFLAGS_MEMBER(wxSYSTEM_MENU)
78 wxFLAGS_MEMBER(wxRESIZE_BORDER)
1c067fe3 79#if WXWIN_COMPATIBILITY_2_6
ffecfa5a 80 wxFLAGS_MEMBER(wxRESIZE_BOX)
1c067fe3 81#endif // WXWIN_COMPATIBILITY_2_6
ffecfa5a
JS
82 wxFLAGS_MEMBER(wxCLOSE_BOX)
83 wxFLAGS_MEMBER(wxMAXIMIZE_BOX)
84 wxFLAGS_MEMBER(wxMINIMIZE_BOX)
85wxEND_FLAGS( wxDialogStyle )
86
87IMPLEMENT_DYNAMIC_CLASS_XTI(wxDialog, wxTopLevelWindow,"wx/dialog.h")
88
89wxBEGIN_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
92wxEND_PROPERTIES_TABLE()
93
94wxBEGIN_HANDLERS_TABLE(wxDialog)
95wxEND_HANDLERS_TABLE()
96
97wxCONSTRUCTOR_6( wxDialog , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle)
98
99#else
100IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
101#endif
102
ffecfa5a
JS
103// ----------------------------------------------------------------------------
104// wxDialogModalData
105// ----------------------------------------------------------------------------
106
107// this is simply a container for any data we need to implement modality which
108// allows us to avoid changing wxDialog each time the implementation changes
109class wxDialogModalData
110{
111public:
112 wxDialogModalData(wxDialog *dialog) : m_evtLoop(dialog) { }
113
114 void RunLoop()
115 {
116 m_evtLoop.Run();
117 }
118
119 void ExitLoop()
120 {
121 m_evtLoop.Exit();
122 }
123
124private:
125 wxModalEventLoop m_evtLoop;
126};
127
128wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData);
129
130// ============================================================================
131// implementation
132// ============================================================================
133
134// ----------------------------------------------------------------------------
135// wxDialog construction
136// ----------------------------------------------------------------------------
137
138void wxDialog::Init()
139{
140}
141
142bool wxDialog::Create(wxWindow *parent,
143 wxWindowID id,
144 const wxString& title,
145 const wxPoint& pos,
146 const wxSize& size,
147 long style,
148 const wxString& name)
149{
e2fc40b4
VZ
150 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
151 return false;
152 return true;
ffecfa5a
JS
153}
154
ffecfa5a
JS
155wxDialog::~wxDialog()
156{
e2fc40b4 157 Show (false);
ffecfa5a
JS
158}
159
160// ----------------------------------------------------------------------------
161// showing the dialogs
162// ----------------------------------------------------------------------------
163
ffecfa5a
JS
164wxWindow *wxDialog::FindSuitableParent() const
165{
166 return NULL;
167}
168
169bool wxDialog::Show(bool show)
170{
3aa8e4ea
JS
171 if (show && CanDoLayoutAdaptation())
172 DoLayoutAdaptation();
173
e2fc40b4 174 return wxTopLevelWindowPalm::Show (show);
ffecfa5a
JS
175}
176
177void wxDialog::Raise()
178{
179}
180
181// show dialog modally
182int wxDialog::ShowModal()
183{
6afc1b46 184 Show (true);
3aa8e4ea 185
e2fc40b4
VZ
186 if (errNone == FrmDoDialog ((FormType *)wxTopLevelWindow::GetForm())) {
187 return 0;
188 }
ffecfa5a
JS
189 return -1;
190}
191
192void wxDialog::EndModal(int retCode)
193{
194}
195