GL Studio API
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
DisplayFrame Class Reference

#include <display_frame.h>

Inheritance diagram for DisplayFrame:
AttributeChangedNotifier ComponentBase RuntimeDisplayFrame GlsRSOWrapper SplashDisplay glsDisplayFrame

Public Member Functions

 DisplayFrame (int width, int height, bool allocateObjects=true)
 
void ClearBitfield (GLbitfield bitField)
 
GLbitfield ClearBitfield ()
 
virtual void DragObject (DisplayObject *obj)
 
virtual DisplayObjectDragObject (void)
 
virtual void ClearDrag ()
 
virtual void FocusObject (DisplayObject *obj)
 
virtual DisplayObjectFocusObject (void)
 
virtual void ClearFocus ()
 
virtual void MultitouchEnabled (bool enabled)
 
virtual bool MultitouchEnabled (void)
 
virtual InputHandlerGetInputHandler ()
 
virtual DisplayObjectHandleDisplayEvent (DisplayEvent *ev)
 
virtual void WriteResources (const char *filename, GlsResourceFilter *filter=NULL)
 
virtual void ReadResources (const char *filename)
 
virtual DistiAttributeBaseResource (const char *name)
 
virtual void GetResources (std::ostream &outstr, GlsResourceFilter *filter=NULL)
 
virtual void SetResources (std::istream &instr)
 
void SetResource (const std::string &resourceName, const std::string &resourceVal)
 
std::string GetResource (const std::string &resourceName)
 
virtual char * GetResource_CRTClean (const char *name)
 
virtual void GetResourceFree_CRTClean (char *memoryToFree)
 
virtual char * GetResources_CRTClean (GlsResourceFilter *filter)
 
virtual void GetResourcesFree_CRTClean (char *memoryToFree)
 
virtual void SetResource_CRTClean (const char *name, const char *value)
 
virtual void SetResources_CRTClean (const char *buf)
 
virtual void NotifyAttributeChanged (const AttributeName &name)
 
virtual InterfaceListTypeGetCppInterfaceDescription (InterfaceListType *addToThisList=NULL)
 
virtual void GetCppInterfaceDescriptionFree (InterfaceListType *array)
 
void SetTexturePaletteSize (int cnt)
 
void Draw (void)
 
void InsertObject (DisplayObject *obj, int loc)
 
void PushObject (DisplayObject *obj)
 
int Width (void)
 
int Height (void)
 
void SetWidth (int w)
 
void SetHeight (int h)
 
virtual void SetRedraw (void)
 
bool CullingEnabled (void)
 
void CullingEnabled (const bool enabled)
 
DistiAttribDictFrameAttribDict (void)
 
const DistiAttribDictFrameAttribDict (void) const
 
DynamicMaterialArrayMaterialPalette (void)
 
ComponentLightMgrLightMgr (void)
 
void LightMgr (ComponentLightMgr *val)
 
virtual void ClearDragAndFocus ()
 
- Public Member Functions inherited from AttributeChangedNotifier
virtual ~AttributeChangedNotifier ()
 

Static Public Member Functions

static void SetOpenGLDefaultState (bool saveVal)
 
static void RestoreOpenGLState (void)
 

Public Attributes

TexturePalettetexturePalette
 
SoundSystem_sound_player
 
Groupobjects
 

Protected Member Functions

virtual void CurrentCursor (unsigned int cursor_id)
 
void CleanupDragMap ()
 
DisplayObjectGetDragObjectForCursor (unsigned int cursorID)
 
DisplayObjectFindDragObject ()
 
virtual float Scale (void)
 

Protected Attributes

bool _cullingEnabled
 
int _width
 
int _height
 
float _lastPickedDepth
 
DynamicMaterialArray _materialPalette
 
ComponentLightMgr_lightMgr
 
GLbitfield _clearBitfield
 
std::string _componentHeaderFileName
 
unsigned int _currentCursor
 
