uctlmenu.hpp

00001 /* ==================================================== ======== ======= *
00002 *
00003 *  uctlmenu.hpp : Control menus
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 //pragma ident  "@(#)uctlmenu.hpp       ubit:05.05.00"
00021 #ifndef _uctlmenu_hpp_
00022 #define _uctlmenu_hpp_
00023 #include <ubit/upiemenu.hpp>
00024 namespace ubit {
00025   
00026 /* ==================================================== ===== ======= */
00077 class UCtlmenu : public UPiemenu {
00078 public:
00079   UBIT_ELEMENT_CLASS(UCtlmenu, UPiemenu)
00080 
00081   UCtlmenu(const UArgs& = UArgs::none);
00082   virtual ~UCtlmenu();
00083 
00084   friend UCtlmenu& uctlmenu(const UArgs& args = UArgs::none) 
00085   {return *new UCtlmenu(args);}
00086   
00087   static  UStyle* createStyle();
00088 };
00089 
00090 /* ==================================================== [Elc] ======= */
00091 /* ==================================================== ===== ======= */
00096 class UCtlAction : public UCall {
00097 public:
00098   UCtlAction() : xmag(1.), ymag(1.) {}
00099   UCtlAction(float _xmag, float _ymag) : xmag(_xmag), ymag(_ymag) {}
00100   virtual ~UCtlAction() {}
00101   
00102   virtual void setMag(float _xmag, float _ymag) {xmag=_xmag, ymag=_ymag;}
00103   float getXMag() const {return xmag;}
00104   float getYMag() const {return ymag;}
00105  
00106 protected:
00107   virtual void mdrag(UMouseEvent& e, UCtlmenu&) = 0;
00114   virtual void operator()(UEvent&);
00116 
00117   virtual void addingTo(UChild*, UGroup* parent);
00119   
00120   float xmag, ymag;
00121 };
00122 
00123 /* ==================================================== ===== ======= */
00126 class UScrollAction : public UCtlAction {
00127 public:
00128   UScrollAction(float xmag = 0.3, float ymag = 0.3);
00129   UScrollAction(UScrollpane&, float xmag = 0.3, float ymag = 0.3);
00130   void setPane(UScrollpane&);
00131   UScrollpane* getPane() const {return pane;}
00132 protected:
00133   virtual void mdrag(UMouseEvent&, UCtlmenu&);
00134   UScrollpane* pane;
00135   float arm_xpos, arm_ypos, xpos, ypos;
00136 };
00137 
00138 /* ==================================================== ===== ======= */
00141 class UPanAction : public UCtlAction {
00142 public:
00143   UPanAction(UPos&, UBox& moving_area, float xmag = 1., float ymag = 1.);
00144 protected:
00145   virtual void mdrag(UMouseEvent&, UCtlmenu&);
00146   UPos* pos;
00147   UBox* moving_area;
00148   float arm_xpos, arm_ypos, xpos, ypos;
00149 };
00150 
00151 /* ==================================================== ===== ======= */
00154 class UZoomAction : public UCtlAction {
00155 public:
00156   UZoomAction(UScale&, UPos&, UBox& moving_area, float xmag = 1., float ymag = 1.);
00157 protected:
00158   virtual void mdrag(UMouseEvent&, UCtlmenu&);
00159   UScale* scale;
00160   UPos* pos;
00161   UBox* box;
00162   float delta;
00163   float pos_x0, pos_y0, open_x0, open_y0, scale0, mouse_delta;
00164 };
00165 
00166 }
00167 #endif
00168 /* ==================================================== [TheEnd] ======= */
00169 /* ==================================================== [(c)Elc] ======= */

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