Compare commits

..

1 Commits

Author SHA1 Message Date
Bryan Petty
4763aabfab This commit was manufactured by cvs2svn to create tag
'WXXML_BEFORE_EXPAT'.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/WXXML_BEFORE_EXPAT@9831 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-04-21 18:02:57 +00:00
240 changed files with 18344 additions and 19140 deletions

View File

@@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////
// 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"
#include "wx/xml/xh_listb.h"
#include "wx/xml/xh_toolb.h"
#include "wx/xml/xh_bmpbt.h"
#include "wx/xml/xh_stbox.h"
#include "wx/xml/xh_scrol.h"
#include "wx/xml/xh_tree.h"
#include "wx/xml/xh_cald.h"
#include "wx/xml/xh_listc.h"
#include "wx/xml/xh_stlin.h"
#include "wx/xml/xh_bmp.h"
#include "wx/xml/xh_unkwn.h"
#include "wx/xml/xh_frame.h"
#endif // _WX_XMLRES_H_

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bmp.h
// Purpose: XML resource handler for wxBitmap and wxIcon
// Author: Vaclav Slavik
// Created: 2000/09/00
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_BMP_H_
#define _WX_XH_BMP_H_
#ifdef __GNUG__
#pragma interface "xh_bmp.h"
#endif
#include "wx/xml/xmlres.h"
class WXDLLEXPORT wxBitmapXmlHandler : public wxXmlResourceHandler
{
public:
wxBitmapXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
class WXDLLEXPORT wxIconXmlHandler : public wxXmlResourceHandler
{
public:
wxIconXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_BMP_H_

View File

@@ -0,0 +1,30 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bmpbt.h
// Purpose: XML resource handler for bitmap buttons
// Author: Brian Gavin
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_BMPBT_H_
#define _WX_XH_BMPBT_H_
#ifdef __GNUG__
#pragma interface "xh_bmpbt.h"
#endif
#include "wx/xml/xmlres.h"
class WXDLLEXPORT wxBitmapButtonXmlHandler : public wxXmlResourceHandler
{
public:
wxBitmapButtonXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_BMPBT_H_

View 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 WXDLLEXPORT wxButtonXmlHandler : public wxXmlResourceHandler
{
public:
wxButtonXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_BTTN_H_

View File

@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_cald.h
// Purpose: XML resource handler for wxCalendarCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_CALD_H_
#define _WX_XH_CALD_H_
#ifdef __GNUG__
#pragma interface "xh_cald.h"
#endif
#include "wx/xml/xmlres.h"
class WXDLLEXPORT wxCalendarCtrlXmlHandler : public wxXmlResourceHandler
{
public:
wxCalendarCtrlXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_CALD_H_

View 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 WXDLLEXPORT wxCheckBoxXmlHandler : public wxXmlResourceHandler
{
public:
wxCheckBoxXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif
#endif // _WX_XH_CHECKBOX_H_

View 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 WXDLLEXPORT wxCheckListXmlHandler : public wxXmlResourceHandler
{
public:
wxCheckListXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
private:
bool m_InsideBox;
wxArrayString strList;
};
#endif // _WX_XH_CHECKLIST_H_

View 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 WXDLLEXPORT wxChoiceXmlHandler : public wxXmlResourceHandler
{
public:
wxChoiceXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
private:
bool m_InsideBox;
wxArrayString strList;
};
#endif // _WX_XH_CHOIC_H_

View 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 WXDLLEXPORT 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_

View 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 WXDLLEXPORT wxDialogXmlHandler : public wxXmlResourceHandler
{
public:
wxDialogXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_DLG_H_

View File

@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_frame.h
// Purpose: XML resource handler for dialogs
// Author: Vaclav Slavik & Aleks.
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_FRAME_H_
#define _WX_XH_FRAME_H_
#ifdef __GNUG__
#pragma interface "xh_frame.h"
#endif
#include "wx/xml/xmlres.h"
class WXDLLEXPORT wxFrameXmlHandler : public wxXmlResourceHandler
{
public:
wxFrameXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_FRAME_H_

View 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 WXDLLEXPORT wxGaugeXmlHandler : public wxXmlResourceHandler
{
enum
{
wxGAUGE_DEFAULT_RANGE = 100
};
public:
wxGaugeXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif
#endif // _WX_XH_GAUGE_H_

View 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 WXDLLEXPORT wxHtmlWindowXmlHandler : public wxXmlResourceHandler
{
public:
wxHtmlWindowXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif
#endif // _WX_XH_SLIDER_H_

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_listb.h
// Purpose: XML resource handler for wxListbox
// Author: Bob Mitchell & Vaclav Slavik
// Created: 2000/07/29
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell & Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_LISTB_H_
#define _WX_XH_LISTB_H_
#ifdef __GNUG__
#pragma interface "xh_listb.h"
#endif
#include "wx/xml/xmlres.h"
#if wxUSE_LISTBOX
class WXDLLEXPORT wxListBoxXmlHandler : public wxXmlResourceHandler
{
public:
wxListBoxXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
private:
bool m_InsideBox;
wxArrayString strList;
};
#endif
#endif // _WX_XH_LISTB_H_

View File

@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_listc.h
// Purpose: XML resource handler for wxCalendarCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_LISTC_H_
#define _WX_XH_LISTC_H_
#ifdef __GNUG__
#pragma interface "xh_listc.h"
#endif
#include "wx/xml/xmlres.h"
class WXDLLEXPORT wxListCtrlXmlHandler : public wxXmlResourceHandler
{
public:
wxListCtrlXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_LISTC_H_

View 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 WXDLLEXPORT wxMenuXmlHandler : public wxXmlResourceHandler
{
public:
wxMenuXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
private:
bool m_InsideMenu;
};
class WXDLLEXPORT wxMenuBarXmlHandler : public wxXmlResourceHandler
{
public:
wxMenuBarXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_MENU_H_

View 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 WXDLLEXPORT wxNotebook;
class WXDLLEXPORT 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_

View 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 WXDLLEXPORT wxPanelXmlHandler : public wxXmlResourceHandler
{
public:
wxPanelXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_PANEL_H_

View 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 WXDLLEXPORT wxRadioButtonXmlHandler : public wxXmlResourceHandler
{
public:
wxRadioButtonXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif
#endif // _WX_XH_RADIOBUTTON_H_

View 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 WXDLLEXPORT 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_

View File

@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_scrol.h
// Purpose: XML resource handler for wxScrollBar
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_SCROL_H_
#define _WX_XH_SCROL_H_
#ifdef __GNUG__
#pragma interface "xh_scrol.h"
#endif
#include "wx/xml/xmlres.h"
#include "wx/defs.h"
class WXDLLEXPORT wxScrollBarXmlHandler : public wxXmlResourceHandler
{
enum
{
wxSL_DEFAULT_VALUE = 0,
wxSL_DEFAULT_MIN = 0,
wxSL_DEFAULT_MAX = 100
};
public:
wxScrollBarXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_SCROL_H_

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////
// 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 WXDLLEXPORT wxSizer;
class WXDLLEXPORT wxSizerXmlHandler : public wxXmlResourceHandler
{
public:
wxSizerXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
private:
bool m_IsInside;
wxSizer *m_ParentSizer;
bool IsSizerNode(wxXmlNode *node);
};
#endif // _WX_XH_BOXSIZER_H_

View 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 WXDLLEXPORT 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_

View 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 WXDLLEXPORT 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 WXDLLEXPORT 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_

View 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 WXDLLEXPORT wxStaticBitmapXmlHandler : public wxXmlResourceHandler
{
public:
wxStaticBitmapXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_STBMP_H_

View File

@@ -0,0 +1,30 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_stbox.h
// Purpose: XML resource handler for wxStaticBox
// Author: Brian Gavin
// Created: 2000/09/00
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_STBOX_H_
#define _WX_XH_STBOX_H_
#ifdef __GNUG__
#pragma interface "xh_stbox.h"
#endif
#include "wx/xml/xmlres.h"
class WXDLLEXPORT wxStaticBoxXmlHandler : public wxXmlResourceHandler
{
public:
wxStaticBoxXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_STBOX_H_

View File

@@ -0,0 +1,32 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_stlin.h
// Purpose: XML resource handler for wxStaticLine
// Author: Vaclav Slavik
// Created: 2000/09/00
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_STLIN_H_
#define _WX_XH_STLIN_H_
#ifdef __GNUG__
#pragma interface "xh_stlin.h"
#endif
#include "wx/xml/xmlres.h"
#if wxUSE_STATLINE
class WXDLLEXPORT wxStaticLineXmlHandler : public wxXmlResourceHandler
{
public:
wxStaticLineXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif
#endif // _WX_XH_STLIN_H_

View 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 WXDLLEXPORT wxStaticTextXmlHandler : public wxXmlResourceHandler
{
public:
wxStaticTextXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_STBMP_H_

View 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 WXDLLEXPORT wxTextCtrlXmlHandler : public wxXmlResourceHandler
{
public:
wxTextCtrlXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_TEXT_H_

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_toolb.h
// Purpose: XML resource handler for wxBoxSizer
// Author: Vaclav Slavik
// Created: 2000/08/11
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_TOOLB_H_
#define _WX_XH_TOOLB_H_
#ifdef __GNUG__
#pragma interface "xh_toolb.h"
#endif
#include "wx/xml/xmlres.h"
#if wxUSE_TOOLBAR
class WXDLLEXPORT wxToolBar;
class WXDLLEXPORT wxToolBarXmlHandler : public wxXmlResourceHandler
{
public:
wxToolBarXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
private:
bool m_IsInside;
wxToolBar *m_Toolbar;
};
#endif
#endif // _WX_XH_TOOLBAR_H_

View File

@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_tree.h
// Purpose: XML resource handler for wxTreeCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_TREE_H_
#define _WX_XH_TREE_H_
#ifdef __GNUG__
#pragma interface "xh_tree.h"
#endif
#include "wx/xml/xmlres.h"
class WXDLLEXPORT wxTreeCtrlXmlHandler : public wxXmlResourceHandler
{
public:
wxTreeCtrlXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_TREE_H_

View File

@@ -0,0 +1,30 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_unkwn.h
// Purpose: XML resource handler for unkown widget
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_UNKWN_H_
#define _WX_XH_UNKWN_H_
#ifdef __GNUG__
#pragma interface "xh_unkwn.h"
#endif
#include "wx/xml/xmlres.h"
class WXDLLEXPORT wxUnknownWidgetXmlHandler : public wxXmlResourceHandler
{
public:
wxUnknownWidgetXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_UNKWN_H_

View File

@@ -0,0 +1,239 @@
/////////////////////////////////////////////////////////////////////////////
// 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 WXDLLEXPORT wxXmlNode;
class WXDLLEXPORT wxXmlProperty;
class WXDLLEXPORT wxXmlDocument;
class WXDLLEXPORT wxXmlIOHandler;
class WXDLLEXPORT wxInputStream;
class WXDLLEXPORT 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(wxT("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.
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_

View 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_

View File

@@ -0,0 +1,303 @@
/////////////////////////////////////////////////////////////////////////////
// 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"
#include "wx/filesys.h"
#include "wx/bitmap.h"
#include "wx/icon.h"
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxDialog;
class WXDLLEXPORT wxPanel;
class WXDLLEXPORT wxWindow;
class WXDLLEXPORT wxFrame;
class WXDLLEXPORT wxToolBar;
class WXDLLEXPORT wxXmlResourceHandler;
#include "wx/xml/xml.h"
class WXDLLEXPORT wxXmlResourceDataRecord
{
public:
wxXmlResourceDataRecord() : Doc(NULL), Time(wxDateTime::Now()) {}
~wxXmlResourceDataRecord() {delete Doc;}
wxString File;
wxXmlDocument *Doc;
wxDateTime Time;
};
WX_DECLARE_EXPORTED_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:
// Ctor. If use_locale is TRUE, translatable strings are
// translated via _(). You can disable it by passing use_locale=FALSE
// (for example if you provide resource file for each locale)
wxXmlResource(bool use_locale = TRUE);
wxXmlResource(const wxString& filemask, bool use_locale = TRUE);
~wxXmlResource();
// Loads resources from XML files that match given filemask.
// This method understands VFS (see filesys.h).
bool Load(const wxString& filemask);
// 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);
#if wxUSE_TOOLBAR
// Loads toolbar
wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name);
#endif
// 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);
bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
// Loads bitmap or icon resource from file:
wxBitmap LoadBitmap(const wxString& name);
wxIcon LoadIcon(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& classname);
// Creates resource from info in given node:
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL);
// Remove nodes with property "platform" that does not
// match current platform
void ProcessPlatformProperty(wxXmlNode *node);
bool GetUseLocale() { return m_UseLocale; }
private:
bool m_UseLocale;
wxList m_Handlers;
wxXmlResourceDataRecords m_Data;
#if wxUSE_FILESYSTEM
wxFileSystem m_CurFileSystem;
wxFileSystem& GetCurFileSystem() { return m_CurFileSystem; }
#endif
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(wxT(str_id))
// This macro returns pointer to particular control in dialog
// created using XML resources. You can use it to set/get values from
// controls.
// Example:
// wxDialog dlg;
// wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
// XMLCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
#define XMLCTRL(window, id, type) \
((type*)((window).FindWindow(XMLID(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;
void SetParentResource(wxXmlResource *res) { m_Resource = res; }
protected:
wxXmlResource *m_Resource;
wxArrayString m_StyleNames;
wxArrayInt m_StyleValues;
// Variables (filled by CreateResource)
wxXmlNode *m_Node;
wxString m_Class;
wxObject *m_Parent, *m_Instance;
wxWindow *m_ParentAsWindow, *m_InstanceAsWindow;
// --- Handy methods:
// Returns true if the node has property class equal to classname,
// e.g. <object class="wxDialog">
bool IsOfClass(wxXmlNode *node, const wxString& classname)
{ return node->GetPropVal(wxT("class"), wxEmptyString) == classname; }
// 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);
// Add styles common to all wxWindow-derived classes
void AddWindowStyles();
// Gets style flags from text in form "flag | flag2| flag3 |..."
// Only understads flags added with AddStyle
int GetStyle(const wxString& param = wxT("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)
// - calls wxGetTranslations (unless disabled in wxXmlResource)
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);
// Get size/position (may be in dlg units):
wxSize GetSize(const wxString& param = wxT("size"));
wxPoint GetPosition(const wxString& param = wxT("pos"));
// Get dimension (may be in dlg units):
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0);
// Get bitmap:
wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), wxSize size = wxDefaultSize);
wxIcon GetIcon(const wxString& param = wxT("icon"), wxSize size = wxDefaultSize);
// Get font:
wxFont GetFont(const wxString& param = wxT("font"));
// Sets common window options:
void SetupWindow(wxWindow *wnd);
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE);
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL)
{ return m_Resource->CreateResFromNode(node, parent, instance); }
// helper
wxFileSystem& GetCurFileSystem() { return m_Resource->GetCurFileSystem(); }
};
#define ADD_STYLE(style) AddStyle(wxT(#style), style)
#endif // _WX_XMLRES_H_

View File

@@ -0,0 +1,23 @@
###############################################################################
# Purpose: Makefile.in for xml resources sample for Unix with autoconf
# Created: 17.09.00
# Author: VS
# Version: $Id$
###############################################################################
top_srcdir = @top_srcdir@/..
top_builddir = ../../..
program_dir = contrib/samples/xml
PROGRAM=xmldemo
OBJECTS=$(PROGRAM).o
APPEXTRALIBS=$(top_builddir)/lib/libwxxml.@WX_TARGET_LIBRARY_TYPE@
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
DATADIRS = rc
DATAFILES = rc/resource.xrc rc/fileopen.gif rc/filesave.gif rc/fuzzy.gif \
rc/quotes.gif rc/scanning.gif rc/update.gif
include $(top_builddir)/src/makeprog.env

View File

@@ -0,0 +1,175 @@
# Microsoft Developer Studio Project File - Name="XmlDemoVC" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=XmlDemoVC - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "XmlDemoVC.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "XmlDemoVC.mak" CFG="XmlDemoVC - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "XmlDemoVC - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "XmlDemoVC - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "XmlDemoVC - Win32 Debug DLL" (based on "Win32 (x86) Application")
!MESSAGE "XmlDemoVC - Win32 Release DLL" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "XmlDemoVC - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib wxxml.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/xmldemo.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib"
!ELSEIF "$(CFG)" == "XmlDemoVC - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib wxxmld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/xmldemo.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib"
!ELSEIF "$(CFG)" == "XmlDemoVC - Win32 Debug DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugDLL"
# PROP BASE Intermediate_Dir "DebugDLL"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugDLL"
# PROP Intermediate_Dir "DebugDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /Yu"wx/wxprec.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdlld.lib wxxmld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/xmldemo.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib"
!ELSEIF "$(CFG)" == "XmlDemoVC - Win32 Release DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseDLL"
# PROP BASE Intermediate_Dir "ReleaseDLL"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseDLL"
# PROP Intermediate_Dir "ReleaseDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdll.lib wxxml.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/xmldemo.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib"
!ENDIF
# Begin Target
# Name "XmlDemoVC - Win32 Release"
# Name "XmlDemoVC - Win32 Debug"
# Name "XmlDemoVC - Win32 Debug DLL"
# Name "XmlDemoVC - Win32 Release DLL"
# Begin Source File
SOURCE=.\xmldemo.cpp
!IF "$(CFG)" == "XmlDemoVC - Win32 Release"
!ELSEIF "$(CFG)" == "XmlDemoVC - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "XmlDemoVC - Win32 Debug DLL"
# SUBTRACT BASE CPP /YX /Yc /Yu
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "XmlDemoVC - Win32 Release DLL"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\xmldemo.rc
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809 /i "../../../include" /i "../../../contrib/include"
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "XmlDemoVC"=.\XmlDemoVC.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,18 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 1999
# Updated:
# Copyright:
#
# Makefile : Builds sample for 32-bit BC++
WXDIR = $(WXWIN)
TARGET=xmldemo
EXTRALIBS=$(WXDIR)\contrib\lib\wxxml.lib
OBJECTS = $(TARGET).obj
!include $(WXDIR)\src\makeprog.b32

View File

@@ -0,0 +1,14 @@
# File: makefile.g95 for stectrl
# Author: Robin Dunn
# Created: 1-Feb-2000
# Updated:
WXDIR = ../../..
TARGET = xmldemo
OBJECTS = $(TARGET).o
EXTRAINC = -I$(WXDIR)/contrib/include
EXTRALIBS = -lwxxml
include $(WXDIR)/src/makeprog.g95

View File

@@ -0,0 +1,14 @@
# File: makefile.vc For stectrl
# Author: Robin Dunn
# Created: 1-Feb-2000
# Updated:
WXDIR = $(WXWIN)
PROGRAM = xmldemo
OBJECTS = $(PROGRAM).obj
EXTRALIBS = $(WXDIR)\contrib\lib\wxxml$(LIBEXT).lib
EXTRAINC = -I$(WXDIR)\contrib\include
!include $(WXDIR)\src\makeprog.vc

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,61 @@
/* XPM */
static char* appicon_xpm[]={
"32 32 26 1",
"s c #000000",
"u c #ff8000",
"m c #ffc0ff",
"q c #400000",
". c None",
"t c #004040",
"d c #303030",
"n c #ffdca8",
"e c #c0c0c0",
"x c #808000",
"o c #c00000",
"c c #585858",
"b c #a0a0a4",
"f c #c000c0",
"# c #000000",
"i c #808080",
"p c #ffa858",
"v c #ffff00",
"k c #800000",
"w c #c0c000",
"r c #004000",
"h c #404000",
"j c #ffc0c0",
"a c #ffffff",
"l c #c05800",
"g c #ff0000",
".....#####...........##.........",
"...##abbccd........##c#.........",
"###aaaebfgh########abi#.........",
"#cbaaaejggkiibeeaaaeeic#........",
"#ieaaaefggldggfjmnaaeei#........",
"#ibeaajggggcggggfmaaabi#b.......",
"#iieaajggggolgggggmaaeec#.......",
"#cieaajgggggdgggggpmaeec#.......",
"#cieaajgggggqgggggggaabi#.......",
"#dieaajpgggcc##cggggaaebc###....",
"#ribaamecccccs##cgggaebccth##...",
"#dieaa#qtdcch###tcs#iichd####...",
"##cbea##dccccs##qhhccccct#####..",
"##iiea##rhccch##tsdtcccdh#####..",
"##cbea###tccookk#hrdhccccs####..",
"##ciea###koogookkddtcccch###q#..",
"##tiea##qoggggokkqhqccccckokkk#.",
"##hbeb#qkoogggookkqkoklkoookkk#.",
"###icb#kkooggggokkdkogggggookk#.",
"###d..#kkoogggouukqkooggggookk#.",
"##....#kkkoguvvvwuhkogggggooko#.",
"##....##kolwvvvvvulcllggggulll#.",
"##....##kuuvvvvvuvudwuuuuuvuuu#.",
"......##uuuuvvvvvuuqivvvvvvuuu#.",
"......##uuuvvwwiqcllhuvvvvvuuu#.",
"......##uuuwl##xuphdivvvvvvvul#.",
"......##uuu##e.#vltcuvuvvvvux#..",
"......##ux#e....###uuww######...",
"......##i#......bbb####.........",
"......###.......................",
"......##........................",
"......##........................"};

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

View File

@@ -0,0 +1,154 @@
<?xml version="1.0"?>
<resource>
<object class="wxMenuBar" name="mainmenu">
<style>wxMB_DOCKABLE</style>
<object class="wxMenu" name="menu_file">
<label>$File</label>
<style>wxMENU_TEAROFF</style>
<object class="wxMenuItem" name="menu_about">
<label>$About...</label>
<bitmap>filesave.gif</bitmap>
</object>
<object class="separator"/>
<object class="wxMenuItem" name="menu_dlg1">
<label>Dialog 1</label>
</object>
<object class="wxMenuItem" name="menu_dlg2">
<label>Dialog 2</label>
</object>
<object class="separator"/>
<object class="wxMenuItem" name="menu_quit">
<label>E$xit\tAlt-X</label>
</object>
</object>
</object>
<object class="wxToolBar" name="toolbar">
<style>wxTB_FLAT|wxTB_DOCKABLE</style>
<margins>2,2</margins>
<object class="tool" name="menu_open">
<bitmap>fileopen.gif</bitmap>
<tooltip>Open catalog</tooltip>
</object>
<object class="tool" name="menu_save">
<bitmap>filesave.gif</bitmap>
<tooltip>Save catalog</tooltip>
</object>
<object class="tool" name="menu_update">
<bitmap>update.gif</bitmap>
<tooltip>Update catalog - synchronize it with sources</tooltip>
</object>
<separator/>
<object class="tool" name="menu_quotes">
<bitmap>quotes.gif</bitmap>
<toggle>1</toggle>
<tooltip>Display quotes around the string?</tooltip>
</object>
<object class="separator"/>
<object class="tool" name="menu_fuzzy">
<bitmap>fuzzy.gif</bitmap>
<tooltip>Toggled if selected string is fuzzy translation</tooltip>
<toggle>1</toggle>
</object>
</object>
<object class="wxDialog" name="dlg1">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxBitmapButton">
<bitmap>fuzzy.gif</bitmap>
<focus>fileopen.gif</focus>
</object>
</object>
<object class="sizeritem">
<object class="wxPanel">
<object class="wxStaticText">
<label>fdgdfgdfgdfg</label>
</object>
<style>wxSUNKEN_BORDER</style>
</object>
<flag>wxALIGN_CENTER</flag>
</object>
<object class="sizeritem">
<object class="wxButton">
<label>Buttonek</label>
</object>
<border>10d</border>
<flag>wxALL</flag>
</object>
<object class="sizeritem">
<object class="wxHtmlWindow">
<htmlcode>&lt;h1&gt;Hi,&lt;/h1&gt;man</htmlcode>
<size>100,45d</size>
</object>
</object>
<object class="sizeritem">
<object class="wxNotebook">
<object class="notebookpage">
<object class="wxPanel">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxHtmlWindow">
<htmlcode>Hello, we are inside a &lt;u&gt;NOTEBOOK&lt;/u&gt;...</htmlcode>
<size>50,50d</size>
</object>
<option>1</option>
</object>
</object>
</object>
<label>Page</label>
</object>
<object class="notebookpage">
<object class="wxPanel">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxHtmlWindow">
<htmlcode>Hello, we are inside a &lt;u&gt;NOTEBOOK&lt;/u&gt;...</htmlcode>
<size>50,50d</size>
</object>
</object>
</object>
</object>
<label>Page 2</label>
</object>
<usenotebooksizer>1</usenotebooksizer>
</object>
<flag>wxEXPAND</flag>
</object>
<orient>wxVERTICAL</orient>
</object>
</object>
<object class="wxDialog" name="dlg2">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem" name="dfgdfg">
<object class="wxTextCtrl">
<size>200,200d</size>
<style>wxTE_MULTILINE|wxSUNKEN_BORDER</style>
<value>Hello, this is an ordinary multiline\n textctrl....</value>
</object>
<option>1</option>
<flag>wxEXPAND|wxALL</flag>
<border>10</border>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxButton" name="wxID_OK">
<label>Ok</label>
<default>1</default>
</object>
</object>
<object class="sizeritem">
<object class="wxButton" name="wxID_CANCEL">
<label>Cancel</label>
</object>
<border>10</border>
<flag>wxLEFT</flag>
</object>
</object>
<flag>wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_RIGHT</flag>
<border>10</border>
</object>
</object>
<title>Second testing dialog</title>
</object>
</resource>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

View File

@@ -0,0 +1,168 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmldemo.cpp
// Purpose: XML resources sample
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "xmldemo.cpp"
#pragma interface "xmldemo.cpp"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWindows headers)
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/image.h"
#include "wx/xml/xmlres.h"
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
// the application icon
#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "rc/appicon.xpm"
#endif
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
// Define a new application type, each program should derive a class from wxApp
class MyApp : public wxApp
{
public:
// override base class virtuals
// ----------------------------
// this one is called on application startup and is a good place for the app
// initialization (doing it here and not in the ctor allows to have an error
// return: if OnInit() returns false, the application terminates)
virtual bool OnInit();
};
// Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame
{
public:
// ctor(s)
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
// event handlers (these functions should _not_ be virtual)
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnDlg1(wxCommandEvent& event);
void OnDlg2(wxCommandEvent& event);
private:
// any class wishing to process wxWindows events must use this macro
DECLARE_EVENT_TABLE()
};
// ----------------------------------------------------------------------------
// event tables and other macros for wxWindows
// ----------------------------------------------------------------------------
// the event tables connect the wxWindows events with the functions (event
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(XMLID("menu_quit"), MyFrame::OnQuit)
EVT_MENU(XMLID("menu_about"), MyFrame::OnAbout)
EVT_MENU(XMLID("menu_dlg1"), MyFrame::OnDlg1)
EVT_MENU(XMLID("menu_dlg2"), MyFrame::OnDlg2)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWindows to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp)
IMPLEMENT_APP(MyApp)
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// the application class
// ----------------------------------------------------------------------------
// 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
wxImage::AddHandler(new wxGIFHandler);
wxTheXmlResource->InitAllHandlers();
wxTheXmlResource->Load("rc/resource.xrc");
MyFrame *frame = new MyFrame("XML resources demo",
wxPoint(50, 50), wxSize(450, 340));
frame->Show(TRUE);
return TRUE;
}
// ----------------------------------------------------------------------------
// main frame
// ----------------------------------------------------------------------------
// frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
SetIcon(wxICON(appicon));
SetMenuBar(wxTheXmlResource->LoadMenuBar("mainmenu"));
SetToolBar(wxTheXmlResource->LoadToolBar(this, "toolbar"));
}
// event handlers
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
// TRUE is to force the frame to close
Close(TRUE);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxString msg;
msg.Printf( _T("This is the about dialog of XML resources demo.\n")
_T("Welcome to %s"), wxVERSION_STRING);
wxMessageBox(msg, "About XML resources demo", wxOK | wxICON_INFORMATION, this);
}
void MyFrame::OnDlg1(wxCommandEvent& WXUNUSED(event))
{
wxDialog dlg;
wxTheXmlResource->LoadDialog(&dlg, this, "dlg1");
dlg.ShowModal();
}
void MyFrame::OnDlg2(wxCommandEvent& WXUNUSED(event))
{
wxDialog dlg;
wxTheXmlResource->LoadDialog(&dlg, this, "dlg2");
dlg.ShowModal();
}

View File

@@ -0,0 +1,2 @@
appicon ICON "rc/appicon.ico"
#include "wx/msw/wx.rc"

324
contrib/src/xml/FORMAT.txt Normal file
View File

@@ -0,0 +1,324 @@
XML resources file format
===============================
1. Basics
-----------
XML resource is well-formed XML document, i.e. all tags are paired
and there is only one root node, which is always <resource>.
In the following text, I will use standard XML terminology:
<tag_one prop1="prop" prop2='yes'>
<tag_two/>
</tag_one>
Here, tag_one is a node (the word 'tag' refers to the type of the node),
prop1 and prop2 are properties and tag_two is a child node of tag_one.
Property's default value is the value that will be assigned to the property
if you do not specify it explicitly.
I will use the term "primary node" to refer to nodes than represent controls,
dialogs etc. "Secondary nodes" are nodes used to store data:
<dialog name="my_dlg"> primary
<title>Demo Dialog...</title> secondary
<size>100,200d</size> secondary
<children> secondary
<button name="wxID_OK"> primary
<label>Ok</label> secondary
<pos>10,10d</pos> secondary
</button>
</children>
</dialog>
In the example above, <label>, <pos>, <size> and <title> are "variables",
i.e. they contain a value and not a list of children (unlike <children> node).
Any node (but the root one) may have property "platform" with possible
values "unix", "win", "mac" or "os2". All nodes with "platform" property
specified and other than the platform the program is currently being executed
on will be removed when reading XML resource file.
Root node may have children of these and only these types: <menu>, <menubar>,
<dialog>, <panel>
2. IDs
--------
Any primary node may have property "name" used to identify it. Default value
is "-1", any string is legal name. Names
wxID_OPEN, wxID_CLOSE, wxID_NEW,
wxID_SAVE, wxID_SAVEAS, wxID_REVERT,
wxID_EXIT, wxID_UNDO, wxID_REDO,
wxID_HELP, wxID_PRINT, wxID_PRINT_SETUP,
wxID_PREVIEW, wxID_ABOUT, wxID_HELP_CONTENTS,
wxID_HELP_COMMANDS, wxID_HELP_PROCEDURES,
wxID_CUT, wxID_COPY, wxID_PASTE,
wxID_CLEAR, wxID_FIND, wxID_DUPLICATE,
wxID_SELECTALL, wxID_OK, wxID_CANCEL,
wxID_APPLY, wxID_YES, wxID_NO,
wxID_STATIC, wxID_FORWARD, wxID_BACKWARD,
wxID_DEFAULT, wxID_MORE, wxID_SETUP,
wxID_RESET, wxID_HELP_CONTEXT
are translated into corresponding wxWindows ID constant, XMLID macro is used
otherwise to generate unique ID. wxWindows control created from named node
will have name=name and id=XMLID(name) or wxID_XXXX.
3. Common variables types
---------------------------
Variables are always of a known type:
bool - boolean value. "1", "true", "t", "on" mean TRUE, anything
else (namely "0", "false", "f", "off") means FALSE.
FIXME: maybe use only 1/0 ??
integer - integer value, i.e. digits 0-9 plus optional minus sign.
text - anything. Within text node all occurences of $ are replaced
by & (used for shortcuts, e.g. "E&xit"), $$ by $, \\, \n, \r,
\t as usual in C++.
style - (also called flags) list of flags delimined by any combination
of spaces and | characters. Resources parser accepts only
_registered_ flags -- i.e. flags that are valid for given
node/control. Example:
<flag>wxEXPAND | wxTOP|wxBOTTOM</flag>
color - color in HTML format: #rrggbb where rr,gg,bb are hexadecimal
values (00-FF) for red, green and blue components in
the RGB color model
coord - size or position information. Consists of two integers
separated by comma ("x,y"). The values are in pixels
unless "d" is attached to the right side of it --
in which case the values are interpreted as dialog units.
Value of -1 means "use default". Examples:
30,30
-1,-1
50,-1
145,56d
67,-1d
4. Layout
-----------
Most common nodes layout is as follows:
<primary_node name="name" platform="platform">
<var_1>...</var_1>
.
.
.
<var_n>...</var_n>
<children>
(n primary nodes)
</children>
</primary_node>
where children node is supported only by panels, dialogs etc. -- see
nodes description for details.
In the following text,
TYPE var_name [ (= default_value) ]
means that given primary node may have child node with name var_name
and content type TYPE. If default value is given, the node is optional
and default_value will be used if not specified. Otherwise, the node
is mandatory and must always be present. For example, "color fg" means
than variable tag fg, e.g. <fg>#rr0000</fg> is expected.
5. Common controls variables
------------------------------
_All_ nodes that represent wxWindows controls (gauge, panel, dialog,
textctrl etc.) accept the following properties:
coord pos (= -1,-1) position of the control. Default value
equals to wxDefaultPosition
coord size (= -1,-1) size of the control. Default value equals to
wxDefaultSize
text tooltip window's tooltip
color bg background color of the control
color fg foreground/text color of the control
style style control style flag. Default value is
control-dependent (but 0 is common value)
style exstyle control extended style flag
bool enabled (= 1) is the control enabled?
bool hidden (= 0) is the control hidden?
bool focused (= 0) has the control focus?
_Usually_ (but not always, only when it makes sense) controls support text
variable label which contains displayed text and/or value which contains
editable text. These are always explicitly mentioned in tag description.
6. Tags description
---------------------
If 'Control' is derived from wxControl, it supports all variables from '5.'
'Styles' section lists all acceptable flags for style and exstyle variables.
<panel>
---------
Control:
wxPanel
Variables:
only common controls variables
Styles:
wxNO_3D, wxTAB_TRAVERSAL, wxWS_EX_VALIDATE_RECURSIVELY
<dialog>
----------
Control:
wxDialog
Variables:
style style (= wxDEFAULT_DIALOG_style)
text title dialog's title
Styles:
wxSTAY_ON_TOP, wxCAPTION, wxDEFAULT_DIALOG_style, wxTHICK_FRAME,
wxSYSTEM_MENU, wxRESIZE_BORDER, wxRESIZE_BOX, wxDIALOG_MODAL,
wxDIALOG_MODELESS, wxNO_3D, wxTAB_TRAVERSAL,
wxWS_EX_VALIDATE_RECURSIVELY
<boxsizer>
--------------
Control:
wxBoxSizer (not a control)
Behaviour:
boxsizer's parent must be either <panel>, <dialog> or another
sizer, nothing else!
If the sizer does not have parent sizer, the sizer will attach itself
to the parent panel/dialog using SetAutoLayout(TRUE) and SetSizer().
If the parent panel/dialog has default size (i.e. not specified in
the resource), the sizer will fit it using wxSizer::Fit(). If the
parent panel/dialog is resizable, size hints will be set
automatically.
Variables:
style orient (= wxHORIZONTAL) orientation, either
wxHORIZONTAL or wxVERTICAL
Styles:
wxHORIZONTAL, wxVERTICAL (for orient variable)
wxLEFT, wxRIGHT, wxTOP, wxBOTTOM, wxNORTH, wxSOUTH, wxEAST, wxWEST,
wxALL, wxGROW, wxEXPAND, wxSHAPED, wxSTRETCH_NOT, wxALIGN_CENTER,
wxALIGN_CENTRE, wxALIGN_LEFT, wxALIGN_TOP, wxALIGN_RIGHT,
wxALIGN_BOTTOM, wxALIGN_CENTER_HORIZONTAL, wxALIGN_CENTRE_HORIZONTAL,
wxALIGN_CENTER_HORIZONTAL, wxALIGN_CENTRE_HORIZONTAL (for flag
variable of <item> or <spacer> child nodes)
Child nodes:
Contains child node <children> which has arbitrary number of
<sizeritem> and <spacer> child nodes.
<sizeritem>
-------------
Variables:
integer option (= 0) relative size of the widget
style flag (= 0) style flag
integer border (= 0) surrounding border
Has exactly one child node <window> that contains the control
(or child sizer because sizers may be nested)
to be inserted into the sizer.
<spacer>
----------
Variables:
integer option (= 0) relative size of the widget
style flag (= 0) style flag
integer border (= 0) surrounding border
Inserts empty space into the sizer
<staticboxsizer>
------------------
Control:
wxStaticBoxSizer (not a control)
Same as <boxsizer> except that it has additional variable:
text label (= "") label of surrounding static box
wxStaticBox required by wxStaticBoxSizer is created automatically!
<notebooksizer>
-----------------
Control:
wxNotebookSizer (not a control)
Behaviour:
notebooksizer's parent must be a sizer (not notebooksizer,
see below)!
Variables:
none
Styles:
none
Child nodes:
Has exactly one child node <window> that contains the notebook
(nothing else is allowed!) to be inserted into the sizer.
<textctrl>
------------
Control:
wxTextCtrl
Variables:
text value (= "")default text of the control
Styles:
wxTE_PROCESS_ENTER, wxTE_PROCESS_TAB, wxTE_MULTILINE, wxTE_PASSWORD,
wxTE_READONLY, wxHSCROLL
<htmlwindow>
--------------
Control:
wxHtmlWindow
Variables:
integer borders (= 0) window's borders
(see wxHtmlWindow::SetBorders)
text url (= "") if present, given page will be loaded
text htmlcode (= "") if present, given _text_ will be displayed
(you will have to use CDATA section
to embed HTML code into XML document)
Styles:
wxHW_SCROLLBAR_NEVER, wxHW_SCROLLBAR_AUTO

View File

@@ -0,0 +1,34 @@
# $Id$
top_srcdir = @top_srcdir@/..
top_builddir = ../../..
libsrc_dir = contrib/src/xml
TARGET_LIBNAME=libwxxml
LIBVERSION_CURRENT=0
LIBVERSION_REVISION=1
LIBVERSION_AGE=0
HEADER_PATH=$(top_srcdir)/contrib/include/wx
HEADER_SUBDIR=xml
HEADERS=xh_all.h xh_bttn.h xh_chckb.h xh_chckl.h xh_choic.h xh_combo.h \
xh_dlg.h xh_gauge.h xh_html.h xh_menu.h xh_notbk.h xh_panel.h \
xh_radbt.h xh_radbx.h xh_sizer.h xh_slidr.h xh_spin.h xh_stbmp.h \
xh_sttxt.h xh_text.h xh_listb.h xml.h xmlio.h xmlres.h xh_toolb.h \
xh_bmpbt.h xh_cald.h xh_listc.h xh_scrol.h xh_stbox.h xh_tree.h \
xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h
OBJECTS=xml.o xmlbin.o xmlbinz.o xmlpars.o xmlres.o xmlrsall.o \
xh_bttn.o xh_chckb.o xh_chckl.o xh_choic.o xh_combo.o xh_dlg.o \
xh_gauge.o xh_html.o xh_menu.o xh_notbk.o xh_panel.o xh_radbt.o \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env

11
contrib/src/xml/README Normal file
View File

@@ -0,0 +1,11 @@
This is hightly incomplete version, not meant for general use!
You will need libxml version 2.2.3 or higher, available
from http://xmlsoft.org. There is a link to precompiled win32 DLL as well.
libxml is distributed under either GNU LGPL or W3C IPR
(http://www.w3.org/Consortium/Legal/copyright-software-19980720.html),
you can choose from them.

View File

@@ -0,0 +1,48 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 2000
# Updated:
# Copyright:
#
# Makefile : Builds BC++ library for 32-bit BC++
WXDIR = $(WXWIN)
# Do not specify the 'libxml' directory on
# this -I line, as the #includes use
# <libxml/xxxx.h>. If your libxml is installed
# in "d:\libxml\libxml2-2.1.1\libxml" you would use:
# wxLIBXMLDIR=/Id:\libxml\libxml2-2.1.1\include
wxLIBXMLDIR=/Ic:\progra~1\libxml\libxml2-2.3.3\include
!if "$(wxLIBXMLDIR)" == ""
!message
!message SETUP REQUIRED
!message
!message You must set the wxLIBXMLDIR variable in makefile.b32 before compiling
!message
!message If you do not have the libxml library, you will need to obtain & install
!message it before compiling the wxXML code. You can obtain libxml from:
!message http://www.xmlsoft.org
!message
!error
!endif
# Set this to where your libxml directory is
EXTRACPPFLAGS=$(wxLIBXMLDIR)
LIBTARGET=$(WXDIR)\lib\wxxml.lib
OBJECTS=xml.obj xmlbin.obj xmlbinz.obj xmlpars.obj xmlres.obj xmlrsall.obj \
xh_bttn.obj xh_chckb.obj xh_chckl.obj xh_choic.obj xh_combo.obj xh_dlg.obj \
xh_gauge.obj xh_html.obj xh_menu.obj xh_notbk.obj xh_panel.obj xh_radbt.obj \
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj \
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj \
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj \
xh_tree.obj xh_unkwn.obj xh_frame.obj
!include $(WXDIR)\src\makelib.b32

View File

@@ -0,0 +1,24 @@
#
# File: makefile.g95
# Author: Julian Smart
# Created: 2000
# Updated:
# Copyright: (c) Julian Smart, 2000
#
# Makefile for wxWindows wxXML library (Cygwin/Mingw32).
WXDIR = ../../..
EXTRACPPFLAGS=-Ic:/progra~1/libxml/libxml2-2.3.3/include
LIBTARGET=$(WXDIR)/lib/libwxxml.a
OBJECTS=xml.o xmlbin.o xmlbinz.o xmlpars.o xmlres.o xmlrsall.o \
xh_bttn.o xh_chckb.o xh_chckl.o xh_choic.o xh_combo.o xh_dlg.o \
xh_gauge.o xh_html.o xh_menu.o xh_notbk.o xh_panel.o xh_radbt.o \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \
xh_frame.o
include $(WXDIR)/src/makelib.g95

145
contrib/src/xml/makefile.vc Normal file
View File

@@ -0,0 +1,145 @@
# File: makefile.vc
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds wxXML classes library (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
wxXMLDIR = $(WXDIR)\contrib\src\xml
wxXMLINC = $(WXDIR)\contrib\include\wx\xml
THISDIR = $(WXDIR)\contrib\src\xml
DOCDIR=$(WXDIR)\contrib\docs
LOCALDOCDIR=$(WXDIR)\contrib\docs\latex\xml
# Do not specify the 'libxml' directory on
# this -I line, as the #includes use
# <libxml/xxxx.h>. If your libxml is installed
# in "d:\libxml\libxml2-2.1.1\libxml" you would use:
# wxLIBXMLDIR=-Id:\libxml\libxml2-2.1.1
wxLIBXMLDIR=
!if "$(wxLIBXMLDIR)" == ""
!message
!message SETUP REQUIRED
!message
!message You must set the wxLIBXMLDIR variable in makefile.vc before compiling
!message
!message If you do not have the libxml library, you will need to obtain & install
!message it before compiling the wxXML code. You can obtain libxml from:
!message http://www.xmlsoft.org
!message
!error
!endif
# Set this to where your libxml directory is
EXTRAFLAGS=$(wxLIBXMLDIR)
# Unfortunately we need this _before_ we include makelib.vc
!if "$(FINAL)" == "1"
D=Release
!else
D=Debug
LIBEXT=d
!endif
LIBTARGET=$(WXDIR)\lib\wxxml$(LIBEXT).lib
EXTRATARGETS=$(D)
OBJECTS=$(D)\xml.obj $(D)\xmlbin.obj $(D)\xmlbinz.obj $(D)\xmlpars.obj $(D)\xmlres.obj $(D)\xmlrsall.obj \
$(D)\xh_bttn.obj $(D)\xh_chckb.obj $(D)\xh_chckl.obj $(D)\xh_choic.obj $(D)\xh_combo.obj $(D)\xh_dlg.obj \
$(D)\xh_frame.obj $(D)\xh_gauge.obj $(D)\xh_html.obj $(D)\xh_menu.obj $(D)\xh_notbk.obj $(D)\xh_panel.obj $(D)\xh_radbt.obj \
$(D)\xh_radbx.obj $(D)\xh_sizer.obj $(D)\xh_slidr.obj $(D)\xh_spin.obj $(D)\xh_stbmp.obj $(D)\xh_sttxt.obj \
$(D)\xh_text.obj $(D)\xh_listb.obj $(D)\xh_toolb.obj \
$(D)\xh_bmpbt.obj $(D)\xh_cald.obj $(D)\xh_listc.obj $(D)\xh_scrol.obj \
$(D)\xh_stbox.obj $(D)\xh_tree.obj $(D)\xh_stlin.obj $(D)\xh_bmp.obj \
$(D)\xh_unkwn.obj
!include $(WXDIR)\src\makelib.vc
DOCSOURCES=$(LOCALDOCDIR)\xml.tex \
$(LOCALDOCDIR)\bugs.tex $(LOCALDOCDIR)\changes.tex\
$(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\intro.tex\
$(LOCALDOCDIR)\topics.tex $(LOCALDOCDIR)\sample.tex
html: $(DOCDIR)\html\xml\xml.htm
htmlhelp: $(DOCDIR)\htmlhelp\xml.chm
htb: $(DOCDIR)\htb\xml.htb
hlp: $(DOCDIR)\winhelp\xml.hlp
pdfrtf: $(DOCDIR)\pdf\xml.rtf
ps: $(DOCDIR)\ps\xml.ps
touchmanual:
touch $(LOCALDOCDIR)\xml.tex
$(DOCDIR)\winhelp\xml.hlp: $(LOCALDOCDIR)\xml.rtf $(LOCALDOCDIR)\xml.hpj
cd $(LOCALDOCDIR)
-erase xml.ph
hc xml
move xml.hlp $(DOCDIR)\winhelp\xml.hlp
move xml.cnt $(DOCDIR)\winhelp\xml.cnt
cd $(THISDIR)
$(LOCALDOCDIR)\xml.rtf: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\xml.tex $(LOCALDOCDIR)\xml.rtf -twice -winhelp
cd $(THISDIR)
$(DOCDIR)\pdf\xml.rtf: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-copy *.bmp $(DOCDIR)\pdf
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\xml.tex $(DOCDIR)\pdf\xml.rtf -twice -rtf
cd $(THISDIR)
$(DOCDIR)\html\xml\xml.htm: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-mkdir $(DOCDIR)\html\xml
copy *.gif $(DOCDIR)\html\xml
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\xml.tex $(DOCDIR)\html\xml\xml.htm -twice -html
-erase $(DOCDIR)\html\xml\*.con
-erase *.con
-erase $(DOCDIR)\html\xml\*.ref
cd $(THISDIR)
$(DOCDIR)\htmlhelp\xml.chm: $(DOCDIR)\html\xml\xml.htm $(DOCDIR)\html\xml\xml.hhp
cd $(DOCDIR)\html\xml
-hhc xml.hhp
move xml.chm $(DOCDIR)\htmlhelp\xml.chm
cd $(THISDIR)
# An htb file is a zip file containing the .htm, .gif, .hhp, .hhc and .hhk
# files, renamed to htb.
# This can then be used with e.g. helpview.
# Optionally, a cached version of the .hhp file can be generated with hhp2cached.
$(DOCDIR)\htb\xml.htb: $(DOCDIR)\html\xml\xml.htm
cd $(DOCDIR)\html\xml
-erase xml.zip xml.htb
zip xml.zip *.htm *.gif *.hhp *.hhc *.hhk
-mkdir $(DOCDIR)\htb
move xml.zip $(DOCDIR)\htb\xml.htb
cd $(THISDIR)
$(LOCALDOCDIR)\xml.dvi: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-latex xml
-latex xml
-makeindx xml
-bibtex xml
-latex xml
-latex xml
cd $(THISDIR)
$(WXDIR)\docs\ps\xml.ps: $(LOCALDOCDIR)\xml.dvi
cd $(LOCALDOCDIR)
-dvips32 -o xml.ps xml
move xml.ps $(WXDIR)\docs\ps\xml.ps
cd $(THISDIR)

View File

@@ -0,0 +1,31 @@
# wxXML makefile
WXDIR = ..\..\..
EXTRACPPFLAGS=/Id:\libxml\libxml2-2.1.1
!include $(WXDIR)\src\makewat.env
WXXMLLIB = $(WXDIR)\lib\wxxml.lib
THISDIR = $(WXDIR)\contrib\src\xml
NAME = wxxml
LNK = $(name).lnk
OBJECTS=xml.obj xmlbin.obj xmlbinz.obj xmlpars.obj xmlres.obj xmlrsall.obj &
xh_bttn.obj xh_chckb.obj xh_chckl.obj xh_choic.obj xh_combo.obj xh_dlg.obj &
xh_gauge.obj xh_html.obj xh_menu.obj xh_notbk.obj xh_panel.obj xh_radbt.obj &
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj &
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj &
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj &
xh_tree.obj xh_unkwn.obj xh_frame.obj
all: $(WXXMLLIB)
$(WXXMLLIB): $(OBJECTS)
*wlib /b /c /n /P=256 $(WXXMLLIB) $(OBJECTS)
clean: .SYMBOLIC
-erase *.obj *.bak *.err *.pch $(WXXMLLIB) *.lbc

230
contrib/src/xml/wxXMLVC.dsp Normal file
View File

@@ -0,0 +1,230 @@
# Microsoft Developer Studio Project File - Name="wxXMLVC" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=wxXMLVC - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "wxXMLVC.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "wxXMLVC.mak" CFG="wxXMLVC - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wxXMLVC - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "wxXMLVC - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "wxXMLVC - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /I "d:\libxml\libxml2-2.1.1" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\wxxml.lib"
!ELSEIF "$(CFG)" == "wxXMLVC - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "../../../include" /I "../../include" /I "d:\libxml\libxml2-2.1.1" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\wxxmld.lib"
!ENDIF
# Begin Target
# Name "wxXMLVC - Win32 Release"
# Name "wxXMLVC - Win32 Debug"
# Begin Source File
SOURCE=.\xh_bttn.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_chckb.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_chckl.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_choic.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_combo.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_dlg.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_gauge.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_html.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_menu.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_notbk.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_panel.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_radbt.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_radbx.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_sizer.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_slidr.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_spin.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stbmp.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_sttxt.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_text.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_listb.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_toolb.cpp
# End Source File
# Begin Source File
SOURCE=.\xml.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlbin.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlbinz.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlpars.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlres.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_bmpbt.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_cald.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_listc.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_scrol.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stbox.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_tree.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stlin.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_bmp.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_unkwn.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlrsall.cpp
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "wxXMLVC"=.\wxXMLVC.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bmp.cpp
// Purpose: XML resource for wxBitmap and wxIcon
// Author: Vaclav Slavik
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_bmp.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_bmp.h"
#include "wx/bitmap.h"
wxBitmapXmlHandler::wxBitmapXmlHandler()
: wxXmlResourceHandler()
{
}
wxObject *wxBitmapXmlHandler::DoCreateResource()
{
return new wxBitmap(GetBitmap(wxT("")));
}
bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmap"));
}
wxIconXmlHandler::wxIconXmlHandler()
: wxXmlResourceHandler()
{
}
wxObject *wxIconXmlHandler::DoCreateResource()
{
return new wxIcon(GetIcon(wxT("")));
}
bool wxIconXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxIcon"));
}

View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bmpbt.cpp
// Purpose: XML resource for bitmap buttons
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_bmpbt.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_bmpbt.h"
#include <wx/bmpbuttn.h>
wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxBU_AUTODRAW);
ADD_STYLE(wxBU_LEFT);
ADD_STYLE(wxBU_RIGHT);
ADD_STYLE(wxBU_TOP);
ADD_STYLE(wxBU_BOTTOM);
AddWindowStyles();
}
wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
{
wxBitmapButton *button = new wxBitmapButton(m_ParentAsWindow,
GetID(),
GetBitmap(wxT("bitmap")),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxBU_AUTODRAW),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
SetupWindow(button);
if (!GetParamValue(wxT("selected")).IsEmpty())
button->SetBitmapSelected(GetBitmap(wxT("selected")));
if (!GetParamValue(wxT("focus")).IsEmpty())
button->SetBitmapFocus(GetBitmap(wxT("focus")));
if (!GetParamValue(wxT("disabled")).IsEmpty())
button->SetBitmapDisabled(GetBitmap(wxT("disabled")));
return button;
}
bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmapButton"));
}

View File

@@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bttn.cpp
// Purpose: XML resource for buttons
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_bttn.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_bttn.h"
#include "wx/button.h"
wxButtonXmlHandler::wxButtonXmlHandler()
: wxXmlResourceHandler()
{
AddWindowStyles();
}
wxObject *wxButtonXmlHandler::DoCreateResource()
{
wxButton *button = new wxButton(m_ParentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
SetupWindow(button);
return button;
}
bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxButton"));
}

View File

@@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_cald.cpp
// Purpose: XML resource for wxCalendarCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_cald.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_cald.h"
#include "wx/calctrl.h"
wxCalendarCtrlXmlHandler::wxCalendarCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxCAL_SUNDAY_FIRST);
ADD_STYLE(wxCAL_MONDAY_FIRST);
ADD_STYLE(wxCAL_SHOW_HOLIDAYS);
ADD_STYLE(wxCAL_NO_YEAR_CHANGE);
ADD_STYLE(wxCAL_NO_MONTH_CHANGE);
AddWindowStyles();
}
wxObject *wxCalendarCtrlXmlHandler::DoCreateResource()
{
wxCalendarCtrl *calendar = new wxCalendarCtrl(m_ParentAsWindow,
GetID(),
wxDefaultDateTime,
/*TODO: take it from resource*/
GetPosition(), GetSize(),
GetStyle(),
GetName());
SetupWindow(calendar);
return calendar;
}
bool wxCalendarCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCalendarCtrl"));
}

View File

@@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_chckb.cpp
// Purpose: XML resource for wxCheckBox
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_chckb.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_chckb.h"
#include "wx/checkbox.h"
#if wxUSE_CHECKBOX
wxCheckBoxXmlHandler::wxCheckBoxXmlHandler()
: wxXmlResourceHandler()
{
AddWindowStyles();
}
wxObject *wxCheckBoxXmlHandler::DoCreateResource()
{
wxCheckBox *control = new wxCheckBox(m_ParentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
control->SetValue( GetBool( wxT("checked")));
SetupWindow(control);
return control;
}
bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCheckBox"));
}
#endif

View File

@@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_chckl.cpp
// Purpose: XML resource for wxCheckList
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_chckl.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_chckl.h"
#include "wx/checklst.h"
wxCheckListXmlHandler::wxCheckListXmlHandler()
: wxXmlResourceHandler(), m_InsideBox(FALSE)
{
// no styles
AddWindowStyles();
}
wxObject *wxCheckListXmlHandler::DoCreateResource()
{
if (m_Class == wxT("wxCheckList"))
{
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxCheckListBox *control = new wxCheckListBox(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
// step through children myself (again.)
wxXmlNode *n = GetParamNode(wxT("content"));
if (n) n = n->GetChildren();
int i = 0;
while (n)
{
if (n->GetType() != wxXML_ELEMENT_NODE ||
n->GetName() != wxT("item"))
{ n = n->GetNext(); continue; }
// checking boolean is a bit ugly here (see GetBool() )
wxString v = n->GetPropVal(wxT("checked"), wxEmptyString);
v.MakeLower();
if (v && v == wxT("1"))
control->Check( i, TRUE );
i++;
n = n->GetNext();
}
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item checked="boolean">Label</item>
// add to the list
strList.Add( GetNodeContent(m_Node) );
return NULL;
}
}
bool wxCheckListXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxCheckList")) ||
(m_InsideBox && node->GetName() == wxT("item"))
);
}

View File

@@ -0,0 +1,95 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_choic.cpp
// Purpose: XML resource for wxChoice
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_choic.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_choic.h"
#include "wx/choice.h"
wxChoiceXmlHandler::wxChoiceXmlHandler()
: wxXmlResourceHandler() , m_InsideBox(FALSE)
{
ADD_STYLE(wxCB_SORT);
AddWindowStyles();
}
wxObject *wxChoiceXmlHandler::DoCreateResource()
{
if( m_Class == wxT("wxChoice"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxChoice *control = new wxChoice(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_Node) );
return NULL;
}
}
bool wxChoiceXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxChoice")) ||
(m_InsideBox && node->GetName() == wxT("item"))
);
}

View File

@@ -0,0 +1,101 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_combo.cpp
// Purpose: XML resource for wxRadioBox
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_combo.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_combo.h"
#include "wx/combobox.h"
#if wxUSE_COMBOBOX
wxComboBoxXmlHandler::wxComboBoxXmlHandler()
: wxXmlResourceHandler() , m_InsideBox(FALSE)
{
ADD_STYLE(wxCB_SIMPLE);
ADD_STYLE(wxCB_SORT);
ADD_STYLE(wxCB_READONLY);
ADD_STYLE(wxCB_DROPDOWN);
AddWindowStyles();
}
wxObject *wxComboBoxXmlHandler::DoCreateResource()
{
if( m_Class == wxT("wxComboBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxComboBox *control = new wxComboBox(m_ParentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_Node) );
return NULL;
}
}
bool wxComboBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxComboBox")) ||
(m_InsideBox && node->GetName() == wxT("item"))
);
}
#endif

View File

@@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_dlg.cpp
// Purpose: XML resource for dialogs
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_dlg.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_dlg.h"
#include "wx/dialog.h"
#include "wx/log.h"
#include "wx/intl.h"
wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxCAPTION);
ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
ADD_STYLE(wxTHICK_FRAME);
ADD_STYLE(wxSYSTEM_MENU);
ADD_STYLE(wxRESIZE_BORDER);
ADD_STYLE(wxRESIZE_BOX);
ADD_STYLE(wxDIALOG_MODAL);
ADD_STYLE(wxDIALOG_MODELESS);
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxDialogXmlHandler::DoCreateResource()
{
wxDialog *dlg = wxDynamicCast(m_Instance, wxDialog);
wxASSERT_MSG(dlg, _("XML resource: Cannot create dialog without instance."));
dlg->Create(m_ParentAsWindow,
GetID(),
GetText(wxT("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(wxT("style"), wxDEFAULT_DIALOG_STYLE),
GetName());
dlg->SetClientSize(GetSize());
dlg->Move(GetPosition());
SetupWindow(dlg);
CreateChildren(dlg);
if (GetBool(_("centered"), FALSE))
dlg->Centre();
return dlg;
}
bool wxDialogXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxDialog"));
}

View File

@@ -0,0 +1,84 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_frame.cpp
// Purpose: XML resource for dialogs
// Author: Vaclav Slavik & Aleks.
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_frame.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_frame.h"
#include "wx/frame.h"
#include "wx/log.h"
#include "wx/intl.h"
wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxCAPTION);
ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
ADD_STYLE(wxTHICK_FRAME);
ADD_STYLE(wxSYSTEM_MENU);
ADD_STYLE(wxRESIZE_BORDER);
ADD_STYLE(wxRESIZE_BOX);
ADD_STYLE(wxFRAME_TOOL_WINDOW);
ADD_STYLE(wxFRAME_FLOAT_ON_PARENT);
ADD_STYLE(wxMAXIMIZE_BOX);
ADD_STYLE(wxMINIMIZE_BOX);
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxFrameXmlHandler::DoCreateResource()
{
wxFrame *frame = wxDynamicCast(m_Instance, wxFrame);
wxASSERT_MSG(frame, _("XML resource: Cannot create dialog without instance."));
frame->Create(m_ParentAsWindow,
GetID(),
GetText(_T("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(_T("style"), wxDEFAULT_FRAME_STYLE),
GetName());
frame->SetClientSize(GetSize());
frame->Move(GetPosition());
SetupWindow(frame);
CreateChildren(frame);
if (GetBool(_("centered"), FALSE))
frame->Centre();
return frame;
}
bool wxFrameXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("wxFrame"));
}

View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_gauge.cpp
// Purpose: XML resource for wxGauge
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_gauge.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_gauge.h"
#include "wx/gauge.h"
#if wxUSE_GAUGE
wxGaugeXmlHandler::wxGaugeXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxGA_HORIZONTAL );
ADD_STYLE( wxGA_VERTICAL );
ADD_STYLE( wxGA_PROGRESSBAR );
ADD_STYLE( wxGA_SMOOTH ); // windows only
AddWindowStyles();
}
wxObject *wxGaugeXmlHandler::DoCreateResource()
{
wxGauge *control = new wxGauge(m_ParentAsWindow,
GetID(),
GetLong( wxT("range"), wxGAUGE_DEFAULT_RANGE),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
if( HasParam( wxT("value") ))
{
control->SetValue( GetLong( wxT("value") ));
}
if( HasParam( wxT("shadow") ))
{
control->SetShadowWidth( GetDimension( wxT("shadow") ));
}
if( HasParam( wxT("bezel") ))
{
control->SetBezelFace( GetDimension( wxT("bezel") ));
}
SetupWindow(control);
return control;
}
bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxGauge"));
}
#endif // wxUSE_GAUGE

View File

@@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_html.cpp
// Purpose: XML resource for wxHtmlWindow
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_html.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_html.h"
#if wxUSE_HTML
#include "wx/html/htmlwin.h"
wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxHW_SCROLLBAR_NEVER );
ADD_STYLE( wxHW_SCROLLBAR_AUTO );
AddWindowStyles();
}
wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
{
wxHtmlWindow *control = new wxHtmlWindow(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle( wxT("style" ), wxHW_SCROLLBAR_AUTO),
GetName()
);
if( HasParam( wxT("borders") ))
{
control->SetBorders( GetDimension( wxT("borders" )));
}
if( HasParam( wxT("url") ))
{
control->LoadPage( GetParamValue( wxT("url" )));
}
else if( HasParam( wxT("htmlcode") ))
{
control->SetPage( GetText(wxT("htmlcode")) );
}
SetupWindow(control);
return control;
}
bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxHtmlWindow"));
}
#endif // wxUSE_HTML

View File

@@ -0,0 +1,101 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_listb.cpp
// Purpose: XML resource for wxListBox
// Author: Bob Mitchell & Vaclav Slavik
// Created: 2000/07/29
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_listb.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_listb.h"
#include "wx/listbox.h"
wxListBoxXmlHandler::wxListBoxXmlHandler()
: wxXmlResourceHandler() , m_InsideBox(FALSE)
{
ADD_STYLE(wxLB_SINGLE);
ADD_STYLE(wxLB_MULTIPLE);
ADD_STYLE(wxLB_EXTENDED);
ADD_STYLE(wxLB_HSCROLL);
ADD_STYLE(wxLB_ALWAYS_SB);
ADD_STYLE(wxLB_NEEDED_SB);
ADD_STYLE(wxLB_SORT);
AddWindowStyles();
}
wxObject *wxListBoxXmlHandler::DoCreateResource()
{
if( m_Class == wxT("wxListBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxListBox *control = new wxListBox(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_Node) );
return NULL;
}
}
bool wxListBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxListBox")) ||
(m_InsideBox && node->GetName() == wxT("item"))
);
}

