Added Property List classes to main library; added proplist sample; merged
changes.txt files git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
325
include/wx/prop.h
Normal file
325
include/wx/prop.h
Normal file
@@ -0,0 +1,325 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "prop.h"
|
||||
#endif
|
||||
|
||||
#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"
|
||||
|
||||
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 wxPropertySheet: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertySheet)
|
||||
public:
|
||||
wxPropertySheet(void);
|
||||
~wxPropertySheet(void);
|
||||
|
||||
// Add a property
|
||||
virtual void AddProperty(wxProperty *property);
|
||||
|
||||
// Get property by name
|
||||
virtual wxProperty *GetProperty(wxString name);
|
||||
|
||||
// Clear all properties
|
||||
virtual void Clear(void);
|
||||
|
||||
virtual bool Save(ostream& str);
|
||||
virtual bool Load(ostream& str);
|
||||
|
||||
virtual void UpdateAllViews(wxPropertyView *thisView = NULL);
|
||||
inline virtual wxList& GetProperties(void) 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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Base class for property sheet views. There are currently two directly derived
|
||||
// classes: wxPropertyListView, and wxPropertyFormView.
|
||||
class wxPropertyView: public wxEvtHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyView)
|
||||
public:
|
||||
wxPropertyView(long flags = 0);
|
||||
~wxPropertyView(void);
|
||||
|
||||
// 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(void) {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(void) const
|
||||
{ return (wxList&) m_validatorRegistryList; }
|
||||
|
||||
virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property);
|
||||
inline virtual void SetPropertySheet(wxPropertySheet *sheet) { m_propertySheet = sheet; }
|
||||
inline virtual wxPropertySheet *GetPropertySheet(void) const { return m_propertySheet; }
|
||||
|
||||
virtual void OnOk(void) {};
|
||||
virtual void OnCancel(void) {};
|
||||
virtual void OnHelp(void) {};
|
||||
|
||||
inline virtual bool OnClose(void) { 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;
|
||||
};
|
||||
|
||||
|
||||
class wxPropertyValidator: public wxEvtHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyValidator)
|
||||
public:
|
||||
wxPropertyValidator(long flags = 0);
|
||||
~wxPropertyValidator(void);
|
||||
|
||||
inline long GetFlags(void) const { return m_validatorFlags; }
|
||||
inline void SetValidatorProperty(wxProperty *prop) { m_validatorProperty = prop; }
|
||||
inline wxProperty *GetValidatorProperty(void) const { return m_validatorProperty; }
|
||||
|
||||
virtual bool StringToFloat (char *s, float *number);
|
||||
virtual bool StringToDouble (char *s, double *number);
|
||||
virtual bool StringToInt (char *s, int *number);
|
||||
virtual bool StringToLong (char *s, long *number);
|
||||
virtual char *FloatToString (float number);
|
||||
virtual char *DoubleToString (double number);
|
||||
virtual char *IntToString (int number);
|
||||
virtual char *LongToString (long number);
|
||||
|
||||
protected:
|
||||
long m_validatorFlags;
|
||||
wxProperty* m_validatorProperty;
|
||||
};
|
||||
|
||||
|
||||
// extern wxPropertyValidator *wxDefaultPropertyValidator;
|
||||
|
||||
class wxPropertyValidatorRegistry: public wxHashTable
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyValidatorRegistry)
|
||||
public:
|
||||
wxPropertyValidatorRegistry(void);
|
||||
~wxPropertyValidatorRegistry(void);
|
||||
|
||||
virtual void RegisterValidator(const wxString& roleName, wxPropertyValidator *validator);
|
||||
virtual wxPropertyValidator *GetValidator(const wxString& roleName);
|
||||
void ClearRegistry(void);
|
||||
};
|
||||
|
||||
/*
|
||||
* Property value class
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
wxPropertyValueNull,
|
||||
wxPropertyValueInteger,
|
||||
wxPropertyValueReal,
|
||||
wxPropertyValuebool,
|
||||
wxPropertyValueString,
|
||||
wxPropertyValueList,
|
||||
wxPropertyValueIntegerPtr,
|
||||
wxPropertyValueRealPtr,
|
||||
wxPropertyValueboolPtr,
|
||||
wxPropertyValueStringPtr
|
||||
} wxPropertyValueType;
|
||||
|
||||
class wxPropertyValue: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyValue)
|
||||
|
||||
wxPropertyValue(void); // Unknown type
|
||||
wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor
|
||||
wxPropertyValue(const char *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(char **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 char *StringValue(void) const;
|
||||
virtual long *IntegerValuePtr(void) const;
|
||||
virtual float *RealValuePtr(void) const;
|
||||
virtual bool *BoolValuePtr(void) const;
|
||||
virtual char **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(ostream& stream); // Write this expression as a top-level clause
|
||||
virtual void WritePropertyType(ostream& 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 char **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
|
||||
char *string;
|
||||
float real;
|
||||
long *integerPtr;
|
||||
bool *boolPtr;
|
||||
char **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 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
|
||||
// _WX_PROP_H_
|
297
include/wx/propform.h
Normal file
297
include/wx/propform.h
Normal file
@@ -0,0 +1,297 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "propform.h"
|
||||
#endif
|
||||
|
||||
#include "wx/prop.h"
|
||||
|
||||
////
|
||||
//// 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 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(void);
|
||||
virtual void OnDoubleClick(wxControl *item);
|
||||
|
||||
// TODO: does OnCommand still get called...???
|
||||
virtual void OnCommand(wxWindow& win, wxCommandEvent& 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 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) ) {}
|
||||
};
|
||||
|
||||
/*
|
||||
* Some default validators
|
||||
*/
|
||||
|
||||
class 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 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 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 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 wxPropertyFormDialog: public wxDialog
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyFormDialog)
|
||||
public:
|
||||
wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox");
|
||||
bool OnClose(void);
|
||||
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;
|
||||
};
|
||||
|
||||
/*
|
||||
* A default panel class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyFormPanel: public wxPanel
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyFormPanel)
|
||||
public:
|
||||
wxPropertyFormPanel(wxPropertyFormView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "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);
|
||||
|
||||
private:
|
||||
wxPropertyFormView* m_view;
|
||||
};
|
||||
|
||||
/*
|
||||
* A default frame class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyFormFrame: public wxFrame
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyFormFrame)
|
||||
public:
|
||||
wxPropertyFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
|
||||
wxFrame(parent, -1, title, pos, size, style, name)
|
||||
{
|
||||
m_view = v;
|
||||
m_propertyPanel = NULL;
|
||||
}
|
||||
bool OnClose(void);
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_PROPFORM_H_
|
557
include/wx/proplist.h
Normal file
557
include/wx/proplist.h
Normal file
@@ -0,0 +1,557 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "proplist.h"
|
||||
#endif
|
||||
|
||||
#include "wx/prop.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
|
||||
|
||||
#ifdef __XVIEW__
|
||||
#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 wxPropertyListView: public wxPropertyView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyListView)
|
||||
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
|
||||
|
||||
bool m_detailedEditing; // E.g. using listbox for choices
|
||||
|
||||
static wxBitmap* sm_tickBitmap;
|
||||
static wxBitmap* sm_crossBitmap;
|
||||
|
||||
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;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class wxPropertyTextEdit: public wxTextCtrl
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyTextEdit)
|
||||
public:
|
||||
wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id,
|
||||
const wxString& value, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "text");
|
||||
void OnSetFocus(void);
|
||||
void OnKillFocus(void);
|
||||
|
||||
wxPropertyListView* m_view;
|
||||
};
|
||||
|
||||
#define wxPROP_ALLOW_TEXT_EDITING 1
|
||||
|
||||
/*
|
||||
* The type of validator used for property lists (Visual Basic style)
|
||||
*/
|
||||
|
||||
class wxPropertyListValidator: public wxPropertyValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPropertyListValidator)
|
||||
protected:
|
||||
public:
|
||||
wxPropertyListValidator(long flags = wxPROP_ALLOW_TEXT_EDITING): wxPropertyValidator(flags) { }
|
||||
~wxPropertyListValidator(void) {}
|
||||
|
||||
// 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);
|
||||
};
|
||||
|
||||
/*
|
||||
* A default dialog box class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyListDialog: public wxDialog
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyListDialog)
|
||||
public:
|
||||
wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox");
|
||||
bool OnClose(void);
|
||||
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;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/*
|
||||
* A default panel class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyListPanel: public wxPanel
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyListPanel)
|
||||
public:
|
||||
wxPropertyListPanel(wxPropertyListView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = "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;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/*
|
||||
* A default frame class to use.
|
||||
*/
|
||||
|
||||
class wxPropertyListFrame: public wxFrame
|
||||
{
|
||||
DECLARE_CLASS(wxPropertyListFrame)
|
||||
public:
|
||||
wxPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME, const wxString& name = "frame"):
|
||||
wxFrame(parent, -1, title, pos, size, style, name)
|
||||
{
|
||||
m_view = v;
|
||||
m_propertyPanel = NULL;
|
||||
}
|
||||
bool OnClose(void);
|
||||
|
||||
// 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; }
|
||||
|
||||
private:
|
||||
wxPropertyListView* m_view;
|
||||
wxPropertyListPanel* m_propertyPanel;
|
||||
};
|
||||
|
||||
/*
|
||||
* Some default validators
|
||||
*/
|
||||
|
||||
class wxRealListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRealListValidator)
|
||||
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(void) {}
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
class wxIntegerListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxIntegerListValidator)
|
||||
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(void) {}
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
class wxBoolListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBoolListValidator)
|
||||
protected:
|
||||
public:
|
||||
wxBoolListValidator(long flags = 0):wxPropertyListValidator(flags)
|
||||
{
|
||||
}
|
||||
~wxBoolListValidator(void) {}
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
class wxStringListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStringListValidator)
|
||||
public:
|
||||
wxStringListValidator(wxStringList *list = NULL, long flags = 0);
|
||||
|
||||
~wxStringListValidator(void)
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
class wxFilenameListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFilenameListValidator)
|
||||
public:
|
||||
wxFilenameListValidator(wxString message = "Select a file", wxString wildcard = "*.*", long flags = 0);
|
||||
|
||||
~wxFilenameListValidator(void);
|
||||
|
||||
// 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;
|
||||
|
||||
};
|
||||
|
||||
class wxColourListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxColourListValidator)
|
||||
protected:
|
||||
public:
|
||||
wxColourListValidator(long flags = 0);
|
||||
|
||||
~wxColourListValidator(void);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
class wxListOfStringsListValidator: public wxPropertyListValidator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListOfStringsListValidator)
|
||||
protected:
|
||||
public:
|
||||
wxListOfStringsListValidator(long flags = 0);
|
||||
|
||||
~wxListOfStringsListValidator(void)
|
||||
{
|
||||
}
|
||||
|
||||
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 char *title = "String List Editor");
|
||||
|
||||
// Called when the edit (...) button is pressed.
|
||||
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_PROPLIST_H_
|
Reference in New Issue
Block a user