Main Page | Modules | Class Hierarchy | Data Structures | File List | Data Fields | Globals | Related Pages

omUITreeNode.h

Go to the documentation of this file.
00001 
00002 // This code is part of the MaiaProject free software
00003 //
00004 // Keyboard and Mouse Emulator - Virtual keyboard Engine
00005 //
00006 // Copyright (c) 2002-2003 Luca Clivio <luca.clivio@maiaproject.org>
00007 // Tel. +39-347-2538040
00008 // via B.Croce 2, 20037 Paderno Dugnano (Milano) - Italy
00009 //
00010 // Developers:
00011 //    Simone Mangano <simone.mangano@maiaproject.org>
00012 //    Andrea Tosato  <andrea.tosato@maiaproject.org>
00013 //
00014 //  -----------------------------------------------------------------------------
00015 //  This program is free software; This program is free software; 
00016 //  you can redistribute it and/or modify it under the terms of the 
00017 //  GNU General Public License as published by the Free Software Foundation; 
00018 //  either version 2 of the License, or (at your option) any later version.
00019 //  but WITHOUT ANY WARRANTY; without even the implied warranty of                              
00020 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                                
00021 //  GNU General Public License for more details.                                                
00022 //  You should have received a copy of the GNU General Public License                           
00023 //  along with this program; if not, write to the Free Software                                 
00024 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                                   
00026 
00027 #ifndef _omUITreeNode_
00028 #define _omUITreeNode_
00029 
00030 
00031 #include <iostream>
00032 #include <vector>
00033 
00034 #include <openmaia/omObject.h>
00035 #include <openmaia/omUIApplication.h>
00036 #include <openmaia/omUIOptions.h>
00037 #include <openmaia/omUIButton.h>
00038 
00039 
00040 
00041 
00055 class omUITreeNode: public omObject {
00056  protected:
00057   // ------------------------------------------------- protected variables ---
00058   omUITreeNode *parent ;   // pointer of parent node
00059   std::vector<omUITreeNode *> nodes ;    // children of the Node
00060   omUIButton *leaf ;   // pointer to leaf object if it is a leaf node.
00061   int nnodes ;    // number of children nodes.
00062   int currentNode;   // current child node selected in automatic scan mode.
00063                      // -1 by default on start.
00064   int scanCount;     // count of loops, used when this branch is selected in automatic scan,
00065                      // when max tick count is reached the node activity will be released.
00066   int scanMax;       // max number of scan loops before exit from the branch.
00067   omObject *data ;    // data associated with the node
00068   bool isLeaf ;   // true if this is a leaf node.
00069   
00070 
00071 
00072 
00073  public:
00074   bool actioned ;  // true if the button is previously actioned 
00075 
00076 
00077   // ------------------------------------------------ public methods ---------------  
00078   omUITreeNode( omUITreeNode *, omObject *, int ) ;  // Constructor of the class as a node
00079   omUITreeNode( omUITreeNode *, omUIButton *);  // Constructor of the class as a leaf
00080   ~omUITreeNode() ;
00081 
00082   void DeleteChildren() ;  // delete all children (used in the root node only)
00083   void AddNode( omUITreeNode *) ; // Add a new child node 
00084   void AddLeaf( omUIButton *) ; // Add a new lead node 
00085   omUITreeNode *GetParentNode() ; // return the parent node pointer 
00086   bool IsYourWindow( void *) ; // check if window is one of leafs
00087   void DeAction(bool) ;  // Deaction the object ... called by a child
00088   void Tick() ;  // Pass the tick signal to the node
00089   void Action() ; // Pass the action signal to the node
00090   void PaintWindows() ;  // paint default picture of all windows
00091   void Show() ;   // show all windows of the node
00092   bool GetActionStatus() ;
00093   void Repaint() ;
00094   
00095 
00096   // --- virtual functions
00097   // Run some commands when the block is selected by the user
00098   virtual void Execute() ;
00099   // Highlight the group
00100   virtual void LightOn() ;
00101   // Turn the highlight off to the group
00102   virtual void LightOff() ;
00103 } ;
00104 
00105 #endif // _omUITreeNode_
00106