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 #ifndef _CEGUIScrollbar_h_
00027 #define _CEGUIScrollbar_h_
00028
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "elements/CEGUIScrollbarProperties.h"
00032
00033
00034 #if defined(_MSC_VER)
00035 # pragma warning(push)
00036 # pragma warning(disable : 4251)
00037 #endif
00038
00039
00040
00041 namespace CEGUI
00042 {
00051 class CEGUIEXPORT Scrollbar : public Window
00052 {
00053 public:
00054 static const String EventNamespace;
00055
00056
00057
00058
00059 static const String EventScrollPositionChanged;
00060 static const String EventThumbTrackStarted;
00061 static const String EventThumbTrackEnded;
00062 static const String EventScrollConfigChanged;
00063
00064
00065
00066
00067
00083 float getDocumentSize(void) const {return d_documentSize;}
00084
00085
00103 float getPageSize(void) const {return d_pageSize;}
00104
00105
00122 float getStepSize(void) const {return d_stepSize;}
00123
00124
00142 float getOverlapSize(void) const {return d_overlapSize;}
00143
00144
00161 float getScrollPosition(void) const {return d_position;}
00162
00163
00164
00165
00166
00177 virtual void initialise(void);
00178
00179
00198 void setDocumentSize(float document_size);
00199
00200
00221 void setPageSize(float page_size);
00222
00223
00243 void setStepSize(float step_size);
00244
00245
00266 void setOverlapSize(float overlap_size);
00267
00268
00290 void setScrollPosition(float position);
00291
00292
00293
00294
00295
00300 Scrollbar(const String& type, const String& name);
00301
00302
00307 virtual ~Scrollbar(void);
00308
00309
00310 protected:
00311
00312
00313
00318 void addScrollbarEvents(void);
00319
00320
00328 virtual PushButton* createIncreaseButton(const String& name) const = 0;
00329
00330
00338 virtual PushButton* createDecreaseButton(const String& name) const = 0;
00339
00340
00348 virtual Thumb* createThumb(const String& name) const = 0;
00349
00350
00355 virtual void updateThumb(void) = 0;
00356
00357
00365 virtual float getValueFromThumb(void) const = 0;
00366
00367
00381 virtual float getAdjustDirectionFromPoint(const Point& pt) const = 0;
00382
00383
00388 bool handleThumbMoved(const EventArgs& e);
00389
00390
00395 bool handleIncreaseClicked(const EventArgs& e);
00396
00397
00402 bool handleDecreaseClicked(const EventArgs& e);
00403
00404
00409 bool handleThumbTrackStarted(const EventArgs& e);
00410
00411
00416 bool handleThumbTrackEnded(const EventArgs& e);
00417
00418
00429 virtual bool testClassName_impl(const String& class_name) const
00430 {
00431 if (class_name==(const utf8*)"Scrollbar") return true;
00432 return Window::testClassName_impl(class_name);
00433 }
00434
00435
00436
00437
00438
00443 virtual void onScrollPositionChanged(WindowEventArgs& e);
00444
00445
00450 virtual void onThumbTrackStarted(WindowEventArgs& e);
00451
00452
00457 virtual void onThumbTrackEnded(WindowEventArgs& e);
00458
00459
00464 virtual void onScrollConfigChanged(WindowEventArgs& e);
00465
00466
00467
00468
00469
00470 virtual void onMouseButtonDown(MouseEventArgs& e);
00471 virtual void onMouseWheel(MouseEventArgs& e);
00472
00473
00474
00475
00476
00477 float d_documentSize;
00478 float d_pageSize;
00479 float d_stepSize;
00480 float d_overlapSize;
00481 float d_position;
00482
00483
00484 Thumb* d_thumb;
00485 PushButton* d_increase;
00486 PushButton* d_decrease;
00487
00488
00489 private:
00490
00491
00492
00493 static ScrollbarProperties::DocumentSize d_documentSizeProperty;
00494 static ScrollbarProperties::PageSize d_pageSizeProperty;
00495 static ScrollbarProperties::StepSize d_stepSizeProperty;
00496 static ScrollbarProperties::OverlapSize d_overlapSizeProperty;
00497 static ScrollbarProperties::ScrollPosition d_scrollPositionProperty;
00498
00499
00500
00501
00502
00503 void addScrollbarProperties(void);
00504 };
00505
00506
00507 }
00508
00509 #if defined(_MSC_VER)
00510 # pragma warning(pop)
00511 #endif
00512
00513 #endif // end of guard _CEGUIScrollbar_h_