View File

@@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_listc.cpp
// Purpose: XML resource for wxListCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_listc.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/textctrl.h"
#include "wx/xml/xh_listc.h"
#include "wx/listctrl.h"
wxListCtrlXmlHandler::wxListCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxLC_LIST);
ADD_STYLE(wxLC_REPORT);
ADD_STYLE(wxLC_ICON);
ADD_STYLE(wxLC_SMALL_ICON);
ADD_STYLE(wxLC_ALIGN_TOP);
ADD_STYLE(wxLC_ALIGN_LEFT);
ADD_STYLE(wxLC_AUTOARRANGE);
ADD_STYLE(wxLC_USER_TEXT);
ADD_STYLE(wxLC_EDIT_LABELS);
ADD_STYLE(wxLC_NO_HEADER);
ADD_STYLE(wxLC_SINGLE_SEL);
ADD_STYLE(wxLC_SORT_ASCENDING);
ADD_STYLE(wxLC_SORT_DESCENDING);
AddWindowStyles();
}
wxObject *wxListCtrlXmlHandler::DoCreateResource()
{
wxListCtrl *list = new wxListCtrl(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
/* TODO: columns definition */
SetupWindow(list);
return list;
}
bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxListCtrl"));
}

130
contrib/src/xml/xh_menu.cpp Normal file
View File

