]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_dlg.cpp
removed __throws_bad_alloc import, this apparently breaks CW8.3 compilation and...
[wxWidgets.git] / src / xrc / xh_dlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_dlg.cpp
3 // Purpose: XRC resource for dialogs
4 // Author: Vaclav Slavik
5 // Created: 2000/03/05
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_XRC
19
20 #include "wx/xrc/xh_dlg.h"
21
22 #ifndef WX_PRECOMP
23 #include "wx/intl.h"
24 #include "wx/log.h"
25 #include "wx/frame.h"
26 #endif
27
28 #include "wx/dialog.h"
29
30 IMPLEMENT_DYNAMIC_CLASS(wxDialogXmlHandler, wxXmlResourceHandler)
31
32 wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler()
33 {
34 XRC_ADD_STYLE(wxSTAY_ON_TOP);
35 XRC_ADD_STYLE(wxCAPTION);
36 XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
37 XRC_ADD_STYLE(wxSYSTEM_MENU);
38 XRC_ADD_STYLE(wxRESIZE_BORDER);
39 XRC_ADD_STYLE(wxCLOSE_BOX);
40 XRC_ADD_STYLE(wxDIALOG_NO_PARENT);
41
42 XRC_ADD_STYLE(wxTAB_TRAVERSAL);
43 XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
44 XRC_ADD_STYLE(wxDIALOG_EX_METAL);
45 XRC_ADD_STYLE(wxMAXIMIZE_BOX);
46 XRC_ADD_STYLE(wxMINIMIZE_BOX);
47 XRC_ADD_STYLE(wxFRAME_SHAPED);
48 XRC_ADD_STYLE(wxDIALOG_EX_CONTEXTHELP);
49
50 #if WXWIN_COMPATIBILITY_2_6
51 XRC_ADD_STYLE(wxDIALOG_MODAL);
52 XRC_ADD_STYLE(wxTHICK_FRAME);
53 XRC_ADD_STYLE(wxRESIZE_BOX);
54 XRC_ADD_STYLE(wxDIALOG_MODELESS);
55 XRC_ADD_STYLE(wxNO_3D);
56 #endif // WXWIN_COMPATIBILITY_2_6
57
58 AddWindowStyles();
59 }
60
61 wxObject *wxDialogXmlHandler::DoCreateResource()
62 {
63 XRC_MAKE_INSTANCE(dlg, wxDialog);
64
65 dlg->Create(m_parentAsWindow,
66 GetID(),
67 GetText(wxT("title")),
68 wxDefaultPosition, wxDefaultSize,
69 GetStyle(wxT("style"), wxDEFAULT_DIALOG_STYLE),
70 GetName());
71
72 if (HasParam(wxT("size")))
73 dlg->SetClientSize(GetSize(wxT("size"), dlg));
74 if (HasParam(wxT("pos")))
75 dlg->Move(GetPosition());
76 if (HasParam(wxT("icon")))
77 dlg->SetIcon(GetIcon(wxT("icon"), wxART_FRAME_ICON));
78
79 SetupWindow(dlg);
80
81 CreateChildren(dlg);
82
83 if (GetBool(wxT("centered"), false))
84 dlg->Centre();
85
86 return dlg;
87 }
88
89 bool wxDialogXmlHandler::CanHandle(wxXmlNode *node)
90 {
91 return IsOfClass(node, wxT("wxDialog"));
92 }
93
94 #endif // wxUSE_XRC