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
00026
00027
00028
00029
00030 #ifndef _CEGUIScrollbar_h_
00031 #define _CEGUIScrollbar_h_
00032
00033 #include "CEGUIBase.h"
00034 #include "CEGUIWindow.h"
00035 #include "elements/CEGUIScrollbarProperties.h"
00036
00037
00038 #if defined(_MSC_VER)
00039 # pragma warning(push)
00040 # pragma warning(disable : 4251)
00041 #endif
00042
00043
00044
00045 namespace CEGUI
00046 {
00051 class CEGUIEXPORT ScrollbarWindowRenderer : public WindowRenderer
00052 {
00053 public:
00058 ScrollbarWindowRenderer(const String& name);
00059
00064 virtual void updateThumb(void) = 0;
00065
00073 virtual float getValueFromThumb(void) const = 0;
00074
00088 virtual float getAdjustDirectionFromPoint(const Point& pt) const = 0;
00089 };
00090
00099 class CEGUIEXPORT Scrollbar : public Window
00100 {
00101 public:
00102 static const String EventNamespace;
00103 static const String WidgetTypeName;
00104
00105
00106
00107
00108 static const String EventScrollPositionChanged;
00109 static const String EventThumbTrackStarted;
00110 static const String EventThumbTrackEnded;
00111 static const String EventScrollConfigChanged;
00112
00113
00114
00115
00116 static const String ThumbNameSuffix;
00117 static const String IncreaseButtonNameSuffix;
00118 static const String DecreaseButtonNameSuffix;
00119
00120
00121
00122
00138 float getDocumentSize(void) const {return d_documentSize;}
00139
00140
00158 float getPageSize(void) const {return d_pageSize;}
00159
00160
00177 float getStepSize(void) const {return d_stepSize;}
00178
00179
00197 float getOverlapSize(void) const {return d_overlapSize;}
00198
00199
00216 float getScrollPosition(void) const {return d_position;}
00217
00218
00230 PushButton* getIncreaseButton() const;
00231
00232
00244 PushButton* getDecreaseButton() const;
00245
00246
00257 Thumb* getThumb() const;
00258
00259
00260
00261
00262
00273 virtual void initialiseComponents(void);
00274
00275
00294 void setDocumentSize(float document_size);
00295
00296
00317 void setPageSize(float page_size);
00318
00319
00339 void setStepSize(float step_size);
00340
00341
00362 void setOverlapSize(float overlap_size);
00363
00364
00386 void setScrollPosition(float position);
00387
00388
00389
00390
00391
00396 Scrollbar(const String& type, const String& name);
00397
00398
00403 virtual ~Scrollbar(void);
00404
00405
00406 protected:
00407
00408
00409
00414 void updateThumb(void);
00415
00416
00424 float getValueFromThumb(void) const;
00425
00426
00440 float getAdjustDirectionFromPoint(const Point& pt) const;
00441
00442
00447
00448
00449
00457
00458
00459
00473
00474
00475
00480 bool handleThumbMoved(const EventArgs& e);
00481
00482
00487 bool handleIncreaseClicked(const EventArgs& e);
00488
00489
00494 bool handleDecreaseClicked(const EventArgs& e);
00495
00496
00501 bool handleThumbTrackStarted(const EventArgs& e);
00502
00503
00508 bool handleThumbTrackEnded(const EventArgs& e);
00509
00510
00521 virtual bool testClassName_impl(const String& class_name) const
00522 {
00523 if (class_name=="Scrollbar") return true;
00524 return Window::testClassName_impl(class_name);
00525 }
00526
00527
00528 virtual bool validateWindowRenderer(const String& name) const
00529 {
00530 return (name == "Scrollbar");
00531 }
00532
00533
00534
00535
00540 virtual void onScrollPositionChanged(WindowEventArgs& e);
00541
00542
00547 virtual void onThumbTrackStarted(WindowEventArgs& e);
00548
00549
00554 virtual void onThumbTrackEnded(WindowEventArgs& e);
00555
00556
00561 virtual void onScrollConfigChanged(WindowEventArgs& e);
00562
00563
00564
00565
00566
00567 virtual void onMouseButtonDown(MouseEventArgs& e);
00568 virtual void onMouseWheel(MouseEventArgs& e);
00569
00570
00571
00572
00573
00574 float d_documentSize;
00575 float d_pageSize;
00576 float d_stepSize;
00577 float d_overlapSize;
00578 float d_position;
00579
00580
00581 private:
00582
00583
00584
00585 static ScrollbarProperties::DocumentSize d_documentSizeProperty;
00586 static ScrollbarProperties::PageSize d_pageSizeProperty;
00587 static ScrollbarProperties::StepSize d_stepSizeProperty;
00588 static ScrollbarProperties::OverlapSize d_overlapSizeProperty;
00589 static ScrollbarProperties::ScrollPosition d_scrollPositionProperty;
00590
00591
00592
00593
00594
00595 void addScrollbarProperties(void);
00596 };
00597
00598 }
00599
00600 #if defined(_MSC_VER)
00601 # pragma warning(pop)
00602 #endif
00603
00604 #endif // end of guard _CEGUIScrollbar_h_