MyGUI  3.2.0
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
MyGUI::Canvas Class Reference

#include <MyGUI_Canvas.h>

+ Inheritance diagram for MyGUI::Canvas:

Data Structures

struct  Event

Public Types

enum  TextureResizeMode { TRM_PT_CONST_SIZE, TRM_PT_VIEW_REQUESTED, TRM_PT_VIEW_ALL }
typedef RTTIBase Base
typedef Canvas RTTIBase
typedef
delegates::CMultiDelegate1
< Canvas * > 
EventHandle_CanvasPtr
typedef delegates::CDelegate2
< Canvas *, Event
EventHandle_CanvasPtrEvent

Public Member Functions

virtual const std::string & getTypeName () const
virtual bool isType (const std::type_info &_type) const
template<typename Type >
bool isType () const
 Canvas ()
void createTexture (TextureResizeMode _resizeMode, TextureUsage _usage=getDefaultTextureUsage(), PixelFormat _format=getDefaultTextureFormat())
 Creates texture.
void createTexture (int _width, int _height, TextureResizeMode _resizeMode, TextureUsage _usage=getDefaultTextureUsage(), PixelFormat _format=getDefaultTextureFormat())
 Creates texture.
void createTexture (const IntSize &_size, TextureResizeMode _resizeMode, TextureUsage _usage=getDefaultTextureUsage(), PixelFormat _format=getDefaultTextureFormat())
 Creates texture.
void destroyTexture ()
 Destroys texture.
void updateTexture ()
 Call user delegate update and removes old texture if it isn't original.
void * lock (TextureUsage _usage=TextureUsage::Write)
 Locks hardware pixel buffer.
void unlock ()
 Unlocks hardware pixel buffer.
bool isLocked () const
 Checks lockness of hardware _pixel buffer.
int getTextureRealWidth () const
 Returns real width of texture.
int getTextureRealHeight () const
 Returns real height of texture.
IntSize getTextureRealSize () const
 Returns real _size of texture.
int getTextureSrcWidth () const
 Returns needed width while creating texture.
int getTextureSrcHeight () const
 Returns needed height while creating texture.
IntSize getTextureSrcSize () const
 Returns needed sizes while creating texture.
PixelFormat getTextureFormat () const
 Returns needed sizes while creating texture.
const std::string & getTextureName () const
 Returns name of the current texture.
virtual void setSize (const IntSize &_value)
virtual void setCoord (const IntCoord &_value)
void setSize (int _width, int _height)
void setCoord (int _left, int _top, int _width, int _height)
TextureResizeMode getResizeMode () const
 Returns resize mode.
void setResizeMode (TextureResizeMode _value)
 Sets resize mode of texture.
bool isTextureSrcSize () const
 Checks if the texture has the source (required by user) size, otherwise real texture size are bigger.
bool isTextureCreated () const
 Returns true if the texture was created (and exists), otherwise false.
bool isTextureManaged () const
 Returns true if we own the texture, otherwise false.
ITexturegetTexture () const
 Reurns interface texture.
void setTextureManaged (bool _value)
 Sets the texture managed.

Static Public Member Functions

static const std::string & getClassTypeName ()
static TextureUsage getDefaultTextureUsage ()
 Returns default GUI texture usage.
static PixelFormat getDefaultTextureFormat ()
 Returns default GUI texture format.

Data Fields

EventHandle_CanvasPtr eventPreTextureChanges
EventHandle_CanvasPtrEvent requestUpdateCanvas

Protected Member Functions

virtual void shutdownOverride ()
virtual void initialiseOverride ()
void _destroyTexture (bool _sendEvent)
 Destroys texture.
void validate (int &_width, int &_height, TextureUsage &_usage, PixelFormat &_format) const
 Update entered parameters according to current texture resize mode(size) and restore (if can) parameters of usage and format from texture.
void createExactTexture (int _width, int _height, TextureUsage _usage, PixelFormat _format)
 Creates the texture itself.
bool checkCreate (int _width, int _height) const
 Checks if we need to create a texture with such sizes.
void resize (const IntSize &_size)
 Calls when resize widget.
void correctUV ()
 Correct texture uv-coordinates.
void frameAdvise (bool _advise)
 For updating once per frame.
void frameEntered (float _time)
 For updating once per frame.
virtual void textureInvalidate (ITexture *_texture)
void _setUVSet (const FloatRect &_rect)

Protected Attributes

ITexturemTexture
 Current texture.
IntSize mReqTexSize
 Requested bu user sizes.
std::string mGenTexName
 Generated texture name.
TextureResizeMode mTexResizeMode
 Texture resize mode.
