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

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmith/wxwidgets/properties/wxsbitmapiconproperty.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: wxsbitmapiconproperty.h 4850 2008-01-29 21:45:49Z byo $
 
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/wxwidgets/properties/wxsbitmapiconproperty.h $
 
21
*/
 
22
 
 
23
#ifndef WXSBITMAPICONPROPERTY_H
 
24
#define WXSBITMAPICONPROPERTY_H
 
25
 
 
26
#include "../../properties/wxsproperties.h"
 
27
#include "../wxscodercontext.h"
 
28
 
 
29
#include <wx/artprov.h>
 
30
 
 
31
/** \brief Structure holding bitmap configuration
 
32
 *
 
33
 * Id determines whether we use art provider or not,
 
34
 * if both Id and FileName are empty, no bitmap is given
 
35
 */
 
36
 
 
37
struct wxsBitmapIconData
 
38
{
 
39
    wxString Id;
 
40
    wxString Client;
 
41
    wxString FileName;
 
42
 
 
43
    /** \brief Generating preview for this bitmap / icon */
 
44
    wxBitmap GetPreview(const wxSize& Size,const wxString& DefaultClient = wxART_OTHER);
 
45
 
 
46
    /** \brief Generating code building this bitmap / icon.
 
47
     *
 
48
     * Empty code is returned when there's no valid bitmap.
 
49
     */
 
50
    wxString BuildCode(bool NoResize,const wxString& SizeCode,wxsCoderContext* Context,const wxString& DefaultClient = wxART_OTHER);
 
51
 
 
52
    /** \brief Checking if this is empty bitmap/icon */
 
53
    bool IsEmpty();
 
54
};
 
55
 
 
56
typedef wxsBitmapIconData wxsBitmapData;
 
57
typedef wxsBitmapIconData wxsIconData;
 
58
 
 
59
/** \brief Property for editing arrays of strings with checked option
 
60
 *
 
61
 * \note This property doesn't take any default value.
 
62
 *       By default array is cleared.
 
63
 */
 
64
class wxsBitmapIconProperty: public wxsCustomEditorProperty
 
65
{
 
66
        public:
 
67
 
 
68
        /** \brief Ctor
 
69
         *  \param PGName           name of property in Property Grid
 
70
         *  \param DataName         name of property in data stuctures
 
71
         *  \param Offset           offset of wxsBitmapIconData structure (returned from wxsOFFSET macro)
 
72
         *  \param DefaultClient    name of default art provider client
 
73
         *  \param Priority         priority of this property
 
74
         */
 
75
                wxsBitmapIconProperty(
 
76
            const wxString& PGName,
 
77
            const wxString& DataName,
 
78
            long Offset,
 
79
            const wxString& DefaultClient = _T("wxART_OTHER"),
 
80
            int Priority=100);
 
81
 
 
82
                /** \brief Returning type name */
 
83
                virtual const wxString GetTypeName() { return _T("wxBitmapIcon"); }
 
84
 
 
85
        /** \brief Showing editor for this property */
 
86
        virtual bool ShowEditor(wxsPropertyContainer* Object);
 
87
 
 
88
    protected:
 
89
 
 
90
        virtual bool XmlRead(wxsPropertyContainer* Object,TiXmlElement* Element);
 
91
        virtual bool XmlWrite(wxsPropertyContainer* Object,TiXmlElement* Element);
 
92
        virtual bool PropStreamRead(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
 
93
        virtual bool PropStreamWrite(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
 
94
 
 
95
        private:
 
96
 
 
97
        long Offset;
 
98
        wxString DefaultClient;
 
99
};
 
100
 
 
101
typedef wxsBitmapIconProperty wxsBitmapProperty;
 
102
typedef wxsBitmapIconProperty wxsIconProperty;
 
103
 
 
104
 
 
105
/** \addtogroup ext_properties_macros
 
106
 *  \{ */
 
107
 
 
108
/** \brief Macro automatically declaring bitmap property
 
109
 *  \param ClassName name of class holding this property
 
110
 *  \param VarName name of wxBitmapData inside class
 
111
 *  \param PGName name used in property grid
 
112
 *  \param DataName name used in Xml / Data Streams
 
113
 *  \param DefaultArtClient default art provider client (use _T("wxART_OTHER") if not sure)
 
114
 */
 
115
#define WXS_BITMAP(ClassName,VarName,PGName,DataName,DefaultArtClient) \
 
116
    { static wxsBitmapProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),DefaultArtClient); \
 
117
      Property(_Property); }
 
118
 
 
119
/** \brief Macro automatically declaring bitmap property with custom priority
 
120
 *  \param ClassName name of class holding this property
 
121
 *  \param VarName name of wxBitmapData inside class
 
122
 *  \param PGName name used in property grid
 
123
 *  \param DataName name used in Xml / Data Streams
 
124
 *  \param DefaultArtClient default art provider client (use _T("wxART_OTHER") if not sure)
 
125
 *  \param Priority priority of this property
 
126
 */
 
127
#define WXS_BITMAP_P(ClassName,VarName,PGName,DataName,DefaultArtClient,Priority) \
 
128
    { static wxsBitmapProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),DefaultArtClient,Priority); \
 
129
      Property(_Property); }
 
130
 
 
131
/** \brief Macro automatically declaring icon property
 
132
 *  \param ClassName name of class holding this property
 
133
 *  \param VarName name of wxIconData inside class
 
134
 *  \param PGName name used in property grid
 
135
 *  \param DataName name used in Xml / Data Streams
 
136
 *  \param DefaultArtClient default art provider client (use _T("wxART_OTHER") if not sure)
 
137
 */
 
138
#define WXS_ICON(ClassName,VarName,PGName,DataName,DefaultArtClient) \
 
139
    { static wxsIconProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),DefaultArtClient); \
 
140
      Property(_Property); }
 
141
 
 
142
/** \brief Macro automatically declaring icon property with custom priority
 
143
 *  \param ClassName name of class holding this property
 
144
 *  \param VarName name of wxIconData inside class
 
145
 *  \param PGName name used in property grid
 
146
 *  \param DataName name used in Xml / Data Streams
 
147
 *  \param DefaultArtClient default art provider client (use _T("wxART_OTHER") if not sure)
 
148
 *  \param Priority priority of this property
 
149
 */
 
150
#define WXS_ICON_P(ClassName,VarName,PGName,DataName,DefaultArtClient,Priority) \
 
151
    { static wxsIconProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),DefaultArtClient,Priority); \
 
152
      Property(_Property); }
 
153
 
 
154
/** \} */
 
155
 
 
156
 
 
157
#endif