]>
Commit | Line | Data |
---|---|---|
e5db28fd | 1 | ///////////////////////////////////////////////////////////////////////////// |
e4db172a | 2 | // Name: src/xrc/xh_wizrd.cpp |
e5db28fd VS |
3 | // Purpose: XRC resource for wxWizard |
4 | // Author: Vaclav Slavik | |
5 | // Created: 2003/03/01 | |
e5db28fd VS |
6 | // Copyright: (c) 2000 Vaclav Slavik |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
f80ea77b | 9 | |
e5db28fd VS |
10 | // For compilers that support precompilation, includes "wx.h". |
11 | #include "wx/wxprec.h" | |
12 | ||
13 | #ifdef __BORLANDC__ | |
14 | #pragma hdrstop | |
15 | #endif | |
16 | ||
621be1ec | 17 | #if wxUSE_XRC && wxUSE_WIZARDDLG |
e5db28fd VS |
18 | |
19 | #include "wx/xrc/xh_wizrd.h" | |
e4db172a WS |
20 | |
21 | #ifndef WX_PRECOMP | |
22 | #include "wx/log.h" | |
23 | #endif | |
24 | ||
e5db28fd VS |
25 | #include "wx/wizard.h" |
26 | ||
854e189f | 27 | IMPLEMENT_DYNAMIC_CLASS(wxWizardXmlHandler, wxXmlResourceHandler) |
e5db28fd VS |
28 | |
29 | wxWizardXmlHandler::wxWizardXmlHandler() : wxXmlResourceHandler() | |
30 | { | |
31 | m_wizard = NULL; | |
32 | m_lastSimplePage = NULL; | |
33 | XRC_ADD_STYLE(wxWIZARD_EX_HELPBUTTON); | |
73026ab9 | 34 | AddWindowStyles(); |
e5db28fd VS |
35 | } |
36 | ||
37 | wxObject *wxWizardXmlHandler::DoCreateResource() | |
f80ea77b | 38 | { |
e5db28fd VS |
39 | if (m_class == wxT("wxWizard")) |
40 | { | |
41 | XRC_MAKE_INSTANCE(wiz, wxWizard) | |
42 | ||
43 | long style = GetStyle(wxT("exstyle"), 0); | |
44 | if (style != 0) | |
45 | wiz->SetExtraStyle(style); | |
46 | wiz->Create(m_parentAsWindow, | |
47 | GetID(), | |
48 | GetText(wxT("title")), | |
49 | GetBitmap(), | |
50 | GetPosition()); | |
1b5d7525 | 51 | SetupWindow(wiz); |
e5db28fd VS |
52 | |
53 | wxWizard *old = m_wizard; | |
54 | m_wizard = wiz; | |
55 | m_lastSimplePage = NULL; | |
56 | CreateChildren(wiz, true /*this handler only*/); | |
57 | m_wizard = old; | |
58 | return wiz; | |
59 | } | |
60 | else | |
61 | { | |
37b6a426 | 62 | wxWizardPage *page; |
19d0f58d | 63 | |
e5db28fd VS |
64 | if (m_class == wxT("wxWizardPageSimple")) |
65 | { | |
66 | XRC_MAKE_INSTANCE(p, wxWizardPageSimple) | |
67 | p->Create(m_wizard, NULL, NULL, GetBitmap()); | |
68 | if (m_lastSimplePage) | |
69 | wxWizardPageSimple::Chain(m_lastSimplePage, p); | |
70 | page = p; | |
71 | m_lastSimplePage = p; | |
72 | } | |
73 | else /*if (m_class == wxT("wxWizardPage"))*/ | |
74 | { | |
37b6a426 VZ |
75 | if ( !m_instance ) |
76 | { | |
819559b2 | 77 | ReportError("wxWizardPage is abstract class and must be subclassed"); |
37b6a426 VZ |
78 | return NULL; |
79 | } | |
80 | ||
81 | page = wxStaticCast(m_instance, wxWizardPage); | |
82 | page->Create(m_wizard, GetBitmap()); | |
e5db28fd VS |
83 | } |
84 | ||
85 | page->SetName(GetName()); | |
86 | page->SetId(GetID()); | |
87 | ||
88 | SetupWindow(page); | |
89 | CreateChildren(page); | |
90 | return page; | |
91 | } | |
92 | } | |
93 | ||
94 | bool wxWizardXmlHandler::CanHandle(wxXmlNode *node) | |
95 | { | |
f80ea77b | 96 | return IsOfClass(node, wxT("wxWizard")) || |
e5db28fd VS |
97 | (m_wizard != NULL && |
98 | (IsOfClass(node, wxT("wxWizardPage")) || | |
99 | IsOfClass(node, wxT("wxWizardPageSimple"))) | |
100 | ); | |
101 | } | |
102 | ||
a1e4ec87 | 103 | #endif // wxUSE_XRC && wxUSE_WIZARDDLG |