| GL Studio C++ Runtime 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:

## Public Member Functions
| DisplayFrame (int width, int height, bool allocateObjects=true)
void | ClearBitfield (GLbitfield bitField)
GLbitfield | ClearBitfield ()
virtual void | DragObject (DisplayObject *obj)
virtual DisplayObject * | DragObject ()
virtual void | ClearDrag ()
virtual void | FocusObject (DisplayObject *obj)
virtual DisplayObject * | FocusObject ()
virtual void | ClearFocus ()
virtual void | MultitouchEnabled (bool enabled)
virtual bool | MultitouchEnabled ()
virtual InputHandler * | GetInputHandler ()
virtual DisplayObject * | HandleDisplayEvent (DisplayEvent *ev)
virtual void | WriteResources (const char *filename, GlsResourceFilter *filter=NULL)
virtual void | ReadResources (const char *filename)
virtual DistiAttributeBase & | Resource (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)
void | SetResource (const char *resourceName, const char *resourceVal)
std::string | GetResource (const std::string &resourceName)
std::string | GetResource (const char *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) override
void | SetTexturePaletteSize (int cnt)
void | Draw ()
void | InsertObject (DisplayObject *obj, bool reparent=true, bool recalculateBoundingbox=true, int loc=-1)
void | InsertObject (DisplayObject *obj, int loc)
void | PushObject (DisplayObject *obj)
int | Width ()
int | Height ()
void | SetWidth (int w)
void | SetHeight (int h)
virtual void | SetRedraw ()
bool | CullingEnabled ()
void | CullingEnabled (const bool enabled)
DistiAttribDict & | FrameAttribDict ()
const DistiAttribDict & | FrameAttribDict () const
DynamicMaterialArray & | MaterialPalette ()
ComponentLightMgr * | LightMgr ()
void | LightMgr (ComponentLightMgr *val)
virtual void | ClearDragAndFocus ()
Public Member Functions inherited from AttributeChangedNotifier
virtual void | NotifyAttributeChanged (const AttributeName &name)=0
virtual | ~AttributeChangedNotifier ()
Public Member Functions inherited from WeakReferenceableMixin
void | AddWeakReference (WeakReference *weakRef) override
void | NotifyWeakReferenceDestroyed (WeakReference *ref) override
virtual void | AddWeakReference (WeakReference *weakRef)=0
virtual void | NotifyWeakReferenceDestroyed (WeakReference *weakReference)=0

## Static Public Member Functions
static void | SetOpenGLDefaultState (bool saveVal)
static void | RestoreOpenGLState ()

## Public Attributes
TexturePalette * | texturePalette
SoundSystem * | _sound_player
Group * | objects

## Protected Member Functions
virtual void | CurrentCursor (unsigned int cursor_id)
void | CleanupDragMap ()
DisplayObject * | GetDragObjectForCursor (unsigned int cursorID)
DisplayObject * | FindDragObject ()
virtual EventCompressor< DisplayFrame > * | GetEventCompressor ()
virtual float | Scale ()
Protected Member Functions inherited from WeakReferenceableMixin
| WeakReferenceableMixin ()
virtual | ~WeakReferenceableMixin ()

## Protected Attributes
bool | _cullingEnabled
int | _width
int | _height
float | _lastPickedDepth
DynamicMaterialArray | _materialPalette
ComponentLightMgr * | _lightMgr
GLbitfield | _clearBitfield
std::string | _componentHeaderFileName
DragObjectMap * | _dragObjectMap
| Holds a focus object for each cursor.
unsigned int | _currentCursor
bool | _multitouchEnabled
unsigned int | _cursorsDown
Protected Attributes inherited from WeakReferenceableMixin
DynamicArray< WeakReference * > * | _weakRefs

## 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()

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

Creates a new display frame

Parameters

  width | The width of this display frame in pixels
  height | The height of this display frame in pixels
  allocateObjects |