@@ -0,0 +1,130 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_menu.cpp
// Purpose: XML resource for menus and menubars
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_menu.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_menu.h"
#include "wx/menu.h"
wxMenuXmlHandler::wxMenuXmlHandler() :
wxXmlResourceHandler(), m_InsideMenu(FALSE)
{
ADD_STYLE(wxMENU_TEAROFF);
}
wxObject *wxMenuXmlHandler::DoCreateResource()
{
if (m_Class == wxT("wxMenu"))
{
wxMenu *menu = new wxMenu(GetStyle());
wxString title = GetText(wxT("label"));
wxString help = GetText(wxT("help"));
bool oldins = m_InsideMenu;
m_InsideMenu = TRUE;
CreateChildren(menu, TRUE/*only this handler*/);
m_InsideMenu = oldins;
wxMenuBar *p_bar = wxDynamicCast(m_Parent, wxMenuBar);
if (p_bar)
p_bar->Append(menu, title);
else
{
wxMenu *p_menu = wxDynamicCast(m_Parent, wxMenu);
if (p_menu)
p_menu->Append(GetID(), title, menu, help);
}
return menu;
}
else
{
wxMenu *p_menu = wxDynamicCast(m_Parent, wxMenu);
if (m_Class == wxT("separator"))
p_menu->AppendSeparator();
else if (m_Class == wxT("break"))
p_menu->Break();
else /*wxMenuItem*/
{
int id = GetID();
bool checkable = GetBool(wxT("checkable"));
wxMenuItem *mitem = new wxMenuItem(p_menu, id, GetText(wxT("label")),
GetText(wxT("help")), checkable);
#if wxCHECK_VERSION(2,3,0) || defined(__WXMSW__)
if (HasParam(wxT("bitmap")))
mitem->SetBitmap(GetBitmap(wxT("bitmap")));
#endif
p_menu->Append(mitem);
mitem->Enable(GetBool(wxT("enabled"), TRUE));
if (checkable) mitem->Check(GetBool(wxT("checked")));
}
return NULL;
}
}
bool wxMenuXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxMenu")) ||
(m_InsideMenu &&
(IsOfClass(node, wxT("wxMenuItem")) ||
IsOfClass(node, wxT("break")) ||
IsOfClass(node, wxT("separator")))
);
}
wxMenuBarXmlHandler::wxMenuBarXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxMB_DOCKABLE);
}
wxObject *wxMenuBarXmlHandler::DoCreateResource()
{
wxMenuBar *menubar = new wxMenuBar(GetStyle());
CreateChildren(menubar);
return menubar;
}
bool wxMenuBarXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxMenuBar"));
}

