Crazy Eddie's GUI System 0.8.7
Loading...
Searching...
No Matches
widgets/Scrollbar.h
1/***********************************************************************
2 created: 13/4/2004
3 author: Paul D Turner
4*************************************************************************/
5/***************************************************************************
6 * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27#ifndef _CEGUIScrollbar_h_
28#define _CEGUIScrollbar_h_
29
30#include "../Base.h"
31#include "../Window.h"
32
33#if defined(_MSC_VER)
34# pragma warning(push)
35# pragma warning(disable : 4251)
36#endif
37
38// Start of CEGUI namespace section
39namespace CEGUI
40{
42class CEGUIEXPORT ScrollbarWindowRenderer : public WindowRenderer
43{
44public:
46
52 virtual void updateThumb(void) = 0;
53
63 virtual float getValueFromThumb(void) const = 0;
64
78 virtual float getAdjustDirectionFromPoint(const Vector2f& pt) const = 0;
79};
80
89class CEGUIEXPORT Scrollbar : public Window
90{
91public:
93 static const String WidgetTypeName;
94
96 static const String EventNamespace;
121
123 static const String ThumbName;
128
145 float getDocumentSize(void) const
146 {
147 return d_documentSize;
148 }
149
166 void setDocumentSize(float document_size);
167
185 float getPageSize(void) const
186 {
187 return d_pageSize;
188 }
189
207 void setPageSize(float page_size);
208
226 float getStepSize(void) const
227 {
228 return d_stepSize;
229 }
230
248 void setStepSize(float step_size);
249
267 float getOverlapSize(void) const
268 {
269 return d_overlapSize;
270 }
271
289 void setOverlapSize(float overlap_size);
290
307 float getScrollPosition(void) const
308 {
309 return d_position;
310 }
311
325 void setScrollPosition(float position);
326
330 void setUnitIntervalScrollPosition(float position);
331
344
357
368 Thumb* getThumb() const;
369
404 void setConfig(const float* const document_size,
405 const float* const page_size,
406 const float* const step_size,
407 const float* const overlap_size,
408 const float* const position);
409
424 void setEndLockEnabled(const bool enabled);
425
441 bool isEndLockEnabled() const;
442
447
452
453 Scrollbar(const String& type, const String& name);
454 ~Scrollbar(void);
455
456 // overrides
458
459protected:
465 void updateThumb(void);
466
476 float getValueFromThumb(void) const;
477
491 float getAdjustDirectionFromPoint(const Vector2f& pt) const;
492
496 bool setScrollPosition_impl(const float position);
497
499 bool isAtEnd() const;
500
502 float getMaxScrollPosition() const;
503
506
509
512
515
518
520 virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
521
522 // New event handlers for slider widget
525
528
531
534
535 // Overridden event handlers
537 virtual void onMouseWheel(MouseEventArgs& e);
538
539 // base class overrides
540 void banPropertiesForAutoWindow();
541
542 // Implementation Data
555
556private:
558 void addScrollbarProperties(void);
559};
560
561} // End of CEGUI namespace section
562
563#if defined(_MSC_VER)
564# pragma warning(pop)
565#endif
566
567#endif // end of guard _CEGUIScrollbar_h_
Base class used as the argument to all subscribers Event object.
Definition EventArgs.h:51
EventArgs based class that is used for objects passed to input event handlers concerning mouse input.
Definition InputEvent.h:281
Base class to provide logic for push button type widgets.
Definition PushButton.h:48
Base class for Scrollbar window renderer objects.
Definition widgets/Scrollbar.h:43
virtual void updateThumb(void)=0
update the size and location of the thumb to properly represent the current state of the scroll bar
virtual float getAdjustDirectionFromPoint(const Vector2f &pt) const =0
Given window location pt, return a value indicating what change should be made to the scroll bar.
virtual float getValueFromThumb(void) const =0
return value that best represents current scroll bar position given the current location of the thumb...
Base scroll bar class.
Definition widgets/Scrollbar.h:90
void setScrollPosition(float position)
Set the current position of scroll bar within the document.
static const String DecreaseButtonName
Widget name for the decrease button component.
Definition widgets/Scrollbar.h:127
void setUnitIntervalScrollPosition(float position)
set the current scroll position as a value in the interval [0, 1]
static const String WidgetTypeName
Window factory name.
Definition widgets/Scrollbar.h:93
bool handleThumbTrackStarted(const EventArgs &e)
handler function for when thumb tracking begins
void setPageSize(float page_size)
Set the page size for this scroll bar.
bool d_endLockPosition
whether 'end lock' mode is enabled.
Definition widgets/Scrollbar.h:554
virtual void onMouseButtonDown(MouseEventArgs &e)
Handler called when a mouse button has been depressed within this window's area.
bool isEndLockEnabled() const
Returns whether the 'end lock'mode for the scrollbar is enabled.
static const String EventScrollConfigChanged
Definition widgets/Scrollbar.h:120
void setEndLockEnabled(const bool enabled)
Enable or disable the 'end lock' mode for the scrollbar.
static const String EventNamespace
Namespace for global events.
Definition widgets/Scrollbar.h:96
virtual void onMouseWheel(MouseEventArgs &e)
Handler called when the mouse wheel (z-axis) position changes within this window's area.
float getUnitIntervalScrollPosition() const
return the current scroll position as a value in the interval [0, 1]
float getMaxScrollPosition() const
return the max allowable scroll position value
bool setScrollPosition_impl(const float position)
void setConfig(const float *const document_size, const float *const page_size, const float *const step_size, const float *const overlap_size, const float *const position)
Sets multiple scrollbar configuration parameters simultaneously.
float d_stepSize
Step size used for increase / decrease button clicks.
Definition widgets/Scrollbar.h:548
static const String IncreaseButtonName
Widget name for the increase button component.
Definition widgets/Scrollbar.h:125
float getDocumentSize(void) const
Return the size of the document or data.
Definition widgets/Scrollbar.h:145
bool handleDecreaseClicked(const EventArgs &e)
handler function for when the decrease button is clicked.
static const String EventScrollPositionChanged
Definition widgets/Scrollbar.h:102
float getValueFromThumb(void) const
return value that best represents current scroll bar position given the current location of the thumb...
void setOverlapSize(float overlap_size)
Set the overlap size for this scroll bar.
Thumb * getThumb() const
Return a pointer to the Thumb component widget for this Scrollbar.
static const String EventThumbTrackStarted
Definition widgets/Scrollbar.h:108
float d_documentSize
The size of the document / data being scrolled thorugh.
Definition widgets/Scrollbar.h:544
PushButton * getIncreaseButton() const
Return a pointer to the 'increase' PushButtoncomponent widget for this Scrollbar.
virtual void onScrollConfigChanged(WindowEventArgs &e)
Handler triggered when the scroll bar data configuration changes.
void updateThumb(void)
update the size and location of the thumb to properly represent the current state of the scroll bar
void initialiseComponents(void)
Initialises the Window based object ready for use.
virtual void onThumbTrackStarted(WindowEventArgs &e)
Handler triggered when the user begins to drag the scroll bar thumb.
PushButton * getDecreaseButton() const
Return a pointer to the 'decrease' PushButton component widget for this Scrollbar.
static const String ThumbName
Widget name for the thumb component.
Definition widgets/Scrollbar.h:123
float getOverlapSize(void) const
Return the overlap size for this scroll bar.
Definition widgets/Scrollbar.h:267
virtual bool validateWindowRenderer(const WindowRenderer *renderer) const
validate window renderer
bool handleIncreaseClicked(const EventArgs &e)
handler function for when the increase button is clicked.
float getStepSize(void) const
Return the step size for this scroll bar.
Definition widgets/Scrollbar.h:226
bool isAtEnd() const
return whether the current scroll position is at the end of the range.
void scrollForwardsByPage()
move scroll position forwards by a page (uses appropriate overlap)
void setStepSize(float step_size)
Set the step size for this scroll bar.
void scrollForwardsByStep()
move scroll position forwards by the current step size
static const String EventThumbTrackEnded
Definition widgets/Scrollbar.h:114
float getAdjustDirectionFromPoint(const Vector2f &pt) const
Given window location pt, return a value indicating what change should be made to the scroll bar.
float d_position
Current scroll position.
Definition widgets/Scrollbar.h:552
void setDocumentSize(float document_size)
Set the size of the document or data.
float d_overlapSize
Amount of overlap when jumping by a page.
Definition widgets/Scrollbar.h:550
bool handleThumbMoved(const EventArgs &e)
handler function for when thumb moves.
virtual void onScrollPositionChanged(WindowEventArgs &e)
Handler triggered when the scroll position changes.
void scrollBackwardsByStep()
move scroll position backwards by the current step size
float getPageSize(void) const
Return the page size for this scroll bar.
Definition widgets/Scrollbar.h:185
bool handleThumbTrackEnded(const EventArgs &e)
handler function for when thumb tracking begins
virtual void onThumbTrackEnded(WindowEventArgs &e)
Handler triggered when the scroll bar thumb is released.
void scrollBackwardsByPage()
move scroll position backwards by a page (uses appropriate overlap)
float d_pageSize
The size of a single 'page' of data.
Definition widgets/Scrollbar.h:546
float getScrollPosition(void) const
Return the current position of scroll bar within the document.
Definition widgets/Scrollbar.h:307
String class used within the GUI system.
Definition String.h:64
Base class for Thumb widget.
Definition Thumb.h:56
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition InputEvent.h:252
Base-class for the assignable WindowRenderer object.
Definition WindowRenderer.h:52
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition Window.h:151
Main namespace for Crazy Eddie's GUI Library.
Definition arch_overview.dox:1