## Member Function Documentation

## ◆ CleanupDragMap()

void CleanupDragMap | ( |  | ) |
| protected

Cleanup unused entries from the drag map

## ◆ ClearBitfield() [1/2]

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

## ◆ ClearBitfield() [2/2]

void ClearBitfield | ( | GLbitfield | bitField | ) |
| inline

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

Parameters

  bitField | The OpenGL bitfield to use when clearing. /see glClear

## ◆ ClearDrag()

virtual void ClearDrag | ( |  | ) |
| virtual

Clears the drag objects for all cursors.

## ◆ ClearDragAndFocus()

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 ComponentBase, and RuntimeDisplayFrame.

## ◆ ClearFocus()

virtual void ClearFocus | ( |  | ) |
| virtual

Clears the focus objects for all cursors.

## ◆ CullingEnabled() [1/2]

bool CullingEnabled | ( |  | ) |

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

Returns
  whether or not culling is enabled for this display frame

## ◆ CullingEnabled() [2/2]

void CullingEnabled | ( | const bool | enabled | ) |

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

Parameters

  enabled | whether or not culling is enabled for this display frame

## ◆ CurrentCursor()

virtual void CurrentCursor | ( | unsigned int | cursor_id | ) |
| protected virtual

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_id | the cursor id

## ◆ DragObject() [1/2]

virtual DisplayObject * DragObject | ( |  | ) |
| virtual

Gets the current "Drag" object for the current cursor

Returns
  The current DragObject

## ◆ DragObject() [2/2]

virtual void DragObject | ( | DisplayObject * | obj | ) |
| virtual

Sets the current "Drag" object for the current cursor

Parameters

  obj | The new DragObject

## ◆ Draw()

void Draw | ( |  | ) |

Draw the objects contained in this display frame

## ◆ FindDragObject()

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

## ◆ FocusObject() [1/2]

virtual DisplayObject * FocusObject | ( |  | ) |
| virtual

Gets the current "Focus" object for the current cursor

Returns
  The current FocusObject

## ◆ FocusObject() [2/2]

virtual void FocusObject | ( | DisplayObject * | obj | ) |
| virtual

Sets the current focus object for the current cursor.

Parameters

  obj | The new focus object to set.

## ◆ FrameAttribDict() [1/2]

DistiAttribDict & FrameAttribDict | ( |  | ) |
| inline

Returns
  A reference to the Attribute dictionary for this display frame

## ◆ FrameAttribDict() [2/2]

const DistiAttribDict & FrameAttribDict | ( |  | ) | const
| inline

Returns
  A const reference to the Attribute dictionary for this display frame

## ◆ GetDragObjectForCursor()

DisplayObject * GetDragObjectForCursor | ( | unsigned int | cursorID | ) |
| protected

Get the drag object that corresponds to the curosr

Parameters

  cursorID | the cursor

Returns
  the drag object or null if none exists

## ◆ GetEventCompressor()

virtual EventCompressor< DisplayFrame > * GetEventCompressor | ( |  | ) |
| inline protected virtual

Get the event compressor for this display frame, if it exists

Returns
  The event compressor.

Reimplemented in EmbeddedDisplayFrame.

## ◆ GetInputHandler()

virtual InputHandler * GetInputHandler | ( |  | ) |
| virtual

Returns
  The input handler for this component.

Reimplemented in ComponentBase.

## ◆ GetResource() [1/2]

std::string GetResource | ( | const char * | resourceName | ) |
| inline

Gets a DisplayFrame resource value.

Parameters

  resourceName | Name of the resource to set.

Returns
  The string value of the requested resource, empty string if not available.

## ◆ GetResource() [2/2]

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

Gets a DisplayFrame resource value.

Parameters

  resourceName | Name of the resource to set.

Returns
  The string value of the requested resource, empty string if not available.

## ◆ GetResource_CRTClean()

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

  name | name of resource

