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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "dialog.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/dialog.h"
36 #include "wx/settings.h"
42 #include "wx/evtloop.h"
43 #include "wx/ptr_scpd.h"
45 // ----------------------------------------------------------------------------
47 // ----------------------------------------------------------------------------
49 #if wxUSE_EXTENDED_RTTI
50 WX_DEFINE_FLAGS( wxDialogStyle
)
52 wxBEGIN_FLAGS( wxDialogStyle
)
53 // new style border flags, we put them first to
54 // use them for streaming out
55 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
56 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
57 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
58 wxFLAGS_MEMBER(wxBORDER_RAISED
)
59 wxFLAGS_MEMBER(wxBORDER_STATIC
)
60 wxFLAGS_MEMBER(wxBORDER_NONE
)
62 // old style border flags
63 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
64 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
65 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
66 wxFLAGS_MEMBER(wxRAISED_BORDER
)
67 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
68 wxFLAGS_MEMBER(wxNO_BORDER
)
70 // standard window styles
71 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
72 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
75 wxFLAGS_MEMBER(wxWS_EX_VALIDATE_RECURSIVELY
)
76 wxFLAGS_MEMBER(wxSTAY_ON_TOP
)
77 wxFLAGS_MEMBER(wxCAPTION
)
78 wxFLAGS_MEMBER(wxTHICK_FRAME
)
79 wxFLAGS_MEMBER(wxSYSTEM_MENU
)
80 wxFLAGS_MEMBER(wxRESIZE_BORDER
)
81 wxFLAGS_MEMBER(wxRESIZE_BOX
)
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 BEGIN_EVENT_TABLE(wxDialog
, wxDialogBase
)
104 EVT_BUTTON(wxID_OK
, wxDialog::OnOK
)
105 EVT_BUTTON(wxID_APPLY
, wxDialog::OnApply
)
106 EVT_BUTTON(wxID_CANCEL
, wxDialog::OnCancel
)
108 EVT_CLOSE(wxDialog::OnCloseWindow
)
111 // ----------------------------------------------------------------------------
113 // ----------------------------------------------------------------------------
115 // this is simply a container for any data we need to implement modality which
116 // allows us to avoid changing wxDialog each time the implementation changes
117 class wxDialogModalData
120 wxDialogModalData(wxDialog
*dialog
) : m_evtLoop(dialog
) { }
133 wxModalEventLoop m_evtLoop
;
136 wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData
);
138 // ============================================================================
140 // ============================================================================
142 // ----------------------------------------------------------------------------
143 // wxDialog construction
144 // ----------------------------------------------------------------------------
146 void wxDialog::Init()
150 bool wxDialog::Create(wxWindow
*parent
,
152 const wxString
& title
,
156 const wxString
& name
)
161 wxDialog::~wxDialog()
165 // ----------------------------------------------------------------------------
166 // showing the dialogs
167 // ----------------------------------------------------------------------------
169 wxWindow
*wxDialog::FindSuitableParent() const
174 bool wxDialog::Show(bool show
)
179 void wxDialog::Raise()
183 // show dialog modally
184 int wxDialog::ShowModal()
189 void wxDialog::EndModal(int retCode
)
193 // ----------------------------------------------------------------------------
194 // wxWin event handlers
195 // ----------------------------------------------------------------------------
198 void wxDialog::OnOK(wxCommandEvent
& WXUNUSED(event
))
202 void wxDialog::OnApply(wxCommandEvent
& WXUNUSED(event
))
206 void wxDialog::OnCancel(wxCommandEvent
& WXUNUSED(event
))
210 void wxDialog::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))