Overview | All Modules | Tutorial | User's Guide | Programming Guide
Previous

COVISE Online Documentation

Next

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vrui::coButton Class Reference

Basic button class providing a selectable rectangular area. More...

#include <coButton.h>

Inheritance diagram for vrui::coButton:
vrui::coAction vrui::coUIElement vrui::coUpdateable vrui::coPushButton vrui::coToggleButton

Public Member Functions

 coButton (coButtonGeometry *geom, coButtonActor *actor)
 Called whenever a button was pressed. More...
 
virtual ~coButton ()
 Destructor. All occurences of this button are removed in its parents. More...
 
void setState (bool state, bool generateEvent=false)
 Set button press state. More...
 
bool getState () const
 Get button press state. More...
 
void updateSwitch ()
 Update the geometry switch. More...
 
bool isPressed () const
 Get button state. More...
 
void setPos (float x, float y, float z=0)
 
virtual int hit (vruiHit *hit)
 Hit is called whenever the button with this action is intersected by the input device. More...
 
virtual void miss ()
 Miss is called once after a hit, if the button is not intersected anymore. More...
 
virtual void onPress ()
 Overwrite this method for action on button presses. More...
 
virtual void onRelease ()
 Overwrite this method for action on button releases. More...
 
virtual void setSize (float, float, float)
 Set UI element size. More...
 
virtual void setSize (float)
 Set UI element size, use equal values for all dimensions. More...
 
virtual float getWidth () const
 Returns element width. More...
 
virtual float getHeight () const
 Returns element height. More...
 
virtual float getXpos () const
 Returns element x position. More...
 
virtual float getYpos () const
 Returns element y position. More...
 
virtual float getZpos () const
 Get z position. More...
 
virtual vruiTransformNodegetDCS ()
 
virtual const char * getClassName () const
 get the Element's classname More...
 
virtual bool isOfClassName (const char *) const
 check if the Element or any ancestor is this classname More...
 
virtual bool update ()
 this method is called once per frame as long as it returns true. More...
 
virtual void setActive (bool a)
 functions activates or deactivates the item More...
 
- Public Member Functions inherited from vrui::coAction
 coAction ()
 Constructor. More...
 
virtual ~coAction ()
 Destructor. More...
 
virtual int hit (vruiHit *hit)=0
 hit is called whenever the node, or any node underneath the node with this action is intersected return ACTION_CALL_ON_MISS if you want miss to be called otherwise return ACTION_DONE More...
 
virtual void miss ()
 miss is called once after a hit, if the node is not intersected anymore More...
 
void setFrame (unsigned int frame)
 INTERNAL set the framecounter (used to produce the miss call) More...
 
unsigned int getFrame () const
 INTERNAL get the framecounter (used to produce the miss call) More...
 
void setNode (vruiNode *)
 INTERNAL set the node this action belongs to. More...
 
void addChild (coAction *)
 INTERNAL add a child action. More...
 
virtual int hitAll (vruiHit *hit)
 INTERNAL same as miss/hit, but do it for all children as well. More...
 
virtual void missAll ()
 INTERNAL same as miss/hit, but do it for all children as well. More...
 
- Public Member Functions inherited from vrui::coUIElement
 coUIElement ()
 
virtual ~coUIElement ()
 Destructor. More...
 
virtual void createGeometry ()
 
virtual void setParent (coUIContainer *)
 Set parent container. More...
 
virtual coUIContainergetParent ()
 Get parent container. More...
 
virtual void setEnabled (bool enabled)
 Set activation state. More...
 
virtual void setHighlighted (bool highlighted)
 Set highlight state. More...
 
virtual void setVisible (bool visible)
 Set element visibility. More...
 
virtual bool isEnabled () const
 Get activation state. More...
 
virtual bool isHighlighted () const
 Get highlight state. More...
 
virtual bool isVisible () const
 Get visibility state. More...
 
virtual float getWidth () const =0
 Returns element width. More...
 
virtual float getHeight () const =0
 Returns element height. More...
 
virtual float getDepth () const
 Get z axis object size. More...
 
virtual float getXpos () const =0
 Returns element x position. More...
 
virtual float getYpos () const =0
 Returns element y position. More...
 
virtual float getZpos () const
 Get z position. More...
 
virtual void childResized (bool shrink=true)
 This method is called by children whenever they change their size Implementations of this method should call the childResized() of their parent container. More...
 
virtual void resizeToParent (float, float, float, bool shrink=true)
 This method is called by containers after they resized to allow children to adjust their geometry to the new parents' size Children must not call childResized() of their parent here, as this could lead to an infinite loop. More...
 
virtual void shrinkToMin ()
 Set element location in space. More...
 
virtual void setPos (float, float, float)=0
 
virtual void setSize (float, float, float)
 Set UI element size. More...
 
virtual void setSize (float)
 Set UI element size, use equal values for all dimensions. More...
 
virtual float getResizePref ()
 
virtual void setUserData (coUIUserData *)
 Set the current userdata object. More...
 
