]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_wizrd.cpp
Applied [ 1223122 ] [wxMSW] Proper repainting when resizing - take 2
[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
c575e45a 11#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
e5db28fd
VS
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);
73026ab9 35 AddWindowStyles();
e5db28fd
VS
36}
37
38wxObject *wxWizardXmlHandler::DoCreateResource()
f80ea77b 39{
e5db28fd
VS
40 if (m_class == wxT("wxWizard"))
41 {
42 XRC_MAKE_INSTANCE(wiz, wxWizard)
43
44 long style = GetStyle(wxT("exstyle"), 0);
45 if (style != 0)
46 wiz->SetExtraStyle(style);
47 wiz->Create(m_parentAsWindow,
48 GetID(),
49 GetText(wxT("title")),
50 GetBitmap(),
51 GetPosition());
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 {
62 wxWizardPage *page = NULL;
19d0f58d
JS
63 wxUnusedVar(page);
64
e5db28fd
VS
65 if (m_class == wxT("wxWizardPageSimple"))
66 {
67 XRC_MAKE_INSTANCE(p, wxWizardPageSimple)
68 p->Create(m_wizard, NULL, NULL, GetBitmap());
69 if (m_lastSimplePage)
70 wxWizardPageSimple::Chain(m_lastSimplePage, p);
71 page = p;
72 m_lastSimplePage = p;
73 }
74 else /*if (m_class == wxT("wxWizardPage"))*/
75 {
76 wxWizardPage *p = NULL;
77 if (m_instance)
78 p = wxStaticCast(m_instance, wxWizardPage);
79 else
80 wxLogError(wxT("wxWizardPage is abstract class, must be subclassed"));
81 p->Create(m_wizard, GetBitmap());
82 page = p;
83 }
84
85 page->SetName(GetName());
86 page->SetId(GetID());
87
88 SetupWindow(page);
89 CreateChildren(page);
90 return page;
91 }
92}
93
94bool 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