New location for some deprecated files

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-03-30 19:47:55 +00:00
parent 820893d0d4
commit 4a3bdee6a9
24 changed files with 14923 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
/* //////////////////////////////////////////////////////////////////////////
// Name: expr.h
// Purpose: C helper defines and functions for wxExpr class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
// Licence: wxWindows licence
////////////////////////////////////////////////////////////////////////// */
#ifndef _WX_EXPRH__
#define _WX_EXPRH__
#include <math.h>
#if defined(__VISAGECPP__) && __IBMCPP__ >= 400
# undef __BSEXCPT__
#endif
#include <stdlib.h>
#ifdef ____HPUX__
#define alloca malloc
#endif
#ifdef __cplusplus
extern "C" {
char *proio_cons(char *, char *);
char * wxmake_integer(char *);
char * wxmake_word(char *);
char * wxmake_string(char *);
char * wxmake_real(char *, char *);
char * wxmake_exp(char *, char *);
char * wxmake_exp2(char *, char *, char*);
void add_expr(char *);
void process_command(char *);
void syntax_error(char *);
}
#else
#if defined(__BORLANDC__) || defined(__VISAGECPP__)
char *proio_cons(char *, char *);
char * wxmake_integer(char *);
char * wxmake_word(char *);
char * wxmake_string(char *);
char * wxmake_real(char *, char *);
char * wxmake_exp(char *, char *);
char * wxmake_exp2(char *, char *, char*);
void add_expr(char *);
void process_command(char *);
void syntax_error(char *);
int lex_input(void);
#else
char *proio_cons();
char * wxmake_integer();
char * wxmake_word();
char * wxmake_string();
char * wxmake_real();
char * wxmake_exp();
char * wxmake_exp2();
void add_expr();
void process_command();
void syntax_error();
#endif
#endif
#endif
/* _WX_EXPRH__ */

View File

