]> git.saurik.com Git - wxWidgets.git/blob - samples/propgrid/sampleprops.h
Rebake everything using bakefile 0.2.7.
[wxWidgets.git] / samples / propgrid / sampleprops.h
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
7 // RCS-ID: $Id$
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
16 DECLARE_VARIANT_OBJECT(wxFontData)
17
18
19 class wxFontDataProperty : public wxFontProperty
20 {
21 WX_PG_DECLARE_PROPERTY_CLASS(wxFontDataProperty)
22 public:
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
37 virtual wxVariant ChildChanged( wxVariant& thisValue,
38 int childIndex,
39 wxVariant& childValue ) const;
40 virtual void RefreshChildren();
41 virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
42
43 protected:
44 // Value must be stored as variant - otherwise it will be
45 // decreffed to oblivion on GetValue().
46 wxVariant m_value_wxFontData;
47 };
48
49 // -----------------------------------------------------------------------
50
51 class wxSizeProperty : public wxPGProperty
52 {
53 WX_PG_DECLARE_PROPERTY_CLASS(wxSizeProperty)
54 public:
55
56 wxSizeProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
57 const wxSize& value = wxSize() );
58 virtual ~wxSizeProperty();
59
60 virtual wxVariant ChildChanged( wxVariant& thisValue,
61 int childIndex,
62 wxVariant& childValue ) const;
63 virtual void RefreshChildren();
64
65 protected:
66
67 // I stands for internal
68 void SetValueI( const wxSize& value )
69 {
70 m_value = WXVARIANT(value);
71 }
72 };
73
74 // -----------------------------------------------------------------------
75
76 class wxPointProperty : public wxPGProperty
77 {
78 WX_PG_DECLARE_PROPERTY_CLASS(wxPointProperty)
79 public:
80
81 wxPointProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
82 const wxPoint& value = wxPoint() );
83 virtual ~wxPointProperty();
84
85 virtual wxVariant ChildChanged( wxVariant& thisValue,
86 int childIndex,
87 wxVariant& childValue ) const;
88 virtual void RefreshChildren();
89
90 protected:
91
92 // I stands for internal
93 void SetValueI( const wxPoint& value )
94 {
95 m_value = WXVARIANT(value);
96 }
97 };
98
99 // -----------------------------------------------------------------------
100
101 WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(wxDirsProperty, class wxEMPTY_PARAMETER_VALUE)
102
103 // -----------------------------------------------------------------------
104
105 WX_PG_DECLARE_VARIANT_DATA(wxArrayDouble)
106
107 class wxArrayDoubleProperty : public wxPGProperty
108 {
109 WX_PG_DECLARE_PROPERTY_CLASS(wxArrayDoubleProperty)
110 public:
111
112 wxArrayDoubleProperty( const wxString& label = wxPG_LABEL,
113 const wxString& name = wxPG_LABEL,
114 const wxArrayDouble& value = wxArrayDouble() );
115
116 virtual ~wxArrayDoubleProperty ();
117
118 virtual void OnSetValue();
119 virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
120 virtual bool StringToValue( wxVariant& variant,
121 const wxString& text,
122 int argFlags = 0 ) const;
123 virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
124 virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
125
126 // Generates cache for displayed text
127 virtual void GenerateValueAsString ( wxString& target, int prec, bool removeZeroes ) const;
128
129 protected:
130 wxString m_display; // Stores cache for displayed text
131 int m_precision; // Used when formatting displayed string.
132 wxChar m_delimiter; // Delimiter between array entries.
133 };
134
135 // -----------------------------------------------------------------------
136
137 #endif // _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_