View File

@@ -0,0 +1,100 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_notbk.cpp
// Purpose: XML resource for wxNotebook
// Author: Vaclav Slavik
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_notbk.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_notbk.h"
#if wxUSE_NOTEBOOK
#include "wx/log.h"
#include "wx/notebook.h"
#include "wx/sizer.h"
wxNotebookXmlHandler::wxNotebookXmlHandler()
: wxXmlResourceHandler(), m_IsInside(FALSE), m_Notebook(NULL)
{
ADD_STYLE(wxNB_FIXEDWIDTH);
ADD_STYLE(wxNB_LEFT);
ADD_STYLE(wxNB_RIGHT);
ADD_STYLE(wxNB_BOTTOM);
AddWindowStyles();
}
wxObject *wxNotebookXmlHandler::DoCreateResource()
{
if (m_Class == wxT("notebookpage"))
{
wxXmlNode *n = GetParamNode(wxT("object"));
if (n)
{
bool old_ins = m_IsInside;
m_IsInside = FALSE;
m_IsInside = old_ins;
wxObject *item = CreateResFromNode(n, m_Notebook, NULL);
wxWindow *wnd = wxDynamicCast(item, wxWindow);
if (wnd)
m_Notebook->AddPage(wnd, GetText(wxT("label")),
GetBool(wxT("selected"), 0));
else
wxLogError(wxT("Error in resource."));
return wnd;
}
else
{
wxLogError(wxT("Error in resource: no control within notebook's <page> tag."));
return NULL;
}
}
else {
wxNotebook *nb = new wxNotebook(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle( wxT("style" )),
GetName());
wxNotebook *old_par = m_Notebook;
m_Notebook = nb;
bool old_ins = m_IsInside;
m_IsInside = TRUE;
CreateChildren(m_Notebook, TRUE/*only this handler*/);
m_IsInside = old_ins;
m_Notebook = old_par;
if (GetBool(wxT("usenotebooksizer"), FALSE))
return new wxNotebookSizer(nb);
else
return nb;
}
}
bool wxNotebookXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_IsInside && IsOfClass(node, wxT("wxNotebook"))) ||
(m_IsInside && IsOfClass(node, wxT("notebookpage"))));
}
#endif

View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_panel.cpp
// Purpose: XML resource for panels
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_panel.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_panel.h"
#include "wx/panel.h"
wxPanelXmlHandler::wxPanelXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxPanelXmlHandler::DoCreateResource()
{
wxPanel *panel = wxDynamicCast(m_Instance, wxPanel);
if (panel == NULL)
panel = new wxPanel(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style"), 0),
GetName());
else
panel->Create(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style"), 0),
GetName());
SetupWindow(panel);
CreateChildren(panel);
return panel;
}
bool wxPanelXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxPanel"));
}

View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_radbt.cpp
// Purpose: XML resource for wxRadioButton
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_radbt.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_radbt.h"
#include "wx/radiobut.h"
#if wxUSE_RADIOBOX
wxRadioButtonXmlHandler::wxRadioButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxRB_GROUP );
AddWindowStyles();
}
wxObject *wxRadioButtonXmlHandler::DoCreateResource()
{
/* BOBM - implementation note.
* once the wxBitmapRadioButton is implemented.
* look for a bitmap property. If not null,
* make it a wxBitmapRadioButton instead of the
* normal radio button.
*/
wxRadioButton *control = new wxRadioButton(m_ParentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
control->SetValue( GetBool(wxT("value"), 0));
SetupWindow(control);
return control;
}
bool wxRadioButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxRadioButton"));
}
#endif

View File

@@ -0,0 +1,102 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_radbx.cpp
// Purpose: XML resource for wxRadioBox
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_radbx.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_radbx.h"
#include "wx/radiobox.h"
#if wxUSE_RADIOBOX
wxRadioBoxXmlHandler::wxRadioBoxXmlHandler()
: wxXmlResourceHandler() , m_InsideBox(FALSE)
{
ADD_STYLE(wxRA_SPECIFY_COLS);
ADD_STYLE(wxRA_HORIZONTAL);
ADD_STYLE(wxRA_SPECIFY_ROWS);
ADD_STYLE(wxRA_VERTICAL);
AddWindowStyles();
}
wxObject *wxRadioBoxXmlHandler::DoCreateResource()
{
if( m_Class == wxT("wxRadioBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxRadioBox *control = new wxRadioBox(m_ParentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetLong( wxT("dimension"), 1 ),
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item selected="boolean">Label</item>
// add to the list
strList.Add( GetNodeContent(m_Node) );
return NULL;
}
}
bool wxRadioBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxRadioBox")) ||
(m_InsideBox && node->GetName() == wxT("item"))
);
}
#endif

View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_scrol.cpp
// Purpose: XML resource for wxScrollBar
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_scrol.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_scrol.h"
#include "wx/scrolbar.h"
wxScrollBarXmlHandler::wxScrollBarXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSB_HORIZONTAL );
ADD_STYLE( wxSB_VERTICAL );
AddWindowStyles();
}
wxObject *wxScrollBarXmlHandler::DoCreateResource()
{
wxScrollBar *control = new wxScrollBar(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
control->SetScrollbar(GetLong( wxT("value"), 0),
GetLong( wxT("thumbsize"),1),
GetLong( wxT("range"), 10),
GetLong( wxT("pagesize"),1)
);
SetupWindow(control);
return control;
}
bool wxScrollBarXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxScrollBar"));
}

View File

@@ -0,0 +1,219 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_sizer.cpp
// Purpose: XML resource for wxBoxSizer
// Author: Vaclav Slavik
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_sizer.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_sizer.h"
#include "wx/sizer.h"
#include "wx/log.h"
#include "wx/statbox.h"
#include "wx/notebook.h"
#include "wx/tokenzr.h"
bool wxSizerXmlHandler::IsSizerNode(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxBoxSizer"))) ||
(IsOfClass(node, wxT("wxStaticBoxSizer"))) ||
(IsOfClass(node, wxT("wxGridSizer"))) ||
(IsOfClass(node, wxT("wxFlexGridSizer")));
}
wxSizerXmlHandler::wxSizerXmlHandler()
: wxXmlResourceHandler(), m_IsInside(FALSE), m_ParentSizer(NULL)
{
ADD_STYLE(wxHORIZONTAL);
ADD_STYLE(wxVERTICAL);
// and flags
ADD_STYLE(wxLEFT);
ADD_STYLE(wxRIGHT);
ADD_STYLE(wxTOP);
ADD_STYLE(wxBOTTOM);
ADD_STYLE(wxNORTH);
ADD_STYLE(wxSOUTH);
ADD_STYLE(wxEAST);
ADD_STYLE(wxWEST);
ADD_STYLE(wxALL);
ADD_STYLE(wxGROW);
ADD_STYLE(wxEXPAND);
ADD_STYLE(wxSHAPED);
ADD_STYLE(wxSTRETCH_NOT);
ADD_STYLE(wxALIGN_CENTER);
ADD_STYLE(wxALIGN_CENTRE);
ADD_STYLE(wxALIGN_LEFT);
ADD_STYLE(wxALIGN_TOP);
ADD_STYLE(wxALIGN_RIGHT);
ADD_STYLE(wxALIGN_BOTTOM);
ADD_STYLE(wxALIGN_CENTER_HORIZONTAL);
ADD_STYLE(wxALIGN_CENTRE_HORIZONTAL);
ADD_STYLE(wxALIGN_CENTER_VERTICAL);
ADD_STYLE(wxALIGN_CENTRE_VERTICAL);
}
wxObject *wxSizerXmlHandler::DoCreateResource()
{
if (m_Class == wxT("sizeritem"))
{
wxXmlNode *n = GetParamNode(wxT("object"));
if (n)
{
bool old_ins = m_IsInside;
wxSizer *old_par = m_ParentSizer;
m_IsInside = FALSE;
if (!IsSizerNode(n)) m_ParentSizer = NULL;
wxObject *item = CreateResFromNode(n, m_Parent, NULL);
m_IsInside = old_ins;
m_ParentSizer = old_par;
wxSizer *sizer = wxDynamicCast(item, wxSizer);
wxWindow *wnd = wxDynamicCast(item, wxWindow);
wxSize minsize = GetSize(wxT("minsize"));
if (sizer)
{
m_ParentSizer->Add(sizer, GetLong(wxT("option")),
GetStyle(wxT("flag")), GetDimension(wxT("border")));
if (!(minsize == wxDefaultSize))
m_ParentSizer->SetItemMinSize(sizer, minsize.x, minsize.y);
}
else if (wnd)
{
m_ParentSizer->Add(wnd, GetLong(wxT("option")),
GetStyle(wxT("flag")), GetDimension(wxT("border")));
if (!(minsize == wxDefaultSize))
m_ParentSizer->SetItemMinSize(wnd, minsize.x, minsize.y);
}
else
wxLogError(wxT("Error in resource."));
return item;
}
else /*n == NULL*/
{
wxLogError(wxT("Error in resource: no control/sizer within sizer's <item> tag."));
return NULL;
}
}
else if (m_Class == wxT("spacer"))
{
wxCHECK_MSG(m_ParentSizer, NULL, wxT("Incorrect syntax of XML resource: spacer not within sizer!"));
wxSize sz = GetSize();
m_ParentSizer->Add(sz.x, sz.y,
GetLong(wxT("option")), GetStyle(wxT("flag")), GetDimension(wxT("border")));
return NULL;
}
else {
wxSizer *sizer = NULL;
wxXmlNode *parentNode = m_Node->GetParent();
wxCHECK_MSG(m_ParentSizer != NULL ||
((IsOfClass(parentNode, wxT("wxPanel")) ||
IsOfClass(parentNode, wxT("wxDialog"))) &&
parentNode->GetType() == wxXML_ELEMENT_NODE), NULL,
wxT("Incorrect use of sizer: parent is not 'wxDialog' or 'wxPanel'."));
if (m_Class == wxT("wxBoxSizer"))
sizer = new wxBoxSizer(GetStyle(wxT("orient"), wxHORIZONTAL));
else if (m_Class == wxT("wxStaticBoxSizer"))
{
sizer = new wxStaticBoxSizer(
new wxStaticBox(m_ParentAsWindow, -1, GetText(wxT("label"))),
GetStyle(wxT("orient"), wxHORIZONTAL));
}
else if (m_Class == wxT("wxGridSizer"))
sizer = new wxGridSizer(GetLong(wxT("rows")), GetLong(wxT("cols")),
GetDimension(wxT("vgap")), GetDimension(wxT("hgap")));
else if (m_Class == wxT("wxFlexGridSizer"))
{
wxFlexGridSizer *fsizer =
new wxFlexGridSizer(GetLong(wxT("rows")), GetLong(wxT("cols")),
GetDimension(wxT("vgap")), GetDimension(wxT("hgap")));
sizer = fsizer;
wxStringTokenizer tkn;
unsigned long l;
tkn.SetString(GetParamValue(wxT("growablerows")), wxT(","));
while (tkn.HasMoreTokens())
{
if (!tkn.GetNextToken().ToULong(&l))
wxLogError(wxT("growablerows must be comma-separated list of row numbers"));
else
fsizer->AddGrowableRow(l);
}
tkn.SetString(GetParamValue(wxT("growablecols")), wxT(","));
while (tkn.HasMoreTokens())
{
if (!tkn.GetNextToken().ToULong(&l))
wxLogError(wxT("growablecols must be comma-separated list of column numbers"));
else
fsizer->AddGrowableCol(l);
}
}
wxSize minsize = GetSize(wxT("minsize"));
if (!(minsize == wxDefaultSize))
sizer->SetMinSize(minsize);
wxSizer *old_par = m_ParentSizer;
m_ParentSizer = sizer;
bool old_ins = m_IsInside;
m_IsInside = TRUE;
CreateChildren(m_Parent, TRUE/*only this handler*/);
m_IsInside = old_ins;
m_ParentSizer = old_par;
if (m_ParentSizer == NULL) // setup window:
{
m_ParentAsWindow->SetAutoLayout(TRUE);
m_ParentAsWindow->SetSizer(sizer);
wxXmlNode *nd = m_Node;
m_Node = parentNode;
if (GetSize() == wxDefaultSize)
sizer->Fit(m_ParentAsWindow);
m_Node = nd;
if (m_ParentAsWindow->GetWindowStyle() & (wxRESIZE_BOX | wxRESIZE_BORDER))
sizer->SetSizeHints(m_ParentAsWindow);
}
return sizer;
}
}
bool wxSizerXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_IsInside && IsSizerNode(node)) ||
(m_IsInside && IsOfClass(node, wxT("sizeritem"))) ||
(m_IsInside && IsOfClass(node, wxT("spacer"))));
}

View File

@@ -0,0 +1,94 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_slidr.cpp
// Purpose: XML resource for wxSlider
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_slidr.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_slidr.h"
#include "wx/slider.h"
#if wxUSE_SLIDER
wxSliderXmlHandler::wxSliderXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSL_HORIZONTAL );
ADD_STYLE( wxSL_VERTICAL );
ADD_STYLE( wxSL_AUTOTICKS );
ADD_STYLE( wxSL_LABELS );
ADD_STYLE( wxSL_LEFT );
ADD_STYLE( wxSL_TOP );
ADD_STYLE( wxSL_RIGHT );
ADD_STYLE( wxSL_BOTTOM );
ADD_STYLE( wxSL_BOTH );
ADD_STYLE( wxSL_SELRANGE );
AddWindowStyles();
}
wxObject *wxSliderXmlHandler::DoCreateResource()
{
wxSlider *control = new wxSlider(m_ParentAsWindow,
GetID(),
GetLong( wxT("value"), wxSL_DEFAULT_VALUE),
GetLong( wxT("min"), wxSL_DEFAULT_MIN),
GetLong( wxT("max"), wxSL_DEFAULT_MAX),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
if( HasParam( wxT("tickfreq") ))
{
control->SetTickFreq( GetLong( wxT("tickfreq") ), 0 );
}
if( HasParam( wxT("pagesize") ))
{
control->SetPageSize( GetLong( wxT("pagesize") ) );
}
if( HasParam( wxT("linesize") ))
{
control->SetLineSize( GetLong( wxT("linesize") ));
}
if( HasParam( wxT("thumb") ))
{
control->SetThumbLength( GetLong( wxT("thumb") ));
}
if( HasParam( wxT("tick") ))
{
control->SetTick( GetLong( wxT("tick") ));
}
if( HasParam( wxT("selmin") ) && HasParam( wxT("selmax")) )
{
control->SetSelection( GetLong( wxT("selmin") ), GetLong( wxT("selmax")) );
}
SetupWindow(control);
return control;
}
bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSlider"));
}
#endif

View File

@@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_spin.cpp
// Purpose: XML resource for wxSpinButton
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_spin.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_spin.h"
#include "wx/spinctrl.h"
#if wxUSE_SPINBTN
wxSpinButtonXmlHandler::wxSpinButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSP_HORIZONTAL );
ADD_STYLE( wxSP_VERTICAL );
ADD_STYLE( wxSP_ARROW_KEYS );
ADD_STYLE( wxSP_WRAP );
AddWindowStyles();
}
wxObject *wxSpinButtonXmlHandler::DoCreateResource()
{
wxSpinButton *control = new wxSpinButton(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle( wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS ),
GetName()
);
control->SetValue( GetLong( wxT("value"), wxSP_DEFAULT_VALUE) );
control->SetRange( GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong( wxT("max"), wxSP_DEFAULT_MAX) );
SetupWindow(control);
return control;
}
bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return node->GetName() == wxT("spinbutton");
}
#endif // wxUSE_SPINBTN
#if wxUSE_SPINCTRL
wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSP_HORIZONTAL );
ADD_STYLE( wxSP_VERTICAL );
ADD_STYLE( wxSP_ARROW_KEYS );
ADD_STYLE( wxSP_WRAP );
}
wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
{
wxSpinCtrl *control = new wxSpinCtrl(m_ParentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle( wxT("style"), wxSP_ARROW_KEYS ),
GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong( wxT("max"), wxSP_DEFAULT_MAX),
GetLong( wxT("value"), wxSP_DEFAULT_VALUE),
GetName()
);
SetupWindow(control);
return control;
}
bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSpinCtrl"));
}
#endif // wxUSE_SPINCTRL

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_stbmp.cpp
// Purpose: XML resource for wxStaticBitmap
// Author: Vaclav Slavik
// Created: 2000/04/22
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_stbmp.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_stbmp.h"
#include "wx/statbmp.h"
wxStaticBitmapXmlHandler::wxStaticBitmapXmlHandler()
: wxXmlResourceHandler()
{
AddWindowStyles();
}
wxObject *wxStaticBitmapXmlHandler::DoCreateResource()
{
wxStaticBitmap *bmp = new wxStaticBitmap(m_ParentAsWindow,
GetID(),
GetBitmap(wxT("bitmap"), GetSize()),
GetPosition(), GetSize(),
GetStyle(),
GetName()
);
SetupWindow(bmp);
return bmp;
}
bool wxStaticBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticBitmap"));
}

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_stbox.cpp
// Purpose: XML resource for wxStaticBox
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_stbox.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_stbox.h"
#include "wx/statbox.h"
wxStaticBoxXmlHandler::wxStaticBoxXmlHandler()
: wxXmlResourceHandler()
{
AddWindowStyles();
}
wxObject *wxStaticBoxXmlHandler::DoCreateResource()
{
wxStaticBox *box = new wxStaticBox(m_ParentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
GetName()
);
SetupWindow(box);
return box;
}
bool wxStaticBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticBox"));
}

View File

@@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_stbox.cpp
// Purpose: XML resource for wxStaticLine
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_stlin.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_stlin.h"
#include "wx/statline.h"
#if wxUSE_STATLINE
wxStaticLineXmlHandler::wxStaticLineXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxLI_HORIZONTAL);
ADD_STYLE(wxLI_VERTICAL);
AddWindowStyles();
}
wxObject *wxStaticLineXmlHandler::DoCreateResource()
{
wxStaticLine *line = new wxStaticLine(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxLI_HORIZONTAL),
GetName()
);
SetupWindow(line);
return line;
}
bool wxStaticLineXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticLine"));
}
#endif

View File

@@ -0,0 +1,53 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_sttxt.cpp
// Purpose: XML resource for wxStaticText
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_sttxt.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_sttxt.h"
#include "wx/stattext.h"
wxStaticTextXmlHandler::wxStaticTextXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxST_NO_AUTORESIZE );
AddWindowStyles();
}
wxObject *wxStaticTextXmlHandler::DoCreateResource()
{
wxStaticText *text = new wxStaticText(m_ParentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
GetName()
);
SetupWindow(text);
return text;
}
bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticText"));
}

View File

@@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_text.cpp
// Purpose: XML resource for wxTextCtrl
// Author: Aleksandras Gluchovas
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Aleksandras Gluchovas
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_text.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_text.h"
#include "wx/textctrl.h"
wxTextCtrlXmlHandler::wxTextCtrlXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxTE_PROCESS_ENTER);
ADD_STYLE(wxTE_PROCESS_TAB);
ADD_STYLE(wxTE_MULTILINE);
ADD_STYLE(wxTE_PASSWORD);
ADD_STYLE(wxTE_READONLY);
ADD_STYLE(wxHSCROLL);
AddWindowStyles();
}
wxObject *wxTextCtrlXmlHandler::DoCreateResource()
{
wxTextCtrl *text = new wxTextCtrl(m_ParentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
SetupWindow(text);
return text;
}
bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxTextCtrl"));
}

View File

@@ -0,0 +1,129 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_toolb.cpp
// Purpose: XML resource for wxBoxSizer
// Author: Vaclav Slavik
// Created: 2000/08/11
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_toolb.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_toolb.h"
#include "wx/toolbar.h"
#if wxUSE_TOOLBAR
wxToolBarXmlHandler::wxToolBarXmlHandler()
: wxXmlResourceHandler(), m_IsInside(FALSE), m_Toolbar(NULL)
{
ADD_STYLE(wxTB_FLAT);
ADD_STYLE(wxTB_DOCKABLE);
ADD_STYLE(wxTB_VERTICAL);
ADD_STYLE(wxTB_HORIZONTAL);
}
wxObject *wxToolBarXmlHandler::DoCreateResource()
{
if (m_Class == wxT("tool"))
{
wxCHECK_MSG(m_Toolbar, NULL, wxT("Incorrect syntax of XML resource: tool not within a toolbar!"));
m_Toolbar->AddTool(GetID(),
GetBitmap(wxT("bitmap")),
GetBitmap(wxT("bitmap2")),
GetBool(wxT("toggle")),
GetPosition().x,
GetPosition().y,
NULL,
GetText(wxT("tooltip")),
GetText(wxT("longhelp")));
return m_Toolbar; // must return non-NULL
}
else if (m_Class == wxT("separator"))
{
wxCHECK_MSG(m_Toolbar, NULL, wxT("Incorrect syntax of XML resource: separator not within a toolbar!"));
m_Toolbar->AddSeparator();
return m_Toolbar; // must return non-NULL
}
else /*<object class="wxToolBar">*/
{
int style = GetStyle(wxT("style"), wxNO_BORDER | wxTB_HORIZONTAL);
#ifdef __WXMSW__
if (!(style & wxNO_BORDER)) style |= wxNO_BORDER;
#endif
wxToolBar *toolbar = new wxToolBar(m_ParentAsWindow,
GetID(),
GetPosition(),
GetSize(),
style,
GetName());
wxSize bmpsize = GetSize(wxT("bitmapsize"));
if (!(bmpsize == wxDefaultSize))
toolbar->SetToolBitmapSize(bmpsize);
wxSize margins = GetSize(wxT("margins"));
if (!(margins == wxDefaultSize))
toolbar->SetMargins(margins.x, margins.y);
long packing = GetLong(wxT("packing"), -1);
if (packing != -1)
toolbar->SetToolPacking(packing);
long separation = GetLong(wxT("separation"), -1);
if (separation != -1)
toolbar->SetToolSeparation(separation);
wxXmlNode *children_node = GetParamNode(wxT("object"));
if (children_node == NULL) return toolbar;
m_IsInside = TRUE;
m_Toolbar = toolbar;
wxXmlNode *n = children_node;
while (n)
{
if (n->GetType() == wxXML_ELEMENT_NODE &&
n->GetName() == wxT("object"))
{
wxObject *created = CreateResFromNode(n, toolbar, NULL);
wxControl *control = wxDynamicCast(created, wxControl);
if (IsOfClass(n, wxT("tool")) &&
IsOfClass(n, wxT("separator")) &&
control != NULL)
toolbar->AddControl(control);
}
n = n->GetNext();
}
m_IsInside = FALSE;
m_Toolbar = NULL;
toolbar->Realize();
return toolbar;
}
}
bool wxToolBarXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_IsInside && IsOfClass(node, wxT("wxToolBar"))) ||
(m_IsInside && IsOfClass(node, wxT("tool"))) ||
(m_IsInside && IsOfClass(node, wxT("separator"))));
}
#endif

View File

@@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_tree.cpp
// Purpose: XML resource for wxTreeCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_tree.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_tree.h"
#include "wx/treectrl.h"
wxTreeCtrlXmlHandler::wxTreeCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxTR_HAS_BUTTONS);
ADD_STYLE(wxTR_EDIT_LABELS);
ADD_STYLE(wxTR_MULTIPLE);
AddWindowStyles();
}
wxObject *wxTreeCtrlXmlHandler::DoCreateResource()
{
wxTreeCtrl *tree = new wxTreeCtrl(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
SetupWindow(tree);
return tree;
}
bool wxTreeCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxTreeCtrl"));
}

View File

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_unkwn.cpp
// Purpose: XML resource for unknown widget
// Author: Vaclav Slavik
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_unkwn.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xh_unkwn.h"
#include "wx/window.h"
#include "wx/log.h"
wxUnknownWidgetXmlHandler::wxUnknownWidgetXmlHandler()
: wxXmlResourceHandler()
{
AddWindowStyles();
}
wxObject *wxUnknownWidgetXmlHandler::DoCreateResource()
{
long id = GetLong(wxT("id"), -1);
wxString name = GetParamValue(wxT("name"));
wxWindow *wnd = NULL;
if (id != -1)
wnd = m_ParentAsWindow->FindWindow(id);
if (wnd == NULL && !name.IsEmpty())
wnd = m_ParentAsWindow->FindWindow(name);
if (wnd == NULL)
wxLogError(wxT("Cannot find specified window for class 'unknown' (id=%li, name='%s')."), id, name.mb_str());
else
{
if (wnd->GetParent() != m_ParentAsWindow)
wnd->Reparent(m_ParentAsWindow);
SetupWindow(wnd);
}
return wnd;
}
bool wxUnknownWidgetXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("unknown"));
}

425
contrib/src/xml/xml.cpp Normal file
View File

@@ -0,0 +1,425 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xml.cpp
// 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
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xml.h"
#pragma implementation "xmlio.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/wfstream.h"
#include "wx/datstrm.h"
#include "wx/zstream.h"
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/xml/xml.h"
#include "wx/xml/xmlio.h"
wxXmlNode::wxXmlNode(wxXmlNode *parent,wxXmlNodeType type,
const wxString& name, const wxString& content,
wxXmlProperty *props, wxXmlNode *next)
: m_Type(type), m_Name(name), m_Content(content),
m_Properties(props), m_Parent(parent),
m_Children(NULL), m_Next(next)
{
if (m_Parent)
{
if (m_Parent->m_Children)
{
m_Next = m_Parent->m_Children;
m_Parent->m_Children = this;
}
else
m_Parent->m_Children = this;
}
}
wxXmlNode::wxXmlNode(wxXmlNodeType type, const wxString& name,
const wxString& content)
: m_Type(type), m_Name(name), m_Content(content),
m_Properties(NULL), m_Parent(NULL),
m_Children(NULL), m_Next(NULL)
{}
wxXmlNode::wxXmlNode(const wxXmlNode& node)
{
m_Next = NULL;
m_Parent = NULL;
DoCopy(node);
}
wxXmlNode& wxXmlNode::operator=(const wxXmlNode& node)
{
delete m_Properties;
delete m_Children;
DoCopy(node);
return *this;
}
void wxXmlNode::DoCopy(const wxXmlNode& node)
{
m_Type = node.m_Type;
m_Name = node.m_Name;
m_Content = node.m_Content;
m_Children = NULL;
wxXmlNode *n = node.m_Children;
while (n)
{
AddChild(new wxXmlNode(*n));
n = n->GetNext();
}
m_Properties = NULL;
wxXmlProperty *p = node.m_Properties;
while (p)
{
AddProperty(p->GetName(), p->GetValue());
p = p->GetNext();
}
}
bool wxXmlNode::HasProp(const wxString& propName) const
{
wxXmlProperty *prop = GetProperties();
while (prop)
{
if (prop->GetName() == propName) return TRUE;
prop = prop->GetNext();
}
return FALSE;
}
bool wxXmlNode::GetPropVal(const wxString& propName, wxString *value) const
{
wxXmlProperty *prop = GetProperties();
while (prop)
{
if (prop->GetName() == propName)
{
*value = prop->GetValue();
return TRUE;
}
prop = prop->GetNext();
}
return FALSE;
}
wxString wxXmlNode::GetPropVal(const wxString& propName, const wxString& defaultVal) const
{
wxString tmp;
if (GetPropVal(propName, &tmp))
return tmp;
else
return defaultVal;
}
void wxXmlNode::AddChild(wxXmlNode *child)
{
if (m_Children == NULL)
m_Children = child;
else
{
wxXmlNode *ch = m_Children;
while (ch->m_Next) ch = ch->m_Next;
ch->m_Next = child;
}
child->m_Next = NULL;
child->m_Parent = this;
}
void wxXmlNode::InsertChild(wxXmlNode *child, wxXmlNode *before_node)
{
wxASSERT_MSG(before_node->GetParent() == this, wxT("wxXmlNode::InsertChild - the node has incorrect parent"));
if (m_Children == before_node)
m_Children = child;
else
{
wxXmlNode *ch = m_Children;
while (ch->m_Next != before_node) ch = ch->m_Next;
ch->m_Next = child;
}
child->m_Parent = this;
child->m_Next = before_node;
}
bool wxXmlNode::RemoveChild(wxXmlNode *child)
{
if (m_Children == NULL)
return FALSE;
else if (m_Children == child)
{
m_Children = child->m_Next;
child->m_Parent = NULL;
child->m_Next = NULL;
return TRUE;
}
else
{
wxXmlNode *ch = m_Children;
while (ch->m_Next)
{
if (ch->m_Next == child)
{
ch->m_Next = child->m_Next;
child->m_Parent = NULL;
child->m_Next = NULL;
return TRUE;
}
ch = ch->m_Next;
}
return FALSE;
}
}
void wxXmlNode::AddProperty(const wxString& name, const wxString& value)
{
AddProperty(new wxXmlProperty(name, value, NULL));
}
void wxXmlNode::AddProperty(wxXmlProperty *prop)
{
if (m_Properties == NULL)
m_Properties = prop;
else
{
wxXmlProperty *p = m_Properties;
while (p->GetNext()) p = p->GetNext();
p->SetNext(prop);
}
}
bool wxXmlNode::DeleteProperty(const wxString& name)
{
if (m_Properties == NULL)
return FALSE;
else if (m_Properties->GetName() == name)
{
wxXmlProperty *prop = m_Properties;
m_Properties = prop->GetNext();
prop->SetNext(NULL);
delete prop;
return TRUE;
}
else
{
wxXmlProperty *p = m_Properties;
while (p->GetNext())
{
if (p->GetNext()->GetName() == name)
{
wxXmlProperty *prop = p->GetNext();
p->SetNext(prop->GetNext());
prop->SetNext(NULL);
delete prop;
return TRUE;
}
p = p->GetNext();
}
return FALSE;
}
}
wxList *wxXmlDocument::sm_Handlers = NULL;
wxXmlDocument::wxXmlDocument(const wxString& filename, wxXmlIOType io_type)
: wxObject(), m_Root(NULL)
{
if (!Load(filename, io_type))
{
delete m_Root;
m_Root = NULL;
}
}
wxXmlDocument::wxXmlDocument(wxInputStream& stream, wxXmlIOType io_type)
: wxObject(), m_Root(NULL)
{
if (!Load(stream, io_type))
{
delete m_Root;
m_Root = NULL;
}
}
wxXmlDocument::wxXmlDocument(const wxXmlDocument& doc)
{
DoCopy(doc);
}
wxXmlDocument& wxXmlDocument::operator=(const wxXmlDocument& doc)
{
delete m_Root;
DoCopy(doc);
return *this;
}
void wxXmlDocument::DoCopy(const wxXmlDocument& doc)
{
m_Version = doc.m_Version;
m_Encoding = doc.m_Encoding;
m_Root = new wxXmlNode(*doc.m_Root);
}
bool wxXmlDocument::Load(const wxString& filename, wxXmlIOType io_type)
{
wxFileInputStream stream(filename);
return Load(stream, io_type);
}
bool wxXmlDocument::Load(wxInputStream& stream, wxXmlIOType io_type)
{
wxNode *n = sm_Handlers->GetFirst();
while (n)
{
wxXmlIOHandler *h = (wxXmlIOHandler*) n->GetData();
if ((io_type == wxXML_IO_AUTO || io_type == h->GetType()) &&
h->CanLoad(stream))
{
return h->Load(stream, *this);
}
n = n->GetNext();
}
wxLogError(_("Cannot find XML I/O handler capable of loading this format."));
return FALSE;
}
bool wxXmlDocument::Save(const wxString& filename, wxXmlIOType io_type) const
{
wxFileOutputStream stream(filename);
return Save(stream, io_type);
}
bool wxXmlDocument::Save(wxOutputStream& stream, wxXmlIOType io_type) const
{
wxNode *n = sm_Handlers->GetFirst();
while (n)
{
wxXmlIOHandler *h = (wxXmlIOHandler*) n->GetData();
if (io_type == h->GetType() && h->CanSave())
{
return h->Save(stream, *this);
}
n = n->GetNext();
}
wxLogError(_("Cannot find XML I/O handler capable of saving in this format."));
return FALSE;
}
void wxXmlDocument::AddHandler(wxXmlIOHandler *handler)
{
if (sm_Handlers == NULL)
{
sm_Handlers = new wxList;
sm_Handlers->DeleteContents(TRUE);
}
sm_Handlers->Append(handler);
}
void wxXmlDocument::CleanUpHandlers()
{
delete sm_Handlers;
sm_Handlers = NULL;
}
void wxXmlDocument::InitStandardHandlers()
{
AddHandler(new wxXmlIOHandlerBin);
AddHandler(new wxXmlIOHandlerBinZ);
AddHandler(new wxXmlIOHandlerLibxml);
}
#include "wx/module.h"
class wxXmlModule: public wxModule
{
DECLARE_DYNAMIC_CLASS(wxXmlModule)
public:
wxXmlModule() {}
bool OnInit() { wxXmlDocument::InitStandardHandlers(); return TRUE; };
void OnExit() { wxXmlDocument::CleanUpHandlers(); };
};
IMPLEMENT_DYNAMIC_CLASS(wxXmlModule, wxModule)

161
contrib/src/xml/xmlbin.cpp Normal file
View File

@@ -0,0 +1,161 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlbin.cpp
// Purpose: wxXmlIOHandlerBin
// Author: Vaclav Slavik
// Created: 2000/07/24
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// nothing, already in xml.cpp
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/datstrm.h"
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/xml/xmlio.h"
bool wxXmlIOHandlerBin::CanLoad(wxInputStream& stream)
{
bool canread;
canread = (ReadHeader(stream) == wxT("XMLBIN "));
stream.SeekI(-9, wxFromCurrent);
return canread;
}
wxString wxXmlIOHandlerBin::ReadHeader(wxInputStream& stream)
{
wxUint8 version;
char cheader[8];
stream.Read(cheader, 8);
cheader[7] = 0;
stream.Read(&version, 1);
if (version != 1) return wxEmptyString;
else return wxString(cheader);
}
void wxXmlIOHandlerBin::WriteHeader(wxOutputStream& stream, const wxString& header)
{
char cheader[8];
size_t i;
wxUint8 version = 1;
for (i = 0; i < header.Length(); i++) cheader[i] = header[i];
for (; i < 7; i++) cheader[i] = ' ';
cheader[7] = 0;
stream.Write(cheader, 8);
stream.Write(&version, 1);
}
static bool SaveBinNode(wxDataOutputStream& ds, wxXmlNode *node)
{
if (node)
{
ds << (wxUint8)1 <<
(wxUint8)node->GetType() <<
node->GetName() << node->GetContent();
wxXmlProperty *prop = node->GetProperties();
while (prop)
{
ds << (wxUint8)1;
ds << prop->GetName() << prop->GetValue();
prop = prop->GetNext();
}
ds << (wxUint8)0;
SaveBinNode(ds, node->GetNext());
SaveBinNode(ds, node->GetChildren());
}
else
ds << (wxUint8)0;
return TRUE;
}
bool wxXmlIOHandlerBin::Save(wxOutputStream& stream, const wxXmlDocument& doc)
{
WriteHeader(stream, "XMLBIN ");
wxDataOutputStream ds(stream);
ds << doc.GetVersion() << doc.GetEncoding();
SaveBinNode(ds, doc.GetRoot());
return stream.LastError() == wxSTREAM_NOERROR;
}
static wxXmlProperty *LoadBinProp(wxDataInputStream& ds)
{
wxUint8 dummy;
ds >> dummy;
if (dummy == 0) return NULL;
wxString name, value;
ds >> name >> value;
return new wxXmlProperty(name, value, LoadBinProp(ds));
}
static wxXmlNode *LoadBinNode(wxDataInputStream& ds, wxXmlNode *parent)
{
wxUint8 type;
wxString name, content;
wxUint8 dummy;
ds >> dummy;
if (dummy == 0) return NULL;
ds >> type >> name >> content;
wxXmlProperty *prop = LoadBinProp(ds);
wxXmlNode *nd = new wxXmlNode(parent, (wxXmlNodeType)type, name, content,
prop, LoadBinNode(ds, parent));
LoadBinNode(ds, nd);
return nd;
}
bool wxXmlIOHandlerBin::Load(wxInputStream& stream, wxXmlDocument& doc)
{
ReadHeader(stream);
wxDataInputStream ds(stream);
wxString tmp;
ds >> tmp;
doc.SetVersion(tmp);
ds >> tmp;
doc.SetEncoding(tmp);
doc.SetRoot(LoadBinNode(ds, NULL));
return (doc.GetRoot() != NULL);
}

View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlbinz.cpp
// Purpose: wxXmlIOHandlerBinZ
// Author: Vaclav Slavik
// Created: 2000/07/24
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// nothing, already in xml.cpp
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/datstrm.h"
#include "wx/log.h"
#include "wx/zstream.h"
#include "wx/xml/xmlio.h"
#if wxUSE_ZLIB
bool wxXmlIOHandlerBinZ::CanLoad(wxInputStream& stream)
{
bool canread;
canread = (ReadHeader(stream) == wxT("XMLBINZ"));
stream.SeekI(-9, wxFromCurrent);
return canread;
}
bool wxXmlIOHandlerBinZ::Save(wxOutputStream& stream, const wxXmlDocument& doc)
{
WriteHeader(stream, "XMLBINZ");
wxZlibOutputStream costr(stream, 9);
return wxXmlIOHandlerBin::Save(costr, doc);
}
bool wxXmlIOHandlerBinZ::Load(wxInputStream& stream, wxXmlDocument& doc)
{
ReadHeader(stream);
wxZlibInputStream costr(stream);
return wxXmlIOHandlerBin::Load(costr, doc);
}
#endif

366
contrib/src/xml/xmlpars.cpp Normal file
View File