virtual coUIUserDatagetUserData () const
 Returns the current userdata object. More...
 
virtual vruiTransformNodegetDCS ()
 
virtual vruiUIElementProvidergetUIElementProvider () const
 
virtual void setAttachment (int)
 sets the attachment border More...
 
virtual int getAttachment () const
 returns the attachment border More...
 
void setUniqueName (const char *)
 
const char * getUniqueName () const
 
virtual const char * getClassName () const
 get the Element's classname More...
 
virtual bool isOfClassName (const char *) const
 check if the Element or any ancestor is this classname More...
 
- Public Member Functions inherited from vrui::coUpdateable
 coUpdateable ()
 Constructor. More...
 
virtual ~coUpdateable ()
 you should adds this object to the update manager in your constructor More...
 
virtual bool update ()=0
 this method is called once per frame as long as it returns true. More...
 

Protected Member Functions

virtual void createGeometry ()
 
virtual void resizeGeometry ()
 
- Protected Member Functions inherited from vrui::coUIElement
virtual void resizeGeometry ()
 
virtual const vruiMatrixgetTransformMatrix ()
 

Protected Attributes

bool selectionState
 true if button is selected by the user More...
 
bool pressState
 true if the button is currently pressed More...
 
coButtonGeometrymyGeometry
 information about visual appearance More...
 
coButtonActormyActor
 action listener, triggered on button press More...
 
float myX
 button x position More...
 
float myY
 button y position More...
 
float myZ
 button z position More...
 
coCombinedButtonInteractioninteractionA
 button interaction More...
 
bool unregister
 try to unregister interactions More...
 
bool active_
 flag if button is active More...
 
- Protected Attributes inherited from vrui::coAction
std::string actionName
 name of this action this can be used to distinguish betwenn different types of actions like touch and intersection actions More...
 
- Protected Attributes inherited from vrui::coUIElement
float xScaleFactor
 UI element x axis scale factor. More...
 
float yScaleFactor
 UI element y axis scale factor. More...
 
float zScaleFactor
 UI element z axis scale factor. More...
 
bool enabled
 true if UI element is enabled, false if UI element cannot be used More...
 
bool highlighted
 true if highlighted More...
 
bool visible
 true if UI element is visible, false if not visible but still present in scene tree More...
 
vruiUIElementProvideruiElementProvider
 

Additional Inherited Members

- Public Types inherited from vrui::coAction
enum  Result { ACTION_DONE = 0x00 , ACTION_CALL_ON_MISS = 0x01 , ACTION_UNDEF = 0x02 }
 
- Public Types inherited from vrui::coUIElement
enum  Material {
  RED = 0 , GREEN , BLUE , YELLOW ,
  GREY , WHITE , BLACK , DARK_YELLOW ,
  WHITE_NL , ITEM_BACKGROUND_NORMAL , ITEM_BACKGROUND_HIGHLIGHTED , ITEM_BACKGROUND_DISABLED ,
  HANDLE_BACKGROUND_NORMAL , HANDLE_BACKGROUND_HIGHLIGHTED , HANDLE_BACKGROUND_DISABLED , BACKGROUND ,
  NUM_MATERIALS
}
 Color definitions, to be used whenever a material is needed. More...
 
enum  {
  LEFT = 0 , TOP , RIGHT , BOTTOM ,
  REPLACE
}
 attachment order is counterclockwise like this and describes the side/border which the item is attached to! More...
 
- Static Public Member Functions inherited from vrui::coUIElement
static vruiMatrixgetMatrixFromPositionHprScale (float x, float y, float z, float h, float p, float r, float scale)
 Constructor. More...
 
- Public Attributes inherited from vrui::coUIElement
enum vrui::coUIElement:: { ... }  Attachments
 attachment order is counterclockwise like this and describes the side/border which the item is attached to! More...
 

Detailed Description

Basic button class providing a selectable rectangular area.

This class is derived from coAction for input device events, and it is derived from coUIElement to inherit the basic UI element functionality.

Constructor & Destructor Documentation

◆ coButton()

vrui::coButton::coButton ( coButtonGeometry geometry,
coButtonActor actor 
)

Called whenever a button was pressed.

This method needs to be overwritten by child classes.

Parameters
buttoncoButton which triggered this event Constructor.
geoma coButtonGeometry is required to define the button shape
actorthe coButtonActor is called whenever the button is pressed

◆ ~coButton()

vrui::coButton::~coButton ( )
virtual

Destructor. All occurences of this button are removed in its parents.

Member Function Documentation

◆ createGeometry()

void vrui::coButton::createGeometry ( )
protectedvirtual

Reimplemented from vrui::coUIElement.

◆ getClassName()

const char * vrui::coButton::getClassName ( ) const
virtual

get the Element's classname

Reimplemented from vrui::coUIElement.

Reimplemented in vrui::coPushButton, and vrui::coToggleButton.

◆ getDCS()

vruiTransformNode * vrui::coButton::getDCS ( )
virtual

