]> git.saurik.com Git - wxWidgets.git/blame - samples/propgrid/sampleprops.h
Show extra mouse buttons and wheel state in the text sample output too.
[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 8// Copyright: (c) Jaakko Salli
526954c5 9// Licence: wxWindows licence
1c4293cb
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
13#define _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
14
06e363ea 15#include "wx/fontdata.h"
1c4293cb 16
0372d42e 17DECLARE_VARIANT_OBJECT(wxFontData)
1c4293cb
VZ
18
19
20class wxFontDataProperty : public wxFontProperty
21{
22 WX_PG_DECLARE_PROPERTY_CLASS(wxFontDataProperty)
23public:
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
4c51a665 32 // In order to have different value type in a derived property
1c4293cb
VZ
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
b8b1ff48
JS
38 virtual wxVariant ChildChanged( wxVariant& thisValue,
39 int childIndex,
40 wxVariant& childValue ) const;
7eac5c53
JS
41 virtual void RefreshChildren();
42 virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
1c4293cb
VZ
43
44protected:
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
52class wxSizeProperty : public wxPGProperty
53{
54 WX_PG_DECLARE_PROPERTY_CLASS(wxSizeProperty)
55public:
56
57 wxSizeProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
58 const wxSize& value = wxSize() );
59 virtual ~wxSizeProperty();
60
b8b1ff48
JS
61 virtual wxVariant ChildChanged( wxVariant& thisValue,
62 int childIndex,
63 wxVariant& childValue ) const;
7eac5c53 64 virtual void RefreshChildren();
1c4293cb
VZ
65
66protected:
67
68 // I stands for internal
69 void SetValueI( const wxSize& value )
70 {
0372d42e 71 m_value = WXVARIANT(value);
1c4293cb
VZ
72 }
73};
74
75// -----------------------------------------------------------------------
76
77class wxPointProperty : public wxPGProperty
78{
79 WX_PG_DECLARE_PROPERTY_CLASS(wxPointProperty)
80public:
81
82 wxPointProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
83 const wxPoint& value = wxPoint() );
84 virtual ~wxPointProperty();
85
b8b1ff48
JS
86 virtual wxVariant ChildChanged( wxVariant& thisValue,
87 int childIndex,
88 wxVariant& childValue ) const;
7eac5c53 89 virtual void RefreshChildren();
1c4293cb
VZ
90
91protected:
92
93 // I stands for internal
94 void SetValueI( const wxPoint& value )
95 {
0372d42e 96 m_value = WXVARIANT(value);
1c4293cb
VZ
97 }
98};
99
100// -----------------------------------------------------------------------
101
102WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(wxDirsProperty, class wxEMPTY_PARAMETER_VALUE)
103
104// -----------------------------------------------------------------------
105
0372d42e 106WX_PG_DECLARE_VARIANT_DATA(wxArrayDouble)
1c4293cb
VZ
107
108class wxArrayDoubleProperty : public wxPGProperty
109{
110 WX_PG_DECLARE_PROPERTY_CLASS(wxArrayDoubleProperty)
111public:
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();
1425eca5 120 virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
7eac5c53
JS
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 );
1c4293cb
VZ
126
127 // Generates cache for displayed text
128 virtual void GenerateValueAsString ( wxString& target, int prec, bool removeZeroes ) const;
129
130protected:
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_