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: wxsstringproperty.h 4850 2008-01-29 21:45:49Z byo $
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/properties/wxsstringproperty.h $
23
#ifndef WXSSTRINGPROPERTY_H
24
#define WXSSTRINGPROPERTY_H
26
#include "wxsproperty.h"
28
/** \brief Base string property (working on wxString class) */
29
class wxsStringProperty: public wxsProperty
34
* \param PGName name of property in Property Grid
35
* \param DataName name of property in data stuctures
36
* \param Offset offset of value (returned from wxsOFFSET macro)
37
* \param IsLongString if true, long string editor will be used (used for multiline strings)
38
* \param XmlStoreEmpty if true, string will be also stored when it's value is equal to default one
39
* \param Default default value applied on read errors
40
* \param Priority priority of this property
42
wxsStringProperty(const wxString& PGName,const wxString& DataName,long Offset,bool IsLongString=true,bool XmlStoreEmpty=false,const wxString& Default=wxEmptyString,int Priority=100);
44
/** \brief Returning type name */
45
virtual const wxString GetTypeName() { return _T("wxString"); }
49
virtual void PGCreate(wxsPropertyContainer* Object,wxPropertyGridManager* Grid,wxPGId Parent);
50
virtual bool PGRead(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id,long Index);
51
virtual bool PGWrite(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id,long Index);
52
virtual bool XmlRead(wxsPropertyContainer* Object,TiXmlElement* Element);
53
virtual bool XmlWrite(wxsPropertyContainer* Object,TiXmlElement* Element);
54
virtual bool PropStreamRead(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
55
virtual bool PropStreamWrite(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
64
/** \addtogroup properties_macros
67
/** \brief Macro automatically declaring one-line wxString property
68
* \param ClassName name of class holding this property
69
* \param VarName name of variable inside class
70
* \param PGName name used in property grid
71
* \param DataName name used in Xml / Data Streams
72
* \param Default value applied on read errors / validation failures
73
* \param XmlStoreEmpty true if strings equal to default value should be written to xml structure, false otherwise
75
#define WXS_SHORT_STRING(ClassName,VarName,PGName,DataName,Default,XmlStoreEmpty) \
76
{ static wxsStringProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),false,XmlStoreEmpty,Default); \
77
Property(_Property); }
79
/** \brief Macro automatically declaring multiline wxString property with custom priority
80
* \param ClassName name of class holding this property
81
* \param VarName name of variable inside class
82
* \param PGName name used in property grid
83
* \param DataName name used in Xml / Data Streams
84
* \param Default value applied on read errors / validation failures
85
* \param XmlStoreEmpty true if strings equal to default value should be written to xml structure, false otherwise
87
#define WXS_STRING(ClassName,VarName,PGName,DataName,Default,XmlStoreEmpty) \
88
{ static wxsStringProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),true,XmlStoreEmpty,Default); \
89
Property(_Property); }
91
/** \brief Macro automatically declaring one-line wxString property with custom priority
92
* \param ClassName name of class holding this property
93
* \param VarName name of variable inside class
94
* \param PGName name used in property grid
95
* \param DataName name used in Xml / Data Streams
96
* \param Default value applied on read errors / validation failures
97
* \param XmlStoreEmpty true if strings equal to default value should be written to xml structure, false otherwise
98
* \param Priority priority of this property
100
#define WXS_SHORT_STRING_P(ClassName,VarName,PGName,DataName,Default,XmlStoreEmpty,Priority) \
101
{ static wxsStringProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),false,XmlStoreEmpty,Default,Priority); \
102
Property(_Property); }
104
/** \brief Macro automatically declaring multiline wxString property with custom priority
105
* \param ClassName name of class holding this property
106
* \param VarName name of variable inside class
107
* \param PGName name used in property grid
108
* \param DataName name used in Xml / Data Streams
109
* \param Default value applied on read errors / validation failures
110
* \param XmlStoreEmpty true if strings equal to default value should be written to xml structure, false otherwise
111
* \param Priority priority of this property
113
#define WXS_STRING_P(ClassName,VarName,PGName,DataName,Default,XmlStoreEmpty,Priority) \
114
{ static wxsStringProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),true,XmlStoreEmpty,Default,Priority); \
115
Property(_Property); }