/usr/include/cegui-0.8.7/CEGUI/falagard/FrameComponent.h is in libcegui-mk2-dev 0.8.7-2.
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 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | /***********************************************************************
created: Mon Jul 18 2005
author: Paul D Turner <paul@cegui.org.uk>
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIFalFrameComponent_h_
#define _CEGUIFalFrameComponent_h_
#include "CEGUI/falagard/ComponentBase.h"
#include "CEGUI/XMLSerializer.h"
#include "CEGUI/falagard/FormattingSetting.h"
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
namespace CEGUI
{
/*!
\brief
Class that encapsulates information for a frame with background
(9 images in total)
Corner images are always drawn at their natural size, edges can be fomatted
(stretched, tiled or aligned) between the corner pieces for a particular
edge, the background image will cover the inner rectangle formed by the edge
images and can be formatted in both dimensions.
*/
class CEGUIEXPORT FrameComponent : public FalagardComponentBase
{
public:
FrameComponent();
/*!
\brief
Set the formatting to be used for the left edge image.
\param fmt
One of the VerticalFormatting enumerated values.
*/
void setLeftEdgeFormatting(VerticalFormatting fmt);
/*!
\brief
Set the formatting to be used for the right edge image.
\param fmt
One of the VerticalFormatting enumerated values.
*/
void setRightEdgeFormatting(VerticalFormatting fmt);
/*!
\brief
Set the formatting to be used for the top edge image.
\param fmt
One of the HorizontalFormatting enumerated values.
*/
void setTopEdgeFormatting(HorizontalFormatting fmt);
/*!
\brief
Set the formatting to be used for the bottom edge image.
\param fmt
One of the HorizontalFormatting enumerated values.
*/
void setBottomEdgeFormatting(HorizontalFormatting fmt);
/*!
\brief
Set the vertical formatting to be used for the background image.
\param fmt
One of the VerticalFormatting enumerated values.
*/
void setBackgroundVerticalFormatting(VerticalFormatting fmt);
/*!
\brief
Set the horizontal formatting to be used for the background image.
\param fmt
One of the HorizontalFormatting enumerated values.
*/
void setBackgroundHorizontalFormatting(HorizontalFormatting fmt);
/*!
\brief
Set the name of a property that will be used to obtain the formatting
to use for the left edge image.
*/
void setLeftEdgeFormattingPropertySource(const String& property_name);
/*!
\brief
Set the name of a property that will be used to obtain the formatting
to use for the right edge image.
*/
void setRightEdgeFormattingPropertySource(const String& property_name);
/*!
\brief
Set the name of a property that will be used to obtain the formatting
to use for the top edge image.
*/
void setTopEdgeFormattingPropertySource(const String& property_name);
/*!
\brief
Set the name of a property that will be used to obtain the formatting
to use for the bottom edge image.
*/
void setBottomEdgeFormattingPropertySource(const String& property_name);
/*!
\brief
Set the name of a property that will be used to obtain the vertical
formatting to use for the backdround image.
*/
void setBackgroundVerticalFormattingPropertySource(const String& property_name);
/*!
\brief
Set the name of a property that will be used to obtain the horizontal
formatting to use for the backdround image.
*/
void setBackgroundHorizontalFormattingPropertySource(const String& property_name);
/*!
\brief
Return the formatting to be used for the left edge image.
\return
One of the VerticalFormatting enumerated values.
*/
VerticalFormatting getLeftEdgeFormatting(const Window& wnd) const;
/*!
\brief
Return the formatting to be used for the right edge image.
\return
One of the VerticalFormatting enumerated values.
*/
VerticalFormatting getRightEdgeFormatting(const Window& wnd) const;
/*!
\brief
Return the formatting to be used for the top edge image.
\return
One of the HorizontalFormatting enumerated values.
*/
HorizontalFormatting getTopEdgeFormatting(const Window& wnd) const;
/*!
\brief
Return the formatting to be used for the bottom edge image.
\return
One of the HorizontalFormatting enumerated values.
*/
HorizontalFormatting getBottomEdgeFormatting(const Window& wnd) const;
/*!
\brief
Return the vertical formatting to be used for the background image.
\return
One of the VerticalFormatting enumerated values.
*/
VerticalFormatting getBackgroundVerticalFormatting(const Window& wnd) const;
/*!
\brief
Return the horizontal formatting to be used for the background image.
\return
One of the HorizontalFormatting enumerated values.
*/
HorizontalFormatting getBackgroundHorizontalFormatting(const Window& wnd) const;
/*!
\brief
Return the Image object that will be drawn by this FrameComponent
for a specified frame part.
\param imageComponent
One of the FrameImageComponent enumerated values specifying the
component image to be accessed.
\param wnd
Reference to a Window object that will be accessed if the image
component is fetched from a Property.
\return
pointer to an Image object, or 0 if the image had not been set
or if the image is sourced from a property that returns an empty
image name.
*/
const Image* getImage(FrameImageComponent imageComponent,
const Window& wnd) const;
/*!
\brief
Return a pointer to the Image object that was set for this FrameComponent
for a specified frame part.
\param imageComponent
One of the FrameImageComponent enumerated values specifying the
component image to be accessed.
\return
Pointer to the Image object, or a null pointer if the image
had not been set.
*/
const Image* getImage(FrameImageComponent imageComponent) const;
/*!
\brief
Set an Image that will be drawn by this FrameComponent.
\param part
One of the FrameImageComponent enumerated values specifying the
component image to be set.
\param image
Pointer to the Image object to be drawn. If this is 0 then drawing
of the component image specified by \a part will be disabled.
*/
void setImage(FrameImageComponent part, const Image* image);
/*!
\brief
Set an Image that will be drawn by this FrameComponent.
\param part
One of the FrameImageComponent enumerated values specifying the
component image to be set.
\param name
String holding the name of an Image. The image should already exist,
if the Image does not exist an Exception will be logged and
drawing of the component image specified by \a part will be
disabled.
*/
void setImage(FrameImageComponent part, const String& name);
/*!
\brief
Set the name of the Property that will be accesssed on the target
Window to determine the Image that will be drawn by the
FrameComponent.
\param part
One of the FrameImageComponent enumerated values specifying the
component image to be set.
\param name
String holding the name of a property that will be accessed. If this
is the empty string then drawing of the component image specified by
\a part will be disabled.
*/
void setImagePropertySource(FrameImageComponent part, const String& name);
/*!
\brief
Return whether the given component image has been specified.
\param part
One of the FrameImageComponent enumerated values specifying the
component image to check.
\return
- true if the image is specified and will be drawn.
- false if the image is not specified.
*/
bool isImageSpecified(FrameImageComponent part) const;
/*!
\brief
Return whether the given component image is specified via a
property.
\param part
One of the FrameImageComponent enumerated values specifying the
component image to check.
\return
- true if the image is specified and fetched via a property.
- false if the image is not fetched via a property
(or is not specified)
*/
bool isImageFetchedFromProperty(FrameImageComponent part) const;
/*!
\brief
Return the name of the property that will be used to determine the
image to use for the given component image.
If the returned String is empty, it indicates either that the
component image is not specified or that the component image is not
sourced from a property.
\see
isImageFetchedFromProperty isImageSpecified
\param part
One of the FrameImageComponent enumerated values specifying the
component image property source to return.
*/
const String& getImagePropertySource(FrameImageComponent part) const;
/*!
\brief
Writes an xml representation of this FrameComponent to \a out_stream.
\param xml_stream
Stream where xml data should be output.
\return
Nothing.
*/
void writeXMLToStream(XMLSerializer& xml_stream) const;
bool operator==(const FrameComponent& rhs) const;
//! Default value for the HorzFormat elements of the FrameComponent
static const HorizontalFormatting HorizontalFormattingDefault;
//! Default value for the VertFormat elements of the FrameComponent
static const VerticalFormatting VerticalFormattingDefault;
protected:
struct FrameImageSource
{
FrameImageSource() :
d_specified(false),
d_image(0)
{}
bool operator==(const FrameImageSource& rhs) const
{
return d_specified == rhs.d_specified &&
d_image == rhs.d_image &&
d_propertyName == rhs.d_propertyName;
}
bool operator!=(const FrameImageSource& rhs) const
{
return !operator==(rhs);
}
bool d_specified;
const Image* d_image;
String d_propertyName;
};
// implemets abstract from base
void render_impl(Window& srcWindow, Rectf& destRect,
const CEGUI::ColourRect* modColours,
const Rectf* clipper, bool clipToDisplay) const;
void renderImage(GeometryBuffer& buffer, const Image* image,
VerticalFormatting vertFmt,
HorizontalFormatting horzFmt,
Rectf& destRect, const ColourRect& colours,
const Rectf* clipper, bool clipToDisplay) const;
FormattingSetting<VerticalFormatting> d_leftEdgeFormatting;
FormattingSetting<VerticalFormatting> d_rightEdgeFormatting;
FormattingSetting<HorizontalFormatting> d_topEdgeFormatting;
FormattingSetting<HorizontalFormatting> d_bottomEdgeFormatting;
FormattingSetting<VerticalFormatting> d_backgroundVertFormatting;
FormattingSetting<HorizontalFormatting> d_backgroundHorzFormatting;
//! FrameImageSource array describing images to be used.
FrameImageSource d_frameImages[FIC_FRAME_IMAGE_COUNT];
};
}
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif
|