bool _multitouchEnabled
 
unsigned int _cursorsDown
 

Detailed Description

The base class for associating a display device with an object list.

DisplayFrame contains all of the display objects, texture, and fonts for an application.

Constructor & Destructor Documentation

DisplayFrame ( int  width,
int  height,
bool  allocateObjects = true 
)

Creates a new display frame

Parameters
widthThe width of this display frame in pixels
heightThe height of this display frame in pixels
allocateObjects

Member Function Documentation

void CleanupDragMap ( )
protected

Cleanup unused entries from the drag map

void ClearBitfield ( GLbitfield  bitField)
inline

Sets the OpenGL clear bitmask that will be used when the window is cleared

Parameters
bitFieldThe OpenGL bitfield to use when clearing. /see glClear
GLbitfield ClearBitfield ( )
inline

Gets the OpenGL clear bitmask that will be used when the window is cleared

Returns
The OpenGL bitfield to use when clearing. /see glClear
virtual void ClearDrag ( )
virtual

Clears the drag objects for all cursors.

virtual void ClearDragAndFocus ( )
virtual

Call this before deleting objects which may be being kept by the drag or focus objects. If an object is to be deleted. The user must ensure that it is not being used as the drag or focus object. If it is, a leave event may be sent to it after it has been deleted, causing a crash. To avoid this the user can either ensure that the object never handles mouse events, or call ClearDragAndFocus() imediatly before deleting them

Reimplemented in RuntimeDisplayFrame, and ComponentBase.

virtual void ClearFocus ( )
virtual

Clears the focus objects for all cursors.

bool CullingEnabled ( void  )

Gets the whether or not culling is enabled for this display frame

Returns
whether or not culling is enabled for this display frame
void CullingEnabled ( const bool  enabled)

Sets the whether or not culling is enabled for this display frame

Parameters
enabledwhether or not culling is enabled for this display frame
virtual void CurrentCursor ( unsigned int  cursor_id)
protectedvirtual

Changes the current cursor to the specified cursor id. Needed by multitouch, so that DragObject and FocusObject will return the correct objects for the current cursor.

Parameters
cursor_idthe cursor id
virtual void DragObject ( DisplayObject obj)
virtual

Sets the current "Drag" object for the current cursor

Parameters
objThe new DragObject
virtual DisplayObject* DragObject ( void  )
virtual

Gets the current "Drag" object for the current cursor

Returns
The current DragObject
void Draw ( void  )

Draw the objects contained in this display frame

DisplayObject* FindDragObject ( )
protected

Find a non-null drag object from the _dragObjectMap if on exists

Returns
a drag object, or null if there aren't any in the map
virtual void FocusObject ( DisplayObject obj)
virtual

Sets the current focus object for the current cursor.

virtual DisplayObject* FocusObject ( void  )
virtual

Gets the current "Focus" object for the current cursor

Returns
The current FocusObject
DistiAttribDict& FrameAttribDict ( void  )
inline
Returns
A reference to the Attribute dictionary for this display frame
const DistiAttribDict& FrameAttribDict ( void  ) const
inline
Returns
A const reference to the Attribute dictionary for this display frame
virtual InterfaceListType* GetCppInterfaceDescription ( InterfaceListType addToThisList = NULL)
virtual

Get the details of the Cpp Interface The actual interface is exposed in compiled code.

Parameters
addToThisListA list to add to and then return. Creates a new one if NULL.
Returns
A templated list. The caller must call the corresponding free method to safely free the memory.

Reimplemented in GlsRSOWrapper, ComponentBase, and SplashDisplay.

virtual void GetCppInterfaceDescriptionFree ( InterfaceListType array)
virtual

Frees the memory allocated by a previous GetCppInterfaceDescription call

Parameters
arrayPointer to memory allocated by GetCppInterfaceDescription

Reimplemented in GlsRSOWrapper, ComponentBase, and SplashDisplay.

