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 NvUIValueText NvUISlider

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 *hasInteract)
 Virtual user interaction handling method.
virtual NvUIEventResponse HandleReaction (const NvUIReaction &react)
 Virtual method for handling NvUIReaction in response to user interaction.
virtual void HandleReshape (float w, float h)
 Virtual method for reacting to a change in viewport size.
virtual bool CanFocus ()
 Accessor for whether this element can be focused -- or has a child that can.
bool CanMoveFocus ()
 Accessor for whether this element can move the focus itself, generally only true for containers.
virtual bool HasFocus ()
 Accessor for whether this element HAS the input focus (or has a child that does).
virtual bool ShowFocus ()
 Accessor for whether this element's focus state should be shown (containers might not always want it shown).
virtual NvUIEventResponse HandleFocusEvent (NvFocusEvent::Enum evt)
 Virtual method for moving the highlight focus between UI elements or acting upon the selected one.
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 SetWidth (float w)
 Virtual method for changing just the width of this element.
virtual void SetHeight (float h)
 Virtual method for changing just the height of this element.
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 void GetFocusRect (NvUIRect &rect)
 Accessor to retrieve the UI-space NvUIRect for this element's focus rectangle.
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 LostInteract ()
 Virtual method for telling this element it has lost interaction.
virtual void DropFocus ()
 Virtual method for telling this element its is no longer 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 GetSlideInteractGroup ()
 Get the SlideInteractGroup identifier for this element.
virtual void SetSlideInteractGroup (uint32_t group)
 Set the SlideInteractGroup 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 GetActiveSlideInteractGroup ()
 Get the SlideInteractGroup identifier that is currently active during user interaction.
static void SetActiveSlideInteractGroup (uint32_t group)
 Set the SlideInteractGroup 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.
NvUIRect m_rect
 Stores the onscreen position and size.
bool m_isVisible
 Whether the element is currently visible/drawn.
bool m_isInteracting
 Whether this object got the 'down' action, thus interacting with the user.
bool m_canFocus
 Whether the element can take focus.
bool m_hasFocus
 Whether the element or a child has the focus.
bool m_showFocus
 Whether the element wants to have focus shown when it has focus; some cotainers may not.
bool m_canMoveFocus
 Whether this element can move focus to another element, usually a container.
float m_alpha
 Stores the current forced 'alpha-fade' level.
uint32_t m_slideInteractGroup
 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 bool NvUIElement::CanFocus (  )  [inline, virtual]

Accessor for whether this element can be focused -- or has a child that can.

bool NvUIElement::CanMoveFocus (  )  [inline]

Accessor for whether this element can move the focus itself, generally only true for containers.

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, NvUIValueText, NvUIButton, NvUIContainer, NvUIWindow, NvUIValueBar, NvUISlider, and NvUIPopup.

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

Virtual method for telling this element its is no longer focus.

Reimplemented in NvUIProxy, and NvUIContainer.

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

Get the SlideInteractGroup 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 void NvUIElement::GetFocusRect ( NvUIRect rect  )  [inline, virtual]

Accessor to retrieve the UI-space NvUIRect for this element's focus rectangle.

Reimplemented in NvUIProxy, NvUISlider, and NvUIPopup.

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::GetSlideInteractGroup (  )  [inline, virtual]

Get the SlideInteractGroup 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 hasInteract 
) [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] hasInteract 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::HandleFocusEvent ( NvFocusEvent::Enum  evt  )  [inline, virtual]

Virtual method for moving the highlight focus between UI elements or acting upon the selected one.

Returns:
true if we were able to move the focus or act on it, false otherwise.

Reimplemented in NvTweakEnumUI< T >, NvUIProxy, NvUIButton, NvUIContainer, 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, NvUIValueText, NvUIButton, NvUIContainer, NvUISlider, NvUIPopup, and NvTweakVarUI< T >.

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

Virtual method for reacting to a change in viewport size.

Not many UI elements will need to handle this direct, so base is a no-op method.

Reimplemented in NvTweakBar, NvUIContainer, and NvUIWindow.

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::HasFocus (  )  [inline, virtual]

Accessor for whether this element HAS the input focus (or has a child that does).

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::LostInteract (  )  [inline, virtual]

Virtual method for telling this element it has lost interaction.

Reimplemented in NvUIProxy, NvUIButton, and NvUIContainer.

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

Set the SlideInteractGroup 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, NvUIValueText, 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, NvUIValueText, 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.

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

Virtual method for changing just the height of this element.

Leverages SetDimensions so all subclasses will get desired results without further effort.

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, NvUIValueText, 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::SetSlideInteractGroup ( uint32_t  group  )  [inline, virtual]

Set the SlideInteractGroup 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.

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

Virtual method for changing just the width of this element.

Leverages SetDimensions so all subclasses will get desired results without further effort.

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

Accessor for whether this element's focus state should be shown (containers might not always want it shown).

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_canFocus [protected]

Whether the element can take focus.

bool NvUIElement::m_canMoveFocus [protected]

Whether this element can move focus to another element, usually a container.

bool NvUIElement::m_hasFocus [protected]

Whether the element or a child has the focus.

bool NvUIElement::m_isInteracting [protected]

Whether this object got the 'down' action, thus interacting with the user.

bool NvUIElement::m_isVisible [protected]

Whether the element is currently visible/drawn.

The container that holds this element.

Stores the onscreen position and size.

bool NvUIElement::m_showFocus [protected]

Whether the element wants to have focus shown when it has focus; some cotainers may not.

uint32_t NvUIElement::m_slideInteractGroup [protected]

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

The SlideInteractGroup 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: