Main Page | Namespace List | Class Hierarchy | Data Structures | File List | Data Fields | Globals

groupnode.h

Go to the documentation of this file.
00001 //--- < GROUPNODE.H > -----------| ViewGraph - A Flexible Graph view Framework |
00002 //
00003 // Group nodes keep a bunch of other 
00004 // nodes underneath and are used to 
00005 // group the behaviour of certain nodes
00006 //
00007 // Derive from GroupNode to implement specific
00008 // group behaviour, as SelectionGroupNode does.
00009 // 
00010 // $Author: botik32 $
00011 // $Revision: 1.10 $
00012 // $Date: 2004/06/02 08:03:55 $
00013 //-----------------------------------------------------------------------------/
00014 
00015 #ifndef GROUPNODE_H
00016 #define GROUPNODE_H
00017 
00018 #include <list>
00019 #include <cZUI/basescenenode.h>
00020 
00021 class Event;
00022 
00023 class GroupNode : public BaseSceneNode{
00024 protected:
00025         long childcount, alloccount;
00026         /// Cached boundrect.
00027         double brx1, bry1, brx2, bry2;
00028         /// Cached scenerect.
00029         double scx1, scy1, scx2, scy2;
00030         BaseSceneNode **children_arr, **childbuf;
00031         void recompute_boundrect( void );
00032         void recompute_scenerect( void );
00033         /// recomputing the boundrect at initial
00034         /// loading stage may slow down the app.
00035         /// Turn dynamic_boundrect off when you
00036         /// first load the children, then make
00037         /// sure to turn it back on if you have
00038         /// a dynamic scene. Default is true.
00039         bool dynamic_boundrect, cache_boundrect;
00040 public:
00041         GroupNode( bool cache_br = true );
00042         
00043         /// The default Event handler passes 
00044         /// all events down to its children
00045         virtual bool handle_event( Event * );
00046         // Repaint events try all nodes in reverse 
00047         // order regardless of outcome.
00048         bool handle_event( RepaintEvent * );
00049         
00050         /// The default Message handler just passes 
00051         /// the request down to its children in hope
00052         /// that the target is one of them.
00053         virtual bool handle_message( Message * );
00054 
00055         // reserve space for N nodes in cases where the 
00056         // number of nodes is known
00057         void reserve( long );
00058 
00059         void add_child( SceneNode * );
00060         void remove_child( SceneNode * );
00061         void remove_child( int idx );
00062         void remove_all_children( void );
00063         void add_child( GroupNode * );
00064         void remove_child( GroupNode * );
00065         void get_boundrect( double&, double&, double&, double& );
00066         void get_scenerect( double&, double&, double&, double& );
00067 
00068         void translate( double dx, double dy );
00069         void rotate( double ax, double ay, double rad );
00070         void move( double newx, double newy );
00071 
00072         // If your node paints some stuff over the children, 
00073         // specify additional checks here
00074         virtual bool check_event_fitspixels( Event * );
00075 
00076         // Handles SceneEvents by recomputing the boundrect
00077         virtual void listen_event( Event * );
00078 
00079         void toggle_dynamic( bool );
00080 
00081         virtual ~GroupNode();
00082 };
00083 
00084 #endif
00085 
00086 /// $Log: groupnode.h,v $
00087 /// Revision 1.10  2004/06/02 08:03:55  botik32
00088 /// Removed fitsall bool from GroupNode
00089 /// Added get_scenerect() to BaseSceneNode
00090 /// Added get_scenerect() to HUDGroupNode
00091 /// Added recompute_scenerect() to GroupNode
00092 /// Changed GroupNode's recompute_boundrect behaviour to
00093 /// accept FitAllRect bounds again
00094 ///
00095 /// Revision 1.9  2004/06/02 05:42:27  botik32
00096 /// With the changes in the boundrect ignoring invalid and
00097 /// fitall bounds, event handling got messed up. Fixed this
00098 /// by adding a fitsall bool to GroupNode.
00099 ///
00100 /// Revision 1.8  2004/05/24 16:23:57  botik32
00101 /// Added missing destructor to GroupNode
00102 ///
00103 /// Revision 1.7  2004/05/19 16:40:36  botik32
00104 /// Bugfixes and enhancements:
00105 /// Added repaint_due() and brepaint_due to ScrollableView
00106 /// Fixed repaint decisions in GraphWindow to work for multiple-window
00107 /// scenes
00108 /// Fixed ScrollableView to call surfacedriver->clear() in constructor
00109 /// Changed mapchooser to use a smaller resolution world map
00110 ///
00111 /// Revision 1.6  2004/05/14 18:35:08  botik32
00112 /// Fixed a bug related to HUDGroups and a few that I do not
00113 /// remember now.
00114 ///
00115 /// Revision 1.5  2004/05/08 19:19:16  botik32
00116 /// Fixed a bad bug in rastermanip's scale2 code
00117 ///
00118 /// Revision 1.4  2004/05/05 07:10:14  botik32
00119 /// Added ContainerNode class for simple element selection/unselection
00120 /// More bugfixes
00121 ///
00122 /// Revision 1.3  2004/04/30 12:39:21  botik32
00123 /// Numerous changes related to making the SceneChangedEvents
00124 /// to work.
00125 /// - Moved listen_event() from BaseSceneNode to EventListener class
00126 /// - Made GroupNode listen to the added children's SceneChangedEvents
00127 /// - Changed Camera to listen to layers' SceneChangedEvents
00128 /// - Moved eventlistener list cleanup from Camera to EventHub class
00129 ///   where it belonged in the first place
00130 ///
00131 /// Revision 1.2  2004/04/18 09:22:01  botik32
00132 /// Changes to groupnode interface, timedeventmanager interface
00133 /// and implementation
00134 ///
00135 /// Revision 1.1.1.1  2004/03/26 10:50:23  botik32
00136 /// Initial release
00137 ///
00138 /// Revision 1.1.1.1  2004/03/26 08:53:33  botik
00139 /// initial import
00140 ///
00141 ///
00142 /// Revision 1.13  2003/11/18 11:23:12  botik
00143 /// Fixed a bug in scenenode that mucked message passing
00144 /// Removed some old handlers from basescenenode that caused
00145 /// problems with repainting under a group
00146 /// Groups work now okay.
00147 ///
00148 /// Revision 1.12  2003/11/18 10:17:24  botik
00149 /// Got HUDGroup to partially work
00150 /// Fixed a typo in leafnode that caused invalid
00151 /// movement on scroll
00152 ///
00153 /// Revision 1.11  2003/11/17 16:22:41  botik
00154 /// bugfixes in layernode
00155 ///
00156 /// Revision 1.10  2003/11/13 18:50:18  botik
00157 /// Fixed (almost) clear and update rect behaviour.
00158 /// Added update_rect to framework and sdl wrapper.
00159 /// Added mouse_in/mouse_out handling
00160 /// Fixed message handling
00161 /// Many small bugfixes
00162 ///
00163 /// Revision 1.9  2003/11/13 12:50:51  botik
00164 /// Refined the event handling architecture
00165 /// Got the event handling to recognize and treat mouse
00166 /// events accordingly
00167 /// Important fixes to ./Makefile
00168 ///
00169 /// Revision 1.8  2003/11/11 15:30:58  botik
00170 /// Added and compiled second framework test,
00171 /// fixed along a few bugs.
00172 ///
00173 /// Revision 1.7  2003/11/09 15:23:01  botik
00174 /// Got GraphDisplay to compile and run.
00175 ///
00176 /// Revision 1.6  2003/11/08 18:54:59  botik
00177 /// Changed handle_event to return bool
00178 ///
00179 /// Revision 1.5  2003/11/03 16:45:16  botik
00180 /// Some changes to scene nodes after careful
00181 /// consideration
00182 ///
00183 /// Revision 1.4  2003/10/30 14:21:43  botik
00184 /// Modified layernode to handle CameraOn/CameraOff events
00185 ///
00186 /// Revision 1.3  2003/10/28 15:43:55  botik
00187 /// More work on event framework and camera composition and
00188 /// z-ordering
00189 ///
00190 /// Revision 1.2  2003/10/24 16:29:10  botik
00191 /// Added more scene support: special scene nodes as well as a
00192 /// camera class that acts as glue between the graph master and the
00193 /// surface.
00194 ///
00195 /// Revision 1.1  2003/10/21 17:39:00  botik
00196 /// Added preliminary scene support
00197 ///

Generated on Wed Jun 23 18:47:21 2004 for cZUI by doxygen 1.3.5