DisplayObject* GetDragObjectForCursor ( unsigned int  cursorID)
protected

Get the drag object that corresponds to the curosr

Parameters
cursorIDthe cursor
Returns
the drag object or null if none exists
virtual InputHandler* GetInputHandler ( )
virtual

Get the input handler

Reimplemented in ComponentBase.

std::string GetResource ( const std::string &  resourceName)
inline

Gets a DisplayFrame resource value.

Parameters
resourceNameName of the resource to set
virtual char* GetResource_CRTClean ( const char *  name)
virtual

CRT Insensitive version of GetResource() Version with streams can not be called from differently compiled code.

Parameters
namename of resource
Returns
The requested value allocated as a char array. The user MUST call GetResourceFree() when finished using returned value.
virtual void GetResourceFree_CRTClean ( char *  memoryToFree)
virtual

Frees the memory allocated by a previous GetResource_CRTClean call

Parameters
memoryToFreePointer to memory allocated by GetResource_CRTClean
virtual void GetResources ( std::ostream &  outstr,
GlsResourceFilter filter = NULL 
)
virtual

Get the resources for this display frame and all it's children acording to the filter

Parameters
outstrThe stream to write to
filterThe filter to control what gets written.

Reimplemented in ComponentBase, and GlsRSOWrapper.

virtual char* GetResources_CRTClean ( GlsResourceFilter filter)
virtual

CRT Insensitive version of GetResources()

Parameters
filterThe filter to control what gets written
Returns
A null terminated char* containing the requested resources The user MUST call GetResourcesFree() on the returned value.
virtual void GetResourcesFree_CRTClean ( char *  memoryToFree)
virtual

Frees the memory allocated by a previous GetResources_CRTClean call

Parameters
memoryToFreePointer to memory allocated by GetResource_CRTClean
virtual DisplayObject* HandleDisplayEvent ( DisplayEvent ev)
virtual

Handles a display event. Picks an object and also tracks focus.

int Height ( void  )

Gets the height in pixels of this display frame

Returns
The height in pixels of this display frame
void InsertObject ( DisplayObject obj,
int  loc 
)

Inserts a display object into this display frame at the specified index in the object list.

Parameters
objThe object to insert
locWhere to insert the object
ComponentLightMgr* LightMgr ( void  )
inline
Returns
A pointer to the light manager for this display frame
void LightMgr ( ComponentLightMgr val)
inline

Sets the light manager for this display frame. This is used only for very special cases. The current LightMgr is NOT deleted when the new one is set. If this is used, it is recommended to restore the value to the original value.

Parameters
valThe pointer to the new light manger.
DynamicMaterialArray& MaterialPalette ( void  )
inline
Returns
A reference to the material palette for this display frame
virtual void MultitouchEnabled ( bool  enabled)
virtual

Enables/Disables multitouch on the display frame. Multitouch is enabled by default. This function has no effect on platforms that do not support multitouch

virtual bool MultitouchEnabled ( void  )
virtual

Gets whether or not multitouch is enabled on the display frame.

virtual void NotifyAttributeChanged ( const AttributeName name)
virtual

Implements AttributeChangedNotifier::NotifyAttributeChanged. Notify the class that the attribute has changed. Observers of the attribute will have their callbacks called

Parameters
namethe name of the attribute

Implements AttributeChangedNotifier.

Reimplemented in ComponentBase.

void PushObject ( DisplayObject obj)

Inserts a display object into this display frame at the end of the object list.

Parameters
objThe object to insert
virtual void ReadResources ( const char *  filename)
virtual

Read the resources (attributes) of the objects in this display frame from the specified file

Parameters
filenameName of the file to read from
virtual DistiAttributeBase& Resource ( const char *  name)
virtual

Gets a reference to the specified attribute for reading and writing. This reference can be streamed into and out of variables. This can access different levels of objects. For example: The DisplayFrame: Resource("ComponentHeaderFile") >> someStdString; An object in the DisplayFrame: Resource("SomeObject.Visible") << someBool; An object in a Component in this DisplayFrame: Resource("SomeComponentObject.SomeObject.Visible") >> someBool;

