2008-09-12 16:57:41 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: samples/propgrid/sampleprops.h
|
|
|
|
// Purpose: wxPropertyGrid Sample Properties Header
|
|
|
|
// Author: Jaakko Salli
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2006-03-05
|
|
|
|
// Copyright: (c) Jaakko Salli
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-09-12 16:57:41 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
|
|
|
|
#define _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
|
|
|
|
|
2011-01-07 12:18:38 -05:00
|
|
|
#include "wx/fontdata.h"
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2008-09-16 11:55:53 -04:00
|
|
|
DECLARE_VARIANT_OBJECT(wxFontData)
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
class wxFontDataProperty : public wxFontProperty
|
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxFontDataProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxFontDataProperty( const wxString& label = wxPG_LABEL,
|
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxFontData& value = wxFontData() );
|
|
|
|
virtual ~wxFontDataProperty ();
|
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
void OnSetValue() wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2011-03-22 10:17:38 -04:00
|
|
|
// In order to have different value type in a derived property
|
2008-09-12 16:57:41 -04:00
|
|
|
// class, we will override GetValue to return custom variant,
|
|
|
|
// instead of changing the base m_value. This allows the methods
|
|
|
|
// in base class to function properly.
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxVariant DoGetValue() const wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2009-06-07 03:52:53 -04:00
|
|
|
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
|
|
|
int childIndex,
|
2014-03-29 20:02:23 -04:00
|
|
|
wxVariant& childValue ) const wxOVERRIDE;
|
|
|
|
virtual void RefreshChildren() wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
protected:
|
2019-07-02 15:34:31 -04:00
|
|
|
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE;
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
// Value must be stored as variant - otherwise it will be
|
|
|
|
// decreffed to oblivion on GetValue().
|
|
|
|
wxVariant m_value_wxFontData;
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxSizeProperty : public wxPGProperty
|
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxSizeProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxSizeProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
|
|
|
|
const wxSize& value = wxSize() );
|
|
|
|
virtual ~wxSizeProperty();
|
|
|
|
|
2009-06-07 03:52:53 -04:00
|
|
|
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
|
|
|
int childIndex,
|
2014-03-29 20:02:23 -04:00
|
|
|
wxVariant& childValue ) const wxOVERRIDE;
|
|
|
|
virtual void RefreshChildren() wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// I stands for internal
|
|
|
|
void SetValueI( const wxSize& value )
|
|
|
|
{
|
2008-09-16 11:55:53 -04:00
|
|
|
m_value = WXVARIANT(value);
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxPointProperty : public wxPGProperty
|
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxPointProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxPointProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
|
|
|
|
const wxPoint& value = wxPoint() );
|
|
|
|
virtual ~wxPointProperty();
|
|
|
|
|
2009-06-07 03:52:53 -04:00
|
|
|
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
|
|
|
int childIndex,
|
2014-03-29 20:02:23 -04:00
|
|
|
wxVariant& childValue ) const wxOVERRIDE;
|
|
|
|
virtual void RefreshChildren() wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// I stands for internal
|
|
|
|
void SetValueI( const wxPoint& value )
|
|
|
|
{
|
2008-09-16 11:55:53 -04:00
|
|
|
m_value = WXVARIANT(value);
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(wxDirsProperty, class wxEMPTY_PARAMETER_VALUE)
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2008-09-16 11:55:53 -04:00
|
|
|
WX_PG_DECLARE_VARIANT_DATA(wxArrayDouble)
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2019-07-05 14:18:37 -04:00
|
|
|
class wxArrayDoubleProperty : public wxEditorDialogProperty
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxArrayDoubleProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxArrayDoubleProperty( const wxString& label = wxPG_LABEL,
|
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxArrayDouble& value = wxArrayDouble() );
|
|
|
|
|
|
|
|
virtual ~wxArrayDoubleProperty ();
|
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void OnSetValue() wxOVERRIDE;
|
|
|
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE;
|
2008-09-19 13:13:51 -04:00
|
|
|
virtual bool StringToValue( wxVariant& variant,
|
|
|
|
const wxString& text,
|
2014-03-29 20:02:23 -04:00
|
|
|
int argFlags = 0 ) const wxOVERRIDE;
|
|
|
|
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
// Generates cache for displayed text
|
|
|
|
virtual void GenerateValueAsString ( wxString& target, int prec, bool removeZeroes ) const;
|
|
|
|
|
2015-02-08 07:45:36 -05:00
|
|
|
wxValidator* DoGetValidator() const wxOVERRIDE;
|
2015-02-17 12:36:00 -05:00
|
|
|
bool ValidateValue(wxVariant& value,
|
|
|
|
wxPGValidationInfo& validationInfo) const wxOVERRIDE;
|
2015-02-08 07:45:36 -05:00
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
protected:
|
2019-07-05 14:18:37 -04:00
|
|
|
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE;
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
wxString m_display; // Stores cache for displayed text
|
|
|
|
int m_precision; // Used when formatting displayed string.
|
|
|
|
wxChar m_delimiter; // Delimiter between array entries.
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#endif // _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
|