~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmith/properties/wxsstringproperty.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This file is part of wxSmith plugin for Code::Blocks Studio
 
3
* Copyright (C) 2006-2007  Bartlomiej Swiecki
 
4
*
 
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.
 
9
*
 
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.
 
14
*
 
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/>.
 
17
*
 
18
* $Revision: 4850 $
 
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 $
 
21
*/
 
22
 
 
23
#ifndef WXSSTRINGPROPERTY_H
 
24
#define WXSSTRINGPROPERTY_H
 
25
 
 
26
#include "wxsproperty.h"
 
27
 
 
28
/** \brief Base string property (working on wxString class) */
 
29
class wxsStringProperty: public wxsProperty
 
30
{
 
31
        public:
 
32
 
 
33
        /** \brief Ctor
 
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
 
41
         */
 
42
                wxsStringProperty(const wxString& PGName,const wxString& DataName,long Offset,bool IsLongString=true,bool XmlStoreEmpty=false,const wxString& Default=wxEmptyString,int Priority=100);
 
43
 
 
44
                /** \brief Returning type name */
 
45
                virtual const wxString GetTypeName() { return _T("wxString"); }
 
46
 
 
47
    protected:
 
48
 
 
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);
 
56
 
 
57
        private:
 
58
        long Offset;
 
59
        bool IsLongString;
 
60
        bool XmlStoreEmpty;
 
61
        wxString Default;
 
62
};
 
63
 
 
64
/** \addtogroup properties_macros
 
65
 *  \{ */
 
66
 
 
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
 
74
 */
 
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); }
 
78
 
 
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
 
86
 */
 
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); }
 
90
 
 
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
 
99
 */
 
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); }
 
103
 
 
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
 
112
 */
 
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); }
 
116
 
 
117
/** \} */
 
118
 
 
119
 
 
120
#endif