]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_wizrd.cpp
added wxNB_TOP
[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/////////////////////////////////////////////////////////////////////////////
f80ea77b 10
e5db28fd
VS
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
621be1ec 22#if wxUSE_XRC && wxUSE_WIZARDDLG
e5db28fd
VS
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()
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());
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;
19d0f58d
JS
62 wxUnusedVar(page);
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 {
75 wxWizardPage *p = NULL;
76 if (m_instance)
77 p = wxStaticCast(m_instance, wxWizardPage);
78 else
79 wxLogError(wxT("wxWizardPage is abstract class, must be subclassed"));
80 p->Create(m_wizard, GetBitmap());
81 page = p;
82 }
83
84 page->SetName(GetName());
85 page->SetId(GetID());
86
87 SetupWindow(page);
88 CreateChildren(page);
89 return page;
90 }
91}
92
93bool wxWizardXmlHandler::CanHandle(wxXmlNode *node)
94{
f80ea77b 95 return IsOfClass(node, wxT("wxWizard")) ||
e5db28fd
VS
96 (m_wizard != NULL &&
97 (IsOfClass(node, wxT("wxWizardPage")) ||
98 IsOfClass(node, wxT("wxWizardPageSimple")))
99 );
100}
101
a1e4ec87 102#endif // wxUSE_XRC && wxUSE_WIZARDDLG