NvUIElement Class Reference

The abstract base class of the NvUI framework. More...

#include <NvUI.h>

Inheritance diagram for NvUIElement:

NvUIButton NvUIContainer NvUIGraphic NvUIProxy NvUIText NvUIValueBar NvUIPopup NvTweakBar NvUIPopupMenu NvUIWindow NvUIGraphicFrame NvTweakVarUIProxyBase NvUISlider NvTweakVarUI< T > NvTweakVarUI< T > NvTweakEnumUI< T >

List of all members.

Public Member Functions

 NvUIElement ()
 Default constructor.
virtual ~NvUIElement ()
 Default destructor.
virtual void Draw (const NvUIDrawState &drawState)
 Pure virtual rendering method for widgets.
virtual NvUIEventResponse HandleEvent (const NvGestureEvent &ev, NvUST timeUST, NvUIElement *hasFocus)
 Virtual user interaction handling method.
virtual NvUIEventResponse HandleReaction (const NvUIReaction &react)
 Virtual method for handling NvUIReaction in response to user interaction.
virtual void SetOrigin (float x, float y)
 Virtual method for setting 2D origin point in UI/view space.
virtual void SetDimensions (float w, float h)
 Virtual method for setting the dimensions of this element in pixels.
virtual void SetDepth (float z)
 Accessor to set the Z/depth value of our UI rectangle.
virtual bool HasDepth ()
 Method to test whether the element's bounding rect has a non-zero Z/depth value.
virtual void GetScreenRect (NvUIRect &rect)
 Accessor to retrieve the UI-space NvUIRect for this element into a passed-in reference.
virtual float GetWidth ()
 Accessor to get the width of this element's bounding rect.
virtual float GetHeight ()
 Accessor to get the height of this element's bounding rect.
virtual void SetVisibility (bool show)
 Set whether or not this element is visible and thus to be drawn.
virtual bool GetVisibility ()
 Get whether or not this element is visible and thus to be drawn.
virtual void SetAlpha (float a)
 Set the alpha-blend amount for this element.
virtual float GetAlpha ()
 Get the current alpha-blend override level for this element.
virtual void GotFocus ()
 Virtual method for telling this element it has interaction-focus (was pressed, was hit).
virtual void LostFocus ()
 Virtual method for telling this element it has lost interaction-focus.
virtual NvUIContainerGetParent ()
 Get the parent NvUIContainer, if one was set.
virtual void SetParent (NvUIContainer *p)
 Set the parent NvUIContainer, so a child knows who currently 'owns' it.
virtual uint32_t GetSlideFocusGroup ()
 Get the SlideFocusGroup identifier for this element.
virtual void SetSlideFocusGroup (uint32_t group)
 Set the SlideFocusGroup identifier for this element.
uint32_t GetUID ()
 Get the construction-time unique identifier for this element.
virtual bool Hit (float x, float y)
 Hit-test a given point against this element's UI rectangle, using no extra margin.
uint32_t GetDrawState ()
 Get the current drawing 'state' or index.
virtual void SetDrawState (uint32_t n)
 Set the current drawing 'state' or index.
void SetDrawStatePrev ()
 Set the current drawing 'state' or index back to a stashed prior value.
uint32_t GetPrevDrawState ()
 Get the prior drawing 'state' or index.
void SetPrevDrawState (uint32_t n)
 Set the prior drawing 'state' or index.
uint32_t GetMaxDrawState ()
 Get maximum draw state value supported by this object.
void SetMaxDrawState (uint32_t n)
 Get maximum draw state value supported by this object.

Static Public Member Functions

static const NvUIReactionGetReaction ()
 Get a const reference to the current/active NvUIReaction object.
static NvUIReactionGetReactionEdit (bool clear=true)
 Get a NON-const reference to the current NvUIReaction object for editing.
static uint32_t GetActiveSlideFocusGroup ()
 Get the SlideFocusGroup identifier that is currently active during user interaction.
static void SetActiveSlideFocusGroup (uint32_t group)
 Set the SlideFocusGroup identifier that is currently active during user interaction.
static void SystemResChange (int32_t w, int32_t h)
 Notify the NvUI system of a system/window resolution change, so it can resize buffers and such.

Protected Attributes

uint32_t m_uiuid
 Stores a unique 32-bit identifier (internal to a given app) for a given element.
bool m_isVisible
 Stores the current 'raw' visibility (on/off).
NvUIRect m_rect
 Stores the onscreen position and size.
float m_alpha
 Stores the current forced 'alpha-fade' level.
uint32_t m_slideFocusGroup
 An identifier for items which can have focus/hit 'slid' between them.
