Dialog unit mods; wxProp tidying

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@816 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-10-09 12:01:58 +00:00
parent c39d4bcf2b
commit fd71308fc8
57 changed files with 2060 additions and 1850 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -41,11 +41,6 @@ class wxPropertyValidatorRegistry;
class wxPropertySheet: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxPropertySheet)
protected:
wxObject *viewedObject;
wxList properties;
wxPropertyView *propertyView;
public:
wxPropertySheet(void);
~wxPropertySheet(void);
@@ -63,10 +58,16 @@ class wxPropertySheet: public wxObject
virtual bool Load(ostream& str);
virtual void UpdateAllViews(wxPropertyView *thisView = NULL);
inline virtual wxList& GetProperties(void) { return properties; }
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;
};
@@ -75,12 +76,6 @@ class wxPropertySheet: public wxObject
class wxPropertyView: public wxEvtHandler
{
DECLARE_DYNAMIC_CLASS(wxPropertyView)
protected:
long buttonFlags;
wxPropertySheet *propertySheet;
wxProperty *currentProperty;
wxList validatorRegistryList;
wxPropertyValidator *currentValidator;
public:
wxPropertyView(long flags = 0);
~wxPropertyView(void);
@@ -97,35 +92,39 @@ class wxPropertyView: public wxEvtHandler
virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {}
virtual void AddRegistry(wxPropertyValidatorRegistry *registry);
inline virtual wxList& GetRegistryList(void)
{ return validatorRegistryList; }
inline virtual wxList& GetRegistryList(void) const
{ return (wxList&) m_validatorRegistryList; }
virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property);
inline virtual void SetPropertySheet(wxPropertySheet *sheet) { propertySheet = sheet; }
inline virtual wxPropertySheet *GetPropertySheet(void) { return propertySheet; }
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 buttonFlags; }
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)
protected:
long validatorFlags;
wxProperty *validatorProperty;
public:
wxPropertyValidator(long flags = 0);
~wxPropertyValidator(void);
inline long GetFlags(void) { return validatorFlags; }
inline void SetValidatorProperty(wxProperty *prop) { validatorProperty = prop; }
inline wxProperty *GetValidatorProperty(void) { return validatorProperty; }
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);
@@ -135,6 +134,10 @@ class wxPropertyValidator: public wxEvtHandler
virtual char *DoubleToString (double number);
virtual char *IntToString (int number);
virtual char *LongToString (long number);
protected:
long m_validatorFlags;
wxProperty* m_validatorProperty;
};
@@ -172,24 +175,6 @@ typedef enum {
class wxPropertyValue: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxPropertyValue)
public:
wxObject *client_data;
wxPropertyValueType type;
bool 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
} value;
wxPropertyValue *next; // If this is a node in a list, points to the next node
wxPropertyValue *last; // If is a list expr, points to the last node
wxPropertyValue(void); // Unknown type
wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor
@@ -209,26 +194,26 @@ class wxPropertyValue: public wxObject
~wxPropertyValue(void);
virtual inline wxPropertyValueType Type(void) { return type; }
virtual inline void SetType(wxPropertyValueType typ) { type = typ; }
virtual long IntegerValue(void);
virtual float RealValue(void);
virtual bool BoolValue(void);
virtual char *StringValue(void);
virtual long *IntegerValuePtr(void);
virtual float *RealValuePtr(void);
virtual bool *BoolValuePtr(void);
virtual char **StringValuePtr(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);
virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg) const;
// Return nth argument of a list expression (starting from zero)
virtual wxPropertyValue *Nth(int arg);
virtual wxPropertyValue *Nth(int arg) const;
// Returns the number of elements in a list expression
virtual int Number(void);
virtual int Number(void) const;
virtual wxPropertyValue *NewCopy(void);
virtual wxPropertyValue *NewCopy(void) const;
virtual void Copy(wxPropertyValue& copyFrom);
virtual void WritePropertyClause(ostream& stream); // Write this expression as a top-level clause
@@ -240,16 +225,16 @@ class wxPropertyValue: public wxObject
virtual void Insert(wxPropertyValue *expr);
// Get first expr in list
virtual inline wxPropertyValue *GetFirst(void)
{ return ((type == wxPropertyValueList) ? value.first : (wxPropertyValue*)NULL); }
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)
{ return next; }
virtual inline wxPropertyValue *GetNext(void) const
{ return m_next; }
// Get last expr in list
virtual inline wxPropertyValue *GetLast(void)
{ return ((type == wxPropertyValueList) ? last : (wxPropertyValue*)NULL); }
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);
@@ -257,13 +242,13 @@ class wxPropertyValue: public wxObject
// Clear list
virtual void ClearList(void);
virtual inline void SetClientData(wxObject *data) { client_data = data; }
virtual inline wxObject *GetClientData(void) { return client_data; }
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) { modifiedFlag = flag; }
inline bool GetModified(void) { return modifiedFlag; }
inline void SetModified(bool flag = TRUE) { m_modifiedFlag = flag; }
inline bool GetModified(void) { return m_modifiedFlag; }
// Operators
void operator=(const wxPropertyValue& val);
@@ -276,6 +261,26 @@ class wxPropertyValue: public wxObject
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
};
/*
@@ -286,13 +291,13 @@ class wxProperty: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxProperty)
protected:
bool enabled;
bool m_enabled;
public:
wxPropertyValue value;
wxString name;
wxString propertyRole;
wxPropertyValidator *propertyValidator;
wxWindow *propertyWindow; // Usually a panel item, if anything
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);
@@ -300,20 +305,20 @@ class wxProperty: public wxObject
wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL);
~wxProperty(void);
virtual wxPropertyValue& GetValue(void);
virtual wxPropertyValidator *GetValidator(void);
virtual wxString& GetName(void);
virtual wxString& GetRole(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) { propertyWindow = win; }
virtual inline wxWindow *GetWindow(void) { return propertyWindow; }
virtual inline void SetWindow(wxWindow *win) { m_propertyWindow = win; }
virtual inline wxWindow *GetWindow(void) const { return m_propertyWindow; }
inline void Enable(bool en) { enabled = en; }
inline bool IsEnabled(void) { return enabled; }
inline void Enable(bool en) { m_enabled = en; }
inline bool IsEnabled(void) const { return m_enabled; }
};
#endif

View File

@@ -54,18 +54,18 @@ BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView)
EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate)
END_EVENT_TABLE()
bool wxPropertyFormView::dialogCancelled = FALSE;
bool wxPropertyFormView::sm_dialogCancelled = FALSE;
wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags)
{
propertyWindow = propPanel;
managedWindow = NULL;
m_propertyWindow = propPanel;
m_managedWindow = NULL;
windowCloseButton = NULL;
windowCancelButton = NULL;
windowHelpButton = NULL;
m_windowCloseButton = NULL;
m_windowCancelButton = NULL;
m_windowHelpButton = NULL;
detailedEditing = FALSE;
m_detailedEditing = FALSE;
}
wxPropertyFormView::~wxPropertyFormView(void)
@@ -74,8 +74,8 @@ wxPropertyFormView::~wxPropertyFormView(void)
void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel)
{
propertySheet = ps;
m_propertySheet = ps;
AssociatePanel(panel);
// CreateControls();
// UpdatePropertyList();
@@ -90,10 +90,10 @@ bool wxPropertyFormView::OnUpdateView(void)
bool wxPropertyFormView::Check(void)
{
if (!propertySheet)
if (!m_propertySheet)
return FALSE;
wxNode *node = propertySheet->GetProperties().First();
wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
@@ -101,7 +101,7 @@ bool wxPropertyFormView::Check(void)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
if (!formValidator->OnCheckValue(prop, this, propertyWindow))
if (!formValidator->OnCheckValue(prop, this, m_propertyWindow))
return FALSE;
}
node = node->Next();
@@ -111,10 +111,10 @@ bool wxPropertyFormView::Check(void)
bool wxPropertyFormView::TransferToPropertySheet(void)
{
if (!propertySheet)
if (!m_propertySheet)
return FALSE;
wxNode *node = propertySheet->GetProperties().First();
wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
@@ -122,7 +122,7 @@ bool wxPropertyFormView::TransferToPropertySheet(void)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnRetrieveValue(prop, this, propertyWindow);
formValidator->OnRetrieveValue(prop, this, m_propertyWindow);
}
node = node->Next();
}
@@ -131,10 +131,10 @@ bool wxPropertyFormView::TransferToPropertySheet(void)
bool wxPropertyFormView::TransferToDialog(void)
{
if (!propertySheet)
if (!m_propertySheet)
return FALSE;
wxNode *node = propertySheet->GetProperties().First();
wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
@@ -142,7 +142,7 @@ bool wxPropertyFormView::TransferToDialog(void)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnDisplayValue(prop, this, propertyWindow);
formValidator->OnDisplayValue(prop, this, m_propertyWindow);
}
node = node->Next();
}
@@ -151,16 +151,16 @@ bool wxPropertyFormView::TransferToDialog(void)
bool wxPropertyFormView::AssociateNames(void)
{
if (!propertySheet || !propertyWindow)
if (!m_propertySheet || !m_propertyWindow)
return FALSE;
wxNode *node = propertyWindow->GetChildren()->First();
wxNode *node = m_propertyWindow->GetChildren()->First();
while (node)
{
wxWindow *win = (wxWindow *)node->Data();
if (win->GetName() != "")
{
wxProperty *prop = propertySheet->GetProperty(win->GetName());
wxProperty *prop = m_propertySheet->GetProperty(win->GetName());
if (prop)
prop->SetWindow(win);
}
@@ -182,16 +182,16 @@ void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event))
if (!Check())
return;
dialogCancelled = FALSE;
sm_dialogCancelled = FALSE;
managedWindow->Close(TRUE);
m_managedWindow->Close(TRUE);
}
void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event))
{
dialogCancelled = TRUE;
managedWindow->Close(TRUE);
sm_dialogCancelled = TRUE;
m_managedWindow->Close(TRUE);
}
void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event))
@@ -210,7 +210,7 @@ void wxPropertyFormView::OnRevert(wxCommandEvent& WXUNUSED(event))
void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
{
if (!propertySheet)
if (!m_propertySheet)
return;
if (win.GetName() == "")
@@ -229,7 +229,7 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
else
{
// Find a validator to route the command to.
wxNode *node = propertySheet->GetProperties().First();
wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
@@ -239,7 +239,7 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnCommand(prop, this, propertyWindow, event);
formValidator->OnCommand(prop, this, m_propertyWindow, event);
return;
}
}
@@ -250,11 +250,11 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
void wxPropertyFormView::OnDoubleClick(wxControl *item)
{
if (!propertySheet)
if (!m_propertySheet)
return;
// Find a validator to route the command to.
wxNode *node = propertySheet->GetProperties().First();
wxNode *node = m_propertySheet->GetProperties().First();
while (node)
{
wxProperty *prop = (wxProperty *)node->Data();
@@ -264,7 +264,7 @@ void wxPropertyFormView::OnDoubleClick(wxControl *item)
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnDoubleClick(prop, this, propertyWindow);
formValidator->OnDoubleClick(prop, this, m_propertyWindow);
return;
}
}
@@ -282,18 +282,18 @@ wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *pare
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name)
{
view = v;
view->AssociatePanel(this);
view->SetManagedWindow(this);
m_view = v;
m_view->AssociatePanel(this);
m_view->SetManagedWindow(this);
// SetAutoLayout(TRUE);
}
bool wxPropertyFormDialog::OnClose(void)
{
if (view)
if (m_view)
{
view->OnClose();
view = NULL;
m_view->OnClose();
m_view = NULL;
return TRUE;
}
else
@@ -302,19 +302,19 @@ bool wxPropertyFormDialog::OnClose(void)
void wxPropertyFormDialog::OnDefaultAction(wxControl *item)
{
view->OnDoubleClick(item);
m_view->OnDoubleClick(item);
}
void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event)
{
if ( view )
view->OnCommand(win, event);
if ( m_view )
m_view->OnCommand(win, event);
}
// Extend event processing to search the view's event table
bool wxPropertyFormDialog::ProcessEvent(wxEvent& event)
{
if ( !view || ! view->ProcessEvent(event) )
if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
@@ -329,18 +329,18 @@ IMPLEMENT_CLASS(wxPropertyFormPanel, wxPanel)
void wxPropertyFormPanel::OnDefaultAction(wxControl *item)
{
view->OnDoubleClick(item);
m_view->OnDoubleClick(item);
}
void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event)
{
view->OnCommand(win, event);
m_view->OnCommand(win, event);
}
// Extend event processing to search the view's event table
bool wxPropertyFormPanel::ProcessEvent(wxEvent& event)
{
if ( !view || ! view->ProcessEvent(event) )
if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
@@ -354,8 +354,8 @@ IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame)
bool wxPropertyFormFrame::OnClose(void)
{
if (view)
return view->OnClose();
if (m_view)
return m_view->OnClose();
else
return FALSE;
}
@@ -367,12 +367,11 @@ wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView
bool wxPropertyFormFrame::Initialize(void)
{
propertyPanel = OnCreatePanel(this, view);
if (propertyPanel)
m_propertyPanel = OnCreatePanel(this, m_view);
if (m_propertyPanel)
{
view->AssociatePanel(propertyPanel);
view->SetManagedWindow(this);
// propertyPanel->SetAutoLayout(TRUE);
m_view->AssociatePanel(m_propertyPanel);
m_view->SetManagedWindow(this);
return TRUE;
}
else
@@ -398,15 +397,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator)
bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow)
{
if (realMin == 0.0 && realMax == 0.0)
if (m_realMin == 0.0 && m_realMax == 0.0)
return TRUE;
// The item used for viewing the real number: should be a text item.
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
wxString value(((wxTextCtrl *)propertyWindow)->GetValue());
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
float val = 0.0;
if (!StringToFloat(WXSTRINGCAST value, &val))
@@ -417,10 +416,10 @@ bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView
return FALSE;
}
if (val < realMin || val > realMax)
if (val < m_realMin || val > m_realMax)
{
char buf[200];
sprintf(buf, "Value must be a real number between %.2f and %.2f!", realMin, realMax);
sprintf(buf, "Value must be a real number between %.2f and %.2f!", m_realMin, m_realMax);
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
@@ -431,11 +430,11 @@ bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormVi
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the real number: should be a text item.
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
wxString value(((wxTextCtrl *)propertyWindow)->GetValue());
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (value.Length() == 0)
return FALSE;
@@ -449,11 +448,11 @@ bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the real number: should be a text item.
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
wxTextCtrl *textItem = (wxTextCtrl *)propertyWindow;
wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
textItem->SetValue(FloatToString(property->GetValue().RealValue()));
return TRUE;
}
@@ -466,19 +465,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator)
bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow)
{
if (integerMin == 0.0 && integerMax == 0.0)
if (m_integerMin == 0.0 && m_integerMax == 0.0)
return TRUE;
// The item used for viewing the real number: should be a text item or a slider
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow)
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
long val = 0;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxString value(((wxTextCtrl *)propertyWindow)->GetValue());
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (!StringToLong(WXSTRINGCAST value, &val))
{
@@ -488,17 +487,17 @@ bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormVi
return FALSE;
}
}
else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
{
val = (long)((wxSlider *)propertyWindow)->GetValue();
val = (long)((wxSlider *)m_propertyWindow)->GetValue();
}
else
return FALSE;
if (val < integerMin || val > integerMax)
if (val < m_integerMin || val > m_integerMax)
{
char buf[200];
sprintf(buf, "Value must be an integer between %ld and %ld!", integerMin, integerMax);
sprintf(buf, "Value must be an integer between %ld and %ld!", m_integerMin, m_integerMax);
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
@@ -509,13 +508,13 @@ bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFor
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the real number: should be a text item or a slider
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow)
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxString value(((wxTextCtrl *)propertyWindow)->GetValue());
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (value.Length() == 0)
return FALSE;
@@ -523,9 +522,9 @@ bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFor
long i = atol((const char *)value);
property->GetValue() = i;
}
else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
{
property->GetValue() = (long)((wxSlider *)propertyWindow)->GetValue();
property->GetValue() = (long)((wxSlider *)m_propertyWindow)->GetValue();
}
else
return FALSE;
@@ -537,18 +536,18 @@ bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFor
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the real number: should be a text item or a slider
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow)
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *textItem = (wxTextCtrl *)propertyWindow;
wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
textItem->SetValue(LongToString(property->GetValue().IntegerValue()));
}
else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
{
((wxSlider *)propertyWindow)->SetValue((int)property->GetValue().IntegerValue());
((wxSlider *)m_propertyWindow)->SetValue((int)property->GetValue().IntegerValue());
}
else
return FALSE;
@@ -564,8 +563,8 @@ bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the boolean: should be a checkbox
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
return TRUE;
@@ -575,12 +574,12 @@ bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormVi
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the boolean: should be a checkbox.
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
property->GetValue() = (bool)checkBox->GetValue();
return TRUE;
}
@@ -589,11 +588,11 @@ bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the boolean: should be a checkbox.
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
checkBox->SetValue((bool)property->GetValue().BoolValue());
return TRUE;
}
@@ -606,23 +605,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator)
wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags):
wxPropertyFormValidator(flags)
{
strings = list;
m_strings = list;
}
bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow )
{
if (!strings)
if (!m_strings)
return TRUE;
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow)
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
if (!strings->Member(text->GetValue()))
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
if (!m_strings->Member(text->GetValue()))
{
wxString s("Value ");
s += text->GetValue();
@@ -643,32 +642,32 @@ bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyForm
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow)
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
property->GetValue() = text->GetValue();
}
else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
{
wxListBox *lbox = (wxListBox *)propertyWindow;
wxListBox *lbox = (wxListBox *)m_propertyWindow;
if (lbox->GetSelection() > -1)
property->GetValue() = lbox->GetStringSelection();
}
/*
else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
{
wxRadioBox *rbox = (wxRadioBox *)propertyWindow;
wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
int n = 0;
if ((n = rbox->GetSelection()) > -1)
property->GetValue() = rbox->GetString(n);
}
*/
else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
{
wxChoice *choice = (wxChoice *)propertyWindow;
wxChoice *choice = (wxChoice *)m_propertyWindow;
if (choice->GetSelection() > -1)
property->GetValue() = choice->GetStringSelection();
}
@@ -681,21 +680,21 @@ bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormV
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *propertyWindow = property->GetWindow();
if (!propertyWindow)
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
text->SetValue(property->GetValue().StringValue());
}
else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
{
wxListBox *lbox = (wxListBox *)propertyWindow;
if (lbox->Number() == 0 && strings)
wxListBox *lbox = (wxListBox *)m_propertyWindow;
if (lbox->Number() == 0 && m_strings)
{
// Try to initialize the listbox from 'strings'
wxNode *node = strings->First();
wxNode *node = m_strings->First();
while (node)
{
char *s = (char *)node->Data();
@@ -706,21 +705,21 @@ bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormV
lbox->SetStringSelection(property->GetValue().StringValue());
}
/*
else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
{
wxRadioBox *rbox = (wxRadioBox *)propertyWindow;
wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
rbox->SetStringSelection(property->GetValue().StringValue());
}
*/
else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
{
wxChoice *choice = (wxChoice *)propertyWindow;
wxChoice *choice = (wxChoice *)m_propertyWindow;
#ifndef __XVIEW__
if (choice->Number() == 0 && strings)
if (choice->Number() == 0 && m_strings)
{
// Try to initialize the choice item from 'strings'
// XView doesn't allow this kind of thing.
wxNode *node = strings->First();
wxNode *node = m_strings->First();
while (node)
{
char *s = (char *)node->Data();

View File

@@ -29,18 +29,7 @@
class wxPropertyFormView: public wxPropertyView
{
DECLARE_DYNAMIC_CLASS(wxPropertyFormView)
protected:
bool detailedEditing; // E.g. using listbox for choices
wxWindow *propertyWindow; // Panel that the controls will appear on
wxWindow *managedWindow; // Frame or dialog
wxButton *windowCloseButton; // Or OK
wxButton *windowCancelButton;
wxButton *windowHelpButton;
public:
static bool dialogCancelled;
wxPropertyFormView(wxWindow *propPanel = NULL, long flags = 0);
~wxPropertyFormView(void);
@@ -78,15 +67,28 @@ class wxPropertyFormView: public wxPropertyView
// TODO: does OnCommand still get called...???
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
inline virtual void AssociatePanel(wxWindow *win) { propertyWindow = win; }
inline virtual wxWindow *GetPanel(void) { return propertyWindow; }
inline virtual void AssociatePanel(wxWindow *win) { m_propertyWindow = win; }
inline virtual wxWindow *GetPanel(void) const { return m_propertyWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; }
inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; }
inline virtual wxButton *GetHelpButton() { return windowHelpButton; }
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()
@@ -144,14 +146,11 @@ class wxPropertyFormValidator: public wxPropertyValidator
class wxRealFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxRealFormValidator)
protected:
float realMin;
float realMax;
public:
// 0.0, 0.0 means no range
wxRealFormValidator(float min = 0.0, float max = 0.0, long flags = 0):wxPropertyFormValidator(flags)
{
realMin = min; realMax = max;
m_realMin = min; m_realMax = max;
}
~wxRealFormValidator(void) {}
@@ -159,25 +158,30 @@ class wxRealFormValidator: public wxPropertyFormValidator
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)
protected:
long integerMin;
long integerMax;
public:
// 0, 0 means no range
wxIntegerFormValidator(long min = 0, long max = 0, long flags = 0):wxPropertyFormValidator(flags)
{
integerMin = min; integerMax = max;
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
@@ -198,20 +202,21 @@ class wxBoolFormValidator: public wxPropertyFormValidator
class wxStringFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxStringFormValidator)
protected:
wxStringList *strings;
public:
wxStringFormValidator(wxStringList *list = NULL, long flags = 0);
~wxStringFormValidator(void)
{
if (strings)
delete strings;
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;
};
/*
@@ -221,8 +226,6 @@ class wxStringFormValidator: public wxPropertyFormValidator
class wxPropertyFormDialog: public wxDialog
{
DECLARE_CLASS(wxPropertyFormDialog)
private:
wxPropertyFormView *view;
public:
wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
@@ -233,6 +236,9 @@ class wxPropertyFormDialog: public wxDialog
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
private:
wxPropertyFormView* m_view;
};
/*
@@ -242,20 +248,21 @@ class wxPropertyFormDialog: public wxDialog
class wxPropertyFormPanel: public wxPanel
{
DECLARE_CLASS(wxPropertyFormPanel)
private:
wxPropertyFormView *view;
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)
{
view = v;
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;
};
/*
@@ -265,24 +272,25 @@ class wxPropertyFormPanel: public wxPanel
class wxPropertyFormFrame: public wxFrame
{
DECLARE_CLASS(wxPropertyFormFrame)
private:
wxPropertyFormView *view;
wxPanel *propertyPanel;
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)
{
view = v;
propertyPanel = NULL;
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) { return propertyPanel; }
inline virtual wxPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
private:
wxPropertyFormView* m_view;
wxPanel* m_propertyPanel;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -74,28 +74,7 @@
class wxPropertyListView: public wxPropertyView
{
DECLARE_DYNAMIC_CLASS(wxPropertyListView)
protected:
wxListBox *propertyScrollingList;
wxListBox *valueList; // Should really be a combobox, but we don't have one.
wxTextCtrl *valueText;
wxButton *confirmButton; // A tick, as in VB
wxButton *cancelButton; // A cross, as in VB
wxButton *editButton; // Invokes the custom validator, if any
bool detailedEditing; // E.g. using listbox for choices
static wxBitmap *tickBitmap;
static wxBitmap *crossBitmap;
wxPanel *propertyWindow; // Panel that the controls will appear on
wxWindow *managedWindow; // Frame or dialog
wxButton *windowCloseButton; // Or OK
wxButton *windowCancelButton;
wxButton *windowHelpButton;
public:
static bool dialogCancelled;
wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT);
~wxPropertyListView(void);
@@ -161,26 +140,49 @@ class wxPropertyListView: public wxPropertyView
void OnEdit(wxCommandEvent& event);
void OnText(wxCommandEvent& event);
inline virtual wxListBox *GetPropertyScrollingList() { return propertyScrollingList; }
inline virtual wxListBox *GetValueList() { return valueList; }
inline virtual wxTextCtrl *GetValueText() { return valueText; }
inline virtual wxButton *GetConfirmButton() { return confirmButton; }
inline virtual wxButton *GetCancelButton() { return cancelButton; }
inline virtual wxButton *GetEditButton() { return editButton; }
inline virtual bool GetDetailedEditing(void) { return detailedEditing; }
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) { propertyWindow = win; }
inline virtual wxPanel *GetPanel(void) { return propertyWindow; }
inline virtual void AssociatePanel(wxPanel *win) { m_propertyWindow = win; }
inline virtual wxPanel *GetPanel(void) const { return m_propertyWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; }
inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; }
inline virtual wxButton *GetHelpButton() { return windowHelpButton; }
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()
};
@@ -188,12 +190,13 @@ class wxPropertyTextEdit: public wxTextCtrl
{
DECLARE_CLASS(wxPropertyTextEdit)
public:
wxPropertyListView *view;
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
@@ -267,8 +270,6 @@ class wxPropertyListValidator: public wxPropertyValidator
class wxPropertyListDialog: public wxDialog
{
DECLARE_CLASS(wxPropertyListDialog)
private:
wxPropertyListView *view;
public:
wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
@@ -280,6 +281,9 @@ class wxPropertyListDialog: public wxDialog
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
private:
wxPropertyListView* m_view;
DECLARE_EVENT_TABLE()
};
@@ -290,21 +294,19 @@ DECLARE_EVENT_TABLE()
class wxPropertyListPanel: public wxPanel
{
DECLARE_CLASS(wxPropertyListPanel)
private:
wxPropertyListView *view;
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)
{
view = v;
m_view = v;
}
~wxPropertyListPanel();
void OnDefaultAction(wxControl *item);
inline void SetView(wxPropertyListView* v) { view = v; }
inline wxPropertyListView* GetView() const { return view; }
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);
@@ -312,6 +314,9 @@ class wxPropertyListPanel: public wxPanel
// Call Layout()
void OnSize(wxSizeEvent& event);
private:
wxPropertyListView* m_view;
DECLARE_EVENT_TABLE()
};
@@ -322,24 +327,25 @@ DECLARE_EVENT_TABLE()
class wxPropertyListFrame: public wxFrame
{
DECLARE_CLASS(wxPropertyListFrame)
private:
wxPropertyListView *view;
wxPropertyListPanel *propertyPanel;
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)
{
view = v;
propertyPanel = NULL;
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) { return propertyPanel; }
inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
private:
wxPropertyListView* m_view;
wxPropertyListPanel* m_propertyPanel;
};
/*
@@ -349,14 +355,11 @@ class wxPropertyListFrame: public wxFrame
class wxRealListValidator: public wxPropertyListValidator
{
DECLARE_DYNAMIC_CLASS(wxRealListValidator)
protected:
float realMin;
float realMax;
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)
{
realMin = min; realMax = max;
m_realMin = min; m_realMax = max;
}
~wxRealListValidator(void) {}
@@ -370,19 +373,20 @@ class wxRealListValidator: public wxPropertyListValidator
// 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)
protected:
long integerMin;
long integerMax;
public:
// 0, 0 means no range
wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags)
{
integerMin = min; integerMax = max;
m_integerMin = min; m_integerMax = max;
}
~wxIntegerListValidator(void) {}
@@ -396,6 +400,10 @@ class wxIntegerListValidator: public wxPropertyListValidator
// 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
@@ -430,15 +438,13 @@ class wxBoolListValidator: public wxPropertyListValidator
class wxStringListValidator: public wxPropertyListValidator
{
DECLARE_DYNAMIC_CLASS(wxStringListValidator)
protected:
wxStringList *strings;
public:
wxStringListValidator(wxStringList *list = NULL, long flags = 0);
~wxStringListValidator(void)
{
if (strings)
delete strings;
if (m_strings)
delete m_strings;
}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
@@ -458,15 +464,14 @@ class wxStringListValidator: public wxPropertyListValidator
// 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)
protected:
wxString filenameWildCard;
wxString filenameMessage;
public:
wxFilenameListValidator(wxString message = "Select a file", wxString wildcard = "*.*", long flags = 0);
@@ -488,6 +493,11 @@ class wxFilenameListValidator: public wxPropertyListValidator
// 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