]>
Commit | Line | Data |
---|---|---|
78d14f80 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1c067fe3 | 2 | // Name: src/xrc/xh_dlg.cpp |
b5d6954b | 3 | // Purpose: XRC resource for dialogs |
78d14f80 VS |
4 | // Author: Vaclav Slavik |
5 | // Created: 2000/03/05 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2000 Vaclav Slavik | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
92e898b0 | 10 | |
78d14f80 VS |
11 | // For compilers that support precompilation, includes "wx.h". |
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #ifdef __BORLANDC__ | |
15 | #pragma hdrstop | |
16 | #endif | |
17 | ||
621be1ec | 18 | #if wxUSE_XRC |
a1e4ec87 | 19 | |
78d14f80 | 20 | #include "wx/xrc/xh_dlg.h" |
88a7a4e1 WS |
21 | |
22 | #ifndef WX_PRECOMP | |
23 | #include "wx/intl.h" | |
e4db172a | 24 | #include "wx/log.h" |
88a7a4e1 WS |
25 | #endif |
26 | ||
78d14f80 | 27 | #include "wx/dialog.h" |
b875c8a8 | 28 | #include "wx/frame.h" |
78d14f80 | 29 | |
854e189f | 30 | IMPLEMENT_DYNAMIC_CLASS(wxDialogXmlHandler, wxXmlResourceHandler) |
78d14f80 VS |
31 | |
32 | wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler() | |
33 | { | |
544fee32 VS |
34 | XRC_ADD_STYLE(wxSTAY_ON_TOP); |
35 | XRC_ADD_STYLE(wxCAPTION); | |
36 | XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE); | |
544fee32 VS |
37 | XRC_ADD_STYLE(wxSYSTEM_MENU); |
38 | XRC_ADD_STYLE(wxRESIZE_BORDER); | |
79132cd3 | 39 | XRC_ADD_STYLE(wxCLOSE_BOX); |
7161de85 | 40 | XRC_ADD_STYLE(wxDIALOG_NO_PARENT); |
544fee32 | 41 | |
544fee32 VS |
42 | XRC_ADD_STYLE(wxTAB_TRAVERSAL); |
43 | XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY); | |
32a1ea1c | 44 | XRC_ADD_STYLE(wxDIALOG_EX_METAL); |
2b5f62a0 VZ |
45 | XRC_ADD_STYLE(wxMAXIMIZE_BOX); |
46 | XRC_ADD_STYLE(wxMINIMIZE_BOX); | |
ab46ac0e | 47 | XRC_ADD_STYLE(wxFRAME_SHAPED); |
89c9b933 | 48 | XRC_ADD_STYLE(wxDIALOG_EX_CONTEXTHELP); |
78d14f80 | 49 | |
1c067fe3 WS |
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 | ||
78d14f80 VS |
58 | AddWindowStyles(); |
59 | } | |
60 | ||
78d14f80 | 61 | wxObject *wxDialogXmlHandler::DoCreateResource() |
92e898b0 RD |
62 | { |
63 | XRC_MAKE_INSTANCE(dlg, wxDialog); | |
64 | ||
78d14f80 VS |
65 | dlg->Create(m_parentAsWindow, |
66 | GetID(), | |
67 | GetText(wxT("title")), | |
68 | wxDefaultPosition, wxDefaultSize, | |
69 | GetStyle(wxT("style"), wxDEFAULT_DIALOG_STYLE), | |
70 | GetName()); | |
544fee32 | 71 | |
f2588180 | 72 | if (HasParam(wxT("size"))) |
0c00c86f | 73 | dlg->SetClientSize(GetSize(wxT("size"), dlg)); |
f2588180 VS |
74 | if (HasParam(wxT("pos"))) |
75 | dlg->Move(GetPosition()); | |
8b34993d VS |
76 | if (HasParam(wxT("icon"))) |
77 | dlg->SetIcon(GetIcon(wxT("icon"), wxART_FRAME_ICON)); | |
544fee32 | 78 | |
78d14f80 VS |
79 | SetupWindow(dlg); |
80 | ||
81 | CreateChildren(dlg); | |
92e898b0 | 82 | |
f80ea77b | 83 | if (GetBool(wxT("centered"), false)) |
78d14f80 | 84 | dlg->Centre(); |
92e898b0 | 85 | |
78d14f80 VS |
86 | return dlg; |
87 | } | |
88 | ||
78d14f80 VS |
89 | bool wxDialogXmlHandler::CanHandle(wxXmlNode *node) |
90 | { | |
91 | return IsOfClass(node, wxT("wxDialog")); | |
92 | } | |
a1e4ec87 | 93 | |
621be1ec | 94 | #endif // wxUSE_XRC |