1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/dialog.cpp
3 // Purpose: wxDialog class
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
27 #include "wx/dialog.h"
33 #include "wx/settings.h"
38 #include "wx/evtloop.h"
39 #include "wx/scopedptr.h"
41 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
45 #if wxUSE_EXTENDED_RTTI
46 WX_DEFINE_FLAGS( wxDialogStyle
)
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
)
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
)
66 // standard window styles
67 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
68 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
71 wxFLAGS_MEMBER(wxWS_EX_VALIDATE_RECURSIVELY
)
72 wxFLAGS_MEMBER(wxSTAY_ON_TOP
)
73 wxFLAGS_MEMBER(wxCAPTION
)
74 #if WXWIN_COMPATIBILITY_2_6
75 wxFLAGS_MEMBER(wxTHICK_FRAME
)
76 #endif // WXWIN_COMPATIBILITY_2_6
77 wxFLAGS_MEMBER(wxSYSTEM_MENU
)
78 wxFLAGS_MEMBER(wxRESIZE_BORDER
)
79 #if WXWIN_COMPATIBILITY_2_6
80 wxFLAGS_MEMBER(wxRESIZE_BOX
)
81 #endif // WXWIN_COMPATIBILITY_2_6
82 wxFLAGS_MEMBER(wxCLOSE_BOX
)
83 wxFLAGS_MEMBER(wxMAXIMIZE_BOX
)
84 wxFLAGS_MEMBER(wxMINIMIZE_BOX
)
85 wxEND_FLAGS( wxDialogStyle
)
87 IMPLEMENT_DYNAMIC_CLASS_XTI(wxDialog
, wxTopLevelWindow
,"wx/dialog.h")
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()
94 wxBEGIN_HANDLERS_TABLE(wxDialog
)
95 wxEND_HANDLERS_TABLE()
97 wxCONSTRUCTOR_6( wxDialog
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Title
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
100 IMPLEMENT_DYNAMIC_CLASS(wxDialog
, wxTopLevelWindow
)
103 // ----------------------------------------------------------------------------
105 // ----------------------------------------------------------------------------
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
109 class wxDialogModalData
112 wxDialogModalData(wxDialog
*dialog
) : m_evtLoop(dialog
) { }
125 wxModalEventLoop m_evtLoop
;
128 wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData
);
130 // ============================================================================
132 // ============================================================================
134 // ----------------------------------------------------------------------------
135 // wxDialog construction
136 // ----------------------------------------------------------------------------
138 void wxDialog::Init()
142 bool wxDialog::Create(wxWindow
*parent
,
144 const wxString
& title
,
148 const wxString
& name
)
150 if ( !wxTopLevelWindow::Create(parent
, id
, title
, pos
, size
, style
, name
) )
155 wxDialog::~wxDialog()
160 // ----------------------------------------------------------------------------
161 // showing the dialogs
162 // ----------------------------------------------------------------------------
164 wxWindow
*wxDialog::FindSuitableParent() const
169 bool wxDialog::Show(bool show
)
171 if (show
&& CanDoLayoutAdaptation())
172 DoLayoutAdaptation();
174 return wxTopLevelWindowPalm::Show (show
);
177 void wxDialog::Raise()
181 // show dialog modally
182 int wxDialog::ShowModal()
186 if (errNone
== FrmDoDialog ((FormType
*)wxTopLevelWindow::GetForm())) {
192 void wxDialog::EndModal(int retCode
)