KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
kjb::gui::Selectable Class Referenceabstract

#include <gui_selectable.h>

Inheritance diagram for kjb::gui::Selectable:
kjb::Renderable kjb::gui::Interactive_object

Public Member Functions

virtual bool selection_hit (unsigned int *index_stack, unsigned int *index_stack_end, int button, int state)=0
 
virtual void render (bool select_mode) const =0
 
virtual void render () const
 
- Public Member Functions inherited from kjb::Renderable
virtual ~Renderable ()
 Deletes this Renderable. More...
 

Detailed Description

Interface for a renderable object to be selectable with the cursor, using opengl's glSelect functionality.

The render() method should call glLoadName() before rendering each selectable object (the caller will call glPushName(0) before calling this object's render method, so you don't need to).

If an object form this class is clicked during selection, process_hit is called with the index of the rendered object.

Objects implementing this interface can be attached to a Viewer by calling Viewer::add_selection_listener

Member Function Documentation

virtual void kjb::gui::Selectable::render ( bool  select_mode) const
pure virtual

Special render method. if select_mode is true, glLoadName() should be called before every selectable object. If some objects aren't selectable, you shouldn't render them when select_mode == true;

virtual void kjb::gui::Selectable::render ( ) const
inlinevirtual

alias for select(false)

Implements kjb::Renderable.

virtual bool kjb::gui::Selectable::selection_hit ( unsigned int *  index_stack,
unsigned int *  index_stack_end,
int  button,
int  state 
)
pure virtual

Process a hit stack returned by glSelectBuffer, Most object will simply dereference index_stack to get the index of the hit item. Heirarchical objects will use the first index to determine which object to dispatch to with the rest of the stack.

Parameters
index_stackstack of indicies that make up this hit record
index_stack_endone past the end of the stack array.
buttonWhich button was clicked. see glutMouseFunction for valued values
stateAuxiliary state when click occurred (shift, ctrl, etc). see glutMouseFunction for valid values.
Returns
true if successfully processed, which in most cases prevents other listeners from processing this hit.

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