Compare commits

...

1 Commits

Author SHA1 Message Date
Bryan Petty
86ff2bbd5d This commit was manufactured by cvs2svn to create tag
'BEFORE_MULTIPLE_LIBS_CHANGE'.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/BEFORE_MULTIPLE_LIBS_CHANGE@21323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2003-06-23 16:04:09 +00:00
1679 changed files with 403673 additions and 9746 deletions

View File

@@ -0,0 +1,473 @@
/////////////////////////////////////////////////////////////////////////////
// Name: canvas.h
// Author: Robert Roebling
// Created: XX/XX/XX
// Copyright: 2000 (c) Robert Roebling
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __WXCANVAS_H__
#define __WXCANVAS_H__
#ifdef __GNUG__
#pragma interface "canvas.cpp"
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/image.h"
#include "wx/txtstrm.h"
#include "wx/geometry.h"
//----------------------------------------------------------------------------
// decls
//----------------------------------------------------------------------------
#define IMAGE_CANVAS 0
class wxCanvas;
//----------------------------------------------------------------------------
// wxCanvasObject
//----------------------------------------------------------------------------
class wxCanvasObject: public wxEvtHandler
{
public:
wxCanvasObject();
// Area occupied by object. Used for clipping, intersection,
// mouse enter etc. Screen coordinates
void SetArea( int x, int y, int width, int height );
void SetArea( wxRect rect );
// These are for screen output only therefore use
// int as coordinates.
virtual bool IsHit( int x, int y, int margin = 0 );
virtual void Render(int xabs, int yabs, int clip_x, int clip_y, int clip_width, int clip_height );
// use doubles later
virtual void Move( int x, int y );
// Once we have world coordinates in doubles, this will get
// called for every object if the world coordinate system
// changes (zooming).
virtual void Recreate();
// Later...
virtual void WriteSVG( wxTextOutputStream &stream );
wxCanvas *GetOwner() { return m_owner; }
virtual void SetOwner( wxCanvas *owner ) { m_owner = owner; }
bool IsControl() { return m_isControl; }
bool IsVector() { return m_isVector; }
bool IsImage() { return m_isImage; }
inline int GetX() { return m_area.x; }
inline int GetY() { return m_area.y; }
inline int GetWidth() { return m_area.width; }
inline int GetHeight() { return m_area.height; }
void CaptureMouse();
void ReleaseMouse();
bool IsCapturedMouse();
protected:
wxCanvas *m_owner;
bool m_isControl;
bool m_isVector;
bool m_isImage;
//relative boundingbox in parent in pixels
wxRect m_area;
friend class wxCanvas;
};
//----------------------------------------------------------------------------
// wxCanvasObjectGroup
//----------------------------------------------------------------------------
class wxCanvasObjectGroup
{
public:
wxCanvasObjectGroup();
virtual ~wxCanvasObjectGroup();
void SetOwner(wxCanvas* canvas);
wxCanvas *GetOwner() { return m_owner; }
virtual void Prepend( wxCanvasObject* obj );
virtual void Append( wxCanvasObject* obj );
virtual void Insert( size_t before, wxCanvasObject* obj );
virtual void Remove( wxCanvasObject* obj );
virtual void Recreate();
void DeleteContents( bool );
virtual void Render(int xabs, int yabs,int x, int y, int width, int height );
virtual void WriteSVG( wxTextOutputStream &stream );
virtual bool IsHit( int x, int y, int margin );
virtual wxCanvasObject* IsHitObject( int x, int y, int margin );
void ExtendArea(double x, double y);
inline double GetXMin() { return m_minx; }
inline double GetYMin() { return m_miny; }
inline double GetXMax() { return m_maxx; }
inline double GetYMax() { return m_maxy; }
protected:
wxCanvas *m_owner;
//bounding box
double m_minx;
double m_miny;
double m_maxx;
double m_maxy;
bool m_validbounds;
wxList m_objects;
friend class wxCanvas;
};
//----------------------------------------------------------------------------
// wxCanvasObjectGroupRef
//----------------------------------------------------------------------------
class wxCanvasObjectGroupRef: public wxCanvasObject
{
public:
wxCanvasObjectGroupRef(double x, double y,wxCanvasObjectGroup* group);
void SetOwner(wxCanvas* canvas);
virtual void Recreate();
virtual void Render(int xabs, int yabs,int x, int y, int width, int height );
virtual void WriteSVG( wxTextOutputStream &stream );
virtual bool IsHit( int x, int y, int margin );
void Move( int x, int y );
inline double GetPosX() { return m_x; }
inline double GetPosY() { return m_y; }
void ExtendArea(double x, double y);
virtual wxCanvasObject* IsHitObject( int x, int y, int margin );
protected:
//position of the group
double m_x;
double m_y;
//reference to the group
wxCanvasObjectGroup* m_group;
//bounding box
double m_minx;
double m_miny;
double m_maxx;
double m_maxy;
bool m_validbounds;
};
//----------------------------------------------------------------------------
// wxCanvasPolygon
//----------------------------------------------------------------------------
class wxCanvasPolygon: public wxCanvasObject
{
public:
wxCanvasPolygon( int n, wxPoint2DDouble points[] );
~wxCanvasPolygon();
void SetBrush(wxBrush& brush) { m_brush = brush; };
void SetPen(wxPen& pen) { m_pen = pen; };
virtual void Recreate();
virtual void Render(int xabs, int yabs, int clip_x, int clip_y, int clip_width, int clip_height );
virtual void WriteSVG( wxTextOutputStream &stream );
private:
void ExtendArea(double x, double y);
wxBrush m_brush;
wxPen m_pen;
int m_n;
wxPoint2DDouble* m_points;
//bounding box
double m_minx;
double m_miny;
double m_maxx;
double m_maxy;
bool m_validbounds;
};
//----------------------------------------------------------------------------
// wxCanvasPolyline
//----------------------------------------------------------------------------
class wxCanvasPolyline: public wxCanvasObject
{
public:
wxCanvasPolyline(int n, wxPoint2DDouble points[]);
~wxCanvasPolyline();
void SetPen(wxPen& pen) { m_pen = pen; };
virtual void Recreate();
virtual void Render(int xabs, int yabs, int clip_x, int clip_y, int clip_width, int clip_height );
virtual void WriteSVG( wxTextOutputStream &stream );
private:
void ExtendArea(double x, double y);
wxPen m_pen;
int m_n;
wxPoint2DDouble* m_points;
//bounding box
double m_minx;
double m_miny;
double m_maxx;
double m_maxy;
bool m_validbounds;
};
//----------------------------------------------------------------------------
// wxCanvasRect
//----------------------------------------------------------------------------
class wxCanvasRect: public wxCanvasObject
{
public:
wxCanvasRect( double x, double y, double w, double h );
void SetBrush(wxBrush& brush) { m_brush = brush; };
void SetPen(wxPen& pen) { m_pen = pen; };
virtual void Recreate();
virtual void Render(int xabs, int yabs, int clip_x, int clip_y, int clip_width, int clip_height );
virtual void WriteSVG( wxTextOutputStream &stream );
private:
wxPen m_pen;
wxBrush m_brush;
double m_x;
double m_y;
double m_width;
double m_height;
};
//----------------------------------------------------------------------------
// wxCanvasLine
//----------------------------------------------------------------------------
class wxCanvasLine: public wxCanvasObject
{
public:
wxCanvasLine( double x1, double y1, double x2, double y2 );
void SetPen(wxPen& pen) { m_pen = pen; };
virtual void Recreate();
virtual void Render(int xabs, int yabs, int clip_x, int clip_y, int clip_width, int clip_height );
virtual void WriteSVG( wxTextOutputStream &stream );
private:
wxPen m_pen;
double m_x1;
double m_y1;
double m_x2;
double m_y2;
};
//----------------------------------------------------------------------------
// wxCanvasImage
//----------------------------------------------------------------------------
class wxCanvasImage: public wxCanvasObject
{
public:
wxCanvasImage( const wxImage &image, double x, double y, double w, double h );
virtual void Recreate();
virtual void Render(int xabs, int yabs, int clip_x, int clip_y, int clip_width, int clip_height );
virtual void WriteSVG( wxTextOutputStream &stream );
private:
double m_x;
double m_y;
double m_width;
double m_height;
wxImage m_image;
#if IMAGE_CANVAS
wxImage m_tmp;
#else
wxBitmap m_tmp;
#endif
};
//----------------------------------------------------------------------------
// wxCanvasControl
//----------------------------------------------------------------------------
class wxCanvasControl: public wxCanvasObject
{
public:
wxCanvasControl( wxWindow *control );
~wxCanvasControl();
virtual void Recreate();
virtual void Move( int x, int y );
private:
wxWindow *m_control;
};
//----------------------------------------------------------------------------
// wxCanvasText
//----------------------------------------------------------------------------
class wxCanvasText: public wxCanvasObject
{
public:
wxCanvasText( const wxString &text, double x, double y, const wxString &foneFile, int size );
~wxCanvasText();
void Recreate();
virtual void Render(int xabs, int yabs, int clip_x, int clip_y, int clip_width, int clip_height );
virtual void WriteSVG( wxTextOutputStream &stream );
void SetRGB( unsigned char red, unsigned char green, unsigned char blue );
void SetFlag( int flag );
int GetFlag() { return m_flag; }
private:
wxString m_text;
double m_x;
double m_y;
unsigned char *m_alpha;
void *m_faceData;
int m_flag;
int m_red;
int m_green;
int m_blue;
wxString m_fontFileName;
int m_size;
};
//----------------------------------------------------------------------------
// wxCanvas
//----------------------------------------------------------------------------
class wxCanvas: public wxScrolledWindow
{
public:
// constructors and destructors
wxCanvas( wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxScrolledWindowStyle );
virtual ~wxCanvas();
virtual void SetArea( int width, int height );
virtual void SetColour( unsigned char red, unsigned char green, unsigned char blue );
virtual void Update( int x, int y, int width, int height, bool blit = TRUE );
virtual void UpdateNow();
virtual void Freeze();
virtual void Thaw();
virtual void Prepend( wxCanvasObject* obj );
virtual void Append( wxCanvasObject* obj );
virtual void Insert( size_t before, wxCanvasObject* obj );
virtual void Remove( wxCanvasObject* obj );
// override these to change your coordiate system ...
virtual int GetDeviceX( double x );
virtual int GetDeviceY( double y );
virtual int GetDeviceWidth( double width );
virtual int GetDeviceHeight( double height );
// ... and call this to tell all objets to recreate then
virtual void Recreate();
#if IMAGE_CANVAS
inline wxImage *GetBuffer() { return &m_buffer; }
#else
inline wxBitmap *GetBuffer() { return &m_buffer; }
inline wxMemoryDC *GetDC() { return m_renderDC; }
#endif
inline int GetBufferX() { return m_bufferX; }
inline int GetBufferY() { return m_bufferY; }
inline int GetBufferWidth() { return m_buffer.GetWidth(); }
inline int GetBufferHeight() { return m_buffer.GetHeight(); }
bool NeedUpdate() { return m_needUpdate; }
bool IsFrozen() { return m_frozen; }
void BlitBuffer( wxDC &dc );
void SetCaptureMouse( wxCanvasObject *obj );
virtual void ScrollWindow( int dx, int dy,
const wxRect* rect = (wxRect *) NULL );
private:
#if IMAGE_CANVAS
wxImage m_buffer;
#else
wxBitmap m_buffer;
wxMemoryDC *m_renderDC;
#endif
int m_bufferX;
int m_bufferY;
bool m_needUpdate;
wxList m_updateRects;
wxCanvasObjectGroup* m_root;
unsigned char m_green,m_red,m_blue;
bool m_frozen;
wxCanvasObject *m_lastMouse;
wxCanvasObject *m_captureMouse;
int m_oldDeviceX,m_oldDeviceY;
friend class wxCanvasObject;
private:
void OnChar( wxKeyEvent &event );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
void OnSize( wxSizeEvent &event );
void OnIdle( wxIdleEvent &event );
void OnSetFocus( wxFocusEvent &event );
void OnKillFocus( wxFocusEvent &event );
void OnEraseBackground( wxEraseEvent &event );
private:
DECLARE_CLASS(wxCanvas)
DECLARE_EVENT_TABLE()
};
#endif
// WXCANVAS

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////
// 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"
#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,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(_T("1.0")), m_Root(NULL) {}
wxXmlDocument(const wxString& filename, wxXmlIOType io_type = wxXML_IO_AUTO);
wxXmlDocument(wxInputStream& stream, wxXmlIOType io_type = wxXML_IO_AUTO);
~wxXmlDocument() { delete m_Root; }
wxXmlDocument(const wxXmlDocument& doc);
wxXmlDocument& operator=(const wxXmlDocument& doc);
// Parses .xml file and loads data. Returns TRUE on success, FALSE
// otherwise.
// NOTE: Any call to this method will result into linking against libxml
// and app's binary size will grow by ca. 250kB
bool Load(const wxString& filename, wxXmlIOType io_type = wxXML_IO_AUTO);
bool Load(wxInputStream& stream, wxXmlIOType io_type = wxXML_IO_AUTO);
// Saves document as .xml file.
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,300 @@
/////////////////////////////////////////////////////////////////////////////
// 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 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);
// 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(_T(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(_T("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(_T("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 = _T("style"), int defaults = 0);
// Gets text from param and does some convertions:
// - replaces \n, \r, \t by respective chars (according to C syntax)
// - replaces $ by & and $$ by $ (needed for $File => &File because of XML)
// - 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 = _T("size"));
wxPoint GetPosition(const wxString& param = _T("pos"));
// Get dimension (may be in dlg units):
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0);
// Get bitmap:
wxBitmap GetBitmap(const wxString& param = _T("bitmap"), wxSize size = wxDefaultSize);
wxIcon GetIcon(const wxString& param = _T("icon"), wxSize size = wxDefaultSize);
// Get font:
wxFont GetFont(const wxString& param = _T("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(_T(#style), style)
#endif // _WX_XMLRES_H_

View File

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

View File

@@ -0,0 +1,23 @@
#
# File: Makefile.in
# Author: Julian Smart
# Created: 2000
# Updated:
# Copyright: (c) 2000 Julian Smart
#
# "%W% %G%"
#
# Makefile for the multicell example (UNIX).
top_srcdir = @top_srcdir@/..
top_builddir = ../../../..
program_dir = contrib/samples/canvas/test
PROGRAM=test
OBJECTS=test.o
APPEXTRALIBS=$(top_builddir)/lib/libcanvas.@WX_TARGET_LIBRARY_TYPE@
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makeprog.env

View File

@@ -0,0 +1,42 @@
/* XPM */
static char * smile_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 4 1",
/* colors */
" s None c None",
". c #000000",
"+ c #ff0000",
"@ c #ffff00",
/* pixels */
" ........ ",
" ...@@@@@@@@... ",
" ..@@@@@@@@@@@@@@.. ",
" ..@@@@@@@@@@@@@@@@.. ",
" .@@@@@@@@@@@@@@@@@@@@. ",
" .@@@@@@@@@@@@@@@@@@@@@@. ",
" .@@@@@@@@@@@@@@@@@@@@@@@@. ",
" ..@@@@@@@@@@@@@@@@@@@@@@@@.. ",
" .@@@@@@@@ @@@@@@ @@@@@@@@. ",
" .@@@@@@@@ @@@@ @@@@@@@@. ",
" .@@@@@@@@ @@@@ @@@@@@@@. ",
" .@@@@@@@@ @@@@ @@@@@@@@. ",
".@@@@@@@@@ @@@@ @@@@@@@@@.",
".@@@@@@@@@ @@@@ @@@@@@@@@.",
".@@@@@@@@@@ @@@@@@ @@@@@@@@@@.",
".@@@@@@@.@@@@@@@@@@@@@@.@@@@@@@.",
".@@@@@@@.@@@@@@@@@@@@@@.@@@@@@@.",
".@@@@@@.@@@@@@@@@@@@@@@@.@@@@@@.",
".@@@....@@@@@@@@@@@@@@@@....@@@.",
".@@@@@@@.@@@@@@@@@@@@@@.@@@@@@@.",
" .@@@@@@@.@@@@@@@@@@@@.@@@@@@@. ",
" .@@@@@@@..@@@@@@@@@@..@@@@@@@. ",
" .@@@@@@@@...@@@@@@...@@@@@@@@. ",
" .@@@@@@@@.+......+.@@@@@@@@. ",
" ..@@@@@@@@.++++++.@@@@@@@@.. ",
" .@@@@@@@@@.++++.@@@@@@@@@. ",
" .@@@@@@@@@....@@@@@@@@@. ",
" .@@@@@@@@@@@@@@@@@@@@. ",
" ..@@@@@@@@@@@@@@@@.. ",
" ..@@@@@@@@@@@@@@.. ",
" ...@@@@@@@@... ",
" ........ "};

View File

@@ -0,0 +1,350 @@
/*
* Program: canvas
*
* Author: Robert Roebling
*
* Copyright: (C) 1998, Robert Roebling
*
*/
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <wx/image.h>
#include <wx/file.h>
#include <wx/timer.h>
#include <wx/log.h>
#include "wx/image.h"
#include "smile.xpm"
#include "wx/canvas/canvas.h"
// derived classes
class MywxCanvasImage: public wxCanvasImage
{
public:
MywxCanvasImage( const wxImage &image, double x, double y, double w, double h );
void MywxCanvasImage::OnMouse(wxMouseEvent &event);
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(MywxCanvasImage,wxCanvasImage)
EVT_MOUSE_EVENTS( MywxCanvasImage::OnMouse )
END_EVENT_TABLE()
MywxCanvasImage::MywxCanvasImage( const wxImage &image, double x, double y, double w, double h )
:wxCanvasImage( image, x, y, w, h )
{
}
void MywxCanvasImage::OnMouse(wxMouseEvent &event)
{
static int dx=0;
static int dy=0;
int x = event.GetX();
int y = event.GetY();
if (event.LeftDown())
{
dx=x;
dy=y;
CaptureMouse();
}
else if (event.LeftUp())
{
ReleaseMouse();
}
else if (IsCapturedMouse())
{
Move(m_area.x+x-dx,m_area.y+y-dy);
m_owner->UpdateNow();
}
}
class MywxCanvasObjectGroupRef: public wxCanvasObjectGroupRef
{
public:
MywxCanvasObjectGroupRef(double x, double y, wxCanvasObjectGroup* group);
void OnMouse(wxMouseEvent &event);
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(MywxCanvasObjectGroupRef,wxCanvasObjectGroupRef)
EVT_MOUSE_EVENTS( MywxCanvasObjectGroupRef::OnMouse )
END_EVENT_TABLE()
MywxCanvasObjectGroupRef::MywxCanvasObjectGroupRef(double x, double y,wxCanvasObjectGroup* group)
:wxCanvasObjectGroupRef(x,y,group)
{
}
void MywxCanvasObjectGroupRef::OnMouse(wxMouseEvent &event)
{
static int dx=0;
static int dy=0;
//new position of object
int x = m_owner->GetDeviceX( event.GetX());
int y = m_owner->GetDeviceY( event.GetY());
if (event.LeftDown())
{
dx=x;
dy=y;
CaptureMouse();
}
else if (event.LeftUp())
{
ReleaseMouse();
}
else if (IsCapturedMouse())
{
Move(m_x+x-dx,m_y+y-dy);
m_owner->UpdateNow();
}
}
class MyFrame;
class MyApp;
// MyFrame
class MyFrame: public wxFrame
{
public:
MyFrame();
~MyFrame();
void OnAbout( wxCommandEvent &event );
void OnNewFrame( wxCommandEvent &event );
void OnQuit( wxCommandEvent &event );
void OnTimer( wxTimerEvent &event );
wxCanvas *m_canvas;
wxCanvasObject *m_sm1;
wxCanvasObject *m_sm2;
wxCanvasObject *m_sm3;
wxCanvasObject *m_sm4;
MywxCanvasObjectGroupRef *m_ref;
MywxCanvasObjectGroupRef *m_ref2;
wxTimer *m_timer;
wxTextCtrl *m_log;
private:
DECLARE_DYNAMIC_CLASS(MyFrame)
DECLARE_EVENT_TABLE()
};
// MyApp
class MyApp: public wxApp
{
public:
virtual bool OnInit();
const wxString& GetFontPath() const { return m_fontpath; }
private:
wxString m_fontpath;
};
// main program
IMPLEMENT_APP(MyApp)
// MyFrame
const int ID_QUIT = 108;
const int ID_ABOUT = 109;
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
EVT_MENU (ID_ABOUT, MyFrame::OnAbout)
EVT_MENU (ID_QUIT, MyFrame::OnQuit)
EVT_TIMER (-1, MyFrame::OnTimer)
END_EVENT_TABLE()
MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, -1, "wxCanvas sample",
wxPoint(20,20), wxSize(470,460) )
{
wxMenu *file_menu = new wxMenu();
file_menu->Append( ID_ABOUT, "&About...");
file_menu->AppendSeparator();
file_menu->Append( ID_QUIT, "E&xit");
wxMenuBar *menu_bar = new wxMenuBar();
menu_bar->Append(file_menu, "&File");
SetMenuBar( menu_bar );
CreateStatusBar(2);
int widths[] = { -1, 100 };
SetStatusWidths( 2, widths );
m_canvas = new wxCanvas( this, -1, wxPoint(0,0), wxSize(10,10) );
m_canvas->SetArea( 1000,1000 );
m_canvas->SetColour( 255, 255, 255 );
wxBitmap bitmap( smile_xpm );
wxImage image( bitmap );
m_sm1 = new wxCanvasImage( image, 0,70,32,32 );
m_canvas->Append( m_sm1 );
int i;
for (i = 10; i < 300; i+=10)
{
wxCanvasRect *r = new wxCanvasRect( i,50,3,140 );
r->SetBrush( *wxRED_BRUSH );
m_canvas->Append( r );
}
m_sm2 = new wxCanvasImage( image, 0,140,24,24 );
m_canvas->Append( m_sm2 );
for (i = 15; i < 300; i+=10)
m_canvas->Append( new wxCanvasRect( i,50,3,140 ) );
wxButton *button = new wxButton( m_canvas, -1, "Hello", wxPoint(80,50) );
m_canvas->Append( new wxCanvasControl( button ) );
m_canvas->Append( new wxCanvasText( "How are you?", 180, 10,
wxGetApp().GetFontPath() + "/times.ttf", 8 ) );
m_canvas->Append( new wxCanvasText( "How are you?", 180, 20,
wxGetApp().GetFontPath() + "/times.ttf", 10 ) );
m_canvas->Append( new wxCanvasText( "How are you?", 180, 30,
wxGetApp().GetFontPath() + "/times.ttf", 12 ) );
m_sm3 = new wxCanvasImage( image, 0,210,32,32 );
m_canvas->Append( m_sm3 );
for (i = 10; i < 300; i+=10)
m_canvas->Append( new wxCanvasLine( 10,-15,i,300 ) );
m_sm4 = new MywxCanvasImage( image, 0,270,64,32 );
m_canvas->Append( m_sm4 );
// m_canvas->Append( new wxCanvasLine( 10,-1500e6,50,300000e6, 0,255,0 ) );
// m_canvas->Append( new wxCanvasLine( 10,-150000,50,300000, 0,255,0 ) );
/*
//make a group of wxCanvasObjects
wxCanvasObjectGroup* group1 = new wxCanvasObjectGroup();
group1->Prepend( new wxCanvasLine( 10,-35,50,190 ) );
group1->Prepend( new wxCanvasImage( image, 4,38,32,32 ) );
group1->Prepend( new wxCanvasRect(20,-20,50,170,0,20,240 ) );
//make another group of wxCanvasObjects
wxCanvasObjectGroup* group2 = new wxCanvasObjectGroup();
group2->Prepend( new wxCanvasImage( image, 60,38,52,32 ) );
group2->Prepend( new wxCanvasRect(10,20,104,52,10,40,10 ) );
//this a reference to group2 put into group1
wxCanvasObjectGroupRef* m_subref = new wxCanvasObjectGroupRef(60,50, group2);
group1->Prepend( m_subref );
//now make two refrences to group1 into root group of the canvas
m_ref = new MywxCanvasObjectGroupRef(40,200, group1);
m_canvas->Prepend( m_ref );
m_ref2 = new MywxCanvasObjectGroupRef(80,350, group1);
m_canvas->Prepend( m_ref2 );
*/
m_log = new wxTextCtrl( this, -1, "", wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
delete old_log;
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( m_canvas, 1, wxEXPAND );
topsizer->Add( m_log, 0, wxEXPAND );
SetAutoLayout( TRUE );
SetSizer( topsizer );
m_timer = new wxTimer( this );
m_timer->Start( 100, FALSE );
}
MyFrame::~MyFrame()
{
delete m_timer;
}
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
{
Close( TRUE );
}
void MyFrame::OnTimer( wxTimerEvent &WXUNUSED(event) )
{
m_sm1->Move( m_sm1->GetX()+1, m_sm1 ->GetY() );
m_sm2->Move( m_sm2->GetX()+1, m_sm2->GetY() );
m_sm3->Move( m_sm3->GetX()+1, m_sm3->GetY() );
m_sm4->Move( m_sm4->GetX()+2, m_sm4->GetY() );
/*
m_ref->Move( m_ref->GetPosX()+1, m_ref->GetPosY() );
m_ref2->Move( m_ref2->GetPosX()+2, m_ref2->GetPosY() );
*/
wxWakeUpIdle();
}
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
{
(void)wxMessageBox( "wxCanvas demo\n"
"Robert Roebling (c) 1998,2000",
"About wxCanvas Demo", wxICON_INFORMATION | wxOK );
}
//-----------------------------------------------------------------------------
// MyApp
//-----------------------------------------------------------------------------
bool MyApp::OnInit()
{
m_fontpath = getenv("TRUETYPE");
if ( !m_fontpath )
{
wxLogError("Please set env var TRUETYPE to the path where times.ttf lives.");
return FALSE;
}
#if wxUSE_LIBPNG
wxImage::AddHandler( new wxPNGHandler );
#endif
wxFrame *frame = new MyFrame();
frame->Show( TRUE );
return TRUE;
}

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.xml 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,119 @@
<?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>
</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"

View File

@@ -0,0 +1,23 @@
# $Id$
top_srcdir = @top_srcdir@/..
top_builddir = ../../..
libsrc_dir = contrib/src/canvas
TARGET_LIBNAME=libcanvas
LIBVERSION_CURRENT=1
LIBVERSION_REVISION=0
LIBVERSION_AGE=0
HEADER_PATH=$(top_srcdir)/contrib/include/wx
HEADER_SUBDIR=canvas
HEADERS=canvas.h
OBJECTS=canvas.o
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,138 @@
#ifndef POSREGEXP_H
#define POSREGEXP_H
#define MatchesNum 0x10
enum EOps
{
ReBlockOps = 0x1000,
ReMul, // *
RePlus, // +
ReQuest, // ?
ReNGMul, // *?
ReNGPlus, // +?
ReNGQuest, // ??
ReRangeN, // {n,}
ReRangeNM, // {n,m}
ReNGRangeN, // {n,}?
ReNGRangeNM, // {n,m}?
ReOr, // |
ReBehind = 0x1100, // ?#n
ReNBehind = 0x1200, // ?~n
ReAhead = 0x1300, // ?=
ReNAhead = 0x1400, // ?!
ReSymbolOps = 0x2000,
ReEmpty,
ReSymb, // a b \W \s ...
ReEnum, // []
ReNEnum, // [^]
ReBrackets, // (...)
ReBkTrace = 0x2100, // \yN
ReBkBrack = 0x2200 // \N
};
enum ESymbols
{
ReAnyChr = 0x4000, // .
ReSoL, // ^
ReEoL, // $
ReDigit, // \d
ReNDigit, // \D
ReWordSymb, // \w
ReNWordSymb, // \W
ReWSpace, // \s
ReNWSpace, // \S
ReUCase, // \u
ReNUCase , // \l
ReWBound, // \b
ReNWBound, // \B
RePreNW, // \c
ReStart, // \m
ReEnd, // \M
ReChr = 0x0 // Char in Lower Byte
};
enum ETempSymb
{
ReTemp = 0x7000,
ReLBrack, ReRBrack,
ReEnumS, ReEnumE, ReNEnumS,
ReRangeS, ReRangeE, ReNGRangeE, ReFrToEnum
};
#define BackSlash '\\'
typedef union SCharData
{
int IArr[8];
char CArr[32];
void SetBit(unsigned char Bit);
void ClearBit(unsigned char Bit);
bool GetBit(unsigned char Bit);
} *PCharData;
typedef struct SRegInfo
{
SRegInfo();
~SRegInfo();
EOps Op;
union{
SRegInfo *Param;
int Symb;
PCharData ChrClass;
}un;
int s,e;
SRegInfo *Parent;
SRegInfo *Next;
} *PRegInfo;
typedef struct SMatches
{
int s[MatchesNum];
int e[MatchesNum];
int CurMatch;
} *PMatches;
typedef class PosRegExp
{
PRegInfo Info;
PMatches BkTrace;
bool NoCase,Extend,NoMoves;
bool Error;
int *Exprn;
int posParse;
int posEnd,posStart;
int posBkStr;
int FirstChar;
bool SetExprLow(const char *Expr);
bool SetStructs(PRegInfo &Info,int st,int end);
void Optimize();
bool CheckSymb(int Symb,bool Inc);
bool LowParse(PRegInfo Re);
bool LowParseRe(PRegInfo &Next);
bool LowCheckNext(PRegInfo Re);
bool ParseRe(int posStr);
bool QuickCheck();
public:
PMatches Matches;
int Ok, CurMatch;
void *param;
char (*CharAt)(int pos, void *param);
PosRegExp();
~PosRegExp();
bool isok();
bool SetNoMoves(bool Moves);
bool SetBkTrace(int posStr,PMatches Trace);
bool SetExpr(const char *Expr);
bool Parse(int posStr, int posStop, PMatches Mtch);
bool Parse(int posStr,int posSol, int posEol, PMatches Mtch, int Moves = -1);
bool Evaluate(char *Expr, int posStr, PMatches Mtch, char **Res);
} *PPosRegExp;
#endif /* POSREGEXP_H */

View File

@@ -0,0 +1,183 @@
// Scintilla source code edit control
// WinDefs.h - the subset of definitions from Windows needed by Scintilla for GTK+
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef WINDEFS_H
#define WINDEFS_H
#define WORD short
#define WPARAM unsigned long
#define LPARAM long
#define LRESULT long
#define DWORD long
#define UINT unsigned int
#define LPSTR char *
#define LONG long
//#if 0
/* RTF control */
#define EM_CANPASTE (1074)
#define EM_CANUNDO (198)
#define EM_CHARFROMPOS (215)
#define EM_EMPTYUNDOBUFFER (205)
#define EM_EXGETSEL (1076)
#define EM_EXLINEFROMCHAR (1078)
#define EM_EXSETSEL (1079)
#define EM_FINDTEXT (1080)
#define EM_FINDTEXTEX (1103)
#define EM_FORMATRANGE (1081)
#define EM_GETFIRSTVISIBLELINE (206)
#define EM_GETLINE (196)
#define EM_GETLINECOUNT (186)
#define EM_GETMARGINS (212)
#define EM_GETMODIFY (184)
#define EM_GETRECT (178)
#define EM_GETSEL (176)
#define EM_GETSELTEXT (1086)
#define EM_GETTEXTRANGE (1099)
#define EM_HIDESELECTION (1087)
#define EM_LINEFROMCHAR (201)
#define EM_LINEINDEX (187)
#define EM_LINELENGTH (193)
#define EM_LINESCROLL (182)
#define EM_POSFROMCHAR (214)
#define EM_REPLACESEL (194)
#define EM_SCROLLCARET (183)
#define EM_SELECTIONTYPE (1090)
#define EM_SETMARGINS (211)
#define EM_SETREADONLY (207)
#define EM_SETSEL (177)
#define EM_UNDO (199)
#define WM_NULL (0)
#define WM_CLEAR (771)
#define WM_COPY (769)
#define WM_CUT (768)
#define WM_GETTEXT (13)
#define WM_GETTEXTLENGTH (14)
#define WM_PASTE (770)
#define WM_SETTEXT (12)
#define WM_UNDO (772)
#define EN_CHANGE (768)
#define EN_KILLFOCUS (512)
#define EN_SETFOCUS (256)
#define EC_LEFTMARGIN 1
#define EC_RIGHTMARGIN 2
#define EC_USEFONTINFO 0xffff
//#endif
#if 0
#if PLAT_GTK
#define VK_DOWN GDK_Down
#define VK_UP GDK_Up
#define VK_LEFT GDK_Left
#define VK_RIGHT GDK_Right
#define VK_HOME GDK_Home
#define VK_END GDK_End
#define VK_PRIOR GDK_Page_Up
#define VK_NEXT GDK_Page_Down
#define VK_DELETE GDK_Delete
#define VK_INSERT GDK_Insert
#define VK_ESCAPE GDK_Escape
#define VK_BACK GDK_BackSpace
#define VK_TAB GDK_Tab
#define VK_RETURN GDK_Return
#define VK_ADD GDK_KP_Add
#define VK_SUBTRACT GDK_KP_Subtract
#define VK_DIVIDE GDK_KP_Divide
#endif
#if PLAT_WX
#define VK_DOWN WXK_DOWN
#define VK_UP WXK_UP
#define VK_LEFT WXK_LEFT
#define VK_RIGHT WXK_RIGHT
#define VK_HOME WXK_HOME
#define VK_END WXK_END
#define VK_PRIOR WXK_PRIOR
#define VK_NEXT WXK_NEXT
#define VK_DELETE WXK_DELETE
#define VK_INSERT WXK_INSERT
#define VK_ESCAPE WXK_ESCAPE
#define VK_BACK WXK_BACK
#define VK_TAB WXK_TAB
#define VK_RETURN WXK_RETURN
#define VK_ADD WXK_ADD
#define VK_SUBTRACT WXK_SUBTRACT
//TODO:
#define VK_DIVIDE WXK_DIVIDE
#endif
#define SHIFT_PRESSED 1
#define LEFT_CTRL_PRESSED 2
#define LEFT_ALT_PRESSED 4
// Are these needed any more
#define LPSTR char *
#define LONG long
#define LPDWORD (long *)
/* SELCHANGE structure */
#define SEL_EMPTY (0)
#define SEL_TEXT (1)
#define SEL_OBJECT (2)
#define SEL_MULTICHAR (4)
#define SEL_MULTIOBJECT (8)
struct RECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
};
/* FINDREPLACE structure */
#define FR_MATCHCASE (0x4)
#define FR_WHOLEWORD (0x2)
#define FR_DOWN (0x1)
#endif
#if 0
struct CHARRANGE {
LONG cpMin;
LONG cpMax;
};
struct TEXTRANGE {
CHARRANGE chrg;
LPSTR lpstrText;
};
struct FINDTEXTEX {
CHARRANGE chrg;
LPSTR lpstrText;
CHARRANGE chrgText;
};
struct NMHDR {
WindowID hwndFrom;
UINT idFrom;
UINT code;
};
struct FORMATRANGE {
SurfaceID hdc;
SurfaceID hdcTarget;
RECT rc;
RECT rcPage;
CHARRANGE chrg;
};
#endif
//#define MAKELONG(a, b) ((a) | ((b) << 16))
//#define LOWORD(x) (x & 0xffff)
//#define HIWORD(x) (x >> 16)
#endif

File diff suppressed because it is too large Load Diff

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

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

@@ -0,0 +1,13 @@
This is hightly incomplete version, not meant for general use!
You will need libxml version 2.2.1 or higher, available
from http://xmlsoft.org. There is a link to precompiled win32 DLL as well.
You can find everything you need to use libxml together with
wxWindows under win32 at http://www.volny.cz/v.slavik/libxml-win32.zip
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,25 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 2000
# Updated:
# Copyright:
#
# Makefile : Builds BC++ library for 32-bit BC++
WXDIR = $(WXWIN)
EXTRACPPFLAGS=/Id:\libxml\libxml2-2.1.1
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
!include $(WXDIR)\src\makelib.b32

View File

@@ -0,0 +1,23 @@
#
# File: makefile.g95
# Author: Julian Smart
# Created: 2000
# Updated:
# Copyright: (c) Julian Smart, 2000
#
# Makefile for wxWindows wxXML library (Cygwin/Mingw32).
WXDIR = ../../..
EXTRACPPFLAGS=/Id:/libxml/libxml2-2.1.1
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
include $(WXDIR)/src/makelib.g95

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

@@ -0,0 +1,125 @@
# 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
# Set this to where your libxml is
EXTRAFLAGS=-Id:\libxml\libxml2-2.1.1
# 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_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
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(_T("")));
}
bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("wxBitmap"));
}
wxIconXmlHandler::wxIconXmlHandler()
: wxXmlResourceHandler()
{
}
wxObject *wxIconXmlHandler::DoCreateResource()
{
return new wxIcon(GetIcon(_T("")));
}
bool wxIconXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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(_T("bitmap")),
GetPosition(), GetSize(),
GetStyle(_T("style"), wxBU_AUTODRAW),
wxDefaultValidator,
GetName());
if (GetBool(_T("default"), 0) == 1) button->SetDefault();
SetupWindow(button);
if (!GetParamValue(_T("selected")).IsEmpty())
button->SetBitmapSelected(GetBitmap(_T("selected")));
if (!GetParamValue(_T("focus")).IsEmpty())
button->SetBitmapFocus(GetBitmap(_T("focus")));
if (!GetParamValue(_T("disabled")).IsEmpty())
button->SetBitmapDisabled(GetBitmap(_T("disabled")));
return button;
}
bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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(_T("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
if (GetBool(_T("default"), 0) == 1) button->SetDefault();
SetupWindow(button);
return button;
}
bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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, _T("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(_T("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
control->SetValue( GetBool( _T("checked")));
SetupWindow(control);
return control;
}
bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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 == _T("wxCheckList"))
{
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately(NULL, GetParamNode(_T("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(_T("content"));
if (n) n = n->GetChildren();
int i = 0;
while (n)
{
if (n->GetType() != wxXML_ELEMENT_NODE ||
n->GetName() != _T("item"))
{ n = n->GetNext(); continue; }
// checking boolean is a bit ugly here (see GetBool() )
wxString v = n->GetPropVal(_T("checked"), wxEmptyString);
v.MakeLower();
if (v && v == _T("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, _T("wxCheckList")) ||
(m_InsideBox && node->GetName() == _T("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 == _T("wxChoice"))
{
// find the selection
long selection = GetLong( _T("selection"), -1 );
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(_T("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, _T("wxChoice")) ||
(m_InsideBox && node->GetName() == _T("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 == _T("wxComboBox"))
{
// find the selection
long selection = GetLong( _T("selection"), -1 );
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(_T("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(_T("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, _T("wxComboBox")) ||
(m_InsideBox && node->GetName() == _T("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(_T("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(_T("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, _T("wxDialog"));
}

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( _T("range"), wxGAUGE_DEFAULT_RANGE),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
if( HasParam( _T("value") ))
{
control->SetValue( GetLong( _T("value") ));
}
if( HasParam( _T("shadow") ))
{
control->SetShadowWidth( GetDimension( _T("shadow") ));
}
if( HasParam( _T("bezel") ))
{
control->SetBezelFace( GetDimension( _T("bezel") ));
}
SetupWindow(control);
return control;
}
bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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( _T("style" ), wxHW_SCROLLBAR_AUTO),
GetName()
);
if( HasParam( _T("borders") ))
{
control->SetBorders( GetDimension( _T("borders" )));
}
if( HasParam( _T("url") ))
{
control->LoadPage( GetParamValue( _T("url" )));
}
else if( HasParam( _T("htmlcode") ))
{
control->SetPage( GetText(_T("htmlcode")) );
}
SetupWindow(control);
return control;
}
bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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 == _T("wxListBox"))
{
// find the selection
long selection = GetLong( _T("selection"), -1 );
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(_T("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, _T("wxListBox")) ||
(m_InsideBox && node->GetName() == _T("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/xml/xh_listc.h"
#include "wx/listctrl.h"
wxListCtrlXmlHandler::wxListCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxLC_LIST);
ADD_STYLE(wxLC_REPORT);
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, _T("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 == _T("wxMenu"))
{
wxMenu *menu = new wxMenu(GetStyle());
wxString title = GetText(_T("label"));
wxString help = GetText(_T("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 == _T("separator"))
p_menu->AppendSeparator();
else if (m_Class == _T("break"))
p_menu->Break();
else /*wxMenuItem*/
{
int id = GetID();
bool checkable = GetBool(_T("checkable"));
wxMenuItem *mitem = new wxMenuItem(p_menu, id, GetText(_T("label")),
GetText(_T("help")), checkable);
#if wxCHECK_VERSION(2,3,0) || defined(__WXMSW__)
if (HasParam(_T("bitmap")))
mitem->SetBitmap(GetBitmap(_T("bitmap")));
#endif
p_menu->Append(mitem);
mitem->Enable(GetBool(_T("enabled"), TRUE));
if (checkable) mitem->Check(GetBool(_T("checked")));
}
return NULL;
}
}
bool wxMenuXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("wxMenu")) ||
(m_InsideMenu &&
(IsOfClass(node, _T("wxMenuItem")) ||
IsOfClass(node, _T("break")) ||
IsOfClass(node, _T("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, _T("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 == _T("notebookpage"))
{
wxXmlNode *n = GetParamNode(_T("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(_T("label")),
GetBool(_T("selected"), 0));
else
wxLogError(_T("Error in resource."));
return wnd;
}
else
{
wxLogError(_T("Error in resource: no control within notebook's <page> tag."));
return NULL;
}
}
else {
wxNotebook *nb = new wxNotebook(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle( _T("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(_T("usenotebooksizer"), FALSE))
return new wxNotebookSizer(nb);
else
return nb;
}
}
bool wxNotebookXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_IsInside && IsOfClass(node, _T("wxNotebook"))) ||
(m_IsInside && IsOfClass(node, _T("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(_T("style"), 0),
GetName());
else
panel->Create(m_ParentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(_T("style"), 0),
GetName());
SetupWindow(panel);
CreateChildren(panel);
return panel;
}
bool wxPanelXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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(_T("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
control->SetValue( GetBool(_T("value"), 0));
SetupWindow(control);
return control;
}
bool wxRadioButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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 == _T("wxRadioBox"))
{
// find the selection
long selection = GetLong( _T("selection"), -1 );
// need to build the list of strings from children
m_InsideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(_T("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(_T("label")),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetLong( _T("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, _T("wxRadioBox")) ||
(m_InsideBox && node->GetName() == _T("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( _T("value"), 0),
GetLong( _T("thumbsize"),1),
GetLong( _T("range"), 10),
GetLong( _T("pagesize"),1)
);
SetupWindow(control);
return control;
}
bool wxScrollBarXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("wxScrollBar"));
}

View File

@@ -0,0 +1,197 @@
/////////////////////////////////////////////////////////////////////////////
// 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"
bool wxSizerXmlHandler::IsSizerNode(wxXmlNode *node)
{
return (IsOfClass(node, _T("wxBoxSizer"))) ||
(IsOfClass(node, _T("wxStaticBoxSizer"))) ||
(IsOfClass(node, _T("wxGridSizer"))) ||
(IsOfClass(node, _T("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 == _T("sizeritem"))
{
wxXmlNode *n = GetParamNode(_T("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(_T("minsize"));
if (sizer)
{
m_ParentSizer->Add(sizer, GetLong(_T("option")),
GetStyle(_T("flag")), GetDimension(_T("border")));
if (!(minsize == wxDefaultSize))
m_ParentSizer->SetItemMinSize(sizer, minsize.x, minsize.y);
}
else if (wnd)
{
m_ParentSizer->Add(wnd, GetLong(_T("option")),
GetStyle(_T("flag")), GetDimension(_T("border")));
if (!(minsize == wxDefaultSize))
m_ParentSizer->SetItemMinSize(wnd, minsize.x, minsize.y);
}
else
wxLogError(_T("Error in resource."));
return item;
}
else /*n == NULL*/
{
wxLogError(_T("Error in resource: no control/sizer within sizer's <item> tag."));
return NULL;
}
}
else if (m_Class == _T("spacer"))
{
wxCHECK_MSG(m_ParentSizer, NULL, _T("Incorrect syntax of XML resource: spacer not within sizer!"));
wxSize sz = GetSize();
m_ParentSizer->Add(sz.x, sz.y,
GetLong(_T("option")), GetStyle(_T("flag")), GetDimension(_T("border")));
return NULL;
}
else {
wxSizer *sizer = NULL;
wxXmlNode *parentNode = m_Node->GetParent();
wxCHECK_MSG(m_ParentSizer != NULL ||
((IsOfClass(parentNode, _T("wxPanel")) ||
IsOfClass(parentNode, _T("wxDialog"))) &&
parentNode->GetType() == wxXML_ELEMENT_NODE), NULL,
_T("Incorrect use of sizer: parent is not 'wxDialog' or 'wxPanel'."));
if (m_Class == _T("wxBoxSizer"))
sizer = new wxBoxSizer(GetStyle(_T("orient"), wxHORIZONTAL));
else if (m_Class == _T("wxStaticBoxSizer"))
{
sizer = new wxStaticBoxSizer(
new wxStaticBox(m_ParentAsWindow, -1, GetText(_T("label"))),
GetStyle(_T("orient"), wxHORIZONTAL));
}
else if (m_Class == _T("wxGridSizer"))
sizer = new wxGridSizer(GetLong(_T("rows")), GetLong(_T("cols")),
GetDimension(_T("vgap")), GetDimension(_T("hgap")));
else if (m_Class == _T("wxFlexGridSizer"))
sizer = new wxFlexGridSizer(GetLong(_T("rows")), GetLong(_T("cols")),
GetDimension(_T("vgap")), GetDimension(_T("hgap")));
wxSize minsize = GetSize(_T("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, _T("sizeritem"))) ||
(m_IsInside && IsOfClass(node, _T("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( _T("value"), wxSL_DEFAULT_VALUE),
GetLong( _T("min"), wxSL_DEFAULT_MIN),
GetLong( _T("max"), wxSL_DEFAULT_MAX),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
if( HasParam( _T("tickfreq") ))
{
control->SetTickFreq( GetLong( _T("tickfreq") ), 0 );
}
if( HasParam( _T("pagesize") ))
{
control->SetPageSize( GetLong( _T("pagesize") ) );
}
if( HasParam( _T("linesize") ))
{
control->SetLineSize( GetLong( _T("linesize") ));
}
if( HasParam( _T("thumb") ))
{
control->SetThumbLength( GetLong( _T("thumb") ));
}
if( HasParam( _T("tick") ))
{
control->SetTick( GetLong( _T("tick") ));
}
if( HasParam( _T("selmin") ) && HasParam( _T("selmax")) )
{
control->SetSelection( GetLong( _T("selmin") ), GetLong( _T("selmax")) );
}
SetupWindow(control);
return control;
}
bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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( _T("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS ),
GetName()
);
control->SetValue( GetLong( _T("value"), wxSP_DEFAULT_VALUE) );
control->SetRange( GetLong( _T("min"), wxSP_DEFAULT_MIN),
GetLong( _T("max"), wxSP_DEFAULT_MAX) );
SetupWindow(control);
return control;
}
bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return node->GetName() == _T("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(_T("value")),
GetPosition(), GetSize(),
GetStyle( _T("style"), wxSP_ARROW_KEYS ),
GetLong( _T("min"), wxSP_DEFAULT_MIN),
GetLong( _T("max"), wxSP_DEFAULT_MAX),
GetLong( _T("value"), wxSP_DEFAULT_VALUE),
GetName()
);
SetupWindow(control);
return control;
}
bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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(_T("bitmap"), GetSize()),
GetPosition(), GetSize(),
GetStyle(),
GetName()
);
SetupWindow(bmp);
return bmp;
}
bool wxStaticBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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(_T("label")),
GetPosition(), GetSize(),
GetStyle(),
GetName()
);
SetupWindow(box);
return box;
}
bool wxStaticBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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(_T("style"), wxLI_HORIZONTAL),
GetName()
);
SetupWindow(line);
return line;
}
bool wxStaticLineXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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(_T("label")),
GetPosition(), GetSize(),
GetStyle(),
GetName()
);
SetupWindow(text);
return text;
}
bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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(_T("value")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
SetupWindow(text);
return text;
}
bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("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 == _T("tool"))
{
wxCHECK_MSG(m_Toolbar, NULL, _T("Incorrect syntax of XML resource: tool not within a toolbar!"));
m_Toolbar->AddTool(GetID(),
GetBitmap(_T("bitmap")),
GetBitmap(_T("bitmap2")),
GetBool(_T("toggle")),
GetPosition().x,
GetPosition().y,
NULL,
GetText(_T("tooltip")),
GetText(_T("longhelp")));
return m_Toolbar; // must return non-NULL
}
else if (m_Class == _T("separator"))
{
wxCHECK_MSG(m_Toolbar, NULL, _T("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(_T("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(_T("bitmapsize"));
if (!(bmpsize == wxDefaultSize))
toolbar->SetToolBitmapSize(bmpsize);
wxSize margins = GetSize(_T("margins"));
if (!(margins == wxDefaultSize))
toolbar->SetMargins(margins.x, margins.y);
long packing = GetLong(_T("packing"), -1);
if (packing != -1)
toolbar->SetToolPacking(packing);
long separation = GetLong(_T("separation"), -1);
if (separation != -1)
toolbar->SetToolSeparation(separation);
wxXmlNode *children_node = GetParamNode(_T("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() == _T("object"))
{
wxObject *created = CreateResFromNode(n, toolbar, NULL);
wxControl *control = wxDynamicCast(created, wxControl);
if (IsOfClass(n, _T("tool")) &&
IsOfClass(n, _T("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, _T("wxToolBar"))) ||
(m_IsInside && IsOfClass(node, _T("tool"))) ||
(m_IsInside && IsOfClass(node, _T("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, _T("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(_T("id"), -1);
wxString name = GetParamValue(_T("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(_T("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, _T("unknown"));
}

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