Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

ubox.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  ubox.hpp : Ubit Box containers.
00004  *  Ubit Project  [Elc][2003]
00005  *  Author: Eric Lecolinet
00006  *
00007  *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00008  *
00009  *  (C) 1999-2003 Eric Lecolinet @ ENST Paris
00010  *  WWW: http://www.enst.fr/~elc/ubit   Email: elc@enst.fr (subject: ubit)
00011  *
00012  * ***********************************************************************
00013  * COPYRIGHT NOTICE : 
00014  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 
00015  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
00016  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 
00017  * 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  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00020  * ***********************************************************************
00021  *
00022  * ==================================================== [Elc:03] ======= *
00023  * ==================================================== ======== ======= */
00024 
00025 #ifndef _ubox_hpp_
00026 #define _ubox_hpp_
00027 //pragma ident  "@(#)ubox.hpp           ubit:03.06.00"
00028 #include <ubit/ugroup.hpp>
00029 
00030 
00108 class UBox: public UGroup {
00109 public:
00110   static UStyle *style;
00111 
00112   UBox(const UArgs& a = UArgs::none);
00117   friend UBox& ubox(const UArgs& a = UArgs::none) {return *new UBox(a);}
00123   virtual ~UBox() {destructs();}
00125 
00126   virtual const UStyle& getStyle(UContext*) const {return makeStyle();}
00127   static  const UStyle& makeStyle();
00128 
00129   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00130   // methods (same as UGroup counterparts)
00131 
00132   UBox& addlist(const UArgs& a) {UGroup::addlist(a); return *this;}
00133 
00134   virtual void update();
00135   virtual void update(UUpdate upmode);
00136 
00137   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00138   // view management
00139 
00140   virtual UView*  getView(int no) const;
00141   virtual int getViewCount() const;
00142   virtual UView** getViews() const;
00143   virtual UView** getViews(int &view_count) const;
00144   virtual int getViews(std::vector<UView*>&) const;
00150   UView* getViewContaining(UEvent&) const;
00152 
00153   UView* getViewContaining(UView* child_view) const;
00155 
00156   UView* getFirstViewInside(UView* parent_view) const;
00165   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00166   // box events
00167 
00168   virtual UBox& onPostChildEvent(const UArgs&);
00191   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00192   // implementation
00193 
00194 #ifndef NO_DOC
00195 public:
00196   friend class UWin;
00197 
00198   virtual class UBox* boxCast() {return this;}
00199   virtual ULink* makeLink();
00200 
00201   virtual void initView(ULink *selflink, UView *ancestor_view);
00202   virtual void initChildViews(UGroup*, ULink *childlink);
00203   virtual void deleteRelatedViews(class UView* parview, class ULink*);
00204   //NB: link can be null (but not parview) for UBox::deleteRelatedViews
00205 
00206   virtual void updateView(UEvent&, UView*, const UUpdate&);
00207   static void updateImpl(const class UUpdate& upmode, 
00208                          UView* winview, UView* layoutview, UView* showview,
00209                          bool impose_size, u_dim w, u_dim h); 
00210 #endif
00211 };
00212 
00213 /* ==================================================== [Elc:03] ======= */
00214 /* ==================================================== ======== ======= */
00215 
00219 class UVbox: public UBox {
00220 public:
00221   static UStyle *style;
00222 
00223   UVbox(const UArgs& a = UArgs::none) : UBox(a) {}
00225 
00226   friend UVbox& uvbox(const UArgs& a = UArgs::none) {return *new UVbox(a);}
00228 
00229   virtual const UStyle& getStyle(UContext*) const {return makeStyle();}
00230   static const UStyle& makeStyle();
00231 };
00232 
00233 /* ==================================================== [Elc:03] ======= */
00234 /* ==================================================== ======== ======= */
00235 
00239 class UHbox: public UBox {
00240 public:
00241   static UStyle *style;
00242 
00243   UHbox(const UArgs& a = UArgs::none) : UBox(a) {}
00245 
00246   friend UHbox& uhbox(const UArgs& a = UArgs::none) {return *new UHbox(a);}
00248 
00249   virtual const UStyle& getStyle(UContext*) const {return makeStyle();}
00250   static const  UStyle& makeStyle();
00251 };
00252 
00253 /* ==================================================== [Elc:03] ======= */
00254 /* ==================================================== ======== ======= */
00255 
00265 class UBar: public UBox {
00266 public:
00267   static UStyle *style;
00268 
00269   UBar(const UArgs& a = UArgs::none): UBox(a) {}
00271 
00272   friend UBar& ubar(const UArgs& a = UArgs::none) {return *new UBar(a);}
00274 
00275   virtual const UStyle& getStyle(UContext*) const {return makeStyle();}
00276   static  const UStyle& makeStyle();
00277 };
00278 
00279 /* ==================================================== [Elc:03] ======= */
00280 /* ==================================================== ======== ======= */
00281 
00297 class UFlowbox: public UBox {
00298 public:
00299   static UStyle *style;
00300 
00301   UFlowbox(const UArgs& a = UArgs::none);
00302 
00303   friend UFlowbox& uflowbox(const UArgs& a = UArgs::none)
00304   {return *(new UFlowbox(a));}
00305 
00306   virtual const UStyle& getStyle(UContext*) const {return makeStyle();}
00307   static  const UStyle& makeStyle();
00308 };
00309 
00310 #endif
00311 /* ==================================================== [TheEnd] ======= */
00312 /* ==================================================== [Elc:03] ======= */

Generated on Thu Mar 3 06:29:04 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.1