uboxes.hpp

00001 /* ==================================================== ======== ======= *
00002 *
00003 *  uboxes.hpp : misc containers.
00004 *  Ubit Project
00005 *  Author: Eric Lecolinet
00006 *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00007 *  (C) 1999-2006 / EricLecolinet / ENST Paris / http://www.enst.fr/~elc/ubit
00008 *
00009 * ***********************************************************************
00010 * COPYRIGHT NOTICE : 
00011 * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 
00012 * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
00013 * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 
00014 * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
00015 * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00016 * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00017 * ***********************************************************************
00018 * ==================================================== [(c)Elc] ======= *
00019 * ==================================================== ======== ======= */
00020 
00021 #ifndef _uboxes_hpp_
00022 #define _uboxes_hpp_
00023 //pragma ident  "@(#)uboxes.hpp         ubit:05.05.00"
00024 #include <ubit/ubox.hpp>
00025 namespace ubit {
00026 
00027 /* ==================================================== ====== ======= */
00031 class UVbox: public UBox {
00032 public:
00033   UBIT_ELEMENT_CLASS(UVbox,UBox)
00034 
00035   UVbox(const UArgs& a = UArgs::none) : UBox(a) {}
00037 
00038   friend UVbox& uvbox(const UArgs& a = UArgs::none) {return *new UVbox(a);}
00039 
00040   static UStyle* createStyle();
00041 };
00042 
00043 /* ==================================================== ======== ======= */
00047 class UHbox: public UBox {
00048 public:
00049   UBIT_ELEMENT_CLASS(UHbox,UBox)
00050 
00051   UHbox(const UArgs& a = UArgs::none) : UBox(a) {}
00053 
00054   friend UHbox& uhbox(const UArgs& a = UArgs::none) {return *new UHbox(a);}
00055 
00056   static UStyle* createStyle();
00057 };
00058 
00059 /* ==================================================== ===== ======= */
00070 class UFlowbox: public UBox {
00071 public:
00072   UBIT_ELEMENT_CLASS(UFlowbox,UBox)
00073 
00074   UFlowbox(const UArgs& a = UArgs::none);
00076   
00077   friend UFlowbox& uflowbox(const UArgs& args = UArgs::none) {return *new UFlowbox(args);}
00079   
00080   static  UStyle* createStyle();
00081 };
00082 
00083 /* ==================================================== ===== ======= */
00086 class UCardbox : public UBox {
00087 public:
00088   UBIT_ELEMENT_CLASS(UCardbox,UBox)
00089 
00090   UCardbox(const UArgs& a = UArgs::none);
00091   friend UCardbox& ucardbox(const UArgs& a = UArgs::none) {return *new UCardbox(a);}
00092 
00093   virtual ~UCardbox();
00094   
00095   // - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - -
00096 
00097   virtual void addTab(UBox& card);
00099 
00100   virtual void addTab(const UArgs& label, UBox& card);
00102       
00103   virtual UBox* getTab(int Nth) const;
00104   virtual UBox* getCard(int Nth) const;
00105 
00106   virtual UBox* getSelectedTab() const;
00107   virtual UBox* getSelectedCard() const;
00108 
00109   virtual int getSelectedIndex() const;
00111 
00112   virtual void setSelectedIndex(int n);
00114 
00115   UListbox& tabs() {return *ptabs;}
00117   
00118   UChoice& choice();
00120 
00121   // - - - impl - - - - - - - - - - - - - - - - - - - - - - - - - - -
00122   
00123   static  UStyle* createStyle();
00124   
00125   //virtual UCardbox& setComboMode(bool = true);
00126   // use a combobox instead of tabs if arg is true.
00127   
00128 #ifndef NO_DOC
00129 protected:
00130   uptr<UListbox> ptabs;
00131   virtual void setSelectedImpl();
00132 #endif
00133 };
00134 
00135 /* ==================================================== ====== ======= */
00141 class UDocbox : public UVbox {
00142 public:
00143   UBIT_ELEMENT_CLASS(UDocbox,UBox)
00144 
00145   UDocbox(const UArgs& = UArgs::none);
00146   virtual ~UDocbox();
00147 
00148   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00149 
00150   virtual UBox& titlebar()           {return *ptitlebar;}
00151   virtual UScrollpane& scrollpane()  {return *pspane;}
00152   virtual UBox& content()            {return *pcontent;}
00153   virtual UScale& scale()            {return *pscale;}
00154   virtual void iconify(bool);
00155   virtual bool isIconified() const;
00156   virtual void zoom(float value = 1.);
00157   virtual void zoomIn();
00158   virtual void zoomOut();
00159   virtual void setZoomQuantum(float);
00160   
00161   // - - - impl - - - - - - - - - - - - - - - - - - - - - - - - - - -
00162 #ifndef NO_DOC
00163 protected:
00164   uptr<UBox> ptitlebar, pcontent;
00165   uptr<UScrollpane> pspane;
00166   uptr<UScale> pscale;
00167   float zoom_quantum;
00168 #endif
00169 };
00170 
00171 /* ==================================================== ===== ======= */
00174 class UAlertbox : public UBox {
00175 public:
00176   UBIT_ELEMENT_CLASS(UAlertbox,UBox)
00177 
00178   UAlertbox(const UArgs& = UArgs::none);
00179     
00180   // NB: show doit etre redefini, sinon show("abcd") est pris comme show(bool)
00181   // a cause des conversions implicites (stupides) du C++
00182   virtual void show(bool b) {UBox::show(b);}
00183   virtual void show(const char* msg) {showMsg(msg);}
00184   virtual void show(const UStr& msg) {showMsg(msg);}
00185 
00186   virtual void showMsg(const char* msg);
00187   virtual void showMsg(const UStr& msg);
00189   
00190   // - - - impl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00191   
00192   static UStyle* createStyle();
00193 
00194 private:
00195   UGroup message;
00196 };
00197 
00198 /* ==================================================== ===== ======= */
00207 class UBar: public UBox {
00208 public:
00209   UBIT_ELEMENT_CLASS(UBar,UBox)
00210 
00211   UBar(const UArgs& a = UArgs::none): UBox(a) {}
00212   friend UBar& ubar(const UArgs& a = UArgs::none) {return *new UBar(a);}
00214   
00215   static UStyle* createStyle();
00216 };
00217 
00218 /* ==================================================== ===== ======= */
00227 class UStatusbar: public UBox {
00228 public:
00229   UBIT_ELEMENT_CLASS(UStatusbar,UBox)
00230 
00231   UStatusbar(const UArgs& a = UArgs::none): UBox(a) {}
00233 
00234   friend UStatusbar& ustatusbar(const UArgs& a = UArgs::none) {return *new UStatusbar(a);}
00235   
00236   static UStyle* createStyle();
00237 };
00238 
00239 }
00240 #endif
00241 /* ==================================================== [TheEnd] ======= */
00242 /* ==================================================== [(c)Elc] ======= */

Generated on Mon Jan 29 00:20:36 2007 for Ubit by  doxygen 1.4.7