00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#ifndef _uscrollbar_hpp_
00026
#define _uscrollbar_hpp_
00027
00028
#include <ubit/ugadgets.hpp>
00029
#include <ubit/uprop.hpp>
00030
#include <ubit/ucolor.hpp>
00031
#include <ubit/uview.hpp>
00032
00033
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
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
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
00127
00128
friend class UScrollbarView;
00129
friend class UPane;
00130
00131 UOrient orient;
00132
float scroller_increment, backgd_increment;
00133 uptr<class UFloat> pvalue;
00134 uptr<class UPane> ppane;
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;
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
00170
00171
00176 class UScrollbarView :
public UView {
00177
public:
00178
static UViewStyle style;
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
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
00195
#endif
00196
};
00197
00198
#endif
00199
00200
00201
00202