]> git.saurik.com Git - wxWidgets.git/blob - samples/propgrid/sampleprops.h
Add missing wxEVT_COMMAND_TEXT_ENTER
[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 licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
13 #define _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
14
15 #include "wx/fontdata.h"
16
17 DECLARE_VARIANT_OBJECT(wxFontData)
18
19
20 class wxFontDataProperty : public wxFontProperty
21 {
22 WX_PG_DECLARE_PROPERTY_CLASS(wxFontDataProperty)
23 public:
24
25 wxFontDataProperty( const wxString& label = wxPG_LABEL,
26 const wxString& name = wxPG_LABEL,
27 const wxFontData& value = wxFontData() );
28 virtual ~wxFontDataProperty ();
29
30 void OnSetValue();
31
32 // In order to have different value type in a derived property
33 // class, we will override GetValue to return custom variant,
34 // instead of changing the base m_value. This allows the methods
35 // in base class to function properly.
36 virtual wxVariant DoGetValue() const;
37
38 virtual wxVariant ChildChanged( wxVariant& thisValue,
39 int childIndex,
40 wxVariant& childValue ) const;
41 virtual void RefreshChildren();
42 virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
43
44 protected:
45 // Value must be stored as variant - otherwise it will be
46 // decreffed to oblivion on GetValue().
47 wxVariant m_value_wxFontData;
48 };
49
50 // -----------------------------------------------------------------------
51
52 class wxSizeProperty : public wxPGProperty
53 {
54 WX_PG_DECLARE_PROPERTY_CLASS(wxSizeProperty)
55 public:
56
57 wxSizeProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
58 const wxSize& value = wxSize() );
59 virtual ~wxSizeProperty();
60
61 virtual wxVariant ChildChanged( wxVariant& thisValue,
62 int childIndex,
63 wxVariant& childValue ) const;
64 virtual void RefreshChildren();
65
66 protected:
67
68 // I stands for internal
69 void SetValueI( const wxSize& value )
70 {
71 m_value = WXVARIANT(value);
72 }
73 };
74
75 // -----------------------------------------------------------------------
76
77 class wxPointProperty : public wxPGProperty
78 {
79 WX_PG_DECLARE_PROPERTY_CLASS(wxPointProperty)
80 public:
81
82 wxPointProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
83 const wxPoint& value = wxPoint() );
84 virtual ~wxPointProperty();
85
86 virtual wxVariant ChildChanged( wxVariant& thisValue,
87 int childIndex,
88 wxVariant& childValue ) const;
89 virtual void RefreshChildren();
90
91 protected:
92
93 // I stands for internal
94 void SetValueI( const wxPoint& value )
95 {
96 m_value = WXVARIANT(value);
97 }
98 };
99
100 // -----------------------------------------------------------------------
101
102 WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(wxDirsProperty, class wxEMPTY_PARAMETER_VALUE)
103
104 // -----------------------------------------------------------------------
105
106 WX_PG_DECLARE_VARIANT_DATA(wxArrayDouble)
107
108 class wxArrayDoubleProperty : public wxPGProperty
109 {
110 WX_PG_DECLARE_PROPERTY_CLASS(wxArrayDoubleProperty)
111 public:
112
113 wxArrayDoubleProperty( const wxString& label = wxPG_LABEL,
114 const wxString& name = wxPG_LABEL,
115 const wxArrayDouble& value = wxArrayDouble() );
116
117 virtual ~wxArrayDoubleProperty ();
118
119 virtual void OnSetValue();
120 virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
121 virtual bool StringToValue( wxVariant& variant,
122 const wxString& text,
123 int argFlags = 0 ) const;
124 virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
125 virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
126
127 // Generates cache for displayed text
128 virtual void GenerateValueAsString ( wxString& target, int prec, bool removeZeroes ) const;
129
130 protected:
131 wxString m_display; // Stores cache for displayed text
132 int m_precision; // Used when formatting displayed string.
133 wxChar m_delimiter; // Delimiter between array entries.
134 };
135
136 // -----------------------------------------------------------------------
137
138 #endif // _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_