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: 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 $
23
#ifndef WXSBITMAPICONPROPERTY_H
24
#define WXSBITMAPICONPROPERTY_H
26
#include "../../properties/wxsproperties.h"
27
#include "../wxscodercontext.h"
29
#include <wx/artprov.h>
31
/** \brief Structure holding bitmap configuration
33
* Id determines whether we use art provider or not,
34
* if both Id and FileName are empty, no bitmap is given
37
struct wxsBitmapIconData
43
/** \brief Generating preview for this bitmap / icon */
44
wxBitmap GetPreview(const wxSize& Size,const wxString& DefaultClient = wxART_OTHER);
46
/** \brief Generating code building this bitmap / icon.
48
* Empty code is returned when there's no valid bitmap.
50
wxString BuildCode(bool NoResize,const wxString& SizeCode,wxsCoderContext* Context,const wxString& DefaultClient = wxART_OTHER);
52
/** \brief Checking if this is empty bitmap/icon */
56
typedef wxsBitmapIconData wxsBitmapData;
57
typedef wxsBitmapIconData wxsIconData;
59
/** \brief Property for editing arrays of strings with checked option
61
* \note This property doesn't take any default value.
62
* By default array is cleared.
64
class wxsBitmapIconProperty: public wxsCustomEditorProperty
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
75
wxsBitmapIconProperty(
76
const wxString& PGName,
77
const wxString& DataName,
79
const wxString& DefaultClient = _T("wxART_OTHER"),
82
/** \brief Returning type name */
83
virtual const wxString GetTypeName() { return _T("wxBitmapIcon"); }
85
/** \brief Showing editor for this property */
86
virtual bool ShowEditor(wxsPropertyContainer* Object);
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);
98
wxString DefaultClient;
101
typedef wxsBitmapIconProperty wxsBitmapProperty;
102
typedef wxsBitmapIconProperty wxsIconProperty;
105
/** \addtogroup ext_properties_macros
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)
115
#define WXS_BITMAP(ClassName,VarName,PGName,DataName,DefaultArtClient) \
116
{ static wxsBitmapProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),DefaultArtClient); \
117
Property(_Property); }
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
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); }
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)
138
#define WXS_ICON(ClassName,VarName,PGName,DataName,DefaultArtClient) \
139
{ static wxsIconProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),DefaultArtClient); \
140
Property(_Property); }
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
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); }