Classes | Public Member Functions | Public Attributes

glv::View Class Reference

The base class of all GUI elements. More...

#include <glv_core.h>

Inheritance diagram for glv::View:
glv::DataModel glv::Notifier glv::SmartObject< View > glv::GLV glv::Grid glv::Group glv::View3D glv::Widget glv::Plot glv::Box glv::Table glv::Buttons glv::Label glv::NumberDialer glv::Sliders glv::SliderVector< Dim > glv::TextView glv::SliderVector< 2 >

List of all members.

Classes

struct  TraversalAction
 An action to be called when traversing the node tree. More...

Public Member Functions

 View (space_t left, space_t top, space_t width, space_t height, drawCallback cb=0)
 View (const Rect &rect=Rect(200, 200), Place::t anchor=Place::TL, drawCallback cb=0)
virtual const char * className () const
 Get class name.
virtual void onAnimate (double dsec, GLV &g)
 Animation callback.
virtual void onDraw (GLV &g)
 Drawing callback.
virtual bool onEvent (Event::t e, GLV &g)
 Event callback to be called after those in callback list.
virtual void onResize (space_t dx, space_t dy)
 Resize callback.
virtual void onDataModelSync ()
 Update internal values if different from attached model variables.
void add (View &child)
 Add a child view to myself, and update linked lists.
void add (View *child)
 Add a child view to myself, and update linked lists.
void makeLastSibling ()
 Put self at end of sibling chain.
void remove ()
 Remove myself from the parent view, and update linked lists.
void traverseDepth (TraversalAction &action)
 Traverse tree depth-first applying an action at each node.
Viewoperator<< (View &newChild)
 Add a child view to myself.
StyleColorcolors () const
 Get style colors.
const std::string & descriptor () const
 Get descriptor.
int enabled (Property::t v) const
 Returns whether a property is set.
Fontfont ()
 Get font.
bool hasCallback (Event::t e, eventCallback cb) const
 Returns whether a particular callback has been registered.
bool hasCallbacks (Event::t e) const
 Returns whether there are callback(s) registered for a particular event.
const std::string & name () const
 Get name.
int numCallbacks (Event::t e) const
 Returns number of registered callbacks.
const ViewposAbs (space_t &al, space_t &at) const
 Computes absolute left-top position. Returns topmost parent view.
void printDescendents () const
 Print tree of descendent Views to stdout.
bool showing () const
 Returns whether View is being shown.
Stylestyle () const
 Get style object.
const ViewtoAbs (space_t &x, space_t &y) const
 Converts relative View x-y coordinates to absolute. Returns topmost parent view.
int visible () const
 Returns model value(s) as string.
Viewanchor (space_t mx, space_t my)
 Set translation factors relative to parent resize amount.
Viewanchor (Place::t parentPlace)
 Set translation factors relative to parent resize amount.
void addCallback (Event::t type, eventCallback cb)
 Push an event callback onto the back of the event callbacks list.
Viewdisable (Property::t p)
 Disable property flag(s).
Viewenable (Property::t p)
 Enable property flag(s).
Viewproperty (Property::t p, bool v)
 Set property flag(s) to a specfic value.
Viewtoggle (Property::t p)
 Toggle property flag(s).
ViewbringToFront ()
 Brings to front of parent View.
ViewcloneStyle ()
 Creates own copy of current style.
void constrainWithinParent ()
 Force to remain in parent.
ViewfindTarget (space_t &x, space_t &y)
 Returns View under these absolute coordinates or 0 if none.
void fit ()
 Fit geometry so all children are visible.
void focused (bool b)
 Set whether I'm focused.
void move (space_t x, space_t y)
 Translate constraining within parent.
void on (Event::t e, eventCallback cb=0)
 Set first callback for a specific event type.
void removeCallback (Event::t e, eventCallback cb)
 Remove a callback for a given event (if found).
void removeAllCallbacks (Event::t e)
 Detach all callbacks for a given event.
Viewdescriptor (const std::string &v)
 Set descriptor, e.g. tooltip text.
Viewname (const std::string &v)
 Set identifier string.
Viewpos (Place::t p, space_t x, space_t y)
 Position a specific place at point (x,y).
Viewpos (Place::t p)
 Position a specific place at point (0,0).
Viewstretch (space_t mx, space_t my)
 Set parent resize stretch factors.
Viewstyle (Style *style)
 Set pointer to style.
Viewmaximize ()
 Matches geometry to parent.
Viewrestore ()
 Undoes maximization.
void rectifyGeometry ()
 Correct geometry for proper display.

Public Attributes

Viewparent
 My parent view.
Viewchild
 My first child (next to be drawn).
Viewsibling
 My next sibling view (drawn after all my children).
std::map< Event::t,
eventCallbackList > 
callbackLists
 Map of event callback sequences.
drawCallback draw
 Drawing callback.

Detailed Description

The base class of all GUI elements.


Constructor & Destructor Documentation

glv::View::View ( space_t  left,
space_t  top,
space_t  width,
space_t  height,
drawCallback  cb = 0 
)
Parameters:
[in] left Initial left edge position
[in] top Initial top edge position
[in] width Initial width
[in] height Initial height
[in] cb Drawing callback
glv::View::View ( const Rect rect = Rect(200, 200),
Place::t  anchor = Place::TL,
drawCallback  cb = 0 
)
Parameters:
[in] rect Rect geometry of View
[in] anchor Anchor place
[in] cb Drawing callback

Member Function Documentation

void glv::View::addCallback ( Event::t  type,
eventCallback  cb 
)

Push an event callback onto the back of the event callbacks list.

If the event callback already exists in the list, then it will be not be added. If multiple callbacks are registered for the same event type, then two types of prioritization take place. First, callbacks on the front of the list get called first. Second, if a callback returns false (for bubbling), then it cancels execution of any subsequent callbacks in the list.

View * glv::View::findTarget ( space_t &  x,
space_t &  y 
)

Returns View under these absolute coordinates or 0 if none.

The coordinates are modified to be relative to the returned View's.

View & glv::View::name ( const std::string &  v  ) 

Set identifier string.

The name should follow the same conventions as identifiers in C. I.e., it can be any string of letters, digits, and underscores, not beginning with a digit. If the argument is not a valid identifier, then the name will not be set.

int glv::View::visible (  )  const [inline]

Returns model value(s) as string.

Returns whether View visibility flag is set


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