@@ -0,0 +1,348 @@
/////////////////////////////////////////////////////////////////////////////
// Name: prop.h
// Purpose: Property sheet classes
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PROP_H_
#define _WX_PROP_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "prop.h"
#endif
#include "wx/deprecated/setup.h"
#if wxUSE_PROPSHEET
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/hash.h"
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/button.h"
#include "wx/listbox.h"
#include "wx/textctrl.h"
#include "wx/gdicmn.h"
#include "wx/layout.h"
#include "wx/sizer.h"
class wxWindow;
class wxProperty;
class wxPropertyValue;
class wxPropertySheet;
class wxPropertyView;
class wxPropertyValidator;
class wxPropertyValidatorRegistry;
#define wxPROPERTY_VERSION 2.0
// A storable sheet of values
class WXDLLEXPORT wxPropertySheet: public wxObject
{
public:
wxPropertySheet(const wxString& name = wxT(""));
~wxPropertySheet();
// Set the name of the sheet
inline virtual void SetName(const wxString& name) { m_name=name; }
inline virtual wxString GetName() const { return m_name; }
// Does this sheet contain a property with this name
virtual bool HasProperty(const wxString& name) const;
// Set property name to value
virtual bool SetProperty(const wxString& name, const wxPropertyValue& value);
// Remove property from sheet by name, deleting it
virtual void RemoveProperty(const wxString& name);
// Get the name of the sheet
// Add a property
virtual void AddProperty(wxProperty *property);
// Get property by name
virtual wxProperty *GetProperty(const wxString& name) const;
// Clear all properties
virtual void Clear();
virtual void UpdateAllViews(wxPropertyView *thisView = NULL);
inline virtual wxList& GetProperties() const { return (wxList&) m_properties; }
// Sets/clears the modified flag for each property value
virtual void SetAllModified(bool flag = TRUE);
protected:
wxObject* m_viewedObject;
wxList m_properties;
wxPropertyView* m_propertyView;
wxString m_name;
private:
DECLARE_DYNAMIC_CLASS(wxPropertySheet)
};
// Base class for property sheet views. There are currently two directly derived
// classes: wxPropertyListView, and wxPropertyFormView.
class WXDLLEXPORT wxPropertyView: public wxEvtHandler
{
public:
wxPropertyView(long flags = 0);
~wxPropertyView();
// Associates and shows the view
virtual void ShowView(wxPropertySheet *WXUNUSED(propertySheet), wxWindow *WXUNUSED(panel)) {}
// Update this view of the viewed object, called e.g. by
// the object itself.
virtual bool OnUpdateView() {return FALSE;};
// Override this to do something as soon as the property changed,
// if the view and validators support it.
virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {}
virtual void AddRegistry(wxPropertyValidatorRegistry *registry);
inline virtual wxList& GetRegistryList() const
{ return (wxList&) m_validatorRegistryList; }
virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property);
inline virtual void SetPropertySheet(wxPropertySheet *sheet) { m_propertySheet = sheet; }
inline virtual wxPropertySheet *GetPropertySheet() const { return m_propertySheet; }
inline virtual bool OnClose() { return FALSE; }
inline long GetFlags(void) { return m_buttonFlags; }
protected:
long m_buttonFlags;
wxPropertySheet* m_propertySheet;
wxProperty* m_currentProperty;
wxList m_validatorRegistryList;
wxPropertyValidator* m_currentValidator;
private:
DECLARE_DYNAMIC_CLASS(wxPropertyView)
};
class WXDLLEXPORT wxPropertyValidator: public wxEvtHandler
{
public:
wxPropertyValidator(long flags = 0);
~wxPropertyValidator();
inline long GetFlags() const { return m_validatorFlags; }
inline void SetValidatorProperty(wxProperty *prop) { m_validatorProperty = prop; }
inline wxProperty *GetValidatorProperty(void) const { return m_validatorProperty; }
virtual bool StringToFloat (wxChar *s, float *number);
virtual bool StringToDouble (wxChar *s, double *number);
virtual bool StringToInt (wxChar *s, int *number);
virtual bool StringToLong (wxChar *s, long *number);
virtual wxChar *FloatToString (float number);
virtual wxChar *DoubleToString (double number);
virtual wxChar *IntToString (int number);
virtual wxChar *LongToString (long number);
protected:
long m_validatorFlags;
wxProperty* m_validatorProperty;
private:
DECLARE_DYNAMIC_CLASS(wxPropertyValidator)
};
// extern wxPropertyValidator *wxDefaultPropertyValidator;
class WXDLLEXPORT wxPropertyValidatorRegistry: public wxHashTable
{
public:
wxPropertyValidatorRegistry();
~wxPropertyValidatorRegistry();
virtual void RegisterValidator(const wxString& roleName, wxPropertyValidator *validator);
virtual wxPropertyValidator *GetValidator(const wxString& roleName);
void ClearRegistry();
private:
DECLARE_DYNAMIC_CLASS(wxPropertyValidatorRegistry)
};
/*
* Property value class
*/
typedef enum {
wxPropertyValueNull,
wxPropertyValueInteger,
wxPropertyValueReal,
wxPropertyValuebool,
wxPropertyValueString,
wxPropertyValueList,
wxPropertyValueIntegerPtr,
wxPropertyValueRealPtr,
wxPropertyValueboolPtr,
wxPropertyValueStringPtr
} wxPropertyValueType;
class WXDLLEXPORT wxPropertyValue: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxPropertyValue)
wxPropertyValue(void); // Unknown type
wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor
wxPropertyValue(const wxChar *val);
wxPropertyValue(const wxString& val);
wxPropertyValue(long val);
wxPropertyValue(bool val);
wxPropertyValue(float val);
wxPropertyValue(double the_real);
wxPropertyValue(wxList *val);
wxPropertyValue(wxStringList *val);
// Pointer versions
wxPropertyValue(wxChar **val);
wxPropertyValue(long *val);
wxPropertyValue(bool *val);
wxPropertyValue(float *val);
~wxPropertyValue(void);
virtual inline wxPropertyValueType Type(void) const { return m_type; }
virtual inline void SetType(wxPropertyValueType typ) { m_type = typ; }
virtual long IntegerValue(void) const;
virtual float RealValue(void) const;
virtual bool BoolValue(void) const;
virtual wxChar *StringValue(void) const;
virtual long *IntegerValuePtr(void) const;
virtual float *RealValuePtr(void) const;
virtual bool *BoolValuePtr(void) const;
virtual wxChar **StringValuePtr(void) const;
// Get nth arg of clause (starting from 1)
virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg) const;
// Return nth argument of a list expression (starting from zero)
virtual wxPropertyValue *Nth(int arg) const;
// Returns the number of elements in a list expression
virtual int Number(void) const;
virtual wxPropertyValue *NewCopy(void) const;
virtual void Copy(wxPropertyValue& copyFrom);
virtual void WritePropertyClause(wxString &stream); // Write this expression as a top-level clause
virtual void WritePropertyType(wxString &stream); // Write as any other subexpression
// Append an expression to a list
virtual void Append(wxPropertyValue *expr);
// Insert at beginning of list
virtual void Insert(wxPropertyValue *expr);
// Get first expr in list
virtual inline wxPropertyValue *GetFirst(void) const
{ return ((m_type == wxPropertyValueList) ? m_value.first : (wxPropertyValue*)NULL); }
// Get next expr if this is a node in a list
virtual inline wxPropertyValue *GetNext(void) const
{ return m_next; }
// Get last expr in list
virtual inline wxPropertyValue *GetLast(void) const
{ return ((m_type == wxPropertyValueList) ? m_last : (wxPropertyValue*)NULL); }
// Delete this node from the list
virtual void Delete(wxPropertyValue *node);
// Clear list
virtual void ClearList(void);
virtual inline void SetClientData(wxObject *data) { m_clientData = data; }
virtual inline wxObject *GetClientData(void) { return m_clientData; }
virtual wxString GetStringRepresentation(void);
inline void SetModified(bool flag = TRUE) { m_modifiedFlag = flag; }
inline bool GetModified(void) { return m_modifiedFlag; }
// Operators
void operator=(const wxPropertyValue& val);
// void operator=(const char *val);
void operator=(const wxString& val);
void operator=(const long val);
void operator=(const bool val);
void operator=(const float val);
void operator=(const wxChar **val);
void operator=(const long *val);
void operator=(const bool *val);
void operator=(const float *val);
public:
wxObject* m_clientData;
wxPropertyValueType m_type;
bool m_modifiedFlag;
union {
long integer; // Also doubles as bool
wxChar *string;
float real;
long *integerPtr;
bool *boolPtr;
wxChar **stringPtr;
float *realPtr;
wxPropertyValue *first; // If is a list expr, points to the first node
} m_value;
wxPropertyValue* m_next; // If this is a node in a list, points to the next node
wxPropertyValue* m_last; // If is a list expr, points to the last node
};
/*
* Property class: contains a name and a value.
*/
class WXDLLEXPORT wxProperty: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxProperty)
protected:
bool m_enabled;
public:
wxPropertyValue m_value;
wxString m_name;
wxString m_propertyRole;
wxPropertyValidator* m_propertyValidator;
wxWindow* m_propertyWindow; // Usually a panel item, if anything
wxProperty(void);
wxProperty(wxProperty& copyFrom);
wxProperty(wxString name, wxString role, wxPropertyValidator *ed = NULL);
wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL);
~wxProperty(void);
virtual wxPropertyValue& GetValue(void) const;
virtual wxPropertyValidator *GetValidator(void) const;
virtual wxString& GetName(void) const;
virtual wxString& GetRole(void) const;
virtual void SetValue(const wxPropertyValue& val);
virtual void SetValidator(wxPropertyValidator *v);
virtual void SetName(wxString& nm);
virtual void SetRole(wxString& role);
void operator=(const wxPropertyValue& val);
virtual inline void SetWindow(wxWindow *win) { m_propertyWindow = win; }
virtual inline wxWindow *GetWindow(void) const { return m_propertyWindow; }
inline void Enable(bool en) { m_enabled = en; }
inline bool IsEnabled(void) const { return m_enabled; }
};
#endif
// wxUSE_PROPSHEET
#endif
// _WX_PROP_H_

View File

@@ -0,0 +1,338 @@
/////////////////////////////////////////////////////////////////////////////
// Name: propform.h
// Purpose: Property form classes
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PROPFORM_H_
#define _WX_PROPFORM_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "propform.h"
#endif
#include "wx/deprecated/setup.h"
#if wxUSE_PROPSHEET
#include "wx/deprecated/prop.h"
#include "wx/panel.h"
class WXDLLEXPORT wxPropertyFormView;
////
//// Property form classes: for using an existing dialog or panel
////
#define wxID_PROP_REVERT 3100
#define wxID_PROP_UPDATE 3101
// Mediates between a physical panel and the property sheet
class WXDLLEXPORT wxPropertyFormView: public wxPropertyView
{
DECLARE_DYNAMIC_CLASS(wxPropertyFormView)
public:
wxPropertyFormView(wxWindow *propPanel = NULL, long flags = 0);
~wxPropertyFormView(void);
// Associates and shows the view
virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *panel);
// Update this view of the viewed object, called e.g. by
// the object itself.
virtual bool OnUpdateView(void);
// Transfer values from property sheet to dialog
virtual bool TransferToDialog(void);
// Transfer values from dialog to property sheet
virtual bool TransferToPropertySheet(void);
// Check that all the values are valid
virtual bool Check(void);
// Give each property in the sheet a panel item, by matching
// the name of the property to the name of the panel item.
// The user doesn't always want to call this; sometimes, it
// will have been done explicitly (e.g., no matching names).
virtual bool AssociateNames(void);
void OnOk(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnUpdate(wxCommandEvent& event);
void OnRevert(wxCommandEvent& event);
virtual bool OnClose();
virtual void OnDoubleClick(wxControl *item);
// TODO: does OnCommand still get called...??? No,
// make ProcessEvent do it.
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
// Extend event processing to process OnCommand
virtual bool ProcessEvent(wxEvent& event);
inline virtual void AssociatePanel(wxWindow *win) { m_propertyWindow = win; }
inline virtual wxWindow *GetPanel(void) const { return m_propertyWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
public:
static bool sm_dialogCancelled;
protected:
bool m_detailedEditing; // E.g. using listbox for choices
wxWindow* m_propertyWindow; // Panel that the controls will appear on
wxWindow* m_managedWindow; // Frame or dialog
wxButton* m_windowCloseButton; // Or OK
wxButton* m_windowCancelButton;
wxButton* m_windowHelpButton;
DECLARE_EVENT_TABLE()
};
/*
* The type of validator used for forms (wxForm style but using an existing panel
* or dialog box).
* Classes derived from this know how to map from whatever widget they
* find themselves paired with, to the wxProperty and vice versa.
* Should the widget pointer be stored with the validator, or
* the wxProperty? If with the property, we don't have to supply
* a validator for every property. Otherwise, there ALWAYS needs
* to be a validator. On the other hand, not storing a wxWindow pointer
* in the wxProperty is more elegant. Perhaps.
* I think on balance, should put wxWindow pointer into wxProperty.
* After all, wxProperty will often be used to represent the data
* assocated with a window. It's that kinda thing.
*/
class WXDLLEXPORT wxPropertyFormValidator: public wxPropertyValidator
{
DECLARE_DYNAMIC_CLASS(wxPropertyFormValidator)
protected:
public:
wxPropertyFormValidator(long flags = 0): wxPropertyValidator(flags) { }
~wxPropertyFormValidator(void) {}
// Called to check value is OK (e.g. when OK is pressed)
// Return FALSE if value didn't check out; signal to restore old value.
virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { return TRUE; }
// Does the transferance from the property editing area to the property itself.
// Called by the view, e.g. when closing the window.
virtual bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0;
// Called by the view to transfer the property to the window.
virtual bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0;
virtual void OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnSetFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnKillFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnCommand( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow), wxCommandEvent& WXUNUSED(event) ) {}
private:
// Virtual function hiding suppression
#if WXWIN_COMPATIBILITY_2
virtual void OnCommand(wxWindow& win,
wxCommandEvent& event)
{ wxEvtHandler::OnCommand(win, event); }
#endif
};
/*
* Some default validators
*/
class WXDLLEXPORT wxRealFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxRealFormValidator)
public:
// 0.0, 0.0 means no range
wxRealFormValidator(float min = 0.0, float max = 0.0, long flags = 0):wxPropertyFormValidator(flags)
{
m_realMin = min; m_realMax = max;
}
~wxRealFormValidator(void) {}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
// Called by the view to transfer the property to the window.
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
protected:
float m_realMin;
float m_realMax;
};
class WXDLLEXPORT wxIntegerFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxIntegerFormValidator)
public:
// 0, 0 means no range
wxIntegerFormValidator(long min = 0, long max = 0, long flags = 0):wxPropertyFormValidator(flags)
{
m_integerMin = min; m_integerMax = max;
}
~wxIntegerFormValidator(void) {}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
protected:
long m_integerMin;
long m_integerMax;
};
class WXDLLEXPORT wxBoolFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxBoolFormValidator)
protected:
public:
wxBoolFormValidator(long flags = 0):wxPropertyFormValidator(flags)
{
}
~wxBoolFormValidator(void) {}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
};
class WXDLLEXPORT wxStringFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxStringFormValidator)
public:
wxStringFormValidator(wxStringList *list = NULL, long flags = 0);
~wxStringFormValidator(void)
{
if (m_strings)
delete m_strings;
}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
protected:
wxStringList* m_strings;
};
/*
* A default dialog box class to use.
*/
class WXDLLEXPORT wxPropertyFormDialog: public wxDialog
{
public:
wxPropertyFormDialog(wxPropertyFormView *v = NULL,
wxWindow *parent = NULL,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = _T("dialogBox"));
void OnCloseWindow(wxCloseEvent& event);
void OnDefaultAction(wxControl *item);
void OnCommand(wxWindow& win, wxCommandEvent& event);
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
private:
wxPropertyFormView* m_view;
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxPropertyFormDialog)
};
/*
* A default panel class to use.
*/
class WXDLLEXPORT wxPropertyFormPanel: public wxPanel
{
public:
wxPropertyFormPanel(wxPropertyFormView *v = NULL,
wxWindow *parent = NULL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = _T("panel"))
: wxPanel(parent, -1, pos, size, style, name)
{
m_view = v;
}
void OnDefaultAction(wxControl *item);
void OnCommand(wxWindow& win, wxCommandEvent& event);
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
void SetView(wxPropertyFormView* view) { m_view = view; }
wxPropertyFormView* GetView() const { return m_view; }
private:
wxPropertyFormView* m_view;
DECLARE_CLASS(wxPropertyFormPanel)
};
/*
* A default frame class to use.
*/
class WXDLLEXPORT wxPropertyFormFrame: public wxFrame
{
public:
wxPropertyFormFrame(wxPropertyFormView *v = NULL,
wxFrame *parent = NULL,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = _T("frame"))
: wxFrame(parent, -1, title, pos, size, style, name)
{
m_view = v;
m_propertyPanel = NULL;
}
void OnCloseWindow(wxCloseEvent& event);
// Must call this to create panel and associate view
virtual bool Initialize(void);
virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v);
inline virtual wxPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
private:
wxPropertyFormView* m_view;
wxPanel* m_propertyPanel;
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxPropertyFormFrame)
};
#endif
// wxUSE_PROPSHEET
#endif
// _WX_PROPFORM_H_

View File