NvUIContainerm_parent
 The container that holds this element.

Friends

class NvUIContainer


Detailed Description

The abstract base class of the NvUI framework.

All UI classes are derived from NvUIElement. It provides all the needed member variables and methods for onscreen user interface elements.


Member Function Documentation

virtual void NvUIElement::Draw ( const NvUIDrawState drawState  )  [virtual]

Pure virtual rendering method for widgets.

Pure virtual as there is no base implementation, it must be implemented by each widget subclass.

Reimplemented in NvTweakBar, NvUIProxy, NvUIGraphic, NvUIGraphicFrame, NvUIText, NvUIButton, NvUIContainer, NvUIValueBar, NvUISlider, and NvUIPopup.

static uint32_t NvUIElement::GetActiveSlideFocusGroup (  )  [inline, static]

Get the SlideFocusGroup identifier that is currently active during user interaction.

virtual float NvUIElement::GetAlpha (  )  [inline, virtual]

Get the current alpha-blend override level for this element.

Reimplemented in NvUIProxy.

uint32_t NvUIElement::GetDrawState (  )  [inline]

Get the current drawing 'state' or index.

Primarily used for multi-state objects like Buttons to have active vs selected/highlighted, vs inactive states tracked, and those states can then be used to render different visuals.

virtual float NvUIElement::GetHeight (  )  [inline, virtual]

Accessor to get the height of this element's bounding rect.

Reimplemented in NvUIProxy.

uint32_t NvUIElement::GetMaxDrawState (  )  [inline]

Get maximum draw state value supported by this object.

Used for classes of objects which have the potential to have many different visual states, but may only be set up with physical visuals for a select set. For example, many buttons may have active and pressed/selected visuals, but may not bother with inactive visual.

virtual NvUIContainer* NvUIElement::GetParent (  )  [inline, virtual]

Get the parent NvUIContainer, if one was set.

uint32_t NvUIElement::GetPrevDrawState (  )  [inline]

Get the prior drawing 'state' or index.

Primarily used for objects that want to temporarily, briefly change state, and then revert back -- such as a push-button widget going active->selected->active. This gets the last stashed value.

static const NvUIReaction& NvUIElement::GetReaction (  )  [inline, static]

Get a const reference to the current/active NvUIReaction object.

static NvUIReaction& NvUIElement::GetReactionEdit ( bool  clear = true  )  [inline, static]

Get a NON-const reference to the current NvUIReaction object for editing.

Parameters:
clear Defaults to true to wipe our prior reaction state. Pass false to leave intact to make minor changes to existing reaction.

virtual void NvUIElement::GetScreenRect ( NvUIRect rect  )  [inline, virtual]

Accessor to retrieve the UI-space NvUIRect for this element into a passed-in reference.

Reimplemented in NvUIProxy.

virtual uint32_t NvUIElement::GetSlideFocusGroup (  )  [inline, virtual]

Get the SlideFocusGroup identifier for this element.

Reimplemented in NvUIProxy, and NvUIContainer.

uint32_t NvUIElement::GetUID (  )  [inline]

Get the construction-time unique identifier for this element.

Reimplemented in NvUIProxy.

virtual bool NvUIElement::GetVisibility (  )  [inline, virtual]

Get whether or not this element is visible and thus to be drawn.

Reimplemented in NvUIProxy.

virtual float NvUIElement::GetWidth (  )  [inline, virtual]

Accessor to get the width of this element's bounding rect.

Reimplemented in NvUIProxy.

virtual NvUIEventResponse NvUIElement::HandleEvent ( const NvGestureEvent ev,
NvUST  timeUST,
NvUIElement hasFocus 
) [inline, virtual]

Virtual user interaction handling method.

We implement a base version to return not-handled, so that non-interactive classes don't have to.

Parameters:
ev The current NvGestureEvent to handle
timeUST A timestamp for the current interaction
[in,out] hasFocus The element that had interaction last, or has taken over current interaction.

Reimplemented in NvTweakVarUIProxyBase, NvTweakEnumUI< T >, NvUIProxy, NvUIButton, NvUIContainer, NvUIWindow, NvUISlider, NvUIPopupMenu, and NvUIPopup.

virtual NvUIEventResponse NvUIElement::HandleReaction ( const NvUIReaction react  )  [inline, virtual]

Virtual method for handling NvUIReaction in response to user interaction.

We implement a base version to return not-handled, so that non-reacting classes don't have to.

Reimplemented in NvTweakVarUIProxyBase, NvTweakVarUI< T >, NvTweakEnumUI< T >, NvTweakBar, NvUIProxy, NvUIButton, NvUIContainer, NvUISlider, NvUIPopup, and NvTweakVarUI< T >.

virtual bool NvUIElement::HasDepth (  )  [inline, virtual]

Method to test whether the element's bounding rect has a non-zero Z/depth value.

Reimplemented in NvUIProxy.

virtual bool NvUIElement::Hit ( float  x,
float  y 
) [inline, virtual]

Hit-test a given point against this element's UI rectangle, using no extra margin.

Reimplemented in NvUIProxy.

virtual void NvUIElement::LostFocus (  )  [inline, virtual]

Virtual method for telling this element it has lost interaction-focus.

Reimplemented in NvUIProxy, NvUIButton, and NvUIContainer.

static void NvUIElement::SetActiveSlideFocusGroup ( uint32_t  group  )  [inline, static]

Set the SlideFocusGroup identifier that is currently active during user interaction.

virtual void NvUIElement::SetAlpha ( float  a  )  [inline, virtual]

Set the alpha-blend amount for this element.

Reimplemented in NvUIProxy, NvUIText, NvUIValueBar, and NvUISlider.

virtual void NvUIElement::SetDepth ( float  z  )  [inline, virtual]

Accessor to set the Z/depth value of our UI rectangle.

Reimplemented in NvUIProxy.

virtual void NvUIElement::SetDimensions ( float  w,
float  h 
) [inline, virtual]

Virtual method for setting the dimensions of this element in pixels.

Base implementation simply sets the NvUIElements rectangle width and height to passed in values.

Reimplemented in NvUIProxy, NvUIText, NvUIContainer, NvUIValueBar, and NvUISlider.

virtual void NvUIElement::SetDrawState ( uint32_t  n  )  [inline, virtual]

Set the current drawing 'state' or index.

Primarily used for multi-state objects like Buttons to have active vs selected/highlighted, vs inactive states tracked, and those states can then be used to render different visuals.

Reimplemented in NvUIProxy, and NvUIPopup.

void NvUIElement::SetDrawStatePrev (  )  [inline]

Set the current drawing 'state' or index back to a stashed prior value.

Primarily used for objects that want to temporarily, briefly change state, and then revert back -- such as a push-button widget going active->selected->active. This restores to last stashed value.

void NvUIElement::SetMaxDrawState ( uint32_t  n  )  [inline]

Get maximum draw state value supported by this object.

Used for classes of objects which have the potential to have many different visual states, but are only set up a select set.

virtual void NvUIElement::SetOrigin ( float  x,
float  y 
) [inline, virtual]

Virtual method for setting 2D origin point in UI/view space.

Base implementation simply sets the NvUIElement's rectangle top-left to the passed in values. Virtual as some subclasses may override to reposition children or account for padding/margins.

Reimplemented in NvUIProxy, NvUIButton, NvUIContainer, NvUIValueBar, NvUISlider, and NvUIPopup.

virtual void NvUIElement::SetParent ( NvUIContainer p  )  [inline, virtual]

Set the parent NvUIContainer, so a child knows who currently 'owns' it.

void NvUIElement::SetPrevDrawState ( uint32_t  n  )  [inline]

Set the prior drawing 'state' or index.

Primarily used for objects to stash prior visual state while they temporarily display a different state. This stashes a passed value (generally the current draw state).

virtual void NvUIElement::SetSlideFocusGroup ( uint32_t  group  )  [inline, virtual]

Set the SlideFocusGroup identifier for this element.

virtual void NvUIElement::SetVisibility ( bool  show  )  [inline, virtual]

Set whether or not this element is visible and thus to be drawn.

Reimplemented in NvUIProxy.

static void NvUIElement::SystemResChange ( int32_t  w,
int32_t  h 
) [static]

Notify the NvUI system of a system/window resolution change, so it can resize buffers and such.


Member Data Documentation

float NvUIElement::m_alpha [protected]

Stores the current forced 'alpha-fade' level.

Uses normal GL [0.0-1.0] expected range.

bool NvUIElement::m_isVisible [protected]

Stores the current 'raw' visibility (on/off).

The container that holds this element.

Stores the onscreen position and size.

uint32_t NvUIElement::m_slideFocusGroup [protected]

An identifier for items which can have focus/hit 'slid' between them.

The SlideFocusGroup is used to aid in cases where it is legal and necessary to 'slide' the user's interaction between a group of elements while the pointer is still held down, e.g. dragging through the menu items of a popup menu, or across keys of a virtual keyboard.

uint32_t NvUIElement::m_uiuid [protected]

Stores a unique 32-bit identifier (internal to a given app) for a given element.

Useful for differentiating or identifying elements without referencing pointers directly, such as inside of a raised NvUIReaction.


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