@@ -0,0 +1,366 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlpars.cpp
// Purpose: wxXmlDocument - XML parser
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// nothing - already in xml.cpp
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/wfstream.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/dynlib.h"
#include "wx/xml/xmlio.h"
#include <libxml/parser.h>
#include <libxml/SAX.h>
// wxWindows SAX handlers for bugs reporting:
static void wxXmlParserError(void *ctx, const char *msg, ...)
{
wxString text;
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt->input)
text.Printf( _("XML parser error at line %d: "), ctxt->input->line );
va_list args;
wxString tmp;
va_start(args, msg);
tmp.PrintfV( msg, args );
va_end(args);
text += tmp;
wxLogError( text.c_str() );
}
static void wxXmlParserWarning(void *ctx, const char *msg, ...)
{
wxString text;
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt->input)
text.Printf( _("XML parser warning at line %d: "), ctxt->input->line );
va_list args;
wxString tmp;
va_start(args, msg);
tmp.PrintfV( msg, args );
va_end(args);
text += tmp;
wxLogWarning( text.c_str() );
}
static xmlSAXHandler gs_wxXmlSAXHandler;
// dynamically loaded functions from libxml:
typedef xmlParserCtxtPtr (*type_xmlCreatePushParserCtxt)
(xmlSAXHandlerPtr sax, void *, const char *, int, const char *);
typedef xmlNodePtr (*type_xmlNewText)(const xmlChar *);
typedef xmlAttrPtr (*type_xmlSetProp)(xmlNodePtr, const xmlChar *, const xmlChar *);
typedef int (*type_xmlParseChunk)(xmlParserCtxtPtr, const char *, int, int);
typedef void (*type_xmlFreeParserCtxt)(xmlParserCtxtPtr);
typedef xmlDocPtr (*type_xmlNewDoc)(const xmlChar *);
typedef void (*type_xmlFreeDoc)(xmlDocPtr);
typedef xmlNodePtr (*type_xmlNewDocNode)(xmlDocPtr, xmlNsPtr, const xmlChar *, const xmlChar *);
typedef void (*type_xmlDocDumpMemory)(xmlDocPtr, xmlChar**, int *);
typedef xmlNodePtr (*type_xmlAddChild)(xmlNodePtr, xmlNodePtr);
typedef xmlNodePtr (*type_xmlNewChild)(xmlNodePtr, xmlNsPtr, const xmlChar *, const xmlChar *);
typedef xmlChar * (*type_xmlNodeListGetString)(xmlDocPtr, xmlNodePtr, int);
typedef xmlNodePtr (*type_xmlDocGetRootElement)(xmlDocPtr);
typedef xmlNodePtr (*type_xmlDocSetRootElement)(xmlDocPtr doc, xmlNodePtr root);
typedef void (*(*type_xmlFree))(void *);
typedef int (*type_xmlKeepBlanksDefault)(int);
typedef void (*type_xmlInitParser)(void);
typedef void (*type_xmlCleanupParser)(void);
typedef xmlSAXHandler *type_xmlDefaultSAXHandler;
static struct
{
wxDllType Handle;
type_xmlCreatePushParserCtxt xmlCreatePushParserCtxt;
type_xmlNewText xmlNewText;
type_xmlSetProp xmlSetProp;
type_xmlParseChunk xmlParseChunk;
type_xmlFreeParserCtxt xmlFreeParserCtxt;
type_xmlNewDoc xmlNewDoc;
type_xmlFreeDoc xmlFreeDoc;
type_xmlNewDocNode xmlNewDocNode;
type_xmlDocDumpMemory xmlDocDumpMemory;
type_xmlAddChild xmlAddChild;
type_xmlNewChild xmlNewChild;
type_xmlNodeListGetString xmlNodeListGetString;
type_xmlDocGetRootElement xmlDocGetRootElement;
type_xmlDocSetRootElement xmlDocSetRootElement;
type_xmlFree xmlFree;
type_xmlKeepBlanksDefault xmlKeepBlanksDefault;
type_xmlInitParser xmlInitParser;
type_xmlCleanupParser xmlCleanupParser;
type_xmlDefaultSAXHandler xmlDefaultSAXHandler;
} gs_libxmlDLL;
static bool gs_libxmlLoaded = FALSE;
static bool gs_libxmlLoadFailed = FALSE;
static void ReleaseLibxml()
{
if (gs_libxmlLoaded)
{
// Check for CleanupParser ..may have failed before initialised
// during LOAD_SYMBOL in LoadLibxml()
if (gs_libxmlDLL.xmlCleanupParser)
gs_libxmlDLL.xmlCleanupParser();
wxDllLoader::UnloadLibrary(gs_libxmlDLL.Handle);
}
gs_libxmlLoaded = FALSE;
gs_libxmlLoadFailed = FALSE;
}
static bool LoadLibxml()
{
if (gs_libxmlLoaded) return TRUE;
if (gs_libxmlLoadFailed) return FALSE;
gs_libxmlLoadFailed = TRUE;
{
wxLogNull lg;
#ifdef __UNIX__
gs_libxmlDLL.Handle =
wxDllLoader::LoadLibrary(wxT("wxlibxml.so.2"), &gs_libxmlLoaded);
if (!gs_libxmlLoaded) gs_libxmlDLL.Handle =
wxDllLoader::LoadLibrary(wxT("libxml.so.2"), &gs_libxmlLoaded);
#endif
#ifdef __WXMSW__
gs_libxmlDLL.Handle =
wxDllLoader::LoadLibrary(wxT("wxlibxml2.dll"), &gs_libxmlLoaded);
if (!gs_libxmlLoaded) gs_libxmlDLL.Handle =
wxDllLoader::LoadLibrary(wxT("libxml2.dll"), &gs_libxmlLoaded);
#endif
}
if (!gs_libxmlLoaded)
{
wxLogError(_("Failed to load libxml shared library."));
return FALSE;
}
#define LOAD_SYMBOL(sym) \
gs_libxmlDLL.sym = \
(type_##sym)wxDllLoader::GetSymbol(gs_libxmlDLL.Handle, wxT(#sym)); \
if (!gs_libxmlDLL.sym) \
{ \
ReleaseLibxml(); \
wxLogError(_("Failed to load libxml shared library.")); \
return FALSE; \
}
LOAD_SYMBOL(xmlCreatePushParserCtxt)
LOAD_SYMBOL(xmlNewText)
LOAD_SYMBOL(xmlSetProp)
LOAD_SYMBOL(xmlParseChunk)
LOAD_SYMBOL(xmlFreeParserCtxt)
LOAD_SYMBOL(xmlNewDoc)
LOAD_SYMBOL(xmlFreeDoc)
LOAD_SYMBOL(xmlNewDocNode)
LOAD_SYMBOL(xmlDocDumpMemory)
LOAD_SYMBOL(xmlAddChild)
LOAD_SYMBOL(xmlNewChild)
LOAD_SYMBOL(xmlNodeListGetString)
LOAD_SYMBOL(xmlDocGetRootElement)
LOAD_SYMBOL(xmlDocSetRootElement)
LOAD_SYMBOL(xmlFree)
LOAD_SYMBOL(xmlKeepBlanksDefault)
LOAD_SYMBOL(xmlInitParser)
LOAD_SYMBOL(xmlCleanupParser)
LOAD_SYMBOL(xmlDefaultSAXHandler)
#undef LOAD_SYMBOL
gs_libxmlLoadFailed = FALSE;
gs_libxmlDLL.xmlInitParser();
memcpy(&gs_wxXmlSAXHandler, gs_libxmlDLL.xmlDefaultSAXHandler,
sizeof(xmlSAXHandler));
gs_wxXmlSAXHandler.error = wxXmlParserError;
gs_wxXmlSAXHandler.fatalError = wxXmlParserError;
gs_wxXmlSAXHandler.warning = wxXmlParserWarning;
return TRUE;
}
bool wxXmlIOHandlerLibxml::CanLoad(wxInputStream& stream)
{
if (!LoadLibxml()) return FALSE;
char cheader[7];
cheader[6] = 0;
stream.Read(cheader, 6);
stream.SeekI(-6, wxFromCurrent);
return strcmp(cheader, "<?xml ") == 0;
}
bool wxXmlIOHandlerLibxml::CanSave()
{
return LoadLibxml();
}
static wxXmlProperty *CreateWXProperty(xmlDocPtr doc, xmlAttrPtr attr)
{
if (attr == NULL) return NULL;
unsigned char *val =
gs_libxmlDLL.xmlNodeListGetString(doc, attr->children, 1);
wxXmlProperty *prop =
new wxXmlProperty(attr->name, val, CreateWXProperty(doc, attr->next));
(*gs_libxmlDLL.xmlFree)(val);
return prop;
}
static wxXmlNode *CreateWXNode(xmlDocPtr doc, wxXmlNode *parent, xmlNodePtr node)
{
if (node == NULL) return NULL;
wxXmlNode *nd = new wxXmlNode(parent, (wxXmlNodeType)node->type,
node->name, node->content,
CreateWXProperty(doc, node->properties),
CreateWXNode(doc, parent, node->next));
CreateWXNode(doc, nd, node->children);
return nd;
}
bool wxXmlIOHandlerLibxml::Load(wxInputStream& stream, wxXmlDocument& doc)
{
if (!LoadLibxml()) return FALSE;
xmlDocPtr dc;
xmlParserCtxtPtr ctxt;
char buffer[1024];
int res;
res = stream.Read(buffer, 4).LastRead();
if (res > 0)
{
bool okay = TRUE;
gs_libxmlDLL.xmlKeepBlanksDefault(0);
ctxt = gs_libxmlDLL.xmlCreatePushParserCtxt(&gs_wxXmlSAXHandler,
NULL, buffer, res, ""/*docname*/);
while ((res = stream.Read(buffer, 1024).LastRead()) > 0)
if (gs_libxmlDLL.xmlParseChunk(ctxt, buffer, res, 0) != 0)
okay = FALSE;
if (gs_libxmlDLL.xmlParseChunk(ctxt, buffer, 0, 1) != 0) okay = FALSE;
dc = ctxt->myDoc;
gs_libxmlDLL.xmlFreeParserCtxt(ctxt);
doc.SetVersion(dc->version);
doc.SetEncoding(dc->encoding);
doc.SetRoot(CreateWXNode(dc, NULL, gs_libxmlDLL.xmlDocGetRootElement(dc)));
gs_libxmlDLL.xmlFreeDoc(dc);
return okay;
}
else return FALSE;
}
static void CreateLibxmlNode(xmlNodePtr node, wxXmlNode *wxnode)
{
node->type = (xmlElementType)wxnode->GetType();
wxXmlProperty *prop = wxnode->GetProperties();
while (prop)
{
gs_libxmlDLL.xmlSetProp(node, (xmlChar*)prop->GetName().mb_str(),
(xmlChar*)prop->GetValue().mb_str());
prop = prop->GetNext();
}
wxXmlNode *child = wxnode->GetChildren();
xmlNodePtr n;
xmlChar *content, *name;
while (child)
{
name = (xmlChar*)child->GetName().mb_str();
if (!child->GetContent()) content = NULL;
else content = (xmlChar*)child->GetContent().mb_str();
if (child->GetType() == wxXML_TEXT_NODE)
gs_libxmlDLL.xmlAddChild(node, n = gs_libxmlDLL.xmlNewText(content));
else
n = gs_libxmlDLL.xmlNewChild(node, NULL, name, content);
CreateLibxmlNode(n, child);
child = child->GetNext();
}
}
bool wxXmlIOHandlerLibxml::Save(wxOutputStream& stream, const wxXmlDocument& doc)
{
if (!LoadLibxml()) return FALSE;
xmlDocPtr dc;
wxASSERT_MSG(doc.GetRoot() != NULL, _("Trying to save empty document!"));
gs_libxmlDLL.xmlKeepBlanksDefault(0);
dc = gs_libxmlDLL.xmlNewDoc((xmlChar*)doc.GetVersion().mb_str());
gs_libxmlDLL.xmlDocSetRootElement(dc,
gs_libxmlDLL.xmlNewDocNode(dc, NULL,
(xmlChar*)doc.GetRoot()->GetName().mb_str(), NULL));
CreateLibxmlNode(gs_libxmlDLL.xmlDocGetRootElement(dc), doc.GetRoot());
xmlChar *buffer;
int size;
gs_libxmlDLL.xmlDocDumpMemory(dc, &buffer, &size);
gs_libxmlDLL.xmlFreeDoc(dc);
stream.Write(buffer, size);
(*gs_libxmlDLL.xmlFree)(buffer);
return stream.LastWrite() == (unsigned)size;
}
#include "wx/module.h"
class wxXmlLibxmlModule: public wxModule
{
DECLARE_DYNAMIC_CLASS(wxXmlLibxmlModule)
public:
wxXmlLibxmlModule() {}
bool OnInit() { return TRUE; }
void OnExit() { ReleaseLibxml(); }
};
IMPLEMENT_DYNAMIC_CLASS(wxXmlLibxmlModule, wxModule)

959
contrib/src/xml/xmlres.cpp Normal file
View File

@@ -0,0 +1,959 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlres.cpp
// Purpose: XML resources
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xmlres.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/dialog.h"
#include "wx/panel.h"
#include "wx/frame.h"
#include "wx/wfstream.h"
#include "wx/filesys.h"
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/tokenzr.h"
#include "wx/fontenum.h"
#include "wx/module.h"
#include "wx/bitmap.h"
#include "wx/image.h"
#include "wx/fontmap.h"
#include "wx/xml/xml.h"
#include "wx/xml/xmlres.h"
#include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxXmlResourceDataRecords);
wxXmlResource::wxXmlResource(bool use_locale)
{
m_Handlers.DeleteContents(TRUE);
m_UseLocale = use_locale;
}
wxXmlResource::wxXmlResource(const wxString& filemask, bool use_locale)
{
m_UseLocale = use_locale;
m_Handlers.DeleteContents(TRUE);
Load(filemask);
}
wxXmlResource::~wxXmlResource()
{
ClearHandlers();
}
bool wxXmlResource::Load(const wxString& filemask)
{
wxString fnd;
wxXmlResourceDataRecord *drec;
bool iswild = wxIsWild(filemask);
#if wxUSE_FILESYSTEM
wxFileSystem fsys;
# define wxXmlFindFirst fsys.FindFirst(filemask, wxFILE)
# define wxXmlFindNext fsys.FindNext()
#else
# define wxXmlFindFirst wxFindFirstFile(filemask, wxFILE)
# define wxXmlFindNext wxFindNextFile()
#endif
if (iswild)
fnd = wxXmlFindFirst;
else
fnd = filemask;
while (!!fnd)
{
#if wxUSE_FILESYSTEM
if (filemask.Lower().Matches("*.zip") ||
filemask.Lower().Matches("*.rsc"))
{
wxFileSystem fs2;
wxString fnd2;
fnd2 = fs2.FindFirst(fnd + wxT("#zip:*.xmb"), wxFILE);
while (!!fnd2)
{
drec = new wxXmlResourceDataRecord;
drec->File = fnd2;
m_Data.Add(drec);
fnd2 = fs2.FindNext();
}
}
else
#endif
{
drec = new wxXmlResourceDataRecord;
drec->File = fnd;
m_Data.Add(drec);
}
if (iswild)
fnd = wxXmlFindNext;
else
fnd = wxEmptyString;
}
# undef wxXmlFindFirst
# undef wxXmlFindNext
return TRUE;
}
void wxXmlResource::AddHandler(wxXmlResourceHandler *handler)
{
m_Handlers.Append(handler);
handler->SetParentResource(this);
}
void wxXmlResource::ClearHandlers()
{
m_Handlers.Clear();
}
wxMenu *wxXmlResource::LoadMenu(const wxString& name)
{
return (wxMenu*)CreateResFromNode(FindResource(name, wxT("wxMenu")), NULL, NULL);
}
wxMenuBar *wxXmlResource::LoadMenuBar(const wxString& name)
{
return (wxMenuBar*)CreateResFromNode(FindResource(name, wxT("wxMenuBar")), NULL, NULL);
}
wxToolBar *wxXmlResource::LoadToolBar(wxWindow *parent, const wxString& name)
{
return (wxToolBar*)CreateResFromNode(FindResource(name, wxT("wxToolBar")), parent, NULL);
}
wxDialog *wxXmlResource::LoadDialog(wxWindow *parent, const wxString& name)
{
wxDialog *dialog = new wxDialog;
if (!LoadDialog(dialog, parent, name))
{ delete dialog; return NULL; }
else return dialog;
}
bool wxXmlResource::LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name)
{
return CreateResFromNode(FindResource(name, wxT("wxDialog")), parent, dlg) != NULL;
}
wxPanel *wxXmlResource::LoadPanel(wxWindow *parent, const wxString& name)
{
return (wxPanel*)CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, NULL);
}
bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name)
{
return CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, panel) != NULL;
}
bool wxXmlResource::LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name)
{
return CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, frame) != NULL;
}
wxBitmap wxXmlResource::LoadBitmap(const wxString& name)
{
wxBitmap *bmp = (wxBitmap*)CreateResFromNode(
FindResource(name, wxT("wxBitmap")), NULL, NULL);
wxBitmap rt;
if (bmp) { rt = *bmp; delete bmp; }
return rt;
}
wxIcon wxXmlResource::LoadIcon(const wxString& name)
{
wxIcon *icon = (wxIcon*)CreateResFromNode(
FindResource(name, wxT("wxIcon")), NULL, NULL);
wxIcon rt;
if (icon) { rt = *icon; delete icon; }
return rt;
}
void wxXmlResource::ProcessPlatformProperty(wxXmlNode *node)
{
wxString s;
bool isok;
wxXmlNode *c = node->GetChildren();
while (c)
{
isok = FALSE;
if (!c->GetPropVal(wxT("platform"), &s))
isok = TRUE;
else
{
wxStringTokenizer tkn(s, " |");
while (tkn.HasMoreTokens())
{
s = tkn.GetNextToken();
if (
#ifdef __WXMSW__
s == wxString(wxT("win"))
#elif defined(__UNIX__)
s == wxString(wxT("unix"))
#elif defined(__MAC__)
s == wxString(wxT("mac"))
#elif defined(__OS2__)
s == wxString(wxT("os2"))
#else
FALSE
#endif
) isok = TRUE;
}
}
if (isok)
ProcessPlatformProperty(c);
else
{
node->RemoveChild(c);
delete c;
}
c = c->GetNext();
}
}
void wxXmlResource::UpdateResources()
{
bool modif;
# if wxUSE_FILESYSTEM
wxFSFile *file = NULL;
wxFileSystem fsys;
# endif
for (size_t i = 0; i < m_Data.GetCount(); i++)
{
modif = (m_Data[i].Doc == NULL);
if (!modif)
{
# if wxUSE_FILESYSTEM
file = fsys.OpenFile(m_Data[i].File);
modif = file && file->GetModificationTime() > m_Data[i].Time;
if (!file)
wxLogError(_("Cannot open file '%s'."), m_Data[i].File.c_str());
wxDELETE(file);
# else
modif = wxDateTime(wxFileModificationTime(m_Data[i].File)) > m_Data[i].Time;
# endif
}
if (modif)
{
wxInputStream *stream = NULL;
# if wxUSE_FILESYSTEM
file = fsys.OpenFile(m_Data[i].File);
if (file)
stream = file->GetStream();
# else
stream = new wxFileInputStream(m_Data[i].File);
# endif
if (stream)
{
delete m_Data[i].Doc;
m_Data[i].Doc = new wxXmlDocument;
}
if (!stream || !m_Data[i].Doc->Load(*stream))
{
wxLogError(_("Cannot load resources from file '%s'."), m_Data[i].File.c_str());
wxDELETE(m_Data[i].Doc);
}
else if (m_Data[i].Doc->GetRoot()->GetName() != wxT("resource"))
{
wxLogError(_("Invalid XML resource '%s': doesn't have root node 'resource'."), m_Data[i].File.c_str());
wxDELETE(m_Data[i].Doc);
}
else
{
ProcessPlatformProperty(m_Data[i].Doc->GetRoot());
m_Data[i].Time = file->GetModificationTime();
}
# if wxUSE_FILESYSTEM
wxDELETE(file);
# else
wxDELETE(stream);
# endif
}
}
}
wxXmlNode *wxXmlResource::FindResource(const wxString& name, const wxString& classname)
{
UpdateResources(); //ensure everything is up-to-date
wxString dummy;
for (size_t f = 0; f < m_Data.GetCount(); f++)
{
if (m_Data[f].Doc == NULL || m_Data[f].Doc->GetRoot() == NULL) continue;
for (wxXmlNode *node = m_Data[f].Doc->GetRoot()->GetChildren();
node; node = node->GetNext())
if (node->GetType() == wxXML_ELEMENT_NODE &&
(!classname ||
node->GetPropVal(wxT("class"), wxEmptyString) == classname) &&
node->GetName() == wxT("object") &&
node->GetPropVal(wxT("name"), &dummy) &&
dummy == name)
{
#if wxUSE_FILESYSTEM
m_CurFileSystem.ChangePathTo(m_Data[f].File);
#endif
return node;
}
}
wxLogError(_("XML resource '%s' (class '%s') not found!"),
name.c_str(), classname.c_str());
return NULL;
}
wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance)
{
if (node == NULL) return NULL;
wxXmlResourceHandler *handler;
wxObject *ret;
wxNode * ND = m_Handlers.GetFirst();
while (ND)
{
handler = (wxXmlResourceHandler*)ND->GetData();
if (node->GetName() == wxT("object") && handler->CanHandle(node))
{
ret = handler->CreateResource(node, parent, instance);
if (ret) return ret;
}
ND = ND->GetNext();
}
wxLogError(_("No handler found for XML node '%s', class '%s'!"),
node->GetName().c_str(),
node->GetPropVal(wxT("class"), wxEmptyString).c_str());
return NULL;
}
wxXmlResourceHandler::wxXmlResourceHandler()
: m_Node(NULL), m_Parent(NULL), m_Instance(NULL),
m_ParentAsWindow(NULL), m_InstanceAsWindow(NULL)
{}
wxObject *wxXmlResourceHandler::CreateResource(wxXmlNode *node, wxObject *parent, wxObject *instance)
{
wxXmlNode *myNode = m_Node;
wxString myClass = m_Class;
wxObject *myParent = m_Parent, *myInstance = m_Instance;
wxWindow *myParentAW = m_ParentAsWindow, *myInstanceAW = m_InstanceAsWindow;
m_Node = node;
m_Class = node->GetPropVal(wxT("class"), wxEmptyString);
m_Parent = parent;
m_Instance = instance;
m_ParentAsWindow = wxDynamicCast(m_Parent, wxWindow);
m_InstanceAsWindow = wxDynamicCast(m_Instance, wxWindow);
wxObject *returned = DoCreateResource();
m_Node = myNode;
m_Class = myClass;
m_Parent = myParent; m_ParentAsWindow = myParentAW;
m_Instance = myInstance; m_InstanceAsWindow = myInstanceAW;
return returned;
}
void wxXmlResourceHandler::AddStyle(const wxString& name, int value)
{
m_StyleNames.Add(name);
m_StyleValues.Add(value);
}
void wxXmlResourceHandler::AddWindowStyles()
{
ADD_STYLE(wxSIMPLE_BORDER);
ADD_STYLE(wxSUNKEN_BORDER);
ADD_STYLE(wxDOUBLE_BORDER);
ADD_STYLE(wxRAISED_BORDER);
ADD_STYLE(wxSTATIC_BORDER);
ADD_STYLE(wxTRANSPARENT_WINDOW);
ADD_STYLE(wxWANTS_CHARS);
ADD_STYLE(wxNO_FULL_REPAINT_ON_RESIZE);
}
bool wxXmlResourceHandler::HasParam(const wxString& param)
{
return (GetParamNode(param) != NULL);
}
int wxXmlResourceHandler::GetStyle(const wxString& param, int defaults)
{
wxString s = GetParamValue(param);
if (!s) return defaults;
wxStringTokenizer tkn(s, wxT("| "), wxTOKEN_STRTOK);
int style = 0;
int index;
wxString fl;
while (tkn.HasMoreTokens())
{
fl = tkn.GetNextToken();
index = m_StyleNames.Index(fl);
if (index != wxNOT_FOUND)
style |= m_StyleValues[index];
else
wxLogError(_("Unknown style flag ") + fl);
}
return style;
}
wxString wxXmlResourceHandler::GetText(const wxString& param)
{
wxString str1 = GetParamValue(param);
wxString str2;
const wxChar *dt;
for (dt = str1.c_str(); *dt; dt++)
{
// Remap $ to &, map $$ to $ (for things like "&File..." --
// this is illegal in XML, so we use "$File..."):
if (*dt == '$')
switch (*(++dt))
{
case '$' : str2 << '$'; break;
default : str2 << '&' << *dt; break;
}
// Remap \n to CR, \r LF, \t to TAB:
else if (*dt == '\\')
switch (*(++dt))
{
case 'n' : str2 << '\n'; break;
case 't' : str2 << '\t'; break;
case 'r' : str2 << '\r'; break;
default : str2 << '\\' << *dt; break;
}
else str2 << *dt;
}
if (m_Resource->GetUseLocale())
return wxGetTranslation(str2);
else
return str2;
}
long wxXmlResourceHandler::GetLong(const wxString& param, long defaultv)
{
long value;
wxString str1 = GetParamValue(param);
if (!str1.ToLong(&value))
value = defaultv;
return value;
}
int wxXmlResourceHandler::GetID()
{
wxString sid = GetName();
long num;
if (sid == wxT("-1")) return -1;
else if (sid.IsNumber() && sid.ToLong(&num)) return num;
#define stdID(id) else if (sid == wxT(#id)) return id
stdID(wxID_OPEN); stdID(wxID_CLOSE); stdID(wxID_NEW);
stdID(wxID_SAVE); stdID(wxID_SAVEAS); stdID(wxID_REVERT);
stdID(wxID_EXIT); stdID(wxID_UNDO); stdID(wxID_REDO);
stdID(wxID_HELP); stdID(wxID_PRINT); stdID(wxID_PRINT_SETUP);
stdID(wxID_PREVIEW); stdID(wxID_ABOUT); stdID(wxID_HELP_CONTENTS);
stdID(wxID_HELP_COMMANDS); stdID(wxID_HELP_PROCEDURES);
stdID(wxID_CUT); stdID(wxID_COPY); stdID(wxID_PASTE);
stdID(wxID_CLEAR); stdID(wxID_FIND); stdID(wxID_DUPLICATE);
stdID(wxID_SELECTALL); stdID(wxID_OK); stdID(wxID_CANCEL);
stdID(wxID_APPLY); stdID(wxID_YES); stdID(wxID_NO);
stdID(wxID_STATIC); stdID(wxID_FORWARD); stdID(wxID_BACKWARD);
stdID(wxID_DEFAULT); stdID(wxID_MORE); stdID(wxID_SETUP);
stdID(wxID_RESET); stdID(wxID_HELP_CONTEXT);
#undef stdID
else return XMLID(sid.c_str());
}
wxString wxXmlResourceHandler::GetName()
{
return m_Node->GetPropVal(wxT("name"), wxT("-1"));
}
bool wxXmlResourceHandler::GetBool(const wxString& param, bool defaultv)
{
wxString v = GetParamValue(param);
v.MakeLower();
if (!v) return defaultv;
else return (v == wxT("1"));
}
wxColour wxXmlResourceHandler::GetColour(const wxString& param)
{
wxString v = GetParamValue(param);
unsigned long tmp = 0;
if (v.Length() != 7 || v[0u] != wxT('#') ||
wxSscanf(v.c_str(), wxT("#%lX"), &tmp) != 1)
{
wxLogError(_("XML resource: Incorrect colour specification '%s' for property '%s'."),
v.c_str(), param.c_str());
return wxNullColour;
}
return wxColour((tmp & 0xFF0000) >> 16 ,
(tmp & 0x00FF00) >> 8,
(tmp & 0x0000FF));
}
wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param, wxSize size)
{
wxString name = GetParamValue(param);
if (name.IsEmpty()) return wxNullBitmap;
#if wxUSE_FILESYSTEM
wxFSFile *fsfile = GetCurFileSystem().OpenFile(name);
if (fsfile == NULL)
{
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.mb_str());
return wxNullBitmap;
}
wxImage img(*(fsfile->GetStream()));
delete fsfile;
#else
wxImage img(GetParamValue(wxT("bitmap")));
#endif
if (!img.Ok())
{
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.mb_str());
return wxNullBitmap;
}
if (!(size == wxDefaultSize)) img.Rescale(size.x, size.y);
return img.ConvertToBitmap();
}
wxIcon wxXmlResourceHandler::GetIcon(const wxString& param, wxSize size)
{
#if wxCHECK_VERSION(2,3,0) || defined(__WXMSW__)
wxIcon icon;
icon.CopyFromBitmap(GetBitmap(param, size));
#else
wxIcon *iconpt;
wxBitmap bmppt = GetBitmap(param, size);
iconpt = (wxIcon*)(&bmppt);
wxIcon icon(*iconpt);
#endif
return icon;
}
wxXmlNode *wxXmlResourceHandler::GetParamNode(const wxString& param)
{
wxXmlNode *n = m_Node->GetChildren();
while (n)
{
if (n->GetType() == wxXML_ELEMENT_NODE && n->GetName() == param)
return n;
n = n->GetNext();
}
return NULL;
}
wxString wxXmlResourceHandler::GetNodeContent(wxXmlNode *node)
{
wxXmlNode *n = node;
if (n == NULL) return wxEmptyString;
n = n->GetChildren();
while (n)
{
if (n->GetType() == wxXML_TEXT_NODE ||
n->GetType() == wxXML_CDATA_SECTION_NODE)
return n->GetContent();
n = n->GetNext();
}
return wxEmptyString;
}
wxString wxXmlResourceHandler::GetParamValue(const wxString& param)
{
if (param.IsEmpty())
return GetNodeContent(m_Node);
else
return GetNodeContent(GetParamNode(param));
}
wxSize wxXmlResourceHandler::GetSize(const wxString& param)
{
wxString s = GetParamValue(param);
if (s.IsEmpty()) s = wxT("-1,-1");
bool is_dlg;
long sx, sy;
is_dlg = s[s.Length()-1] == wxT('d');
if (is_dlg) s.RemoveLast();
if (!s.BeforeFirst(wxT(',')).ToLong(&sx) ||
!s.AfterLast(wxT(',')).ToLong(&sy))
{
wxLogError(_("Cannot parse coordinates from '%s'."), s.mb_str());
return wxDefaultSize;
}
if (is_dlg)
{
if (m_InstanceAsWindow)
return wxDLG_UNIT(m_InstanceAsWindow, wxSize(sx, sy));
else if (m_ParentAsWindow)
return wxDLG_UNIT(m_ParentAsWindow, wxSize(sx, sy));
else
{
wxLogError(_("Cannot convert dialog units: dialog unknown."));
return wxDefaultSize;
}
}
else return wxSize(sx, sy);
}
wxPoint wxXmlResourceHandler::GetPosition(const wxString& param)
{
wxSize sz = GetSize(param);
return wxPoint(sz.x, sz.y);
}
wxCoord wxXmlResourceHandler::GetDimension(const wxString& param, wxCoord defaultv)
{
wxString s = GetParamValue(param);
if (s.IsEmpty()) return defaultv;
bool is_dlg;
long sx;
is_dlg = s[s.Length()-1] == wxT('d');
if (is_dlg) s.RemoveLast();
if (!s.ToLong(&sx))
{
wxLogError(_("Cannot parse dimension from '%s'."), s.mb_str());
return defaultv;
}
if (is_dlg)
{
if (m_InstanceAsWindow)
return wxDLG_UNIT(m_InstanceAsWindow, wxSize(sx, 0)).x;
else if (m_ParentAsWindow)
return wxDLG_UNIT(m_ParentAsWindow, wxSize(sx, 0)).x;
else
{
wxLogError(_("Cannot convert dialog units: dialog unknown."));
return defaultv;
}
}
else return sx;
}
wxFont wxXmlResourceHandler::GetFont(const wxString& param)
{
wxXmlNode *font_node = GetParamNode(param);
if (font_node == NULL)
{
wxLogError(_("Cannot find font node '%s'."), param.mb_str());
return wxNullFont;
}
wxXmlNode *oldnode = m_Node;
m_Node = font_node;
long size = GetLong(wxT("size"), 12);
wxString style = GetParamValue(wxT("style"));
wxString weight = GetParamValue(wxT("weight"));
int istyle = wxNORMAL, iweight = wxNORMAL;
if (style == wxT("italic")) istyle = wxITALIC;
else if (style == wxT("slant")) istyle = wxSLANT;
if (weight == wxT("bold")) iweight = wxBOLD;
else if (weight == wxT("light")) iweight = wxLIGHT;
wxString family = GetParamValue(wxT("family"));
int ifamily = wxDEFAULT;
if (family == wxT("decorative")) ifamily = wxDECORATIVE;
else if (family == wxT("roman")) ifamily = wxROMAN;
else if (family == wxT("script")) ifamily = wxSCRIPT;
else if (family == wxT("swiss")) ifamily = wxSWISS;
else if (family == wxT("modern")) ifamily = wxMODERN;
bool underlined = GetBool(wxT("underlined"), FALSE);
wxString encoding = GetParamValue(wxT("encoding"));
wxFontMapper mapper;
wxFontEncoding enc = wxFONTENCODING_DEFAULT;
if (!encoding.IsEmpty()) enc = mapper.CharsetToEncoding(encoding);
if (enc == wxFONTENCODING_SYSTEM) enc = wxFONTENCODING_SYSTEM;
wxString faces = GetParamValue(wxT("face"));
wxString facename = wxEmptyString;
wxFontEnumerator enu;
enu.EnumerateFacenames();
wxStringTokenizer tk(faces, wxT(","));
while (tk.HasMoreTokens())
{
int index = enu.GetFacenames()->Index(tk.GetNextToken(), FALSE);
if (index != wxNOT_FOUND)
{
facename = (*enu.GetFacenames())[index];
break;
}
}
m_Node = oldnode;
wxFont font(size, ifamily, istyle, iweight, underlined, facename, enc);
return font;
}
void wxXmlResourceHandler::SetupWindow(wxWindow *wnd)
{
//FIXME : add cursor
if (HasParam(wxT("exstyle")))
wnd->SetExtraStyle(GetStyle(wxT("exstyle")));
if (HasParam(wxT("bg")))
wnd->SetBackgroundColour(GetColour(wxT("bg")));
if (HasParam(wxT("fg")))
wnd->SetForegroundColour(GetColour(wxT("fg")));
if (GetBool(wxT("enabled"), 1) == 0)
wnd->Enable(FALSE);
if (GetBool(wxT("focused"), 0) == 1)
wnd->SetFocus();
if (GetBool(wxT("hidden"), 0) == 1)
wnd->Show(FALSE);
#if wxUSE_TOOLTIPS
if (HasParam(wxT("tooltip")))
wnd->SetToolTip(GetText(wxT("tooltip")));
#endif
if (HasParam(wxT("font")))
wnd->SetFont(GetFont());
}
void wxXmlResourceHandler::CreateChildren(wxObject *parent, bool this_hnd_only)
{
wxXmlNode *n = m_Node->GetChildren();
while (n)
{
if (n->GetType() == wxXML_ELEMENT_NODE &&
n->GetName() == wxT("object"))
{
if (this_hnd_only && CanHandle(n))
CreateResource(n, parent, NULL);
else
m_Resource->CreateResFromNode(n, parent, NULL);
}
n = n->GetNext();
}
}
void wxXmlResourceHandler::CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode)
{
wxXmlNode *root;
if (rootnode == NULL) root = m_Node; else root = rootnode;
wxXmlNode *n = root->GetChildren();
while (n)
{
if (n->GetType() == wxXML_ELEMENT_NODE && CanHandle(n))
{
CreateResource(n, parent, NULL);
}
n = n->GetNext();
}
}
// --------------- XMLID implementation -----------------------------
#define XMLID_TABLE_SIZE 1024
struct XMLID_record
{
int id;
char *key;
XMLID_record *next;
};
static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
/*static*/ int wxXmlResource::GetXMLID(const char *str_id)
{
static int XMLID_LastID = wxID_HIGHEST;
int index = 0;
for (const char *c = str_id; *c != '\0'; c++) index += (int)*c;
index %= XMLID_TABLE_SIZE;
XMLID_record *oldrec = NULL;
int matchcnt = 0;
for (XMLID_record *rec = XMLID_Records[index]; rec; rec = rec->next)
{
if (strcmp(rec->key, str_id) == 0)
{
return rec->id;
}
matchcnt++;
oldrec = rec;
}
XMLID_record **rec_var = (oldrec == NULL) ?
&XMLID_Records[index] : &oldrec->next;
*rec_var = new XMLID_record;
(*rec_var)->id = ++XMLID_LastID;
(*rec_var)->key = strdup(str_id);
(*rec_var)->next = NULL;
return (*rec_var)->id;
}
static void CleanXMLID_Record(XMLID_record *rec)
{
if (rec)
{
CleanXMLID_Record(rec->next);
free (rec->key);
delete rec;
}
}
static void CleanXMLID_Records()
{
for (int i = 0; i < XMLID_TABLE_SIZE; i++)
CleanXMLID_Record(XMLID_Records[i]);
}
// --------------- module and globals -----------------------------
static wxXmlResource gs_XmlResource;
wxXmlResource *wxTheXmlResource = &gs_XmlResource;
class wxXmlResourceModule: public wxModule
{
DECLARE_DYNAMIC_CLASS(wxXmlResourceModule)
public:
wxXmlResourceModule() {}
bool OnInit() {return TRUE;}
void OnExit()
{
wxTheXmlResource->ClearHandlers();
CleanXMLID_Records();
}
};
IMPLEMENT_DYNAMIC_CLASS(wxXmlResourceModule, wxModule)

View File

@@ -0,0 +1,97 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlrsall.cpp
// Purpose: wxXmlResource::InitAllHandlers
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// -- Already done in xmlres.cpp
//#ifdef __GNUG__
//#pragma implementation "xmlres.h"
//#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xml/xmlres.h"
#include "wx/xml/xh_all.h"
void wxXmlResource::InitAllHandlers()
{
AddHandler(new wxBitmapXmlHandler);
AddHandler(new wxIconXmlHandler);
AddHandler(new wxMenuXmlHandler);
AddHandler(new wxMenuBarXmlHandler);
AddHandler(new wxDialogXmlHandler);
AddHandler(new wxPanelXmlHandler);
AddHandler(new wxSizerXmlHandler);
//Controls
AddHandler(new wxButtonXmlHandler);
AddHandler(new wxBitmapButtonXmlHandler);
AddHandler(new wxStaticTextXmlHandler);
AddHandler(new wxStaticBoxXmlHandler);
AddHandler(new wxStaticBitmapXmlHandler);
AddHandler(new wxTreeCtrlXmlHandler);
AddHandler(new wxCalendarCtrlXmlHandler);
AddHandler(new wxListCtrlXmlHandler);
#if CHECKLISTBOX
AddHandler(new wxCheckListXmlHandler);
#endif
#if wxUSE_CHOICE
AddHandler(new wxChoiceXmlHandler);
#endif
#if wxUSE_SLIDER
AddHandler(new wxSliderXmlHandler);
#endif
#if wxUSE_GAUGE
AddHandler(new wxGaugeXmlHandler);
#endif
#if wxUSE_CHECKBOX
AddHandler(new wxCheckBoxXmlHandler);
#endif
#if wxUSE_HTML
AddHandler(new wxHtmlWindowXmlHandler);
#endif
#if wxUSE_SPINBTN
AddHandler(new wxSpinButtonXmlHandler);
#endif
#if wxUSE_SPINCTRL
AddHandler(new wxSpinCtrlXmlHandler);
#endif
#if wxUSE_SCROLLBAR
AddHandler(new wxScrollBarXmlHandler);
#endif
#if wxUSE_RADIOBOX
AddHandler(new wxRadioBoxXmlHandler);
AddHandler(new wxRadioButtonXmlHandler);
#endif
#if wxUSE_COMBOBOX
AddHandler(new wxComboBoxXmlHandler);
#endif
#if wxUSE_NOTEBOOK
AddHandler(new wxNotebookXmlHandler);
#endif
AddHandler(new wxTextCtrlXmlHandler);
#if wxUSE_LISTBOX
AddHandler(new wxListBoxXmlHandler);
#endif
#if wxUSE_TOOLBAR
AddHandler(new wxToolBarXmlHandler);
#endif
#if wxUSE_STATLINE
AddHandler(new wxStaticLineXmlHandler);
#endif
AddHandler(new wxUnknownWidgetXmlHandler);
AddHandler(new wxFrameXmlHandler);
}

10
contrib/utils/Makefile.in Normal file
View File

@@ -0,0 +1,10 @@
# $Id$
CONTRIB_UTILS=wxrc wxrcedit convertrc
all:
@for d in $(CONTRIB_UTILS); do (cd $$d && $(MAKE)); done
clean:
@for d in $(CONTRIB_UTILS); do (cd $$d && $(MAKE) clean); done

View File

@@ -0,0 +1,307 @@
# Microsoft Developer Studio Project File - Name="ConvertVC" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=ConvertVC - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ConvertVC.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ConvertVC.mak" CFG="ConvertVC - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ConvertVC - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "ConvertVC - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "ConvertVC - Win32 Debug DLL" (based on "Win32 (x86) Application")
!MESSAGE "ConvertVC - Win32 Release DLL" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "ConvertVC - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/wxconvert.exe"
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/wxconvert.exe" /pdbtype:sept
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Debug DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugDLL"
# PROP BASE Intermediate_Dir "DebugDLL"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugDLL"
# PROP Intermediate_Dir "DebugDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /YX"wxprec.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdlld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/wxconvert.exe" /pdbtype:sept
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Release DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseDLL"
# PROP BASE Intermediate_Dir "ReleaseDLL"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseDLL"
# PROP Intermediate_Dir "ReleaseDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdll.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/wxconvert.exe"
!ENDIF
# Begin Target
# Name "ConvertVC - Win32 Release"
# Name "ConvertVC - Win32 Debug"
# Name "ConvertVC - Win32 Debug DLL"
# Name "ConvertVC - Win32 Release DLL"
# Begin Source File
SOURCE=.\wx\msw\blank.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\bullseye.cur
# End Source File
# Begin Source File
SOURCE=.\convert.cpp
# End Source File
# Begin Source File
SOURCE=.\convert.h
# End Source File
# Begin Source File
SOURCE=.\wx\msw\error.ico
# End Source File
# Begin Source File
SOURCE=.\wx\msw\hand.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\info.ico
# End Source File
# Begin Source File
SOURCE=.\wx\msw\magnif1.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\noentry.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\pbrush.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\pencil.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\pntleft.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\pntright.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\query.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\question.ico
# End Source File
# Begin Source File
SOURCE=.\rc2wxr.cpp
!IF "$(CFG)" == "ConvertVC - Win32 Release"
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Debug DLL"
# SUBTRACT BASE CPP /YX /Yc /Yu
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Release DLL"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\rc2wxr.h
# End Source File
# Begin Source File
SOURCE=.\rc2xml.cpp
!IF "$(CFG)" == "ConvertVC - Win32 Release"
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Debug DLL"
# SUBTRACT BASE CPP /YX /Yc /Yu
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Release DLL"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\rc2xml.h
# End Source File
# Begin Source File
SOURCE=.\wx\msw\roller.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\size.cur
# End Source File
# Begin Source File
SOURCE=.\wx\msw\tip.ico
# End Source File
# Begin Source File
SOURCE=.\wx\msw\warning.ico
# End Source File
# Begin Source File
SOURCE=.\wx\msw\watch1.cur
# End Source File
# Begin Source File
SOURCE=.\wxconvert.rc
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
# End Source File
# Begin Source File
SOURCE=.\wxr2xml.cpp
!IF "$(CFG)" == "ConvertVC - Win32 Release"
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Debug DLL"
# SUBTRACT BASE CPP /YX /Yc /Yu
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "ConvertVC - Win32 Release DLL"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\wxr2xml.h
# End Source File
# End Target
# End Project

Some files were not shown because too many files have changed in this diff Show More