added XML resources library
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7831 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
37
contrib/include/wx/xml/xh_all.h
Normal file
37
contrib/include/wx/xml/xh_all.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_all.h
|
||||
// Purpose: includes all xh_*.h files
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/03/05
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_ALL_H_
|
||||
#define _WX_XH_ALL_H_
|
||||
|
||||
|
||||
// Existing handlers:
|
||||
|
||||
#include "wx/xml/xh_menu.h"
|
||||
#include "wx/xml/xh_panel.h"
|
||||
#include "wx/xml/xh_dlg.h"
|
||||
#include "wx/xml/xh_bttn.h"
|
||||
#include "wx/xml/xh_chckb.h"
|
||||
#include "wx/xml/xh_gauge.h"
|
||||
#include "wx/xml/xh_html.h"
|
||||
#include "wx/xml/xh_spin.h"
|
||||
#include "wx/xml/xh_sttxt.h"
|
||||
#include "wx/xml/xh_slidr.h"
|
||||
#include "wx/xml/xh_radbt.h"
|
||||
#include "wx/xml/xh_radbx.h"
|
||||
#include "wx/xml/xh_combo.h"
|
||||
#include "wx/xml/xh_chckl.h"
|
||||
#include "wx/xml/xh_choic.h"
|
||||
#include "wx/xml/xh_sizer.h"
|
||||
#include "wx/xml/xh_stbmp.h"
|
||||
#include "wx/xml/xh_notbk.h"
|
||||
#include "wx/xml/xh_text.h"
|
||||
|
||||
#endif // _WX_XMLRES_H_
|
29
contrib/include/wx/xml/xh_bttn.h
Normal file
29
contrib/include/wx/xml/xh_bttn.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_bttn.h
|
||||
// Purpose: XML resource handler for buttons
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/03/05
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_BTTN_H_
|
||||
#define _WX_XH_BTTN_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_bttn.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
class wxButtonXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxButtonXmlHandler() : wxXmlResourceHandler() {}
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_BTTN_H_
|
35
contrib/include/wx/xml/xh_chckb.h
Normal file
35
contrib/include/wx/xml/xh_chckb.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_chckb.h
|
||||
// Purpose: XML resource handler for wxCheckBox
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_CHCKB_H_
|
||||
#define _WX_XH_CHCKB_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_chckb.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_CHECKBOX
|
||||
|
||||
class wxCheckBoxXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxCheckBoxXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // _WX_XH_CHECKBOX_H_
|
||||
|
33
contrib/include/wx/xml/xh_chckl.h
Normal file
33
contrib/include/wx/xml/xh_chckl.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_chckl.h
|
||||
// Purpose: XML resource handler for wxCheckListBox
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_CHCKL_H_
|
||||
#define _WX_XH_CHCKL_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_chckl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
class wxCheckListXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxCheckListXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
private:
|
||||
bool m_InsideBox;
|
||||
wxArrayString strList;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // _WX_XH_CHECKLIST_H_
|
32
contrib/include/wx/xml/xh_choic.h
Normal file
32
contrib/include/wx/xml/xh_choic.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_choic.h
|
||||
// Purpose: XML resource handler for wxChoice
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_CHOIC_H_
|
||||
#define _WX_XH_CHOIC_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_choic.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
class wxChoiceXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxChoiceXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
private:
|
||||
bool m_InsideBox;
|
||||
wxArrayString strList;
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_CHOIC_H_
|
35
contrib/include/wx/xml/xh_combo.h
Normal file
35
contrib/include/wx/xml/xh_combo.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_combo.h
|
||||
// Purpose: XML resource handler for wxComboBox
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_COMBO_H_
|
||||
#define _WX_XH_COMBO_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_combo.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
#if wxUSE_COMBOBOX
|
||||
|
||||
class wxComboBoxXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxComboBoxXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
private:
|
||||
bool m_InsideBox;
|
||||
wxArrayString strList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_XH_COMBO_H_
|
29
contrib/include/wx/xml/xh_dlg.h
Normal file
29
contrib/include/wx/xml/xh_dlg.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_dlg.h
|
||||
// Purpose: XML resource handler for dialogs
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/03/05
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_DLG_H_
|
||||
#define _WX_XH_DLG_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_dlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
class wxDialogXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxDialogXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_DLG_H_
|
40
contrib/include/wx/xml/xh_gauge.h
Normal file
40
contrib/include/wx/xml/xh_gauge.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_gauge.h
|
||||
// Purpose: XML resource handler for wxGauge
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_GAUGE_H_
|
||||
#define _WX_XH_GAUGE_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_gauge.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_GAUGE
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
|
||||
class wxGaugeXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
enum
|
||||
{
|
||||
wxGAUGE_DEFAULT_RANGE = 100
|
||||
};
|
||||
|
||||
public:
|
||||
wxGaugeXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_XH_GAUGE_H_
|
34
contrib/include/wx/xml/xh_html.h
Normal file
34
contrib/include/wx/xml/xh_html.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_html.h
|
||||
// Purpose: XML resource handler for wxHtmlWindow
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_HTML_H_
|
||||
#define _WX_XH_HTML_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_html.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
class wxHtmlWindowXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxHtmlWindowXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_XH_SLIDER_H_
|
40
contrib/include/wx/xml/xh_menu.h
Normal file
40
contrib/include/wx/xml/xh_menu.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_menu.h
|
||||
// Purpose: XML resource handler for menus/menubars
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/03/05
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_MENU_H_
|
||||
#define _WX_XH_MENU_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_menu.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
class wxMenuXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxMenuXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
|
||||
private:
|
||||
bool m_InsideMenu;
|
||||
};
|
||||
|
||||
class wxMenuBarXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxMenuBarXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_MENU_H_
|
37
contrib/include/wx/xml/xh_notbk.h
Normal file
37
contrib/include/wx/xml/xh_notbk.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_notbk.h
|
||||
// Purpose: XML resource handler for wxNotebook
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_NOTBK_H_
|
||||
#define _WX_XH_NOTBK_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_notbk.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
#if wxUSE_NOTEBOOK
|
||||
|
||||
class wxNotebook;
|
||||
|
||||
class wxNotebookXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxNotebookXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
|
||||
private:
|
||||
bool m_IsInside;
|
||||
wxNotebook *m_Notebook;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_XH_NOTBK_H_
|
29
contrib/include/wx/xml/xh_panel.h
Normal file
29
contrib/include/wx/xml/xh_panel.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_panel.h
|
||||
// Purpose: XML resource handler for panels
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/03/05
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_PANEL_H_
|
||||
#define _WX_XH_PANEL_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_panel.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
class wxPanelXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxPanelXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_PANEL_H_
|
33
contrib/include/wx/xml/xh_radbt.h
Normal file
33
contrib/include/wx/xml/xh_radbt.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_radbt.h
|
||||
// Purpose: XML resource handler for radio buttons
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_RADBT_H_
|
||||
#define _WX_XH_RADBT_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_radbt.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_RADIOBOX
|
||||
|
||||
class wxRadioButtonXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxRadioButtonXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_XH_RADIOBUTTON_H_
|
35
contrib/include/wx/xml/xh_radbx.h
Normal file
35
contrib/include/wx/xml/xh_radbx.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_radbx.h
|
||||
// Purpose: XML resource handler for radio box
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_RADBX_H_
|
||||
#define _WX_XH_RADBX_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_radbx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
#if wxUSE_RADIOBOX
|
||||
|
||||
class wxRadioBoxXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxRadioBoxXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
private:
|
||||
bool m_InsideBox;
|
||||
wxArrayString strList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_XH_RADBX_H_
|
36
contrib/include/wx/xml/xh_sizer.h
Normal file
36
contrib/include/wx/xml/xh_sizer.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_sizer.h
|
||||
// Purpose: XML resource handler for wxBoxSizer
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/04/24
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_SIZER_H_
|
||||
#define _WX_XH_SIZER_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_sizer.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
|
||||
class wxSizer;
|
||||
|
||||
class wxSizerXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxSizerXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
|
||||
private:
|
||||
bool m_IsInside;
|
||||
wxSizer *m_ParentSizer;
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_BOXSIZER_H_
|
40
contrib/include/wx/xml/xh_slidr.h
Normal file
40
contrib/include/wx/xml/xh_slidr.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_slidr.h
|
||||
// Purpose: XML resource handler for wxSlider
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_SLIDR_H_
|
||||
#define _WX_XH_SLIDR_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_slidr.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_SLIDER
|
||||
|
||||
class wxSliderXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
enum
|
||||
{
|
||||
wxSL_DEFAULT_VALUE = 0,
|
||||
wxSL_DEFAULT_MIN = 0,
|
||||
wxSL_DEFAULT_MAX = 100
|
||||
};
|
||||
|
||||
public:
|
||||
wxSliderXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_XH_SLIDER_H_
|
55
contrib/include/wx/xml/xh_spin.h
Normal file
55
contrib/include/wx/xml/xh_spin.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_spin.h
|
||||
// Purpose: XML resource handler for wxSpinButton
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_SPIN_H_
|
||||
#define _WX_XH_SPIN_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_spin.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_SPINBTN
|
||||
class wxSpinButtonXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
enum
|
||||
{
|
||||
wxSP_DEFAULT_VALUE = 0,
|
||||
wxSP_DEFAULT_MIN = 0,
|
||||
wxSP_DEFAULT_MAX = 100
|
||||
};
|
||||
|
||||
public:
|
||||
wxSpinButtonXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
#endif
|
||||
|
||||
#if wxUSE_SPINCTRL
|
||||
class wxSpinCtrlXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
enum
|
||||
{
|
||||
wxSP_DEFAULT_VALUE = 0,
|
||||
wxSP_DEFAULT_MIN = 0,
|
||||
wxSP_DEFAULT_MAX = 100
|
||||
};
|
||||
|
||||
public:
|
||||
wxSpinCtrlXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _WX_XH_SPIN_H_
|
30
contrib/include/wx/xml/xh_stbmp.h
Normal file
30
contrib/include/wx/xml/xh_stbmp.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_stbmp.h
|
||||
// Purpose: XML resource handler for wxStaticBitmap
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/04/22
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_STBMP_H_
|
||||
#define _WX_XH_STBMP_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_stbmp.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
|
||||
class wxStaticBitmapXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxStaticBitmapXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_STBMP_H_
|
30
contrib/include/wx/xml/xh_sttxt.h
Normal file
30
contrib/include/wx/xml/xh_sttxt.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_sttxt.h
|
||||
// Purpose: XML resource handler for wxStaticBitmap
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_STTXT_H_
|
||||
#define _WX_XH_STTXT_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_sttxt.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
|
||||
class wxStaticTextXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxStaticTextXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_STBMP_H_
|
30
contrib/include/wx/xml/xh_text.h
Normal file
30
contrib/include/wx/xml/xh_text.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_text.h
|
||||
// Purpose: XML resource handler for wxTextCtrl
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Aleksandras Gluchovas
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_TEXT_H_
|
||||
#define _WX_XH_TEXT_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xh_text.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xml/xmlres.h"
|
||||
|
||||
|
||||
class wxTextCtrlXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
wxTextCtrlXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_TEXT_H_
|
241
contrib/include/wx/xml/xml.h
Normal file
241
contrib/include/wx/xml/xml.h
Normal file
@@ -0,0 +1,241 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xml.h
|
||||
// Purpose: wxXmlDocument - XML parser & data holder class
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/03/05
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XML_H_
|
||||
#define _WX_XML_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xml.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/list.h"
|
||||
|
||||
|
||||
class wxXmlNode;
|
||||
class wxXmlProperty;
|
||||
class wxXmlDocument;
|
||||
class wxXmlIOHandler;
|
||||
class wxInputStream;
|
||||
class wxOutputStream;
|
||||
|
||||
|
||||
// Represents XML node type.
|
||||
enum wxXmlNodeType
|
||||
{
|
||||
// note: values are synchronized with xmlElementType from libxml
|
||||
wxXML_ELEMENT_NODE = 1,
|
||||
wxXML_ATTRIBUTE_NODE = 2,
|
||||
wxXML_TEXT_NODE = 3,
|
||||
wxXML_CDATA_SECTION_NODE = 4,
|
||||
wxXML_ENTITY_REF_NODE = 5,
|
||||
wxXML_ENTITY_NODE = 6,
|
||||
wxXML_PI_NODE = 7,
|
||||
wxXML_COMMENT_NODE = 8,
|
||||
wxXML_DOCUMENT_NODE = 9,
|
||||
wxXML_DOCUMENT_TYPE_NODE = 10,
|
||||
wxXML_DOCUMENT_FRAG_NODE = 11,
|
||||
wxXML_NOTATION_NODE = 12,
|
||||
wxXML_HTML_DOCUMENT_NODE = 13
|
||||
};
|
||||
|
||||
|
||||
// Types of XML files:
|
||||
|
||||
enum wxXmlIOType
|
||||
{
|
||||
wxXML_IO_AUTO = 0, // detect it automatically
|
||||
wxXML_IO_LIBXML, // use libxml2 to parse/save XML document
|
||||
wxXML_IO_BIN, // save in binary uncompressed proprietary format
|
||||
wxXML_IO_BINZ // svae in binary zlib-compressed proprietary format
|
||||
};
|
||||
|
||||
|
||||
// Represents node property(ies).
|
||||
// Example: in <img src="hello.gif" id="3"/> "src" is property with value
|
||||
// "hello.gif" and "id" is prop. with value "3".
|
||||
|
||||
class WXDLLEXPORT wxXmlProperty
|
||||
{
|
||||
public:
|
||||
wxXmlProperty() : m_Next(NULL) {}
|
||||
wxXmlProperty(const wxString& name, const wxString& value, wxXmlProperty *next)
|
||||
: m_Name(name), m_Value(value), m_Next(next) {}
|
||||
~wxXmlProperty() { delete m_Next; }
|
||||
|
||||
wxString GetName() const { return m_Name; }
|
||||
wxString GetValue() const { return m_Value; }
|
||||
wxXmlProperty *GetNext() const { return m_Next; }
|
||||
|
||||
void SetName(const wxString& name) { m_Name = name; }
|
||||
void SetValue(const wxString& value) { m_Value = value; }
|
||||
void SetNext(wxXmlProperty *next) { m_Next = next; }
|
||||
|
||||
private:
|
||||
wxString m_Name;
|
||||
wxString m_Value;
|
||||
wxXmlProperty *m_Next;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Represents node in XML document. Node has name and may have content
|
||||
// and properties. Most common node types are wxXML_TEXT_NODE (name and props
|
||||
// are irrelevant) and wxXML_ELEMENT_NODE (e.g. in <title>hi</title> there is
|
||||
// element with name="title", irrelevant content and one child (wxXML_TEXT_NODE
|
||||
// with content="hi").
|
||||
|
||||
class WXDLLEXPORT wxXmlNode
|
||||
{
|
||||
public:
|
||||
wxXmlNode() : m_Properties(NULL), m_Parent(NULL),
|
||||
m_Children(NULL), m_Next(NULL) {}
|
||||
wxXmlNode(wxXmlNode *parent,wxXmlNodeType type,
|
||||
const wxString& name, const wxString& content,
|
||||
wxXmlProperty *props, wxXmlNode *next);
|
||||
~wxXmlNode() { delete m_Properties; delete m_Next; delete m_Children; }
|
||||
|
||||
// copy ctor & operator=. Note that this does NOT copy syblings
|
||||
// and parent pointer, i.e. m_Parent and m_Next will be NULL
|
||||
// after using copy ctor and are never unmodified by operator=.
|
||||
// On the other hand, it DOES copy children and properties.
|
||||
wxXmlNode(const wxXmlNode& node);
|
||||
wxXmlNode& operator=(const wxXmlNode& node);
|
||||
|
||||
// user-friendly creation:
|
||||
wxXmlNode(wxXmlNodeType type, const wxString& name,
|
||||
const wxString& content = wxEmptyString);
|
||||
void AddChild(wxXmlNode *child);
|
||||
void InsertChild(wxXmlNode *child, wxXmlNode *before_node);
|
||||
bool RemoveChild(wxXmlNode *child);
|
||||
void AddProperty(const wxString& name, const wxString& value);
|
||||
bool DeleteProperty(const wxString& name);
|
||||
|
||||
// access methods:
|
||||
wxXmlNodeType GetType() const { return m_Type; }
|
||||
wxString GetName() const { return m_Name; }
|
||||
wxString GetContent() const { return m_Content; }
|
||||
|
||||
wxXmlNode *GetParent() const { return m_Parent; }
|
||||
wxXmlNode *GetNext() const { return m_Next; }
|
||||
wxXmlNode *GetChildren() const { return m_Children; }
|
||||
|
||||
wxXmlProperty *GetProperties() const { return m_Properties; }
|
||||
bool GetPropVal(const wxString& propName, wxString *value) const;
|
||||
wxString GetPropVal(const wxString& propName, const wxString& defaultVal) const;
|
||||
bool HasProp(const wxString& propName) const;
|
||||
|
||||
void SetType(wxXmlNodeType type) { m_Type = type; }
|
||||
void SetName(const wxString& name) { m_Name = name; }
|
||||
void SetContent(const wxString& con) { m_Content = con; }
|
||||
|
||||
void SetParent(wxXmlNode *parent) { m_Parent = parent; }
|
||||
void SetNext(wxXmlNode *next) { m_Next = next; }
|
||||
void SetChildren(wxXmlNode *child) { m_Children = child; }
|
||||
|
||||
void SetProperties(wxXmlProperty *prop) { m_Properties = prop; }
|
||||
void AddProperty(wxXmlProperty *prop);
|
||||
|
||||
private:
|
||||
wxXmlNodeType m_Type;
|
||||
wxString m_Name;
|
||||
wxString m_Content;
|
||||
wxXmlProperty *m_Properties;
|
||||
wxXmlNode *m_Parent, *m_Children, *m_Next;
|
||||
|
||||
void DoCopy(const wxXmlNode& node);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// This class holds XML data/document as parsed by libxml. Note that
|
||||
// internal representation is independant on libxml and you can use
|
||||
// it without libxml (see Load/SaveBinary).
|
||||
|
||||
class WXDLLEXPORT wxXmlDocument : public wxObject
|
||||
{
|
||||
public:
|
||||
wxXmlDocument() : wxObject(), m_Version(_T("1.0")), m_Root(NULL) {}
|
||||
wxXmlDocument(const wxString& filename, wxXmlIOType io_type = wxXML_IO_AUTO);
|
||||
wxXmlDocument(wxInputStream& stream, wxXmlIOType io_type = wxXML_IO_AUTO);
|
||||
~wxXmlDocument() { delete m_Root; }
|
||||
|
||||
wxXmlDocument(const wxXmlDocument& doc);
|
||||
wxXmlDocument& operator=(const wxXmlDocument& doc);
|
||||
|
||||
// Parses .xml file and loads data. Returns TRUE on success, FALSE
|
||||
// otherwise.
|
||||
// NOTE: Any call to this method will result into linking against libxml
|
||||
// and app's binary size will grow by ca. 250kB
|
||||
bool Load(const wxString& filename, wxXmlIOType io_type = wxXML_IO_AUTO);
|
||||
bool Load(wxInputStream& stream, wxXmlIOType io_type = wxXML_IO_AUTO);
|
||||
|
||||
// Saves document as .xml file.
|
||||
// NOTE: Any call to this method will result into linking against libxml
|
||||
// and app's binary size will grow by ca. 250kB
|
||||
bool Save(const wxString& filename, wxXmlIOType io_type) const;
|
||||
bool Save(wxOutputStream& stream, wxXmlIOType io_type) const;
|
||||
|
||||
// Returns root node of the document.
|
||||
wxXmlNode *GetRoot() const { return m_Root; }
|
||||
|
||||
// Returns version of document (may be empty).
|
||||
wxString GetVersion() const { return m_Version; }
|
||||
// Returns encoding of document (may be empty).
|
||||
wxString GetEncoding() const { return m_Encoding; }
|
||||
|
||||
// Write-access methods:
|
||||
void SetRoot(wxXmlNode *node) { delete m_Root ; m_Root = node; }
|
||||
void SetVersion(const wxString& version) { m_Version = version; }
|
||||
void SetEncoding(const wxString& encoding) { m_Encoding = encoding; }
|
||||
|
||||
static void AddHandler(wxXmlIOHandler *handler);
|
||||
static void CleanUpHandlers();
|
||||
static void InitStandardHandlers();
|
||||
|
||||
protected:
|
||||
static wxList *sm_Handlers;
|
||||
|
||||
private:
|
||||
wxString m_Version, m_Encoding;
|
||||
wxXmlNode *m_Root;
|
||||
|
||||
void DoCopy(const wxXmlDocument& doc);
|
||||
};
|
||||
|
||||
|
||||
|
||||
// wxXmlIOHandler takes care of loading and/or saving XML data.
|
||||
// see xmlio.h for available handlers
|
||||
|
||||
class WXDLLEXPORT wxXmlIOHandler : public wxObject
|
||||
{
|
||||
public:
|
||||
wxXmlIOHandler() {}
|
||||
|
||||
virtual wxXmlIOType GetType() = 0;
|
||||
virtual bool CanLoad(wxInputStream& stream) = 0;
|
||||
virtual bool CanSave() = 0;
|
||||
|
||||
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc) = 0;
|
||||
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _WX_XML_H_
|
72
contrib/include/wx/xml/xmlio.h
Normal file
72
contrib/include/wx/xml/xmlio.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xmlio.h
|
||||
// Purpose: wxXmlIOHandler - XML I/O classes
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/07/24
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XMLIO_H_
|
||||
#define _WX_XMLIO_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xmlio.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/xml/xml.h"
|
||||
|
||||
|
||||
class WXDLLEXPORT wxXmlIOHandlerBin : public wxXmlIOHandler
|
||||
{
|
||||
public:
|
||||
wxXmlIOHandlerBin() {}
|
||||
|
||||
virtual wxXmlIOType GetType() { return wxXML_IO_BIN; }
|
||||
virtual bool CanLoad(wxInputStream& stream);
|
||||
virtual bool CanSave() { return TRUE; }
|
||||
|
||||
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
||||
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
||||
|
||||
protected:
|
||||
wxString ReadHeader(wxInputStream& stream);
|
||||
void WriteHeader(wxOutputStream& stream, const wxString& header);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#if wxUSE_ZLIB
|
||||
|
||||
class WXDLLEXPORT wxXmlIOHandlerBinZ : public wxXmlIOHandlerBin
|
||||
{
|
||||
public:
|
||||
wxXmlIOHandlerBinZ() {}
|
||||
|
||||
virtual wxXmlIOType GetType() { return wxXML_IO_BINZ; }
|
||||
virtual bool CanLoad(wxInputStream& stream);
|
||||
|
||||
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
||||
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
class WXDLLEXPORT wxXmlIOHandlerLibxml : public wxXmlIOHandler
|
||||
{
|
||||
public:
|
||||
virtual wxXmlIOType GetType() { return wxXML_IO_LIBXML; }
|
||||
virtual bool CanLoad(wxInputStream& stream);
|
||||
virtual bool CanSave();
|
||||
|
||||
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
||||
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XMLIO_H_
|
255
contrib/include/wx/xml/xmlres.h
Normal file
255
contrib/include/wx/xml/xmlres.h
Normal file
@@ -0,0 +1,255 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xmlres.h
|
||||
// Purpose: XML resources
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2000/03/05
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XMLRES_H_
|
||||
#define _WX_XMLRES_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "xmlres.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/datetime.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
class wxMenu;
|
||||
class wxMenuBar;
|
||||
class wxDialog;
|
||||
class wxPanel;
|
||||
class wxWindow;
|
||||
|
||||
class wxXmlResourceHandler;
|
||||
|
||||
#include "wx/xml/xml.h"
|
||||
|
||||
enum
|
||||
{
|
||||
wxXML_BINARY,
|
||||
wxXML_ARCHIVE
|
||||
};
|
||||
|
||||
|
||||
|
||||
class WXDLLEXPORT wxXmlResourceDataRecord
|
||||
{
|
||||
public:
|
||||
wxXmlResourceDataRecord() : Doc(NULL), Time(wxDateTime::Now()) {}
|
||||
~wxXmlResourceDataRecord() {delete Doc;}
|
||||
|
||||
wxString File;
|
||||
wxXmlDocument *Doc;
|
||||
wxDateTime Time;
|
||||
};
|
||||
|
||||
WX_DECLARE_OBJARRAY(wxXmlResourceDataRecord, wxXmlResourceDataRecords);
|
||||
|
||||
// This class holds XML resources from one or more .xml files
|
||||
// (or derived forms, either binary or zipped -- see manual for
|
||||
// details).
|
||||
|
||||
class WXDLLEXPORT wxXmlResource : public wxObject
|
||||
{
|
||||
public:
|
||||
wxXmlResource();
|
||||
wxXmlResource(const wxString& filemask, int type);
|
||||
~wxXmlResource();
|
||||
|
||||
// Loads resources from XML files that match given filemask.
|
||||
// This method understands VFS (see filesys.h). Type is one of
|
||||
// wxXML_TEXT, wxXML_BINARY, wxXML_ARCHIVE and specifies type of
|
||||
// data to be expected:
|
||||
// wxXML_BINARY - binary version of .xml file, as produced
|
||||
// by wxXmlDocument::SaveBinary
|
||||
// wxXML_ARCHIVE - ZIP archive that contains arbitrary number
|
||||
// of files with .xmb extension
|
||||
// (this kind of ZIP archive is produced by
|
||||
// XML resources compiler that ships with wxWin)
|
||||
bool Load(const wxString& filemask, int type = wxXML_ARCHIVE);
|
||||
|
||||
// Initialize handlers for all supported controls/windows. This will
|
||||
// make the executable quite big because it forces linking against
|
||||
// most of wxWin library
|
||||
void InitAllHandlers();
|
||||
|
||||
// Initialize only specific handler (or custom handler). Convention says
|
||||
// that handler name is equal to control's name plus 'XmlHandler', e.g.
|
||||
// wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. XML resource compiler
|
||||
// (xmlres) can create include file that contains initialization code for
|
||||
// all controls used within the resource.
|
||||
void AddHandler(wxXmlResourceHandler *handler);
|
||||
|
||||
// Removes all handlers
|
||||
void ClearHandlers();
|
||||
|
||||
// Loads menu from resource. Returns NULL on failure.
|
||||
wxMenu *LoadMenu(const wxString& name);
|
||||
|
||||
// Loads menubar from resource. Returns NULL on failure.
|
||||
wxMenuBar *LoadMenuBar(const wxString& name);
|
||||
|
||||
// Loads dialog. dlg points to parent window (if any). Second form
|
||||
// is used to finish creation of already existing instance (main reason
|
||||
// for this is that you may want to use derived class with new event table)
|
||||
// Example (typical usage):
|
||||
// MyDialog dlg;
|
||||
// wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
|
||||
// dlg->ShowModal();
|
||||
wxDialog *LoadDialog(wxWindow *parent, const wxString& name);
|
||||
bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name);
|
||||
|
||||
// Loads panel. panel points to parent window (if any). Second form
|
||||
// is used to finish creation of already existing instance.
|
||||
wxPanel *LoadPanel(wxWindow *parent, const wxString& name);
|
||||
bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
|
||||
|
||||
// Returns numeric ID that is equivalent to string id used in XML
|
||||
// resource. To be used in event tables
|
||||
// Macro XMLID is provided for convenience
|
||||
static int GetXMLID(const char *str_id);
|
||||
|
||||
protected:
|
||||
// Scans resources list for unloaded files and loads them. Also reloads
|
||||
// files that have been modified since last loading.
|
||||
void UpdateResources();
|
||||
|
||||
// Finds resource (calls UpdateResources) and returns node containing it
|
||||
wxXmlNode *FindResource(const wxString& name, const wxString& type);
|
||||
|
||||
// Creates resource from info in given node:
|
||||
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL);
|
||||
|
||||
private:
|
||||
wxList m_Handlers;
|
||||
wxXmlResourceDataRecords m_Data;
|
||||
|
||||
friend class wxXmlResourceHandler;
|
||||
};
|
||||
|
||||
|
||||
// Global instance of resource class. For your convenience.
|
||||
extern wxXmlResource *wxTheXmlResource;
|
||||
|
||||
// This macro translates string identifier (as used in XML resource,
|
||||
// e.g. <menuitem id="my_menu">...</menuitem>) to integer id that is needed by
|
||||
// wxWindows event tables.
|
||||
// Example:
|
||||
// BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
// EVT_MENU(XMLID("quit"), MyFrame::OnQuit)
|
||||
// EVT_MENU(XMLID("about"), MyFrame::OnAbout)
|
||||
// EVT_MENU(XMLID("new"), MyFrame::OnNew)
|
||||
// EVT_MENU(XMLID("open"), MyFrame::OnOpen)
|
||||
// END_EVENT_TABLE()
|
||||
#define XMLID(str_id) wxXmlResource::GetXMLID(str_id)
|
||||
|
||||
|
||||
class WXDLLEXPORT wxXmlResourceHandler : public wxObject
|
||||
{
|
||||
public:
|
||||
wxXmlResourceHandler();
|
||||
virtual ~wxXmlResourceHandler() {}
|
||||
|
||||
// Creates object (menu, dialog, control, ...) from XML node.
|
||||
// Should check for validity.
|
||||
// parent is higher-level object (usually window, dialog or panel)
|
||||
// that is often neccessary to create resource
|
||||
// if instance != NULL it should not create new instance via 'new' but
|
||||
// rather use this one and call its Create method
|
||||
wxObject *CreateResource(wxXmlNode *node, wxObject *parent, wxObject *instance);
|
||||
|
||||
// This one is called from CreateResource after variables
|
||||
// were filled
|
||||
virtual wxObject *DoCreateResource() = 0;
|
||||
|
||||
// Returns TRUE if it understands this node and can create
|
||||
// resource from it, FALSE otherwise.
|
||||
virtual bool CanHandle(wxXmlNode *node) = 0;
|
||||
|
||||
// Check "platform" property if it matches this platform
|
||||
// that is, if this node 'exists' under this platform
|
||||
static bool CheckPlatform(wxXmlNode *node);
|
||||
|
||||
void SetParentResource(wxXmlResource *res) { m_Resource = res; }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
wxXmlResource *m_Resource;
|
||||
wxArrayString m_StyleNames;
|
||||
wxArrayInt m_StyleValues;
|
||||
|
||||
// Variables (filled by CreateResource)
|
||||
wxXmlNode *m_Node;
|
||||
wxObject *m_Parent, *m_Instance;
|
||||
wxWindow *m_ParentAsWindow, *m_InstanceAsWindow;
|
||||
|
||||
// --- Handy methods:
|
||||
|
||||
// Gets node content from wxXML_ENTITY_NODE
|
||||
// (the problem is, <tag>content<tag> is represented as
|
||||
// wxXML_ENTITY_NODE name="tag", content=""
|
||||
// |-- wxXML_TEXT_NODE or
|
||||
// wxXML_CDATA_SECTION_NODE name="" content="content"
|
||||
wxString GetNodeContent(wxXmlNode *node);
|
||||
|
||||
// Check to see if a param exists
|
||||
bool HasParam(const wxString& param);
|
||||
|
||||
// Finds the node or returns NULL
|
||||
wxXmlNode *GetParamNode(const wxString& param);
|
||||
wxString GetParamValue(const wxString& param);
|
||||
|
||||
// Add style flag (e.g. wxMB_DOCKABLE) to list of flags
|
||||
// understood by this handler
|
||||
void AddStyle(const wxString& name, int value);
|
||||
|
||||
// Gets style flags from text in form "flag | flag2| flag3 |..."
|
||||
// Only understads flags added with AddStyle
|
||||
int GetStyle(const wxString& param = _T("style"), int defaults = 0);
|
||||
|
||||
// Gets text from param and does some convertions:
|
||||
// - replaces \n, \r, \t by respective chars (according to C syntax)
|
||||
// - replaces $ by & and $$ by $ (needed for $File => &File because of XML)
|
||||
// - converts encodings if neccessary
|
||||
wxString GetText(const wxString& param);
|
||||
|
||||
// Return XMLID
|
||||
int GetID();
|
||||
wxString GetName();
|
||||
|
||||
// Get bool flag (1,t,yes,on,true are TRUE, everything else is FALSE)
|
||||
bool GetBool(const wxString& param, bool defaultv = FALSE);
|
||||
|
||||
// Get integer value from param
|
||||
long GetLong( const wxString& param, long defaultv = 0 );
|
||||
|
||||
// Get colour in HTML syntax (#RRGGBB)
|
||||
wxColour GetColour(const wxString& param);
|
||||
|
||||
wxSize GetSize(const wxString& param = _T("size"));
|
||||
wxPoint GetPosition(const wxString& param = _T("pos"));
|
||||
|
||||
// Sets common window options:
|
||||
void SetupWindow(wxWindow *wnd);
|
||||
|
||||
void CreateChildren(wxObject *parent, bool only_this_handler = FALSE,
|
||||
wxXmlNode *children_node = NULL /*stands for
|
||||
GetParamNode("children")*/);
|
||||
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL)
|
||||
{ return m_Resource->CreateResFromNode(node, parent, instance); }
|
||||
};
|
||||
|
||||
#define ADD_STYLE(style) AddStyle(_T(#style), style)
|
||||
|
||||
|
||||
|
||||
#endif // _WX_XMLRES_H_
|
Reference in New Issue
Block a user