Reimplemented from vrui::coUIElement.

◆ getHeight()

float vrui::coButton::getHeight ( ) const
virtual

Returns element height.

Implements vrui::coUIElement.

◆ getState()

bool vrui::coButton::getState ( ) const

Get button press state.

Returns
button press state

◆ getWidth()

float vrui::coButton::getWidth ( ) const
virtual

Returns element width.

Implements vrui::coUIElement.

◆ getXpos()

virtual float vrui::coButton::getXpos ( ) const
inlinevirtual

Returns element x position.

Implements vrui::coUIElement.

◆ getYpos()

virtual float vrui::coButton::getYpos ( ) const
inlinevirtual

Returns element y position.

Implements vrui::coUIElement.

◆ getZpos()

virtual float vrui::coButton::getZpos ( ) const
inlinevirtual

Get z position.

Returns
z position

Reimplemented from vrui::coUIElement.

◆ hit()

int vrui::coButton::hit ( vruiHit hit)
virtual

Hit is called whenever the button with this action is intersected by the input device.

Parameters
hitintersection information
Returns
ACTION_CALL_ON_MISS if you want miss to be called, otherwise ACTION_DONE is returned

Implements vrui::coAction.

◆ isOfClassName()

bool vrui::coButton::isOfClassName ( const char *  classname) const
virtual

check if the Element or any ancestor is this classname

Reimplemented from vrui::coUIElement.

Reimplemented in vrui::coPushButton, and vrui::coToggleButton.

◆ isPressed()

bool vrui::coButton::isPressed ( ) const

Get button state.

Returns
true if button is pressed

◆ miss()

void vrui::coButton::miss ( )
virtual

Miss is called once after a hit, if the button is not intersected anymore.

Reimplemented from vrui::coAction.

Reimplemented in vrui::coPushButton.

◆ onPress()

void vrui::coButton::onPress ( )
virtual

Overwrite this method for action on button presses.

Reimplemented in vrui::coPushButton, and vrui::coToggleButton.

◆ onRelease()

void vrui::coButton::onRelease ( )
virtual

Overwrite this method for action on button releases.

Reimplemented in vrui::coPushButton, and vrui::coToggleButton.

◆ resizeGeometry()

void vrui::coButton::resizeGeometry ( )
protectedvirtual

Reimplemented from vrui::coUIElement.

◆ setActive()

void vrui::coButton::setActive ( bool  a)
virtual

functions activates or deactivates the item

◆ setPos()

void vrui::coButton::setPos ( float  x,
float  y,
float  z = 0 
)
virtual

Implements vrui::coUIElement.

◆ setSize() [1/2]

void vrui::coButton::setSize ( float  s)
virtual

Set UI element size, use equal values for all dimensions.

Parameters
ssize = scaling factor (1 is default)

Reimplemented from vrui::coUIElement.

◆ setSize() [2/2]

void vrui::coButton::setSize ( float  xs,
float  ys,
float  zs 
)
virtual

Set UI element size.

Use different values for all dimensions.

Parameters
xs,ys,zssize = scaling factor for respective dimension (1 is default)

Reimplemented from vrui::coUIElement.

◆ setState()

void vrui::coButton::setState ( bool  state,
bool  generateEvent = false 
)

Set button press state.

Parameters
statebutton press state
generateEventif true, onPress and onRelease events are generated

◆ update()

bool vrui::coButton::update ( )
virtual

this method is called once per frame as long as it returns true.

as soon as it returns false, it is removed from the update manager and not called again. the update method is called prior to preFrame();

Implements vrui::coUpdateable.

◆ updateSwitch()

void vrui::coButton::updateSwitch ( )

Update the geometry switch.

The switch state depends on both the button's selection state and press state. Thus, four switch states need to be considered.

Member Data Documentation

◆ active_

bool vrui::coButton::active_
protected

flag if button is active

◆ interactionA

coCombinedButtonInteraction* vrui::coButton::interactionA
protected

button interaction

◆ myActor

coButtonActor* vrui::coButton::myActor
protected

action listener, triggered on button press

◆ myGeometry

coButtonGeometry* vrui::coButton::myGeometry
protected

information about visual appearance

◆ myX

float vrui::coButton::myX
protected

button x position

◆ myY

float vrui::coButton::myY
protected

button y position

◆ myZ

float vrui::coButton::myZ
protected

button z position

◆ pressState

bool vrui::coButton::pressState
protected

true if the button is currently pressed

◆ selectionState

bool vrui::coButton::selectionState
protected

true if button is selected by the user

◆ unregister

bool vrui::coButton::unregister
protected

try to unregister interactions


The documentation for this class was generated from the following files:
PreviousNext

Authors: Martin Aumüller, Ruth Lang, Daniela Rainer, Jürgen Schulze-Döbold, Andreas Werner, Peter Wolf, Uwe Wössner
Copyright © 1993-2009 HLRS, 2004-2009 RRZK, 2005-2009 Visenso
COVISE Version 6.5 Academic