]> git.saurik.com Git - wxWidgets.git/blame - samples/propgrid/sampleprops.h
fix the MSVC check in the last comment and accompanying comment
[wxWidgets.git] / samples / propgrid / sampleprops.h
CommitLineData
1c4293cb
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: samples/propgrid/sampleprops.h
3// Purpose: wxPropertyGrid Sample Properties Header
4// Author: Jaakko Salli
5// Modified by:
6// Created: 2006-03-05
ea5af9c5 7// RCS-ID: $Id$
1c4293cb
VZ
8// Copyright: (c) Jaakko Salli
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
13#define _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
14
15
0372d42e 16DECLARE_VARIANT_OBJECT(wxFontData)
1c4293cb
VZ
17
18
19class wxFontDataProperty : public wxFontProperty
20{
21 WX_PG_DECLARE_PROPERTY_CLASS(wxFontDataProperty)
22public:
23
24 wxFontDataProperty( const wxString& label = wxPG_LABEL,
25 const wxString& name = wxPG_LABEL,
26 const wxFontData& value = wxFontData() );
27 virtual ~wxFontDataProperty ();
28
29 void OnSetValue();
30
31 // Inorder to have different value type in a derived property
32 // class, we will override GetValue to return custom variant,
33 // instead of changing the base m_value. This allows the methods
34 // in base class to function properly.
35 virtual wxVariant DoGetValue() const;
36
7eac5c53
JS
37 virtual void ChildChanged( wxVariant& thisValue,
38 int childIndex, wxVariant& childValue ) const;
39 virtual void RefreshChildren();
40 virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
1c4293cb
VZ
41
42protected:
43 // Value must be stored as variant - otherwise it will be
44 // decreffed to oblivion on GetValue().
45 wxVariant m_value_wxFontData;
46};
47
48// -----------------------------------------------------------------------
49
50class wxSizeProperty : public wxPGProperty
51{
52 WX_PG_DECLARE_PROPERTY_CLASS(wxSizeProperty)
53public:
54
55 wxSizeProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
56 const wxSize& value = wxSize() );
57 virtual ~wxSizeProperty();
58
7eac5c53
JS
59 virtual void ChildChanged( wxVariant& thisValue,
60 int childIndex, wxVariant& childValue ) const;
61 virtual void RefreshChildren();
1c4293cb
VZ
62
63protected:
64
65 // I stands for internal
66 void SetValueI( const wxSize& value )
67 {
0372d42e 68 m_value = WXVARIANT(value);
1c4293cb
VZ
69 }
70};
71
72// -----------------------------------------------------------------------
73
74class wxPointProperty : public wxPGProperty
75{
76 WX_PG_DECLARE_PROPERTY_CLASS(wxPointProperty)
77public:
78
79 wxPointProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
80 const wxPoint& value = wxPoint() );
81 virtual ~wxPointProperty();
82
7eac5c53
JS
83 virtual void ChildChanged( wxVariant& thisValue,
84 int childIndex, wxVariant& childValue ) const;
85 virtual void RefreshChildren();
1c4293cb
VZ
86
87protected:
88
89 // I stands for internal
90 void SetValueI( const wxPoint& value )
91 {
0372d42e 92 m_value = WXVARIANT(value);
1c4293cb
VZ
93 }
94};
95
96// -----------------------------------------------------------------------
97
98WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(wxDirsProperty, class wxEMPTY_PARAMETER_VALUE)
99
100// -----------------------------------------------------------------------
101
0372d42e 102WX_PG_DECLARE_VARIANT_DATA(wxArrayDouble)
1c4293cb
VZ
103
104class wxArrayDoubleProperty : public wxPGProperty
105{
106 WX_PG_DECLARE_PROPERTY_CLASS(wxArrayDoubleProperty)
107public:
108
109 wxArrayDoubleProperty( const wxString& label = wxPG_LABEL,
110 const wxString& name = wxPG_LABEL,
111 const wxArrayDouble& value = wxArrayDouble() );
112
113 virtual ~wxArrayDoubleProperty ();
114
115 virtual void OnSetValue();
1425eca5 116 virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
7eac5c53
JS
117 virtual bool StringToValue( wxVariant& variant,
118 const wxString& text,
119 int argFlags = 0 ) const;
120 virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
121 virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
1c4293cb
VZ
122
123 // Generates cache for displayed text
124 virtual void GenerateValueAsString ( wxString& target, int prec, bool removeZeroes ) const;
125
126protected:
127 wxString m_display; // Stores cache for displayed text
128 int m_precision; // Used when formatting displayed string.
129 wxChar m_delimiter; // Delimiter between array entries.
130};
131
132// -----------------------------------------------------------------------
133
134#endif // _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_