]> git.saurik.com Git - wxWidgets.git/blob - samples/propgrid/sampleprops.h
return 0 (meaning the file is not seekable, as the docs now explain) instead of 4KB...
[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 WX_PG_DECLARE_PARENTAL_METHODS()
38 WX_PG_DECLARE_EVENT_METHODS()
39
40 protected:
41 // Value must be stored as variant - otherwise it will be
42 // decreffed to oblivion on GetValue().
43 wxVariant m_value_wxFontData;
44 };
45
46 // -----------------------------------------------------------------------
47
48 class wxSizeProperty : public wxPGProperty
49 {
50 WX_PG_DECLARE_PROPERTY_CLASS(wxSizeProperty)
51 public:
52
53 wxSizeProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
54 const wxSize& value = wxSize() );
55 virtual ~wxSizeProperty();
56
57 WX_PG_DECLARE_PARENTAL_METHODS()
58
59 protected:
60
61 // I stands for internal
62 void SetValueI( const wxSize& value )
63 {
64 m_value = WXVARIANT(value);
65 }
66 };
67
68 // -----------------------------------------------------------------------
69
70 class wxPointProperty : public wxPGProperty
71 {
72 WX_PG_DECLARE_PROPERTY_CLASS(wxPointProperty)
73 public:
74
75 wxPointProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
76 const wxPoint& value = wxPoint() );
77 virtual ~wxPointProperty();
78
79 WX_PG_DECLARE_PARENTAL_METHODS()
80
81 protected:
82
83 // I stands for internal
84 void SetValueI( const wxPoint& value )
85 {
86 m_value = WXVARIANT(value);
87 }
88 };
89
90 // -----------------------------------------------------------------------
91
92 WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(wxDirsProperty, class wxEMPTY_PARAMETER_VALUE)
93
94 // -----------------------------------------------------------------------
95
96 WX_PG_DECLARE_VARIANT_DATA(wxArrayDouble)
97
98 class wxArrayDoubleProperty : public wxPGProperty
99 {
100 WX_PG_DECLARE_PROPERTY_CLASS(wxArrayDoubleProperty)
101 public:
102
103 wxArrayDoubleProperty( const wxString& label = wxPG_LABEL,
104 const wxString& name = wxPG_LABEL,
105 const wxArrayDouble& value = wxArrayDouble() );
106
107 virtual ~wxArrayDoubleProperty ();
108
109 virtual void OnSetValue();
110 WX_PG_DECLARE_BASIC_TYPE_METHODS()
111 WX_PG_DECLARE_EVENT_METHODS()
112 WX_PG_DECLARE_ATTRIBUTE_METHODS()
113
114 // Generates cache for displayed text
115 virtual void GenerateValueAsString ( wxString& target, int prec, bool removeZeroes ) const;
116
117 protected:
118 wxString m_display; // Stores cache for displayed text
119 int m_precision; // Used when formatting displayed string.
120 wxChar m_delimiter; // Delimiter between array entries.
121 };
122
123 // -----------------------------------------------------------------------
124
125 #endif // _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_