uint8mTexData
 Saved pointer from last calling lock.
bool mTexManaged
 true if we own the texture (can delete it or replace by another instance), otherwise false
bool mFrameAdvise
 For updating once per frame. True state means updating before next frame starts.
bool mInvalidateData

Detailed Description

Widget wrapper over Texture - shows the texture. Implemented: resizing of texture (see TextureResizeMode); recovery after loosing device;

Definition at line 36 of file MyGUI_Canvas.h.


Member Typedef Documentation

Reimplemented from MyGUI::Widget.

Definition at line 40 of file MyGUI_Canvas.h.

Definition at line 61 of file MyGUI_Canvas.h.

Definition at line 62 of file MyGUI_Canvas.h.

Reimplemented from MyGUI::Widget.

Definition at line 40 of file MyGUI_Canvas.h.


Member Enumeration Documentation

Available resize and view modes of texture

Remarks:
PT - Power of Two (size)
Enumerator:
TRM_PT_CONST_SIZE 
TRM_PT_VIEW_REQUESTED 

Texture doesn't resizes and fills all widget space.

TRM_PT_VIEW_ALL 

You can view all pixels of texture, texture cropped by sizes of widget.

Texture resizes and fills all widget space

Definition at line 69 of file MyGUI_Canvas.h.


Constructor & Destructor Documentation

Definition at line 32 of file MyGUI_Canvas.cpp.


Member Function Documentation

void MyGUI::Canvas::_destroyTexture ( bool  _sendEvent) [protected]

Destroys texture.

Definition at line 171 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::_setUVSet ( const FloatRect _rect) [protected]

Definition at line 279 of file MyGUI_Canvas.cpp.

bool MyGUI::Canvas::checkCreate ( int  _width,
int  _height 
) const [protected]

Checks if we need to create a texture with such sizes.

Definition at line 126 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::correctUV ( ) [protected]

Correct texture uv-coordinates.

Definition at line 186 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::createExactTexture ( int  _width,
int  _height,
TextureUsage  _usage,
PixelFormat  _format 
) [protected]

Creates the texture itself.

Definition at line 59 of file MyGUI_Canvas.cpp.

Creates texture.

Definition at line 43 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::createTexture ( int  _width,
int  _height,
TextureResizeMode  _resizeMode,
TextureUsage  _usage = getDefaultTextureUsage(),
PixelFormat  _format = getDefaultTextureFormat() 
)

Creates texture.

Definition at line 87 of file MyGUI_Canvas.cpp.

Creates texture.

Definition at line 51 of file MyGUI_Canvas.cpp.

Destroys texture.

Definition at line 156 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::frameAdvise ( bool  _advise) [protected]

For updating once per frame.

Definition at line 225 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::frameEntered ( float  _time) [protected]

For updating once per frame.

Reimplemented from MyGUI::Widget.

Definition at line 245 of file MyGUI_Canvas.cpp.

static const std::string& MyGUI::Canvas::getClassTypeName ( ) [inline, static]

Reimplemented from MyGUI::Widget.

Definition at line 40 of file MyGUI_Canvas.h.

Returns default GUI texture format.

Definition at line 375 of file MyGUI_Canvas.cpp.

Returns default GUI texture usage.

Definition at line 370 of file MyGUI_Canvas.cpp.

Returns resize mode.

Definition at line 340 of file MyGUI_Canvas.cpp.

Reurns interface texture.

Definition at line 360 of file MyGUI_Canvas.cpp.

Returns needed sizes while creating texture.

Definition at line 320 of file MyGUI_Canvas.cpp.

const std::string & MyGUI::Canvas::getTextureName ( ) const

Returns name of the current texture.

Definition at line 325 of file MyGUI_Canvas.cpp.

Returns real height of texture.

Definition at line 295 of file MyGUI_Canvas.cpp.

Returns real _size of texture.

Definition at line 300 of file MyGUI_Canvas.cpp.

Returns real width of texture.

Definition at line 290 of file MyGUI_Canvas.cpp.

Returns needed height while creating texture.

Definition at line 310 of file MyGUI_Canvas.cpp.

Returns needed sizes while creating texture.

Definition at line 315 of file MyGUI_Canvas.cpp.

Returns needed width while creating texture.

Definition at line 305 of file MyGUI_Canvas.cpp.

virtual const std::string& MyGUI::Canvas::getTypeName ( ) const [inline, virtual]

Get type name as string

Reimplemented from MyGUI::Widget.

Definition at line 40 of file MyGUI_Canvas.h.

void MyGUI::Canvas::initialiseOverride ( ) [protected, virtual]

Reimplemented from MyGUI::Widget.

