set the correct properties for the source files
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48088 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,36 +1,36 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: wx/xrc/xh_propdlg.h
|
// Name: wx/xrc/xh_propdlg.h
|
||||||
// Purpose: XML resource handler for wxPropertySheetDialog
|
// Purpose: XML resource handler for wxPropertySheetDialog
|
||||||
// Author: Sander Berents
|
// Author: Sander Berents
|
||||||
// Created: 2007/07/12
|
// Created: 2007/07/12
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2007 Sander Berents
|
// Copyright: (c) 2007 Sander Berents
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_XH_PROPDLG_H_
|
#ifndef _WX_XH_PROPDLG_H_
|
||||||
#define _WX_XH_PROPDLG_H_
|
#define _WX_XH_PROPDLG_H_
|
||||||
|
|
||||||
#include "wx/xrc/xmlres.h"
|
#include "wx/xrc/xmlres.h"
|
||||||
|
|
||||||
#if wxUSE_XRC
|
#if wxUSE_XRC
|
||||||
|
|
||||||
class WXDLLEXPORT wxPropertySheetDialog;
|
class WXDLLEXPORT wxPropertySheetDialog;
|
||||||
|
|
||||||
class WXDLLIMPEXP_XRC wxPropertySheetDialogXmlHandler : public wxXmlResourceHandler
|
class WXDLLIMPEXP_XRC wxPropertySheetDialogXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxPropertySheetDialogXmlHandler)
|
DECLARE_DYNAMIC_CLASS(wxPropertySheetDialogXmlHandler)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxPropertySheetDialogXmlHandler();
|
wxPropertySheetDialogXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isInside;
|
bool m_isInside;
|
||||||
wxPropertySheetDialog *m_dialog;
|
wxPropertySheetDialog *m_dialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_XRC
|
#endif // wxUSE_XRC
|
||||||
|
|
||||||
#endif // _WX_XH_PROPDLG_H_
|
#endif // _WX_XH_PROPDLG_H_
|
||||||
|
@@ -1,150 +1,150 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/xrc/xh_propdlg.cpp
|
// Name: src/xrc/xh_propdlg.cpp
|
||||||
// Purpose: XRC resource handler for wxPropertySheetDialog
|
// Purpose: XRC resource handler for wxPropertySheetDialog
|
||||||
// Author: Sander Berents
|
// Author: Sander Berents
|
||||||
// Created: 2007/07/12
|
// Created: 2007/07/12
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2007 Sander Berents
|
// Copyright: (c) 2007 Sander Berents
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_XRC && wxUSE_BOOKCTRL
|
#if wxUSE_XRC && wxUSE_BOOKCTRL
|
||||||
|
|
||||||
#include "wx/xrc/xh_propdlg.h"
|
#include "wx/xrc/xh_propdlg.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/sizer.h"
|
#include "wx/sizer.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/bookctrl.h"
|
#include "wx/bookctrl.h"
|
||||||
#include "wx/propdlg.h"
|
#include "wx/propdlg.h"
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPropertySheetDialogXmlHandler, wxXmlResourceHandler)
|
IMPLEMENT_DYNAMIC_CLASS(wxPropertySheetDialogXmlHandler, wxXmlResourceHandler)
|
||||||
|
|
||||||
wxPropertySheetDialogXmlHandler::wxPropertySheetDialogXmlHandler()
|
wxPropertySheetDialogXmlHandler::wxPropertySheetDialogXmlHandler()
|
||||||
:wxXmlResourceHandler(),
|
:wxXmlResourceHandler(),
|
||||||
m_isInside(false),
|
m_isInside(false),
|
||||||
m_dialog(NULL)
|
m_dialog(NULL)
|
||||||
{
|
{
|
||||||
XRC_ADD_STYLE(wxSTAY_ON_TOP);
|
XRC_ADD_STYLE(wxSTAY_ON_TOP);
|
||||||
XRC_ADD_STYLE(wxCAPTION);
|
XRC_ADD_STYLE(wxCAPTION);
|
||||||
XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
|
XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
|
||||||
XRC_ADD_STYLE(wxSYSTEM_MENU);
|
XRC_ADD_STYLE(wxSYSTEM_MENU);
|
||||||
XRC_ADD_STYLE(wxRESIZE_BORDER);
|
XRC_ADD_STYLE(wxRESIZE_BORDER);
|
||||||
XRC_ADD_STYLE(wxCLOSE_BOX);
|
XRC_ADD_STYLE(wxCLOSE_BOX);
|
||||||
XRC_ADD_STYLE(wxDIALOG_NO_PARENT);
|
XRC_ADD_STYLE(wxDIALOG_NO_PARENT);
|
||||||
|
|
||||||
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
|
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
|
||||||
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
|
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
|
||||||
XRC_ADD_STYLE(wxDIALOG_EX_METAL);
|
XRC_ADD_STYLE(wxDIALOG_EX_METAL);
|
||||||
XRC_ADD_STYLE(wxMAXIMIZE_BOX);
|
XRC_ADD_STYLE(wxMAXIMIZE_BOX);
|
||||||
XRC_ADD_STYLE(wxMINIMIZE_BOX);
|
XRC_ADD_STYLE(wxMINIMIZE_BOX);
|
||||||
XRC_ADD_STYLE(wxFRAME_SHAPED);
|
XRC_ADD_STYLE(wxFRAME_SHAPED);
|
||||||
XRC_ADD_STYLE(wxDIALOG_EX_CONTEXTHELP);
|
XRC_ADD_STYLE(wxDIALOG_EX_CONTEXTHELP);
|
||||||
|
|
||||||
AddWindowStyles();
|
AddWindowStyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxObject *wxPropertySheetDialogXmlHandler::DoCreateResource()
|
wxObject *wxPropertySheetDialogXmlHandler::DoCreateResource()
|
||||||
{
|
{
|
||||||
if (m_class == wxT("propertysheetpage"))
|
if (m_class == wxT("propertysheetpage"))
|
||||||
{
|
{
|
||||||
wxXmlNode *n = GetParamNode(wxT("object"));
|
wxXmlNode *n = GetParamNode(wxT("object"));
|
||||||
|
|
||||||
if (!n) n = GetParamNode(wxT("object_ref"));
|
if (!n) n = GetParamNode(wxT("object_ref"));
|
||||||
|
|
||||||
if (n)
|
if (n)
|
||||||
{
|
{
|
||||||
wxBookCtrlBase *bookctrl = m_dialog->GetBookCtrl();
|
wxBookCtrlBase *bookctrl = m_dialog->GetBookCtrl();
|
||||||
bool old_ins = m_isInside;
|
bool old_ins = m_isInside;
|
||||||
m_isInside = false;
|
m_isInside = false;
|
||||||
wxObject *item = CreateResFromNode(n, bookctrl, NULL);
|
wxObject *item = CreateResFromNode(n, bookctrl, NULL);
|
||||||
m_isInside = old_ins;
|
m_isInside = old_ins;
|
||||||
wxWindow *wnd = wxDynamicCast(item, wxWindow);
|
wxWindow *wnd = wxDynamicCast(item, wxWindow);
|
||||||
|
|
||||||
if (wnd)
|
if (wnd)
|
||||||
{
|
{
|
||||||
bookctrl->AddPage(wnd, GetText(wxT("label")), GetBool(wxT("selected")));
|
bookctrl->AddPage(wnd, GetText(wxT("label")), GetBool(wxT("selected")));
|
||||||
if (HasParam(wxT("bitmap")))
|
if (HasParam(wxT("bitmap")))
|
||||||
{
|
{
|
||||||
wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER);
|
wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER);
|
||||||
wxImageList *imgList = bookctrl->GetImageList();
|
wxImageList *imgList = bookctrl->GetImageList();
|
||||||
if (imgList == NULL)
|
if (imgList == NULL)
|
||||||
{
|
{
|
||||||
imgList = new wxImageList(bmp.GetWidth(), bmp.GetHeight());
|
imgList = new wxImageList(bmp.GetWidth(), bmp.GetHeight());
|
||||||
bookctrl->AssignImageList(imgList);
|
bookctrl->AssignImageList(imgList);
|
||||||
}
|
}
|
||||||
int imgIndex = imgList->Add(bmp);
|
int imgIndex = imgList->Add(bmp);
|
||||||
bookctrl->SetPageImage(bookctrl->GetPageCount()-1, imgIndex);
|
bookctrl->SetPageImage(bookctrl->GetPageCount()-1, imgIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wxLogError(wxT("Error in resource."));
|
wxLogError(wxT("Error in resource."));
|
||||||
return wnd;
|
return wnd;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogError(wxT("Error in resource: no control within wxPropertySheetDialog's <page> tag."));
|
wxLogError(wxT("Error in resource: no control within wxPropertySheetDialog's <page> tag."));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XRC_MAKE_INSTANCE(dlg, wxPropertySheetDialog)
|
XRC_MAKE_INSTANCE(dlg, wxPropertySheetDialog)
|
||||||
|
|
||||||
dlg->Create(m_parentAsWindow,
|
dlg->Create(m_parentAsWindow,
|
||||||
GetID(),
|
GetID(),
|
||||||
GetText(wxT("title")),
|
GetText(wxT("title")),
|
||||||
GetPosition(),
|
GetPosition(),
|
||||||
GetSize(),
|
GetSize(),
|
||||||
GetStyle(),
|
GetStyle(),
|
||||||
GetName());
|
GetName());
|
||||||
|
|
||||||
if (HasParam(wxT("icon"))) dlg->SetIcon(GetIcon(wxT("icon"), wxART_FRAME_ICON));
|
if (HasParam(wxT("icon"))) dlg->SetIcon(GetIcon(wxT("icon"), wxART_FRAME_ICON));
|
||||||
|
|
||||||
SetupWindow(dlg);
|
SetupWindow(dlg);
|
||||||
|
|
||||||
wxPropertySheetDialog *old_par = m_dialog;
|
wxPropertySheetDialog *old_par = m_dialog;
|
||||||
m_dialog = dlg;
|
m_dialog = dlg;
|
||||||
bool old_ins = m_isInside;
|
bool old_ins = m_isInside;
|
||||||
m_isInside = true;
|
m_isInside = true;
|
||||||
CreateChildren(m_dialog, true/*only this handler*/);
|
CreateChildren(m_dialog, true/*only this handler*/);
|
||||||
m_isInside = old_ins;
|
m_isInside = old_ins;
|
||||||
m_dialog = old_par;
|
m_dialog = old_par;
|
||||||
|
|
||||||
if (GetBool(wxT("centered"), false)) dlg->Centre();
|
if (GetBool(wxT("centered"), false)) dlg->Centre();
|
||||||
wxString buttons = GetText(wxT("buttons"));
|
wxString buttons = GetText(wxT("buttons"));
|
||||||
if (!buttons.IsEmpty())
|
if (!buttons.IsEmpty())
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if (buttons.Find(wxT("wxOK")) != wxNOT_FOUND) flags |= wxOK;
|
if (buttons.Find(wxT("wxOK")) != wxNOT_FOUND) flags |= wxOK;
|
||||||
if (buttons.Find(wxT("wxCANCEL")) != wxNOT_FOUND) flags |= wxCANCEL;
|
if (buttons.Find(wxT("wxCANCEL")) != wxNOT_FOUND) flags |= wxCANCEL;
|
||||||
if (buttons.Find(wxT("wxYES")) != wxNOT_FOUND) flags |= wxYES;
|
if (buttons.Find(wxT("wxYES")) != wxNOT_FOUND) flags |= wxYES;
|
||||||
if (buttons.Find(wxT("wxNO")) != wxNOT_FOUND) flags |= wxNO;
|
if (buttons.Find(wxT("wxNO")) != wxNOT_FOUND) flags |= wxNO;
|
||||||
if (buttons.Find(wxT("wxHELP")) != wxNOT_FOUND) flags |= wxHELP;
|
if (buttons.Find(wxT("wxHELP")) != wxNOT_FOUND) flags |= wxHELP;
|
||||||
if (buttons.Find(wxT("wxNO_DEFAULT")) != wxNOT_FOUND) flags |= wxNO_DEFAULT;
|
if (buttons.Find(wxT("wxNO_DEFAULT")) != wxNOT_FOUND) flags |= wxNO_DEFAULT;
|
||||||
dlg->CreateButtons(flags);
|
dlg->CreateButtons(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPropertySheetDialogXmlHandler::CanHandle(wxXmlNode *node)
|
bool wxPropertySheetDialogXmlHandler::CanHandle(wxXmlNode *node)
|
||||||
{
|
{
|
||||||
return ((!m_isInside && IsOfClass(node, wxT("wxPropertySheetDialog"))) ||
|
return ((!m_isInside && IsOfClass(node, wxT("wxPropertySheetDialog"))) ||
|
||||||
(m_isInside && IsOfClass(node, wxT("propertysheetpage"))));
|
(m_isInside && IsOfClass(node, wxT("propertysheetpage"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_XRC && wxUSE_BOOKCTRL
|
#endif // wxUSE_XRC && wxUSE_BOOKCTRL
|
||||||
|
Reference in New Issue
Block a user