arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

WidgetFactory Class Reference

#include <WidgetFactory.h>

Inheritance diagram for WidgetFactory:

gutz::Counted List of all members.

Detailed Description

a base class for generating basic widget items.

this hides the "appearance" from the behavior levels of the hierarchy, this way we can re-use widgets even if we don't have openGL or don't like the way they look.

This class should be restricted to generating only "basic" widget items like, nodes, edges, sliders, and cones. More complex, composite, widgets should take a factory in it's constructor to generate the correct "kind" of basic widgets using the gen*() functions.

This is a prototype factory, which means all widgets must implement some form of clone() function. The WidgetItem interface requires you to be able to implement

 WidgetItem *clone() const 
However, many classes like NodeWidget and EdgeWidget define the WidgetItem::clone() and declare new clone ops for that specific subclass, which get called by their implementation of WidgetItem::clone(). This is very usefull since we are sepparating the behavior and appearance via the class hierarchy and would still like to copy the widgets.

To create a custom factory is simplest to just create a new factory or use/copy an existing "const default" one, for instance here is the definition of the default GLUWidgetFactory :

     const WidgetFactory GLUWidgetFactory(new GLUNodeWidget(...), new GLUEdgeWidget(...));
To customize just copy and modify:
     WidgetFactory myWF = GLUWidgetFactory;
     ... /// change atributes of the widget protos to suite
The advantage here is that specifics about color and appearance can remain transparent at the behavior level of the widget hierarchy, it also means that the "style" of the widget-set being used can be easly customeized while the code remains generic. For instance, if the user wants salmon pink nodes and lime green bars, this style can be created by cloning the appropriate prototypes, or by using this "prototype-widget-factory" created from an example salmon-pink node and lime green bars to generate composite widgets such as the FrameWidget.

Definition at line 68 of file WidgetFactory.h.

NodeWidget prototypes

virtual NodeWidgetgenNode () const
virtual NodeWidgetSP getNodeProto ()
virtual const NodeWidget
*const 
getNodeProto () const
virtual void setNodeProto (NodeWidget *nw)

EdgeWidget prototypes

virtual EdgeWidgetgenEdge () const
virtual EdgeWidgetSP getEdgeProto ()
virtual const EdgeWidget
*const 
getEdgeProto () const
virtual void setEdgeProto (EdgeWidget *ew)

Public Member Functions

 WidgetFactory (NodeWidget *nodeProto, EdgeWidget *edgeProto)
 WidgetFactory (const WidgetFactory &wf)
virtual ~WidgetFactory ()
WidgetFactoryoperator= (const WidgetFactory &wf)

Protected Member Functions

 WidgetFactory ()
 not used

virtual void _incCount ()
 gutz::Counted interface, increment reference count by one.

virtual void _decCount ()
 gutz::Counted interface, decrement reference count by one.

virtual int _getCount () const
 gutz::Counted interface, get the current reference count.


Protected Attributes

NodeWidgetSP _nodeProto
EdgeWidgetSP _edgeProto

Friends

class SmartPtr
class SmartPtrRef


Constructor & Destructor Documentation

WidgetFactory::WidgetFactory NodeWidget nodeProto,
EdgeWidget edgeProto
[inline]
 

Definition at line 70 of file WidgetFactory.h.

References _edgeProto, and _nodeProto.

WidgetFactory::WidgetFactory const WidgetFactory wf  )  [inline]
 

Definition at line 76 of file WidgetFactory.h.

References _edgeProto, and _nodeProto.

virtual WidgetFactory::~WidgetFactory  )  [inline, virtual]
 

Definition at line 81 of file WidgetFactory.h.

WidgetFactory::WidgetFactory  )  [inline, protected]
 

not used

Definition at line 115 of file WidgetFactory.h.


Member Function Documentation

virtual void gutz::Counted::_decCount  )  [inline, protected, virtual, inherited]
 

gutz::Counted interface, decrement reference count by one.

Not generaly used by subclasses, mostly for collaboration with gutz::SmartPtr. Sometimes you need to call this though, see the documentation for gutz::SmartPtr

Definition at line 54 of file smartptr.h.

Referenced by TFImage::clear(), NrroImage::fBlendOverRGBA(), and Nrro::updateMinMax().

virtual int gutz::Counted::_getCount  )  const [inline, protected, virtual, inherited]
 

gutz::Counted interface, get the current reference count.

Not generaly used by subclasses, mostly for collaboration with gutz::SmartPtr.

Definition at line 58 of file smartptr.h.

virtual void gutz::Counted::_incCount  )  [inline, protected, virtual, inherited]
 

gutz::Counted interface, increment reference count by one.

Not generaly used by subclasses, mostly for collaboration with gutz::SmartPtr. Sometimes you need to call this though, see the documentation for gutz::SmartPtr

Definition at line 48 of file smartptr.h.

Referenced by TFImage::clear(), NrroImage::fBlendOverRGBA(), and Nrro::updateMinMax().

virtual EdgeWidget* WidgetFactory::genEdge  )  const [inline, virtual]
 

Definition at line 103 of file WidgetFactory.h.

References _edgeProto.

virtual NodeWidget* WidgetFactory::genNode  )  const [inline, virtual]
 

Definition at line 91 of file WidgetFactory.h.

References _nodeProto.

virtual const EdgeWidget* const WidgetFactory::getEdgeProto  )  const [inline, virtual]
 

Definition at line 107 of file WidgetFactory.h.

References _edgeProto, and gutz::SmartPtr< EdgeWidget >::getPtr().

virtual EdgeWidgetSP WidgetFactory::getEdgeProto  )  [inline, virtual]
 

Definition at line 105 of file WidgetFactory.h.

References _edgeProto.

Referenced by FrameWidget::FrameWidget().

virtual const NodeWidget* const WidgetFactory::getNodeProto  )  const [inline, virtual]
 

Definition at line 95 of file WidgetFactory.h.

References _nodeProto, and gutz::SmartPtr< NodeWidget >::getPtr().

virtual NodeWidgetSP WidgetFactory::getNodeProto  )  [inline, virtual]
 

Definition at line 93 of file WidgetFactory.h.

References _nodeProto.

Referenced by FrameWidget::FrameWidget().

WidgetFactory& WidgetFactory::operator= const WidgetFactory wf  )  [inline]
 

Definition at line 83 of file WidgetFactory.h.

References _edgeProto, and _nodeProto.

virtual void WidgetFactory::setEdgeProto EdgeWidget ew  )  [inline, virtual]
 

Definition at line 109 of file WidgetFactory.h.

References _edgeProto.

virtual void WidgetFactory::setNodeProto NodeWidget nw  )  [inline, virtual]
 

Definition at line 97 of file WidgetFactory.h.

References _nodeProto.


Friends And Related Function Documentation

friend class SmartPtr [friend, inherited]
 

Definition at line 40 of file smartptr.h.

Referenced by Nrro::NrroIter< T >::NrroIter().

friend class SmartPtrRef [friend, inherited]
 

Definition at line 41 of file smartptr.h.


Member Data Documentation

EdgeWidgetSP WidgetFactory::_edgeProto [protected]
 

Definition at line 118 of file WidgetFactory.h.

Referenced by genEdge(), getEdgeProto(), operator=(), setEdgeProto(), and WidgetFactory().

NodeWidgetSP WidgetFactory::_nodeProto [protected]
 

Definition at line 117 of file WidgetFactory.h.

Referenced by genNode(), getNodeProto(), operator=(), setNodeProto(), and WidgetFactory().


The documentation for this class was generated from the following file:
Send questions, comments, and bug reports to:
jmk