2003-04-22 16:25:50 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-04-26 04:21:31 -04:00
|
|
|
// Name: src/xrc/xh_wizrd.cpp
|
2003-04-22 16:25:50 -04:00
|
|
|
// Purpose: XRC resource for wxWizard
|
|
|
|
// Author: Vaclav Slavik
|
|
|
|
// Created: 2003/03/01
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2000 Vaclav Slavik
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2004-06-11 09:14:23 -04:00
|
|
|
|
2003-04-22 16:25:50 -04:00
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
2004-09-23 05:18:13 -04:00
|
|
|
#if wxUSE_XRC && wxUSE_WIZARDDLG
|
2003-04-22 16:25:50 -04:00
|
|
|
|
|
|
|
#include "wx/xrc/xh_wizrd.h"
|
2006-04-26 04:21:31 -04:00
|
|
|
|
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#include "wx/log.h"
|
|
|
|
#endif
|
|
|
|
|
2003-04-22 16:25:50 -04:00
|
|
|
#include "wx/wizard.h"
|
|
|
|
|
2003-06-12 14:10:38 -04:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(wxWizardXmlHandler, wxXmlResourceHandler)
|
2003-04-22 16:25:50 -04:00
|
|
|
|
|
|
|
wxWizardXmlHandler::wxWizardXmlHandler() : wxXmlResourceHandler()
|
|
|
|
{
|
|
|
|
m_wizard = NULL;
|
|
|
|
m_lastSimplePage = NULL;
|
|
|
|
XRC_ADD_STYLE(wxWIZARD_EX_HELPBUTTON);
|
2005-01-17 14:15:49 -05:00
|
|
|
AddWindowStyles();
|
2003-04-22 16:25:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
wxObject *wxWizardXmlHandler::DoCreateResource()
|
2004-06-11 09:14:23 -04:00
|
|
|
{
|
2003-04-22 16:25:50 -04:00
|
|
|
if (m_class == wxT("wxWizard"))
|
|
|
|
{
|
|
|
|
XRC_MAKE_INSTANCE(wiz, wxWizard)
|
|
|
|
|
|
|
|
long style = GetStyle(wxT("exstyle"), 0);
|
|
|
|
if (style != 0)
|
|
|
|
wiz->SetExtraStyle(style);
|
|
|
|
wiz->Create(m_parentAsWindow,
|
|
|
|
GetID(),
|
|
|
|
GetText(wxT("title")),
|
|
|
|
GetBitmap(),
|
|
|
|
GetPosition());
|
2008-09-30 07:50:59 -04:00
|
|
|
SetupWindow(wiz);
|
2003-04-22 16:25:50 -04:00
|
|
|
|
|
|
|
wxWizard *old = m_wizard;
|
|
|
|
m_wizard = wiz;
|
|
|
|
m_lastSimplePage = NULL;
|
|
|
|
CreateChildren(wiz, true /*this handler only*/);
|
|
|
|
m_wizard = old;
|
|
|
|
return wiz;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-07 18:34:34 -05:00
|
|
|
wxWizardPage *page;
|
2003-12-11 06:27:56 -05:00
|
|
|
|
2003-04-22 16:25:50 -04:00
|
|
|
if (m_class == wxT("wxWizardPageSimple"))
|
|
|
|
{
|
|
|
|
XRC_MAKE_INSTANCE(p, wxWizardPageSimple)
|
|
|
|
p->Create(m_wizard, NULL, NULL, GetBitmap());
|
|
|
|
if (m_lastSimplePage)
|
|
|
|
wxWizardPageSimple::Chain(m_lastSimplePage, p);
|
|
|
|
page = p;
|
|
|
|
m_lastSimplePage = p;
|
|
|
|
}
|
|
|
|
else /*if (m_class == wxT("wxWizardPage"))*/
|
|
|
|
{
|
2006-03-07 18:34:34 -05:00
|
|
|
if ( !m_instance )
|
|
|
|
{
|
2009-03-15 06:29:14 -04:00
|
|
|
ReportError("wxWizardPage is abstract class and must be subclassed");
|
2006-03-07 18:34:34 -05:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
page = wxStaticCast(m_instance, wxWizardPage);
|
|
|
|
page->Create(m_wizard, GetBitmap());
|
2003-04-22 16:25:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
page->SetName(GetName());
|
|
|
|
page->SetId(GetID());
|
|
|
|
|
|
|
|
SetupWindow(page);
|
|
|
|
CreateChildren(page);
|
|
|
|
return page;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool wxWizardXmlHandler::CanHandle(wxXmlNode *node)
|
|
|
|
{
|
2004-06-11 09:14:23 -04:00
|
|
|
return IsOfClass(node, wxT("wxWizard")) ||
|
2003-04-22 16:25:50 -04:00
|
|
|
(m_wizard != NULL &&
|
|
|
|
(IsOfClass(node, wxT("wxWizardPage")) ||
|
|
|
|
IsOfClass(node, wxT("wxWizardPageSimple")))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2004-09-18 04:53:16 -04:00
|
|
|
#endif // wxUSE_XRC && wxUSE_WIZARDDLG
|