00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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
00169