/usr/include/wxsmith/wxwidgets/properties/wxspositionsizeproperty.h is in libwxsmithlib-dev 13.12+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | /*
* This file is part of wxSmith plugin for Code::Blocks Studio
* Copyright (C) 2006-2007 Bartlomiej Swiecki
*
* wxSmith is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* wxSmith is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
*
* $Revision: 8148 $
* $Id: wxspositionsizeproperty.h 8148 2012-07-19 19:50:28Z mortenmacfly $
* $HeadURL: http://svn.code.sf.net/p/codeblocks/code/branches/release-xx.yy/src/plugins/contrib/wxSmith/wxwidgets/properties/wxspositionsizeproperty.h $
*/
#ifndef WXSPOSITIONSIZEPROPERTY_H
#define WXSPOSITIONSIZEPROPERTY_H
#include "../../properties/wxsproperties.h"
#include "../wxscodercontext.h"
/** \brief Structure holding informations about size or position and functions operating on them */
struct wxsPositionSizeData
{
bool IsDefault;
long X;
long Y;
bool DialogUnits;
inline wxsPositionSizeData(): IsDefault(true), X(0), Y(0), DialogUnits(false) {}
/** \brief Function returning position from data */
inline wxPoint GetPosition(wxWindow* Parent)
{
return IsDefault ?
wxDefaultPosition:
DialogUnits ? wxDLG_UNIT(Parent,wxPoint(X,Y)) : wxPoint(X,Y);
}
/** \brief Function fetching data from given position
*
* This function may be used to set proper values for X and Y coordinates
* when we have wxPoint value. Thsi function takes care of converting
* to valid units and check if value is default.
*/
inline void SetPosition(const wxPoint& Point,wxWindow* Parent)
{
if ( Point == wxDefaultPosition )
{
IsDefault = true;
}
else
{
IsDefault = false;
if ( DialogUnits )
{
wxPoint Temp = Parent->ConvertPixelsToDialog(Point);
X = Temp.x;
Y = Temp.y;
}
else
{
X = Point.x;
Y = Point.y;
}
}
}
/** \brief Function returning string representation of position
*
* This representatin may be used in generated code.
*/
wxString GetPositionCode(wxsCoderContext* Context);
/** \brief Function returnign size from data */
inline wxSize GetSize(wxWindow* Parent)
{
return IsDefault ?
wxDefaultSize :
DialogUnits ? wxDLG_UNIT(Parent,wxSize(X,Y)) : wxSize(X,Y);
}
/** \brief Function fetching data from given size
*
* This function may be used to set proper values for Width and Height
* when we have wxSize value. Thsi function takes care of converting
* to valid units and check if value is default.
*/
inline void SetSize(const wxSize& Size,wxWindow* Parent)
{
if ( Size == wxDefaultSize )
{
IsDefault = true;
}
else
{
IsDefault = false;
if ( DialogUnits )
{
wxSize Temp = Parent->ConvertPixelsToDialog(Size);
X = Temp.GetWidth();
Y = Temp.GetHeight();
}
else
{
X = Size.GetWidth();
Y = Size.GetHeight();
}
}
}
/** \brief Function returning string representation of size
*
* This representatin may be used in generated code.
*/
wxString GetSizeCode(wxsCoderContext* Context);
};
typedef wxsPositionSizeData wxsPositionData;
typedef wxsPositionSizeData wxsSizeData;
/** \brief Property handling Position and Size properties
*
* To declare this property, four variables are required - two long integers
* for coordinates, one boolean for switching between dialog / pixel units
* and one boolean for switching between default / user defined value.
* There are no default values for this property. By default
* "default" flag is turned on, dimensions are both -1, using dialog units
* is set to false.
*/
class wxsPositionSizeProperty: public wxsProperty
{
public:
/** \brief Ctor
* \param PGUseDefName name of "use default value" property
* \param PGXName name of x/width property
* \param PGYName name of y/height property
* \param PGDUName name of "use dialog units" property
* \param DataName name of property in data stuctures
* \param Offset offset to wxsPositionSizeData structure
* \param Priority priority of this property
*/
wxsPositionSizeProperty(
const wxString& PGUseDefName,
const wxString& PGXName,
const wxString& PGYName,
const wxString& PGDUName,
const wxString& DataName,
long Offset,
int Priority=100);
/** \brief Returning type name */
virtual const wxString GetTypeName() { return _T("wxPosition wxSize"); }
protected:
virtual void PGCreate(wxsPropertyContainer* Object,wxPropertyGridManager* Grid,wxPGId Parent);
virtual bool PGRead(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id,long Index);
virtual bool PGWrite(wxsPropertyContainer* Object,wxPropertyGridManager* Grid, wxPGId Id,long Index);
virtual bool XmlRead(wxsPropertyContainer* Object,TiXmlElement* Element);
virtual bool XmlWrite(wxsPropertyContainer* Object,TiXmlElement* Element);
virtual bool PropStreamRead(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
virtual bool PropStreamWrite(wxsPropertyContainer* Object,wxsPropertyStream* Stream);
private:
wxString PGXName;
wxString PGYName;
wxString PGDUName;
wxString DataName;
long Offset;
};
typedef wxsPositionSizeProperty wxsPositionProperty;
typedef wxsPositionSizeProperty wxsSizeProperty;
/** \addtogroup ext_properties_macros
* \{ */
/** \brief Macro automatically declaring position property
* \param ClassName name of class holding this property
* \param VarName name of wxsPositionData structure inside container
* \param PGDefName name of "default vlaue" property used in property grid
* \param PGXName name of X coordinate used in property grid
* \param PGYName name of Y coordinate used in property grid
* \param PGDUName name of "dialog units" switch used in property grid
* \param DataName name used in Xml / Data Streams
*/
#define WXS_POSITION(ClassName,VarName,PGDefName,PGXName,PGYName,PGDUName,DataName) \
{ static wxsPositionProperty _Property(PGDefName,PGXName,PGYName,PGDUName,DataName,wxsOFFSET(ClassName,VarName)); \
Property(_Property); }
/** \brief Macro automatically declaring position property with custom priority
* \param ClassName name of class holding this property
* \param VarName name of wxsPositionData structure inside container
* \param PGDefName name of "default vlaue" property used in property grid
* \param PGXName name of X coordinate used in property grid
* \param PGYName name of Y coordinate used in property grid
* \param PGDUName name of "dialog units" switch used in property grid
* \param DataName name used in Xml / Data Streams
* \param Priority priority of this property
*/
#define WXS_POSITION_P(ClassName,VarName,PGDefName,PGXName,PGYName,PGDUName,DataName,Priority) \
{ static wxsPositionProperty _Property(PGDefName,PGXName,PGYName,PGDUName,DataName,wxsOFFSET(ClassName,VarName),Priority); \
Property(_Property); }
/** \brief Macro automatically declaring size property
* \param ClassName name of class holding this property
* \param VarName name of wxsSizeData structure inside container
* \param PGDefName name of "default vlaue" property used in property grid
* \param PGWidthName name of Width used in property grid
* \param PGHeightName name of Height coordinate used in property grid
* \param PGDUName name of "dialog units" switch used in property grid
* \param DataName name used in Xml / Data Streams
*/
#define WXS_SIZE(ClassName,VarName,PGDefName,PGWidthName,PGHeightName,PGDUName,DataName) \
{ static wxsSizeProperty _Property(PGDefName,PGWidthName,PGHeightName,PGDUName,DataName,wxsOFFSET(ClassName,VarName)); \
Property(_Property); }
/** \brief Macro automatically declaring size property with custom priority
* \param ClassName name of class holding this property
* \param VarName name of wxsSizeData structure inside container
* \param PGDefName name of "default vlaue" property used in property grid
* \param PGWidthName name of Width used in property grid
* \param PGHeightName name of Height coordinate used in property grid
* \param PGDUName name of "dialog units" switch used in property grid
* \param DataName name used in Xml / Data Streams
* \param Priority priority of this property
*/
#define WXS_SIZE_P(ClassName,VarName,PGDefName,PGWidthName,PGHeightName,PGDUName,DataName,Priority) \
{ static wxsSizeProperty _Property(PGDefName,PGWidthName,PGHeightName,PGDUName,DataName,wxsOFFSET(ClassName,VarName),Priority); \
Property(_Property); }/** \} */
#endif
|