Returns
  The requested value allocated as a char array. The user MUST call GetResourceFree() when finished using returned value.

## ◆ GetResourceFree_CRTClean()

virtual void GetResourceFree_CRTClean | ( | char * | memoryToFree | ) |
| virtual

Frees the memory allocated by a previous GetResource_CRTClean call

Parameters

  memoryToFree | Pointer to memory allocated by GetResource_CRTClean

## ◆ GetResources()

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

  outstr | The stream to write to
  filter | The filter to control what gets written.

Reimplemented in ComponentBase, and GlsRSOWrapper.

## ◆ GetResources_CRTClean()

virtual char * GetResources_CRTClean | ( | GlsResourceFilter * | filter | ) |
| virtual

CRT Insensitive version of GetResources()

Parameters

  filter | The filter to control what gets written

Returns
  A null terminated char* containing the requested resources The user MUST call GetResourcesFree() on the returned value.

## ◆ GetResourcesFree_CRTClean()

virtual void GetResourcesFree_CRTClean | ( | char * | memoryToFree | ) |
| virtual

Frees the memory allocated by a previous GetResources_CRTClean call

Parameters

  memoryToFree | Pointer to memory allocated by GetResource_CRTClean

## ◆ HandleDisplayEvent()

virtual DisplayObject * HandleDisplayEvent | ( | DisplayEvent * | ev | ) |
| virtual

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

Parameters

  ev | The display event to be handled.

Returns
  A pointer to the object that received the event, otherwise NULL.

## ◆ Height()

int Height | ( |  | ) |

Gets the height in pixels of this display frame

Returns
  The height in pixels of this display frame

## ◆ InsertObject() [1/2]

void InsertObject | ( | DisplayObject * | obj,
|  | bool | reparent = `true`,
|  | bool | recalculateBoundingbox = `true`,
|  | int | loc = `-1`
| ) |  |

Adds the specified object into the group, at the end of the list

Parameters

  obj | A pointer to the object to add
  reparent | Whether or not the object parent should be set to this group
  recalculateBoundingbox | Whether or not to recalculate the bounding box
  loc | Where to insert it (defaults to -1 which means at the end of the list)

## ◆ InsertObject() [2/2]

void InsertObject | ( | DisplayObject * | obj,
|  | int | loc
| ) |  |

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

Parameters

  obj | The object to insert
  loc | Where to insert the object

## ◆ LightMgr() [1/2]

ComponentLightMgr * LightMgr | ( |  | ) |
| inline

Returns
  A pointer to the light manager for this display frame

## ◆ LightMgr() [2/2]

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

  val | The pointer to the new light manger.

## ◆ MaterialPalette()

DynamicMaterialArray & MaterialPalette | ( |  | ) |
| inline

Returns
  A reference to the material palette for this display frame

## ◆ MultitouchEnabled() [1/2]

virtual bool MultitouchEnabled | ( |  | ) |
| virtual

Returns
  Whether or not multitouch is enabled on the display frame.

## ◆ MultitouchEnabled() [2/2]

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.

Parameters

  enabled | The new multitouch state to set.

## ◆ NotifyAttributeChanged()

virtual void NotifyAttributeChanged | ( | const AttributeName & | name | ) |
| override virtual

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

Parameters

  name | the name of the attribute

Implements AttributeChangedNotifier.

Reimplemented in ComponentBase.

## ◆ PushObject()

void PushObject | ( | DisplayObject * | obj | ) |

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

Parameters

  obj | The object to insert

## ◆ ReadResources()

virtual void ReadResources | ( | const char * | filename | ) |
| virtual

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

Parameters

  filename | Name of the file to read from

## ◆ Resource()

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;

Parameters

  name | The name of the attribute to get.

Returns
  A reference to the requested attribute if available, otherwise DistiEmptyAttribute.

Reimplemented in ComponentBase, and GlsRSOWrapper.