Reimplemented in ComponentBase, and GlsRSOWrapper.

static void RestoreOpenGLState ( void  )
static

Call this after calling SetOpenGLDefaultState with saveVal == true. DO NOT call this after calling SetOpenGLDefaultState with saveVal == false because this will pop the attribute stack.

virtual float Scale ( void  )
inlineprotectedvirtual
Returns
The current scale for the display frame

Reimplemented in RuntimeDisplayFrame.

void SetHeight ( int  h)

Sets the height in pixels of this display frame

Parameters
hThe new height in pixels of this display frame
static void SetOpenGLDefaultState ( bool  saveVal)
static

Sets up the OpenGL Pipeline to the state expected by GL Studio drawing. resetTemplate is used to not reset certain catagories. For example, it may be desirable for a GL Studio object to receive lighting from it's VegaPrime scene.

Parameters
saveValWhether or not to save values. If true, this will call glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS) and glPushAttrib(GL_ALL_ATTRIB_BITS). You should call RestoreOpenGLState() after drawing to pop the attributes.
virtual void SetRedraw ( void  )
virtual

Does nothing here in the base class. Allows other display frames to add functionality

Reimplemented in ComponentBase, and glsDisplayFrame.

void SetResource ( const std::string &  resourceName,
const std::string &  resourceVal 
)
inline

Sets a DisplayFrame resource value.

Parameters
resourceNameName of the resource to set.
resourceValValue of the resource to set
virtual void SetResource_CRTClean ( const char *  name,
const char *  value 
)
virtual

CRT Insensitive version of SetResource() Version with streams can not be called from differently compiled code.

Parameters
namename of resource
valuenew value for resource
virtual void SetResources ( std::istream &  instr)
virtual

Parse a stream of resource value pairs.

Parameters
instrStream containing the resource data
virtual void SetResources_CRTClean ( const char *  buf)
virtual

CRT Insensitive version of SetResources() Parse a buffer of resource value pairs.

Parameters
bufString containing resource data
void SetTexturePaletteSize ( int  cnt)

Sets the texture palette size for this display frame

Parameters
cntThe number of entries to have in the display frame
void SetWidth ( int  w)

Sets the width in pixels of this display frame

Parameters
wThe new width in pixels of this display frame
int Width ( void  )

Gets the width in pixels of this display frame

Returns
The width in pixels of this display frame
virtual void WriteResources ( const char *  filename,
GlsResourceFilter filter = NULL 
)
virtual

Write the resources (attributes) of the objects in this display frame to the specified file

Parameters
filenameName of the file to write to
filterA filter to specify which attributes to write

Member Data Documentation

GLbitfield _clearBitfield
protected

The OpenGL bitfield to use when clearing. /see glClear

std::string _componentHeaderFileName
protected

backing store for META_COMPONENT_HEADER_FILE_NAME attribute

bool _cullingEnabled
protected

True if culling is enabled for this DisplayFrame

unsigned int _currentCursor
protected

the current cursor being processed

unsigned int _cursorsDown
protected

The number of cursors (touches) that are currently down

int _height
protected

The height of the window for this display frame

float _lastPickedDepth
protected

Keeps previous picks depth for use when no pick is performed (dragging)

ComponentLightMgr* _lightMgr
protected

The _lightMgr is used to setup lighting for the DisplayFrame

DynamicMaterialArray _materialPalette
protected

A Dynamic array for keeping the materials for this frame

bool _multitouchEnabled
protected

whether or not multitouch is enabled

SoundSystem* _sound_player

Sound file player for this DisplayFrame

int _width
protected

The width of the window for this display frame

Group* objects

The object hierarchy for this display frame

TexturePalette* texturePalette

An array of textures allocated for display on objects


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