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