## ◆ RestoreOpenGLState()

static void RestoreOpenGLState | ( |  | ) |
| 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.

## ◆ Scale()

virtual float Scale | ( |  | ) |
| inline protected virtual

Returns
  The current scale for the display frame

Reimplemented in RuntimeDisplayFrame.

## ◆ SetHeight()

void SetHeight | ( | int | h | ) |

Sets the height in pixels of this display frame

Parameters

  h | The new height in pixels of this display frame

## ◆ SetOpenGLDefaultState()

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

  saveVal | Whether 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.

## ◆ SetRedraw()

virtual void SetRedraw | ( |  | ) |
| inline virtual

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

Deprecated:
  Should not be called by new code.

Reimplemented in ComponentBase, and EmbeddedDisplayFrame.

## ◆ SetResource() [1/2]

void SetResource | ( | const char * | resourceName,
|  | const char * | resourceVal
| ) |  |
| inline

Sets a DisplayFrame resource value.

Parameters

  resourceName | Name of the resource to set.
  resourceVal | Value of the resource to set.

## ◆ SetResource() [2/2]

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

Sets a DisplayFrame resource value.

Parameters

  resourceName | Name of the resource to set.
  resourceVal | Value of the resource to set

## ◆ SetResource_CRTClean()

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

  name | name of resource
  value | new value for resource

## ◆ SetResources()

virtual void SetResources | ( | std::istream & | instr | ) |
| virtual

Parse a stream of resource value pairs.

Parameters

  instr | Stream containing the resource data

## ◆ SetResources_CRTClean()

virtual void SetResources_CRTClean | ( | const char * | buf | ) |
| virtual

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

Parameters

  buf | String containing resource data

## ◆ SetTexturePaletteSize()

void SetTexturePaletteSize | ( | int | cnt | ) |

Sets the texture palette size for this display frame

Parameters

  cnt | The number of entries to have in the display frame

## ◆ SetWidth()

void SetWidth | ( | int | w | ) |

Sets the width in pixels of this display frame

Parameters

  w | The new width in pixels of this display frame

## ◆ Width()

int Width | ( |  | ) |

Gets the width in pixels of this display frame

Returns
  The width in pixels of this display frame

## ◆ WriteResources()

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

  filename | Name of the file to write to
  filter | A filter to specify which attributes to write

## Member Data Documentation

## ◆ _clearBitfield

GLbitfield _clearBitfield
| protected

The OpenGL bitfield to use when clearing. /see glClear

## ◆ _componentHeaderFileName

std::string _componentHeaderFileName
| protected

backing store for META_COMPONENT_HEADER_FILE_NAME attribute

## ◆ _cullingEnabled

bool _cullingEnabled
| protected

True if culling is enabled for this DisplayFrame

## ◆ _currentCursor

unsigned int _currentCursor
| protected

the current cursor being processed

## ◆ _cursorsDown

unsigned int _cursorsDown
| protected

The number of cursors (touches) that are currently down

## ◆ _height

int _height
| protected

The height of the window for this display frame

## ◆ _lastPickedDepth

float _lastPickedDepth
| protected

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

## ◆ _lightMgr

ComponentLightMgr* _lightMgr
| protected

The _lightMgr is used to setup lighting for the DisplayFrame

## ◆ _materialPalette

DynamicMaterialArray _materialPalette
| protected

A Dynamic array for keeping the materials for this frame

## ◆ _multitouchEnabled

bool _multitouchEnabled
| protected

whether or not multitouch is enabled

## ◆ _sound_player

SoundSystem* _sound_player

Sound file player for this DisplayFrame

## ◆ _width

int _width
| protected

The width of the window for this display frame

## ◆ objects

Group* objects

The object hierarchy for this display frame

## ◆ texturePalette

TexturePalette* texturePalette

An array of textures allocated for display on objects

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

- display_frame.h