Definition at line 167 of file MyGUI_Canvas.cpp.

bool MyGUI::Canvas::isLocked ( ) const

Checks lockness of hardware _pixel buffer.

Definition at line 285 of file MyGUI_Canvas.cpp.

Returns true if the texture was created (and exists), otherwise false.

Definition at line 350 of file MyGUI_Canvas.cpp.

Returns true if we own the texture, otherwise false.

See also:
mManaged

Definition at line 355 of file MyGUI_Canvas.cpp.

Checks if the texture has the source (required by user) size, otherwise real texture size are bigger.

Definition at line 220 of file MyGUI_Canvas.cpp.

virtual bool MyGUI::Canvas::isType ( const std::type_info &  _type) const [inline, virtual]

Compare with selected type

Reimplemented from MyGUI::Widget.

Definition at line 40 of file MyGUI_Canvas.h.

template<typename Type >
bool MyGUI::Canvas::isType ( ) const [inline]

Compare with selected type

Reimplemented from MyGUI::Widget.

Definition at line 40 of file MyGUI_Canvas.h.

Locks hardware pixel buffer.

Definition at line 206 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::resize ( const IntSize _size) [protected]

Calls when resize widget.

Definition at line 77 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::setCoord ( const IntCoord _value) [virtual]

Set widget position and size

Reimplemented from MyGUI::Widget.

Definition at line 113 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::setCoord ( int  _left,
int  _top,
int  _width,
int  _height 
)

See Widget::setCoord(const IntCoord& _coord)

Reimplemented from MyGUI::Widget.

Definition at line 335 of file MyGUI_Canvas.cpp.

Sets resize mode of texture.

See also:
TextureResizeMode

Definition at line 345 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::setSize ( const IntSize _value) [virtual]

Set widget size

Reimplemented from MyGUI::Widget.

Definition at line 106 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::setSize ( int  _width,
int  _height 
)

See Widget::setSize(const IntSize& _size)

Reimplemented from MyGUI::Widget.

Definition at line 330 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::setTextureManaged ( bool  _value)

Sets the texture managed.

Remarks:
Be careful with assigning managed status to texture, which wasn't created in Canvas!
See also:
mManaged

Definition at line 365 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::shutdownOverride ( ) [protected, virtual]

Reimplemented from MyGUI::Widget.

Definition at line 161 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::textureInvalidate ( ITexture _texture) [protected, virtual]

Implements MyGUI::ITextureInvalidateListener.

Definition at line 274 of file MyGUI_Canvas.cpp.

Unlocks hardware pixel buffer.

Definition at line 215 of file MyGUI_Canvas.cpp.

Call user delegate update and removes old texture if it isn't original.

Definition at line 120 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::validate ( int &  _width,
int &  _height,
TextureUsage _usage,
PixelFormat _format 
) const [protected]

Update entered parameters according to current texture resize mode(size) and restore (if can) parameters of usage and format from texture.

Definition at line 137 of file MyGUI_Canvas.cpp.


Field Documentation

Event : Notify user texture instance will be changed

See also:
requestUpdateCanvas.
signature : void method(MyGUI::Canvas* _canvas)
Parameters:
_canvas,whichwill be updated

Definition at line 168 of file MyGUI_Canvas.h.

bool MyGUI::Canvas::mFrameAdvise [protected]

For updating once per frame. True state means updating before next frame starts.

Definition at line 229 of file MyGUI_Canvas.h.

std::string MyGUI::Canvas::mGenTexName [protected]

Generated texture name.

Definition at line 217 of file MyGUI_Canvas.h.

Definition at line 231 of file MyGUI_Canvas.h.

Requested bu user sizes.

Definition at line 214 of file MyGUI_Canvas.h.

Saved pointer from last calling lock.

See also:
lock

Definition at line 223 of file MyGUI_Canvas.h.

bool MyGUI::Canvas::mTexManaged [protected]

true if we own the texture (can delete it or replace by another instance), otherwise false

Definition at line 226 of file MyGUI_Canvas.h.

Texture resize mode.

See also:
TextureResizeMode

Definition at line 220 of file MyGUI_Canvas.h.

Current texture.

Reimplemented from MyGUI::SkinItem.

Definition at line 211 of file MyGUI_Canvas.h.

Event : Texture instance was changed (May be caused by resizing texture or lossing device). User have to update all references to new instance of texture.
signature : void method(MyGUI::Canvas* _canvas, MyGUI::Canvas::Event _event)

Parameters:
_canvas,whichneeds to update
_event

Definition at line 175 of file MyGUI_Canvas.h.


The documentation for this class was generated from the following files: