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

uscrollbar.hpp

00001 /* ==================================================== ======== ======= * 00002 * 00003 * uscrollbar.hpp 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 _uscrollbar_hpp_ 00026 #define _uscrollbar_hpp_ 00027 //pragma ident "@(#)uscrollbar.hpp ubit:03.06.03" 00028 #include <ubit/ugadgets.hpp> 00029 #include <ubit/uprop.hpp> 00030 #include <ubit/ucolor.hpp> 00031 #include <ubit/uview.hpp> 00032 00033 /* ==================================================== [Elc:03] ======= */ 00034 /* ==================================================== ======== ======= */ 00038 class UScrollbar: public UBox { 00039 public: 00040 static class UScrollbarStyle *style; 00041 00042 enum Modes { 00043 STANDARD = 1, TRANSP= 1<<1, WITH_RAIL = 1<<2 , WITH_FEEDBACK = 1<<3 00044 //COMPACT_EVENTS = 1<<5 00045 }; 00046 00047 UScrollbar(const UArgs& = UArgs::none); 00048 UScrollbar(const class UOrient&, const UArgs& = UArgs::none); 00049 UScrollbar(UFloat& value, const class UOrient&, const UArgs& = UArgs::none); 00056 ~UScrollbar(); 00057 00058 friend UScrollbar& uscrollbar(const UOrient&, const UArgs& a = UArgs::none); 00060 00061 friend UScrollbar& uhscrollbar(const UArgs& a = UArgs::none); 00063 00064 friend UScrollbar& uvscrollbar(const UArgs& a = UArgs::none); 00066 00067 virtual const UStyle& getStyle(UContext*) const; 00068 00069 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00070 00071 bool isHorizontal() const; 00072 bool isVertical() const; 00073 00074 float getValue() const; 00075 UFloat& value() const {return *pvalue;} 00076 00077 void setValue(const UFloat& percent); 00078 void setValue(float percent, bool update_pane = true); 00083 float getScrollerIncrement() const; 00084 void setScrollerIncrement(float percent); 00086 00087 float getBackgroundIncrement() const; 00088 void setBackgroundIncrement(float percent); 00090 00091 void setUpdateOnDrag(bool state = true); 00093 00094 bool isTransparent() const; 00095 void setTransparent(bool state); 00096 00097 void setPane(class UPane*); 00099 00100 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00101 // imbricated gadgets 00102 00103 protected: 00104 class LessScroller: public UButton { 00105 public: 00106 static class UStyle* style; 00107 LessScroller(const UArgs&); 00108 virtual const UStyle& getStyle(UContext*) const; 00109 }; 00110 00111 class MoreScroller: public UButton { 00112 public: 00113 static class UStyle* style; 00114 MoreScroller(const UArgs&); 00115 virtual const UStyle& getStyle(UContext*) const; 00116 }; 00117 00118 virtual UBox& createRail(const UArgs& = UArgs::none); 00119 virtual UBox& createSlider(const UArgs& = UArgs::none); 00120 virtual UBox& createLessScroller(const UArgs& = UArgs::none); 00121 virtual UBox& createMoreScroller(const UArgs& = UArgs::none); 00122 00123 #ifndef NO_DOC 00124 00125 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00126 // implementation 00127 00128 friend class UScrollbarView; 00129 friend class UPane; 00130 00131 UOrient orient; // orientation 00132 float scroller_increment, backgd_increment; // increments 00133 uptr<class UFloat> pvalue; // scrollbar value (percentage) 00134 uptr<class UPane> ppane; // the pane controlled by this scrollbar 00135 00136 uptr<UBox> pless_btn, pmore_btn, pslider_btn, pslider_box; 00137 UBgcolor bgcolor, slider_bgcolor, rail_bgcolor; 00138 UAlpha slider_alpha, rail_alpha; 00139 uptr<class UBorder> rail_border; 00140 UPos slider_pos; // current position of the slider 00141 00142 bool pressed, entered; 00143 bool transparent, with_rail, enter_feedback, drag_feedback, incremental_mode; 00144 u_pos delta_mouse; 00145 00146 virtual void constructs(); 00147 00148 void setValueImpl(float percent, bool upd); 00150 00151 virtual void pressSlider(UEvent&); 00152 virtual void releaseSlider(UEvent&); 00153 virtual void dragSlider(UEvent&); 00154 virtual void enterSlider(UEvent&); 00155 virtual void leaveSlider(UEvent&); 00156 virtual void pressScroller(UEvent&, int dir); 00157 00158 virtual void pressSliderBox(UEvent&); 00159 virtual void releaseSliderBox(UEvent&); 00160 virtual void dragSliderBox(UEvent&); 00161 virtual void enterSliderBox(UEvent&); 00162 virtual void leaveSliderBox(UEvent&); 00163 00164 virtual float getPercent(UEvent&, UView *slider_btn_view, 00165 UView *slider_box_view, u_dim delta_mouse); 00166 #endif 00167 }; 00168 00169 /* ==================================================== [Elc:03] ======= */ 00170 /* ==================================================== ======== ======= */ 00171 00176 class UScrollbarView : public UView { 00177 public: 00178 static UViewStyle style; // renderer 00179 virtual UViewStyle* getViewStyle() {return &style;} 00180 00181 UScrollbarView(UBoxLink*, UView* parview, UWinGraph*); 00182 virtual void setScroll(float percent); 00183 00184 #ifndef NO_DOC 00185 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00186 // implementation 00187 00188 friend class UScrollbar; 00189 static UView* makeView(UBoxLink*, UView* parview, UWinGraph*); 00190 virtual bool doLayout(UContext&, class UViewLayout&); 00191 virtual void doUpdate(UContext&, URegion r, URegion clip, class UViewUpdate&); 00192 00193 private: 00194 //int scrollmin, scrollmax; 00195 #endif 00196 }; 00197 00198 #endif 00199 /* ==================================================== [TheEnd] ======= */ 00200 /* ==================================================== [Elc:03] ======= */ 00201 00202

Generated on Fri Aug 13 12:12:14 2004 for Ubit[Eric.Lecolinet@enst.fr] by doxygen 1.3.7