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

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmith/properties/wxsboolproperty.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: wxsboolproperty.h 4850 2008-01-29 21:45:49Z byo $
 
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/properties/wxsboolproperty.h $
 
21
*/
 
22
 
 
23
#ifndef WXSBOOLPROPERTY_H
 
24
#define WXSBOOLPROPERTY_H
 
25
 
 
26
#include "wxsproperty.h"
 
27
 
 
28
/** \brief Base boolean property */
 
29
class wxsBoolProperty: 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 boolean (taken from wxsOFFSET macro)
 
37
         *  \param Default  default value applied on read errors
 
38
         */
 
39
                wxsBoolProperty(const wxString& PGName,const wxString& DataName,long Offset,bool Default=0,int Priority=100);
 
40
 
 
41
        /** \brief Returning type name */
 
42
        virtual const wxString GetTypeName() { return _T("bool"); }
 
43
 
 
44
    protected:
 
45
 
 
46
        virtual void PGCreate(wxsPropertyContainer* Object,wxPropertyGridManager* Grid,wxPGId Parent);
 
47
        virtual bool PGRead(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id,long Index);
 
48
        virtual bool PGWrite(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id,long Index);
 
49
        virtual bool XmlRead(wxsPropertyContainer* Object,TiXmlElement* Element);
 
50
        virtual bool XmlWrite(wxsPropertyContainer* Object,TiXmlElement* Element);
 
51
        virtual bool PropStreamRead(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
 
52
        virtual bool PropStreamWrite(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
 
53
 
 
54
        private:
 
55
        long Offset;
 
56
        bool Default;
 
57
};
 
58
 
 
59
/** \addtogroup properties_macros Macros automatically defining standard properties
 
60
 *  \{ */
 
61
 
 
62
/** \brief Macro automatically declaring boolean property
 
63
 *  \param ClassName name of class holding this property
 
64
 *  \param VarName name of variable inside class
 
65
 *  \param PGName name used in property grid
 
66
 *  \param DataName name used in Xml / Data Streams
 
67
 *  \param Default value applied on read errors / validation failures
 
68
 */
 
69
#define WXS_BOOL(ClassName,VarName,PGName,DataName,Default) \
 
70
    { static wxsBoolProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),Default); \
 
71
      Property(_Property); }
 
72
 
 
73
/** \brief Macro automatically declaring boolean property with custom priority
 
74
 *  \param ClassName name of class holding this property
 
75
 *  \param VarName name of variable inside class
 
76
 *  \param PGName name used in property grid
 
77
 *  \param DataName name used in Xml / Data Streams
 
78
 *  \param Default value applied on read errors / validation failures
 
79
 *  \param Priority priority of this property
 
80
 */
 
81
#define WXS_BOOL_P(ClassName,VarName,PGName,DataName,Default,Priority) \
 
82
    { static wxsBoolProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),Default,Priority); \
 
83
      Property(_Property); }
 
84
 
 
85
/** \} */
 
86
 
 
87
#endif