00001 /* ==================================================== ======== ======= * 00002 * 00003 * uparent.hpp [internal implementation] 00004 * Ubit Project 00005 * Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs 00006 * (C) 1999-2006 EricLecolinet / ENST Paris / http://www.enst.fr/~elc/ubit 00007 * 00008 * *********************************************************************** 00009 * COPYRIGHT NOTICE : 00010 * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 00011 * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 00012 * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 00013 * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 00014 * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION. 00015 * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS. 00016 * *********************************************************************** 00017 * ==================================================== [-c-Elc] ======= * 00018 * ==================================================== ======== ======= */ 00019 00020 #ifndef _uparent_hpp_ 00021 #define _uparent_hpp_ 00022 //pragma ident "@(#)uparent.hpp ubit:05.05.00" 00023 namespace ubit { 00024 00025 /* ==================================================== ======== ======= */ 00028 class UParent { 00029 public: 00030 UParent(UChildIter i) : child_iter(i) {} 00031 UGroup* operator*() {return child_iter->parent;} 00032 UChild& getChildNode() {return child_iter.getNode();} 00033 private: 00034 UChildIter child_iter; 00035 }; 00036 00037 /* ==================================================== ======== ======= */ 00038 00039 template <class _I> 00040 struct _UParentIter : public _I { 00041 _UParentIter() : _I(null) {} // !ATT: peut poser probleme si pas g++ ! 00042 _UParentIter(const _I& i) : _I(i) {} 00043 _UParentIter(const _UParentIter& i) : _I(i) {} 00044 00045 UGroup* operator*() {return static_cast<UGroup*>(*_I::operator*());} 00046 UParent& getNode() {return _I::operator*();} 00047 }; 00048 00052 typedef _UParentIter<std::list<UParent>::iterator> UParentIter; 00053 00054 /* ==================================================== ===== ======= */ 00058 struct UParents : public std::list<UParent> { 00059 00060 void updateAllParents(const UUpdate&); 00062 00063 void updateAutoParents(const UUpdate&); 00065 00066 void fireParents(UEvent&, const UOn&); 00068 00069 void setParentsModes(UMask bmodes, UMask cmodes, bool onoff); 00071 00072 void setParentsViewsModes(int vmodes, bool on_off); 00074 00075 void removeFirst(UChild*); 00077 }; 00078 00079 } 00080 #endif 00081 /* ==================================================== [TheEnd] ======= */ 00082 /* ==================================================== [(c)Elc] ======= */