2
* This file is part of wxSmith plugin for Code::Blocks Studio
3
* Copyright (C) 2006-2007 Bartlomiej Swiecki
5
* wxSmith is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* wxSmith is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
19
* $Id: wxsenumproperty.h 4850 2008-01-29 21:45:49Z byo $
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/properties/wxsenumproperty.h $
23
#ifndef WXSENUMPROPERTY_H
24
#define WXSENUMPROPERTY_H
26
#include "wxsproperty.h"
28
/** \brief Property with enumerated values
30
* Enum property works almost the same as long property but it uses
31
* predefined values from given set.
32
* Note that this class is abstract and should be used as base class for others.
34
class wxsEnumProperty: public wxsProperty
39
* \param PGName name of property used in Property Grid
40
* \param DataName name of property used in data structures
41
* \param Offset offset of long integer holding enumerated value (taken from wxsOFFSET macro)
42
* \param Values array of long integer values which can be enumerated
43
* \param Names array of names used for items in Values array, ending with 0
44
* \param UpdateEnteries posting true here notifies, that arrays may change while property is shown in property grid
45
* \param Default defaut value applied on read errors
46
* \param UseNamesInXml if true, names will be stored inside xml node instead of values
47
* \param Priority priority of this property
50
const wxString& PGName,
51
const wxString& DataName,
55
bool UpdateEnteries=false,
57
bool UseNamesInXml=false,
62
virtual const wxString GetTypeName() { return _T(""); }
63
virtual void PGCreate(wxsPropertyContainer* Object,wxPropertyGridManager* Grid,wxPGId Parent);
64
virtual bool PGRead(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id, long Index);
65
virtual bool PGWrite(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id, long Index);
66
virtual bool XmlRead(wxsPropertyContainer* Object,TiXmlElement* Element);
67
virtual bool XmlWrite(wxsPropertyContainer* Object,TiXmlElement* Element);
68
virtual bool PropStreamRead(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
69
virtual bool PropStreamWrite(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
80
/** \addtogroup properties_macros
83
/** \brief Macro automatically declaring enum property
84
* \param ClassName name of class holding this property
85
* \param VarName name of variable of type long inside class
86
* \param PGName name used in property grid
87
* \param DataName name used in Xml / Data Streams
88
* \param Values global array of long values for enums
89
* \param Names global array of names (stored as wxChar*) for enums, ended with 0 entry
90
* \param Default value applied on read errors / validation failures
92
#define WXS_ENUM(ClassName,VarName,PGName,DataName,Values,Names,Default) \
93
{ static wxsEnumProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),Values,Names,false,Default,true); \
94
Property(_Property); }
96
/** \brief Macro automatically declaring enum property with custom priority
97
* \param ClassName name of class holding this property
98
* \param VarName name of variable of type long inside class
99
* \param PGName name used in property grid
100
* \param DataName name used in Xml / Data Streams
101
* \param Values global array of long values for enums
102
* \param Names global array of names (stored as wxChar*) for enums, ended with 0 entry
103
* \param Default value applied on read errors / validation failures
104
* \param Priority priority of this property
106
#define WXS_ENUM_P(ClassName,VarName,PGName,DataName,Values,Names,Default,Priority) \
107
{ static wxsEnumProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),Values,Names,false,Default,true,Priority); \
108
Property(_Property); }