@@ -0,0 +1,597 @@
/////////////////////////////////////////////////////////////////////////////
// Name: proplist.h
// Purpose: Property list classes
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
TO DO:
(1) Optional popup-help for each item, and an optional Help button
for dialog.
(2) Align Ok, Cancel, Help buttons properly.
(3) Consider retrieving the rectangle on the panel that can be
drawn into (where the value listbox is) and giving an example
of editing graphically. May be too fancy.
(4) Deriveable types for wxPropertyValue => may need to reorganise
wxPropertyValue to use inheritance rather than present all-types-in-one
scheme.
(5) Optional popup panel for value list, perhaps.
(6) Floating point checking routine still crashes with Floating
point error for zany input.
(7) Property sheet with choice (or listbox) to select alternative
sheets... multiple views per panel, only one active. For this
we really need a wxChoice that can be dynamically set: XView
may be a problem; Motif?
(8) More example validators, e.g. colour selector.
*/
#ifndef _WX_PROPLIST_H_
#define _WX_PROPLIST_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "proplist.h"
#endif
#include "wx/deprecated/setup.h"
#if wxUSE_PROPSHEET
#include "wx/deprecated/prop.h"
#include "wx/panel.h"
#define wxPROP_BUTTON_CLOSE 1
#define wxPROP_BUTTON_OK 2
#define wxPROP_BUTTON_CANCEL 4
#define wxPROP_BUTTON_CHECK_CROSS 8
#define wxPROP_BUTTON_HELP 16
#define wxPROP_DYNAMIC_VALUE_FIELD 32
#define wxPROP_PULLDOWN 64
#define wxPROP_SHOWVALUES 128
// Show OK/Cancel buttons on X-based systems where window management is
// more awkward
#if defined(__WXMOTIF__) || defined(__WXGTK__)
#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN
#else
#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN | wxPROP_SHOWVALUES
#endif
#define wxID_PROP_CROSS 3000
#define wxID_PROP_CHECK 3001
#define wxID_PROP_EDIT 3002
#define wxID_PROP_TEXT 3003
#define wxID_PROP_SELECT 3004
#define wxID_PROP_VALUE_SELECT 3005
// Mediates between a physical panel and the property sheet
class WXDLLEXPORT wxPropertyListView: public wxPropertyView
{
public:
wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT);
~wxPropertyListView(void);
// Associates and shows the view
virtual void ShowView(wxPropertySheet *propertySheet, wxPanel *panel);
// Update this view of the viewed object, called e.g. by
// the object itself.
virtual bool OnUpdateView(void);
wxString MakeNameValueString(wxString name, wxString value);
// Update a single line in the list of properties
virtual bool UpdatePropertyDisplayInList(wxProperty *property);
// Update the whole list
virtual bool UpdatePropertyList(bool clearEditArea = TRUE);
// Find the wxListBox index corresponding to this property
virtual int FindListIndexForProperty(wxProperty *property);
// Select and show string representation in editor the given
// property. NULL resets to show no property.
virtual bool ShowProperty(wxProperty *property, bool select = TRUE);
virtual bool EditProperty(wxProperty *property);
// Update the display from the property
virtual bool DisplayProperty(wxProperty *property);
// Update the property from the display
virtual bool RetrieveProperty(wxProperty *property);
// Find appropriate validator and load property into value controls
virtual bool BeginShowingProperty(wxProperty *property);
// Find appropriate validator and unload property from value controls
virtual bool EndShowingProperty(wxProperty *property);
// Begin detailed editing (e.g. using value listbox)
virtual void BeginDetailedEditing(void);
// End detailed editing (e.g. using value listbox)
virtual void EndDetailedEditing(void);
// Called by the property listbox
void OnPropertySelect(wxCommandEvent& event);
// Called by the value listbox
void OnValueListSelect(wxCommandEvent& event);
virtual bool CreateControls(void);
virtual void ShowTextControl(bool show);
virtual void ShowListBoxControl(bool show);
virtual void EnableCheck(bool show);
virtual void EnableCross(bool show);
void OnOk(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnPropertyDoubleClick(wxCommandEvent& event);
// virtual void OnDoubleClick(void);
void OnCheck(wxCommandEvent& event);
void OnCross(wxCommandEvent& event);
void OnEdit(wxCommandEvent& event);
void OnText(wxCommandEvent& event);
inline virtual wxListBox *GetPropertyScrollingList() const { return m_propertyScrollingList; }
inline virtual wxListBox *GetValueList() const { return m_valueList; }
inline virtual wxTextCtrl *GetValueText() const { return m_valueText; }
inline virtual wxButton *GetConfirmButton() const { return m_confirmButton; }
inline virtual wxButton *GetCancelButton() const { return m_cancelButton; }
inline virtual wxButton *GetEditButton() const { return m_editButton; }
inline virtual bool GetDetailedEditing(void) const { return m_detailedEditing; }
inline virtual void AssociatePanel(wxPanel *win) { m_propertyWindow = win; }
inline virtual wxPanel *GetPanel(void) const { return m_propertyWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
bool OnClose(void);
public:
static bool sm_dialogCancelled;
protected:
wxListBox* m_propertyScrollingList;
wxListBox* m_valueList; // Should really be a combobox, but we don't have one.
wxTextCtrl* m_valueText;
wxButton* m_confirmButton; // A tick, as in VB
wxButton* m_cancelButton; // A cross, as in VB
wxButton* m_editButton; // Invokes the custom validator, if any
wxSizer* m_middleSizer;
bool m_detailedEditing; // E.g. using listbox for choices
wxPanel* m_propertyWindow; // Panel that the controls will appear on
wxWindow* m_managedWindow; // Frame or dialog
wxButton* m_windowCloseButton; // Or OK
wxButton* m_windowCancelButton;
wxButton* m_windowHelpButton;
private:
DECLARE_DYNAMIC_CLASS(wxPropertyListView)
DECLARE_EVENT_TABLE()
virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *window)
{ wxPropertyView::ShowView(propertySheet, window); };
};
class WXDLLEXPORT wxPropertyTextEdit: public wxTextCtrl
{
public:
wxPropertyTextEdit(wxPropertyListView *v = NULL,
wxWindow *parent = NULL,
const wxWindowID id = -1,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxT("text"));
void OnSetFocus();
void OnKillFocus();
wxPropertyListView* m_view;
private:
DECLARE_CLASS(wxPropertyTextEdit)
};
#define wxPROP_ALLOW_TEXT_EDITING 1
/*
* The type of validator used for property lists (Visual Basic style)
*/
class WXDLLEXPORT wxPropertyListValidator: public wxPropertyValidator
{
public:
wxPropertyListValidator(long flags = wxPROP_ALLOW_TEXT_EDITING): wxPropertyValidator(flags) { }
~wxPropertyListValidator() {}
// Called when the property is selected or deselected: typically displays the value
// in the edit control (having chosen a suitable control to display: (non)editable text or listbox)
virtual bool OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is double clicked. Extra functionality can be provided, such as
// cycling through possible values.
inline virtual bool OnDoubleClick(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
// Called when the value listbox is selected. Default behaviour is to copy
// string to text control, and retrieve the value into the property.
virtual bool OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property value is edited using standard text control
inline virtual bool OnPrepareControls(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
virtual bool OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is edited in detail
inline virtual bool OnPrepareDetailControls(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
// Called if focus lost, IF we're in a modeless property editing situation.
inline virtual bool OnClearDetailControls(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
// Called when the edit (...) button is pressed. The default implementation
// calls view->BeginDetailedEditing; the filename validator (for example) overrides
// this function to show the file selector.
virtual void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
inline virtual bool OnCheckValue(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transferance from the property editing area to the property itself
virtual bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
virtual bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
private:
DECLARE_DYNAMIC_CLASS(wxPropertyListValidator)
};
/*
* A default dialog box class to use.
*/
class WXDLLEXPORT wxPropertyListDialog: public wxDialog
{
public:
wxPropertyListDialog(wxPropertyListView *v = NULL,
wxWindow *parent = NULL,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxT("dialogBox"));
void OnCloseWindow(wxCloseEvent& event);
void OnDefaultAction(wxControl *item);
void OnCancel(wxCommandEvent& event);
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
private:
wxPropertyListView* m_view;
private:
DECLARE_CLASS(wxPropertyListDialog)
DECLARE_EVENT_TABLE()
};
/*
* A default panel class to use.
*/
class WXDLLEXPORT wxPropertyListPanel: public wxPanel
{
public:
wxPropertyListPanel(wxPropertyListView *v = NULL,
wxWindow *parent = NULL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxT("panel"))
: wxPanel(parent, -1, pos, size, style, name)
{
m_view = v;
}
~wxPropertyListPanel();
void OnDefaultAction(wxControl *item);
inline void SetView(wxPropertyListView* v) { m_view = v; }
inline wxPropertyListView* GetView() const { return m_view; }
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
// Call Layout()
void OnSize(wxSizeEvent& event);
private:
wxPropertyListView* m_view;
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxPropertyListPanel)
};
/*
* A default frame class to use.
*/
class WXDLLEXPORT wxPropertyListFrame: public wxFrame
{
public:
wxPropertyListFrame(wxPropertyListView *v = NULL,
wxFrame *parent = NULL,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = _T("frame"))
: wxFrame(parent, -1, title, pos, size, style, name)
{
m_view = v;
m_propertyPanel = NULL;
}
void OnCloseWindow(wxCloseEvent& event);
// Must call this to create panel and associate view
virtual bool Initialize(void);
virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v);
inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
inline wxPropertyListView* GetView() const { return m_view; }
private:
wxPropertyListView* m_view;
wxPropertyListPanel* m_propertyPanel;
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxPropertyListFrame)
};
/*
* Some default validators
*/
class WXDLLEXPORT wxRealListValidator: public wxPropertyListValidator
{
public:
// 0.0, 0.0 means no range
wxRealListValidator(float min = 0.0, float max = 0.0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags)
{ m_realMin = min; m_realMax = max; }
~wxRealListValidator() {}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
float m_realMin;
float m_realMax;
private:
DECLARE_DYNAMIC_CLASS(wxRealListValidator)
};
class WXDLLEXPORT wxIntegerListValidator: public wxPropertyListValidator
{
public:
// 0, 0 means no range
wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags)
{
m_integerMin = min; m_integerMax = max;
}
~wxIntegerListValidator() {}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
long m_integerMin;
long m_integerMax;
private:
DECLARE_DYNAMIC_CLASS(wxIntegerListValidator)
};
class WXDLLEXPORT wxBoolListValidator: public wxPropertyListValidator
{
public:
wxBoolListValidator(long flags = 0):wxPropertyListValidator(flags) {}
~wxBoolListValidator() {}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is double clicked. Extra functionality can be provided,
// cycling through possible values.
virtual bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
private:
DECLARE_DYNAMIC_CLASS(wxBoolListValidator)
};
class WXDLLEXPORT wxStringListValidator: public wxPropertyListValidator
{
public:
wxStringListValidator(wxStringList *list = NULL, long flags = 0);
~wxStringListValidator()
{
if (m_strings)
delete m_strings;
}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is double clicked. Extra functionality can be provided,
// cycling through possible values.
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
wxStringList* m_strings;
private:
DECLARE_DYNAMIC_CLASS(wxStringListValidator)
};
class WXDLLEXPORT wxFilenameListValidator: public wxPropertyListValidator
{
public:
wxFilenameListValidator(wxString message = wxT("Select a file"), wxString wildcard = wxALL_FILES_PATTERN, long flags = 0);
~wxFilenameListValidator();
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transferance from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
wxString m_filenameWildCard;
wxString m_filenameMessage;
private:
DECLARE_DYNAMIC_CLASS(wxFilenameListValidator)
};
class WXDLLEXPORT wxColourListValidator: public wxPropertyListValidator
{
public:
wxColourListValidator(long flags = 0);
~wxColourListValidator();
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
private:
DECLARE_DYNAMIC_CLASS(wxColourListValidator)
};
class WXDLLEXPORT wxListOfStringsListValidator: public wxPropertyListValidator
{
public:
wxListOfStringsListValidator(long flags = 0);
~wxListOfStringsListValidator() {}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is double clicked.
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool EditStringList(wxWindow *parent, wxStringList *stringList, const wxChar *title = wxT("String List Editor"));
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
private:
DECLARE_DYNAMIC_CLASS(wxListOfStringsListValidator)
};
#endif
// wxUSE_PROPSHEET
#endif
// _WX_PROPLIST_H_

View File

@@ -0,0 +1,209 @@
/////////////////////////////////////////////////////////////////////////////
// Name: resource.h
// Purpose: Resource processing
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RESOURCEH__
#define _WX_RESOURCEH__
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "resource.h"
#endif
#include "wx/setup.h"
#include "wx/deprecated/setup.h"
#if wxUSE_WX_RESOURCES
#include "wx/bitmap.h"
#include <stdio.h>
// A few further types not in wx_types.h
#define wxRESOURCE_TYPE_SEPARATOR 1000
#define wxRESOURCE_TYPE_XBM_DATA 1001
#define wxRESOURCE_TYPE_XPM_DATA 1002
#define RESOURCE_PLATFORM_WINDOWS 1
#define RESOURCE_PLATFORM_X 2
#define RESOURCE_PLATFORM_MAC 3
#define RESOURCE_PLATFORM_ANY 4
// Extended styles: for resource usage only
// Use dialog units instead of pixels
#define wxRESOURCE_DIALOG_UNITS 0x0001
// Use default system colour and font
#define wxRESOURCE_USE_DEFAULTS 0x0002
// Old-style vertical label
#define wxRESOURCE_VERTICAL_LABEL 0x0004
// Old-style horizontal label
#define wxRESOURCE_HORIZONTAL_LABEL 0x0008
// Macros to help use dialog units
#define wxDLG_POINT(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxPoint(x, y)) : wxPoint(x, y))
#define wxDLG_SIZE(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxSize(x, y)) : wxSize(x, y))
#ifdef FindResource
#undef FindResource
#endif
class WXDLLEXPORT wxInputStream;
/*
* Internal format for control/panel item
*/
class WXDLLEXPORT wxItemResource: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxItemResource)
public:
wxItemResource();
~wxItemResource();
inline void SetType(const wxString& type) { m_itemType = type; }
inline void SetStyle(long styl) { m_windowStyle = styl; }
inline void SetId(int id) { m_windowId = id; }
inline void SetBitmap(const wxBitmap& bm) { m_bitmap = bm; }
inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
inline void SetFont(const wxFont& font) { m_windowFont = font; }
inline wxFont& GetFont() const { return (wxFont&) m_windowFont; }
inline void SetSize(int xx, int yy, int ww, int hh)
{ m_x = xx; m_y = yy; m_width = ww; m_height = hh; }
inline void SetTitle(const wxString& title) { m_title = title; }
inline void SetName(const wxString& name) { m_name = name; }
inline void SetValue1(long v) { m_value1 = v; }
inline void SetValue2(long v) { m_value2 = v; }
inline void SetValue3(long v) { m_value3 = v; }
inline void SetValue5(long v) { m_value5 = v; }
inline void SetValue4(const wxString& v) { m_value4 = v; }
inline void SetStringValues(const wxStringList& svalues) { m_stringValues = svalues; }
inline const wxString& GetType() const { return m_itemType; }
inline int GetX() const { return m_x; }
inline int GetY() const { return m_y; }
inline int GetWidth() const { return m_width; }
inline int GetHeight() const { return m_height; }
inline const wxString& GetTitle() const { return m_title; }
inline const wxString& GetName() const { return m_name; }
inline long GetStyle() const { return m_windowStyle; }
inline int GetId() const { return m_windowId; }
inline wxInt32 GetValue1() const { return m_value1; }
inline wxInt32 GetValue2() const { return m_value2; }
inline wxInt32 GetValue3() const { return m_value3; }
inline wxInt32 GetValue5() const { return m_value5; }
inline wxString GetValue4() const { return m_value4; }
inline wxList& GetChildren() const { return (wxList&) m_children; }
inline wxStringList& GetStringValues() const { return (wxStringList&) m_stringValues; }
inline void SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; }
inline void SetLabelColour(const wxColour& col) { m_labelColour = col; }
inline void SetButtonColour(const wxColour& col) { m_buttonColour = col; }
inline wxColour& GetBackgroundColour() const { return (wxColour&) m_backgroundColour; }
inline wxColour& GetLabelColour() const { return (wxColour&) m_labelColour; }
inline wxColour& GetButtonColour() const { return (wxColour&) m_buttonColour; }
inline void SetResourceStyle(long style) { m_exStyle = style; }
inline wxInt32 GetResourceStyle() const { return m_exStyle; }
protected:
wxList m_children;
wxString m_itemType;
int m_x, m_y, m_width, m_height;
wxString m_title;
wxString m_name;
long m_windowStyle;
long m_value1, m_value2, m_value3, m_value5;
wxString m_value4;
int m_windowId;
wxStringList m_stringValues; // Optional string values
wxBitmap m_bitmap;
wxColour m_backgroundColour;
wxColour m_labelColour;
wxColour m_buttonColour;
wxFont m_windowFont;
long m_exStyle; // Extended, resource-specific styles
};
/*
* Resource table (normally only one of these)
*/
class WXDLLEXPORT wxResourceTable: public wxHashTable
{
DECLARE_DYNAMIC_CLASS(wxResourceTable)
protected:
public:
wxHashTable identifiers;
wxResourceTable();
~wxResourceTable();
virtual wxItemResource *FindResource(const wxString& name) const;
virtual void AddResource(wxItemResource *item);
virtual bool DeleteResource(const wxString& name);
virtual bool ParseResourceFile(const wxString& filename);
virtual bool ParseResourceFile(wxInputStream *is);
virtual bool ParseResourceData(const wxString& data);
virtual bool SaveResource(const wxString& filename);
// Register XBM/XPM data
virtual bool RegisterResourceBitmapData(const wxString& name, char bits[], int width, int height);
virtual bool RegisterResourceBitmapData(const wxString& name, char **data);
virtual wxControl *CreateItem(wxWindow *panel, const wxItemResource* childResource, const wxItemResource* parentResource) const;
virtual void ClearTable();
};
WXDLLEXPORT extern void wxInitializeResourceSystem();
WXDLLEXPORT extern void wxCleanUpResourceSystem();
WXDLLEXPORT_DATA(extern wxResourceTable*) wxDefaultResourceTable;
WXDLLEXPORT extern long wxParseWindowStyle(const wxString& style);
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxBitmap;
class WXDLLEXPORT wxIcon;
WXDLLEXPORT extern wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern wxMenuBar* wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL, wxMenuBar *menuBar = (wxMenuBar *) NULL);
WXDLLEXPORT extern wxMenu* wxResourceCreateMenu(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseData(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseData(const char* resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseFile(const wxString& filename, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseString(char* s, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseString(const wxString& s, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern void wxResourceClear(wxResourceTable *table = (wxResourceTable *) NULL);
// Register XBM/XPM data
WXDLLEXPORT extern bool wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table = (wxResourceTable *) NULL);
#define wxResourceRegisterIconData wxResourceRegisterBitmapData
/*
* Resource identifer code: #define storage
*/
WXDLLEXPORT extern bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table = (wxResourceTable *) NULL);
#if defined(__WXPM__)
#include "wx/os2/wxrsc.h"
#endif
#endif
#endif
// _WX_RESOURCEH__

View File

@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/deprecated/setup.h
// Purpose: Configuration for deprecated features of the library
// Author: Julian Smart
// Modified by:
// Created: 2003-03-30
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DEPRECATED_SETUP_H_
#define _WX_DEPRECATED_SETUP_H_
// wxUSE_TIMEDATE enables compilation of the old wxDate and wxTime classes (not
// the same as wxDateTime!). These classes are obsolete and shouldn't be used
// in new code
//
// Default is 0
//
// Recommended setting: 0 unless you have legacy code which uses these classes
#define wxUSE_TIMEDATE 0
// wxProperty[Value/Form/List] classes, used by Dialog Editor
#define wxUSE_PROPSHEET 1
// wxTreeLayout class
#define wxUSE_TREELAYOUT 1
// use wxExpr (a.k.a. PrologIO)
#define wxUSE_PROLOGIO 1
// Use .wxr resource mechanism (requires PrologIO library)
#define wxUSE_WX_RESOURCES 1
#endif
// _WX_DEPRECATED_SETUP_H_

View File

@@ -0,0 +1,155 @@
///////////////////////////////////////////////////////////////////////////////
// Name: treelay.h
// Purpose: wxTreeLayout class
// Author: Julian Smart
// Modified by:
// Created: 7/4/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TREELAY_H_
#define _WX_TREELAY_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "wxtree.h"
#endif
#ifndef WX_PRECOMP
#include "wx/object.h"
class wxList;
class wxDC;
class wxMouseEvent;
#endif
#include "wx/deprecated/setup.h"
#include "wx/string.h"
#if wxUSE_TREELAYOUT
class WXDLLEXPORT wxTreeLayout: public wxObject
{
public:
wxTreeLayout();
virtual ~wxTreeLayout() { }
// Redefine these
virtual void GetChildren(long id, wxList& list) = 0;
virtual long GetNextNode(long id) = 0;
virtual long GetNodeParent(long id) = 0;
virtual long GetNodeX(long id) = 0;
virtual long GetNodeY(long id) = 0;
virtual void SetNodeX(long id, long x) = 0;
virtual void SetNodeY(long id, long y) = 0;
virtual void ActivateNode(long id, bool active) = 0;
virtual bool NodeActive(long id) = 0;
// Optional redefinition
void Initialize(void);
inline virtual void SetNodeName(long WXUNUSED(id), const wxString& WXUNUSED(name)) {}
inline virtual wxString GetNodeName(long WXUNUSED(id)) { return wxString(wxT("")); }
virtual void GetNodeSize(long id, long *x, long *y, wxDC& dc);
virtual void Draw(wxDC& dc);
virtual void DrawNodes(wxDC& dc);
virtual void DrawBranches(wxDC& dc);
virtual void DrawNode(long id, wxDC& dc);
virtual void DrawBranch(long from, long to, wxDC& dc);
// Don't redefine
virtual void DoLayout(wxDC& dc, long topNode = -1);
// Accessors -- don't redefine
inline void SetTopNode(long id) { m_parentNode = id; }
inline long GetTopNode(void) const { return m_parentNode; }
inline void SetSpacing(long x, long y) { m_xSpacing = x; m_ySpacing = y; }
inline long GetXSpacing(void) const { return m_xSpacing; }
inline long GetYSpacing(void) const { return m_ySpacing; }
inline void SetMargins(long x, long y) { m_leftMargin = x; m_topMargin = y; }
inline long GetTopMargin(void) const { return m_topMargin; }
inline long GetLeftMargin(void) const { return m_leftMargin; }
inline bool GetOrientation(void) const { return m_orientation; }
inline void SetOrientation(bool orient) { m_orientation = orient; }
private:
void CalcLayout(long node_id, int level, wxDC& dc);
protected:
long m_parentNode;
long m_lastY;
long m_lastX;
long m_xSpacing;
long m_ySpacing;
long m_topMargin;
long m_leftMargin;
bool m_orientation; // TRUE for top-to-bottom, FALSE for left-to-right
private:
DECLARE_ABSTRACT_CLASS(wxTreeLayout)
};
class WXDLLEXPORT wxStoredNode
{
public:
wxString m_name;
long m_x, m_y;
long m_parentId;
bool m_active;
long m_clientData;
};
/*
* A version of wxTreeLayout with storage for nodes
*/
class WXDLLEXPORT wxTreeLayoutStored: public wxTreeLayout
{
public:
wxTreeLayoutStored(int noNodes = 200);
virtual ~wxTreeLayoutStored(void);
void Initialize(int n);
wxString HitTest(wxMouseEvent& event, wxDC& dc);
wxStoredNode* GetNode(long id) const;
inline int GetNumNodes() const { return m_maxNodes; };
inline int GetNodeCount() const { return m_num; };
virtual void GetChildren(long id, wxList& list);
virtual long GetNextNode(long id);
virtual long GetNodeParent(long id);
virtual long GetNodeX(long id);
virtual long GetNodeY(long id);
virtual void SetNodeX(long id, long x);
virtual void SetNodeY(long id, long y);
virtual void SetNodeName(long id, const wxString& name);
virtual wxString GetNodeName(long id);
virtual void ActivateNode(long id, bool active);
virtual bool NodeActive(long id);
virtual void SetClientData(long id, long clientData);
virtual long GetClientData(long id) const;
virtual long AddChild(const wxString& name, const wxString& parent = wxT(""));
virtual long AddChild(const wxString& name, long parent);
virtual long NameToId(const wxString& name);
// Data members
private:
wxStoredNode* m_nodes;
int m_num;
int m_maxNodes;
private:
DECLARE_DYNAMIC_CLASS(wxTreeLayoutStored)
DECLARE_NO_COPY_CLASS(wxTreeLayoutStored)
};
// For backward compatibility
#define wxStoredTree wxTreeLayoutStored
#endif
// wxUSE_TREELAYOUT
#endif
// _WX_TREELAY_H_

View File

@@ -0,0 +1,285 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wxexpr.h
// Purpose: Prolog-like file I/O, used by resource system.
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WXEXPRH__
#define _WX_WXEXPRH__
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "wxexpr.h"
#endif
#include "wx/deprecated/setup.h"
#if wxUSE_PROLOGIO
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/list.h"
#include "wx/hash.h"
#include "wx/deprecated/expr.h"
#include <stdio.h>
// Compatibility
#define PrologExpr wxExpr
#define PrologDatabase wxExprDatabase
#define proioErrorHandler wxExprErrorHandler
#define PROIO_ERROR_GENERAL 1
#define PROIO_ERROR_SYNTAX 2
#define PrologNull wxExprNull
#define PrologInteger wxExprInteger
#define PrologReal wxExprReal
#define PrologWord wxExprWord
#define PrologString wxExprString
#define PrologList wxExprList
#define PrologType wxExprType
// Error types
#define WXEXPR_ERROR_GENERAL 1
#define WXEXPR_ERROR_SYNTAX 2
// Error handler function definition. If app returns TRUE,
// carry on processing.
typedef bool (*wxExprErrorHandler) (int errorType, char *msg);
WXDLLEXPORT_DATA(extern wxExprErrorHandler) currentwxExprErrorHandler;
typedef enum {
wxExprNull,
wxExprInteger,
wxExprReal,
wxExprWord,
wxExprString,
wxExprList
} wxExprType;
class WXDLLEXPORT wxExprDatabase;
class WXDLLEXPORT wxExpr
{
public:
wxObject *client_data;
wxExprType type;
union {
long integer;
wxChar *word;
wxChar *string;
double real;
wxExpr *first; // If is a list expr, points to the first node
} value;
wxExpr *next; // If this is a node in a list, points to the next node
wxExpr *last; // If is a list expr, points to the last node
wxExpr(wxExprType the_type, wxChar *word_or_string, bool allocate);
wxExpr(const wxString& functor); // Assume this is a new clause - pass functor
wxExpr(wxExprType the_type, const wxString& word_or_string = wxT(""));
wxExpr(long the_integer);
wxExpr(double the_real);
wxExpr(wxList *the_list);
~wxExpr(void);
inline wxExprType Type(void) const { return type; }
inline long IntegerValue(void) const
{
if (type == wxExprInteger)
return value.integer;
else if (type == wxExprReal)
return (long)value.real;
else return 0;
}
inline double RealValue(void) const {
if (type == wxExprReal)
return value.real;
else if (type == wxExprInteger)
return (double)value.integer;
else return (double)0.0;
}
inline wxString WordValue(void) const {
if (type == wxExprWord)
return value.word;
else if (type == wxExprString)
return wxString(value.string);
else return wxString(wxT(""));
}
inline wxString StringValue(void) const {
if (type == wxExprString)
return wxString(value.string);
else if (type == wxExprWord)
return wxString(value.word);
else return wxString(wxT(""));
}
// Get nth arg of clause (starting from 1)
wxExpr *Arg(wxExprType type, int arg) const;
// Return nth argument of a list expression (starting from zero)
wxExpr *Nth(int arg) const;
// Returns the number of elements in a list expression
int Number(void) const;
// Make a clone
wxExpr *Copy(void) const;
wxExpr *GetAttributeValueNode(const wxString& word) const; // Use only for a clause or list
wxExpr *AttributeValue(const wxString& word) const; // Use only for a clause
wxString Functor(void) const; // Only for a clause
bool IsFunctor(const wxString& s) const; // Only for a clause
void WriteClause(FILE* stream); // Write this expression as a top-level clause
void WriteExpr(FILE* stream); // Write as any other subexpression
// Append an expression to a list
void Append(wxExpr *expr);
// Insert at beginning of list
void Insert(wxExpr *expr);
// Get first expr in list
inline wxExpr *GetFirst(void) const { return ((type == wxExprList) ? value.first : (wxExpr*)NULL); }
// Get next expr if this is a node in a list
inline wxExpr *GetNext(void) const { return next; }
// Get last expr in list
inline wxExpr *GetLast(void) const { return ((type == wxExprList) ? last : (wxExpr*)NULL); }
// This should really be called SetAttributeValue since any existing
// attribute-value is deleted first.
void AddAttributeValue(const wxString& attribute, long value);
void AddAttributeValue(const wxString& attribute, double value);
void AddAttributeValueWord(const wxString& attribute, const wxString& value);
void AddAttributeValueString(const wxString& attribute, const wxString& value);
void AddAttributeValue(const wxString& attribute, wxList *value);
void AddAttributeValue(const wxString& attribute, wxExpr *value);
void AddAttributeValueStringList(const wxString& attribute, wxList *string_list);
void DeleteAttributeValue(const wxString& attribute);
bool GetAttributeValue(const wxString& att, int& var) const;
bool GetAttributeValue(const wxString& att, long& var) const;
bool GetAttributeValue(const wxString& att, float& var) const;
bool GetAttributeValue(const wxString& att, double& var) const;
bool GetAttributeValue(const wxString& att, wxString& var) const; // Word OR string -> string
bool GetAttributeValue(const wxString& att, wxExpr **var) const;
// Compatibility with old PrologIO
inline void AssignAttributeValue(wxChar *att, int *var) const { GetAttributeValue(att, *var); }
inline void AssignAttributeValue(wxChar *att, long *var) const { GetAttributeValue(att, *var); }
inline void AssignAttributeValue(wxChar *att, float *var) const { GetAttributeValue(att, *var); }
inline void AssignAttributeValue(wxChar *att, double *var) const { GetAttributeValue(att, *var); }
inline void AssignAttributeValue(wxChar *att, wxExpr **var) const { GetAttributeValue(att, var); }
void AssignAttributeValue(wxChar *att, wxChar **var) const ; // Word OR string -> string
// Add string items to list if the list attribute exists
bool GetAttributeValueStringList(const wxString& att, wxList *var) const;
// Associate other data with this expression, e.g. when reading in a
// number of linked items - store C++ object pointer with the expression
// so we can index into the wxExpr database and fish out the pointer.
inline void SetClientData(wxObject *data) { client_data = data; }
inline wxObject *GetClientData(void) const { return client_data; }
DECLARE_NO_COPY_CLASS(wxExpr)
};
class WXDLLEXPORT wxExprDatabase: public wxList
{
private:
wxNode *position; // Where we are in a search
wxHashTable *hash_table;
wxString attribute_to_hash;
public:
int noErrors;
wxExprDatabase(wxExprErrorHandler handler = 0);
// Use hashing on both the functor, and the attribute of
// specified type (wxExprString or wxExprInteger) and name.
// So to find node 45
// (i.e. match the clause node(id=45, ...))
// it usually requires 1 look-up: the keys for functor and attribute
// are added together.
// Obviously if the attribute was missing in a clause, it would
// fail to be found by this method, but could be retrieved by a
// linear search using BeginFind and FindClauseByFunctor,
// or just searching through the list as per usual.
wxExprDatabase(wxExprType type, const wxString& attribute, int size = 500,
wxExprErrorHandler handler = 0);
~wxExprDatabase(void);
void BeginFind(void) ; // Initialise a search
wxExpr *FindClause(long id) ; // Find a term based on an integer id attribute
// e.g. node(id=23, type=rectangle, ....).
// Find on basis of attribute/value pairs, e.g. type=rectangle
// This doesn't use hashing; it's a linear search.
wxExpr *FindClause(const wxString& word, const wxString& value);
wxExpr *FindClause(const wxString& word, long value);
wxExpr *FindClause(const wxString& word, double value);
wxExpr *FindClauseByFunctor(const wxString& functor);
wxExpr *HashFind(const wxString& functor, const wxString& value) const;
wxExpr *HashFind(const wxString& functor, long value) const;
void Append(wxExpr *expr); // Does cleverer things if hashing is on
void ClearDatabase(void);
inline int GetErrorCount() const { return noErrors; }
bool Read(const wxString& filename);
bool ReadFromString(const wxString& buffer);
bool Write(const wxString& fileName);
bool Write(FILE* stream);
// Compatibility
inline bool ReadProlog(wxChar *filename) { return Read(wxString(filename)); }
inline bool ReadPrologFromString(char *buffer)
{
return ReadFromString(wxString(buffer, wxConvLibc));
}
inline void WriteProlog(FILE* stream) { Write(stream); }
private:
DECLARE_DYNAMIC_CLASS(wxExprDatabase)
DECLARE_NO_COPY_CLASS(wxExprDatabase)
};
// Function call-style interface - some more convenience wrappers/unwrappers
// Make a call
WXDLLEXPORT wxExpr* wxExprMakeCall(const wxString& functor ...);
#define wxExprMakeInteger(x) (new wxExpr((long)x))
#define wxExprMakeReal(x) (new wxExpr((double)x))
#define wxExprMakeString(x) (new wxExpr(wxExprString, x))
#define wxExprMakeWord(x) (new wxExpr(wxExprWord, x))
#define wxExprMake(x) (new wxExpr(x))
// Checks functor
WXDLLEXPORT bool wxExprIsFunctor(wxExpr *expr, const wxString& functor);
// Temporary variable for communicating between wxexpr.cpp and YACC/LEX
WXDLLEXPORT_DATA(extern wxExprDatabase*) thewxExprDatabase;
// YACC/LEX can leave memory lying around...
extern "C" WXDLLEXPORT int wxExprCleanUp();
#endif // wxUSE_PROLOGIO
#endif // _WX_WXEXPRH__