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