]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/dialog.cpp
Fix typo in last commit
[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 38#include "wx/evtloop.h"
664e1314 39#include "wx/scopedptr.h"
ffecfa5a
JS
40
41// ----------------------------------------------------------------------------
42// wxWin macros
43// ----------------------------------------------------------------------------
44
ffecfa5a
JS
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
51class wxDialogModalData
52{
53public:
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
66private:
67 wxModalEventLoop m_evtLoop;
68};
69
70wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData);
71
72// ============================================================================
73// implementation
74// ============================================================================
75
76// ----------------------------------------------------------------------------
77// wxDialog construction
78// ----------------------------------------------------------------------------
79
80void wxDialog::Init()
81{
82}
83
84bool 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{
e2fc40b4
VZ
92 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
93 return false;
94 return true;
ffecfa5a
JS
95}
96
ffecfa5a
JS
97wxDialog::~wxDialog()
98{
e2fc40b4 99 Show (false);
ffecfa5a
JS
100}
101
102// ----------------------------------------------------------------------------
103// showing the dialogs
104// ----------------------------------------------------------------------------
105
ffecfa5a
JS
106bool wxDialog::Show(bool show)
107{
3aa8e4ea
JS
108 if (show && CanDoLayoutAdaptation())
109 DoLayoutAdaptation();
110
e2fc40b4 111 return wxTopLevelWindowPalm::Show (show);
ffecfa5a
JS
112}
113
114void wxDialog::Raise()
115{
116}
117
118// show dialog modally
119int wxDialog::ShowModal()
120{
6afc1b46 121 Show (true);
3aa8e4ea 122
e2fc40b4
VZ
123 if (errNone == FrmDoDialog ((FormType *)wxTopLevelWindow::GetForm())) {
124 return 0;
125 }
ffecfa5a
JS
126 return -1;
127}
128
129void wxDialog::EndModal(int retCode)
130{
131}
132