]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/dialog.cpp
Fix typo in last commit
[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 #include "wx/dialog.h"
28
29 #ifndef WX_PRECOMP
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
38 #include "wx/evtloop.h"
39 #include "wx/scopedptr.h"
40
41 // ----------------------------------------------------------------------------
42 // wxWin macros
43 // ----------------------------------------------------------------------------
44
45 // ----------------------------------------------------------------------------
46 // wxDialogModalData
47 // ----------------------------------------------------------------------------
48
49 // this is simply a container for any data we need to implement modality which
50 // allows us to avoid changing wxDialog each time the implementation changes
51 class wxDialogModalData
52 {
53 public:
54 wxDialogModalData(wxDialog *dialog) : m_evtLoop(dialog) { }
55
56 void RunLoop()
57 {
58 m_evtLoop.Run();
59 }
60
61 void ExitLoop()
62 {
63 m_evtLoop.Exit();
64 }
65
66 private:
67 wxModalEventLoop m_evtLoop;
68 };
69
70 wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData);
71
72 // ============================================================================
73 // implementation
74 // ============================================================================
75
76 // ----------------------------------------------------------------------------
77 // wxDialog construction
78 // ----------------------------------------------------------------------------
79
80 void wxDialog::Init()
81 {
82 }
83
84 bool wxDialog::Create(wxWindow *parent,
85 wxWindowID id,
86 const wxString& title,
87 const wxPoint& pos,
88 const wxSize& size,
89 long style,
90 const wxString& name)
91 {
92 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
93 return false;
94 return true;
95 }
96
97 wxDialog::~wxDialog()
98 {
99 Show (false);
100 }
101
102 // ----------------------------------------------------------------------------
103 // showing the dialogs
104 // ----------------------------------------------------------------------------
105
106 bool wxDialog::Show(bool show)
107 {
108 if (show && CanDoLayoutAdaptation())
109 DoLayoutAdaptation();
110
111 return wxTopLevelWindowPalm::Show (show);
112 }
113
114 void wxDialog::Raise()
115 {
116 }
117
118 // show dialog modally
119 int wxDialog::ShowModal()
120 {
121 Show (true);
122
123 if (errNone == FrmDoDialog ((FormType *)wxTopLevelWindow::GetForm())) {
124 return 0;
125 }
126 return -1;
127 }
128
129 void wxDialog::EndModal(int retCode)
130 {
131 }
132