]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_wizrd.cpp
mention ShouldInheritColours() change
[wxWidgets.git] / src / xrc / xh_wizrd.cpp
CommitLineData
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/////////////////////////////////////////////////////////////////////////////
10
11#ifdef __GNUG__
12#pragma implementation "xh_wizrd.h"
13#endif
14
15// For compilers that support precompilation, includes "wx.h".
16#include "wx/wxprec.h"
17
18#ifdef __BORLANDC__
19 #pragma hdrstop
20#endif
21
22#if wxUSE_WIZARDDLG
23
24#include "wx/xrc/xh_wizrd.h"
25#include "wx/log.h"
26#include "wx/wizard.h"
27
854e189f 28IMPLEMENT_DYNAMIC_CLASS(wxWizardXmlHandler, wxXmlResourceHandler)
e5db28fd
VS
29
30wxWizardXmlHandler::wxWizardXmlHandler() : wxXmlResourceHandler()
31{
32 m_wizard = NULL;
33 m_lastSimplePage = NULL;
34 XRC_ADD_STYLE(wxWIZARD_EX_HELPBUTTON);
35}
36
37wxObject *wxWizardXmlHandler::DoCreateResource()
38{
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());
51
52 wxWizard *old = m_wizard;
53 m_wizard = wiz;
54 m_lastSimplePage = NULL;
55 CreateChildren(wiz, true /*this handler only*/);
56 m_wizard = old;
57 return wiz;
58 }
59 else
60 {
61 wxWizardPage *page = NULL;
62 if (m_class == wxT("wxWizardPageSimple"))
63 {
64 XRC_MAKE_INSTANCE(p, wxWizardPageSimple)
65 p->Create(m_wizard, NULL, NULL, GetBitmap());
66 if (m_lastSimplePage)
67 wxWizardPageSimple::Chain(m_lastSimplePage, p);
68 page = p;
69 m_lastSimplePage = p;
70 }
71 else /*if (m_class == wxT("wxWizardPage"))*/
72 {
73 wxWizardPage *p = NULL;
74 if (m_instance)
75 p = wxStaticCast(m_instance, wxWizardPage);
76 else
77 wxLogError(wxT("wxWizardPage is abstract class, must be subclassed"));
78 p->Create(m_wizard, GetBitmap());
79 page = p;
80 }
81
82 page->SetName(GetName());
83 page->SetId(GetID());
84
85 SetupWindow(page);
86 CreateChildren(page);
87 return page;
88 }
89}
90
91bool wxWizardXmlHandler::CanHandle(wxXmlNode *node)
92{
93 return IsOfClass(node, wxT("wxWizard")) ||
94 (m_wizard != NULL &&
95 (IsOfClass(node, wxT("wxWizardPage")) ||
96 IsOfClass(node, wxT("wxWizardPageSimple")))
97 );
98}
99
100#endif // wxUSE_WIZARDDLG