My Project
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
ParaEngine::CGUIPosition Struct Reference

position of the GUI object More...

#include <GUIPosition.h>

Classes

union  _relativity
 

Public Types

enum  GUI_ALIGNMENT_TYPE {
  upper_left = 0, bottom_right, bottom_left, upper_right,
  center_top, center_bottom, center_left, center_right,
  center, middle_top, middle_bottom, middle_left,
  middle_right, fill
}
 relative to 2D screen More...
 
enum  CGUIPosition_TYPE { relative_to_screen = 10, relative_to_3Dobject = 11, relative_to_parent = 12 }
 How the position of the GUI object is specified. More...
 

Public Member Functions

 CGUIPosition (const RECT &rect_)
 
 CGUIPosition (int x, int y, int width, int height)
 
void SetWidth (int width)
 
void SetHeight (int height)
 
void SetDepth (float Depth)
 
void Update3DDepth (float Depth)
 updates the 3d object depth if the object is relative to 3d object It's used internally. More...
 
bool IsNormalWidthHeight () const
 
int GetWidth () const
 
int GetHeight () const
 
int GetLeft () const
 
int GetTop () const
 
void SetLeft (int X)
 
void SetTop (int Y)
 
float GetDepth () const
 
void SetXY (int X, int Y)
 
void SetSize (int width, int height)
 
void Reposition (const char *alignment, int left, int top, int width, int height)
 reposition the control using the same parameter definition used when control is created. More...
 
int SetAlignment (const char *alignment)
 "_lt": align to left top of the screen "_lb": align to left bottom of the screen "_ct": align to center of the screen "_ctt": align to center top of the screen "_ctb": align to center bottom of the screen "_ctl": align to center left of the screen "_ctr": align to center right of the screen "_rt": align to right top of the screen "_rb": align to right bottom of the screen "_mt": align to middle top "_ml": align to middle left "_mr": align to middle right "_mb": align to middle bottom "_fi": align to left top and right bottom. More...
 
void CalculateAbsPosition (RECT *pOut, const RECT *pParentRect) const
 Get the standard position of pIn relative to pParentRect. More...
 
bool IsRelativeTo3DObject () const
 
bool IsRelativeToParent () const
 
bool IsRelativeToScreen () const
 
CGUIPosition_TYPE GetPositionType () const
 
void SetPositionType (CGUIPosition_TYPE val)
 
void SetRelatveTo3DObject (const char *s3DObjectName, float fOffset=0.f)
 
void SetRelatveTo3DObject (CBaseObject *p3DObject, float fOffset=0.f)
 
bool Is3DObjectSpecified () const
 
CBaseObjectGetRelative3DObject (IScene *pScene=NULL) const
 

Static Public Member Functions

static void GetAbsPosition (RECT *pOut, const RECT *pParentRect, const CGUIPosition *pIn)
 same as CalculateAbsPosition
 

Public Attributes

RECT rect
 internal value in absolute screen coordinates
 
union ParaEngine::CGUIPosition::_relativity Relative
 
std::string m_s3DObjectName
 3d object name that this gui object is attached to. More...
 
int m_n3DObjectID
 3d object id that this gui object is attached to. More...
 

Protected Attributes

CGUIPosition_TYPE m_nPositionType
 relative to screen | relative to 3D scene object
 
float m_fDepth
 

Detailed Description

position of the GUI object

Member Enumeration Documentation

§ CGUIPosition_TYPE

How the position of the GUI object is specified.

It can be object in pure screen pixels (a rectangular), or in scaled screen coordinates (a percentage)

§ GUI_ALIGNMENT_TYPE

relative to 2D screen

Enumerator
upper_left 
  • relative to the upper, left. The upper-left point is treated as (0,0)
bottom_right 
  • relative to the bottom, right. The bottom-right point is treated as (0,0)
bottom_left 
  • relative to the bottom, left. The bottom-left point is treated as (0,0)
upper_right 
  • relative to the upper, right. The upper-right point is treated as (0,0)
center_top 
  • relative to the center top, where height and width is fixed
center_bottom 
  • relative to the center bottom, where height and width is fixed
center_left 
  • relative to the center left, where height and width is fixed
center_right 
  • relative to the center right, where height and width is fixed
center 
  • relative to the center center. The central point is treated as (0,0)
middle_top 
  • align to the top, it specifies the distances to the top and the left/right edge
middle_bottom 
  • align to the bottom, it specifies the distances to the bottom and the left/right edge
middle_left 
  • align to the left, it specifies the distances to the left and the top/bottom edge
middle_right 
  • align to the right, it specifies the distances to the right and the top/bottom edge
fill 
  • align to left top and right bottom. This is like fill in the parent window.

Member Function Documentation

§ CalculateAbsPosition()

void ParaEngine::CGUIPosition::CalculateAbsPosition ( RECT pOut,
const RECT pParentRect 
) const

Get the standard position of pIn relative to pParentRect.

Parameters
pOut[out]: output in standard rect
pParentRect[in]: the standard rect of the parent of pIn;
pIn[in]: any rect.

§ Reposition()

void ParaEngine::CGUIPosition::Reposition ( const char *  alignment,
int  left,
int  top,
int  width,
int  height 
)

reposition the control using the same parameter definition used when control is created.

see InitObject() for parameter definition.

§ SetAlignment()

int CGUIPosition::SetAlignment ( const char *  alignment)

"_lt": align to left top of the screen "_lb": align to left bottom of the screen "_ct": align to center of the screen "_ctt": align to center top of the screen "_ctb": align to center bottom of the screen "_ctl": align to center left of the screen "_ctr": align to center right of the screen "_rt": align to right top of the screen "_rb": align to right bottom of the screen "_mt": align to middle top "_ml": align to middle left "_mr": align to middle right "_mb": align to middle bottom "_fi": align to left top and right bottom.

This is like fill in the parent window. the layout is given below:
_lt _mt _rt
_ml _ct _mr
_lb _mb _rb

Returns
1 if width, height is used as right, bottom. otherwise 0

§ Update3DDepth()

void ParaEngine::CGUIPosition::Update3DDepth ( float  Depth)

updates the 3d object depth if the object is relative to 3d object It's used internally.

If users want to modify the depth of the UI, use SetDepth() instead

Member Data Documentation

§ m_n3DObjectID

int ParaEngine::CGUIPosition::m_n3DObjectID

3d object id that this gui object is attached to.

§ m_s3DObjectName

std::string ParaEngine::CGUIPosition::m_s3DObjectName

3d object name that this gui object is attached to.

If empty, m_n3DObjectID is used.


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