Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

scrollbar.h

Go to the documentation of this file.
00001 /*
00002         ClanGUI, copyrights by various people. Have a look in the CREDITS file.
00003         
00004         This sourcecode is distributed using the Library GNU Public Licence,
00005         version 2 or (at your option) any later version. Please read LICENSE
00006         for details.
00007 */
00008 
00010 
00011 #ifndef header_scrollbar
00012 #define header_scrollbar
00013 
00014 #include "component.h"
00015 
00016 class CL_Button;
00017 class CL_ComponentOptions;
00018 class CL_Rect;
00019 
00020 class CL_ScrollBar : public CL_Component
00021 //: ScrollBar component
00022 {
00024 public:
00025         CL_ScrollBar(
00026                 const CL_ComponentOptions &options,
00027                 CL_Component *parent,
00028                 CL_StyleManager *style = NULL);
00029 
00030         CL_ScrollBar(
00031                 const CL_Rect &pos,
00032                 int min,
00033                 int max,
00034                 bool orientation,
00035                 CL_Component *parent,
00036                 CL_StyleManager *style = NULL);
00037 
00038         virtual ~CL_ScrollBar();
00039 
00041 public:
00042         CL_Component *get_client_area() const;
00043         //: Returns the client area of the component.
00044 
00045         bool is_vertical() const;
00046         //: Returns the orientation of the scroll bar.
00047         // Return true if scrollbar is vertical, false otherwise.
00048 
00049         bool is_tracking() const;
00050         //: Returns true if tracking is enabled, or false if tracking is disabled. 
00051         // Tracking is initially enabled. See set_tracking for more info on tracking.
00052 
00053         int get_min_value() const;
00054         //: Returns the current min value.
00055 
00056         int get_max_value() const;
00057         //: Returns the current max value.
00058 
00059         int get_range() const;
00060         //: Returns the range (delta max-min).
00061 
00062         int get_value() const;
00063         //: Returns the current range control value. 
00064 
00065         bool is_dragging_slider() const;
00066         //: Returns true if the user has clicked the mouse on the slider and is currently dragging it, or false if not. 
00067 
00068         bool is_fixed_length_slider() const;
00069         //: Returns true if this is a fixed length slider, false otherwise.
00070 
00071         CL_Rect &get_slider_rect() const;
00072         //: Returns the scroll bar slider rectangle. 
00073 
00075 public:
00076         void set_fixed_length_slider(bool fixed_length = true);
00077         //: Sets the length-mode of the slider.
00078         // If fixed_length is true, the slider is constant in size. (See set_slider_length()).
00079         // If fixed_length is false, the slider is resized automatically based on the range.
00080 
00081         void set_slider_length(int length);
00082         //: Sets the current size of the slider.
00083         // Only usable in fixed-length sliders.
00084 
00085         void set_vertical(bool enable = true);
00086         //: Sets the scroll bar orientation to vertical if enable is true, horizontal otherwise.
00087 
00088         void set_tracking(bool enable = true);
00089         //: Enables scroll bar tracking if enable is true, or disables tracking if enable is false. 
00090         // If tracking is enabled (the default), the scroll bar emits the
00091         // sig_value_changed() signal while the slider is being dragged. If tracking is
00092         // disabled, the scroll bar emits the valueChanged() signal only when the user
00093         // releases the mouse button after moving the slider.
00094 
00095         void set_range(int min_value, int max_value);
00096         //: Sets the range between min_value and max_value. 
00097         // If max_value is smaller than min_value, max_value is set to min_value.
00098 
00099         void set_min_value(int value);
00100         //: Sets the range to start from value. 
00101         // If current maximum value is less than the minvalue, maxvalue is set to minvalue.
00102 
00103         void set_max_value(int value);
00104         //: Sets the range to end at value. 
00105         // If current maximum value is less than the minvalue, maxvalue is set to minvalue.
00106 
00107         void set_value(int value);
00108         //:: Sets the range controls value to value and forces it to be within the legal range. 
00109 
00110         void increase(int step = 1);
00111         //: Increases current value with step.
00112 
00113         void decrease(int step = 1);
00114         //: Decreases current value with step.
00115 
00116 /*
00117         int get_drag_offset_x() const;
00118 
00119         int get_drag_offset_y() const;
00120 
00121         const CL_Rect &get_drag_rect() const;
00122 
00123         bool is_scrolling() const;
00124 
00125         bool is_section_scrolling() const;
00126 
00127         int get_scroll_direction() const;
00128 
00129         void set_drag_offset_x(int new_offset_x);
00130 
00131         void set_drag_offset_y(int new_offset_y);
00132 
00133         void set_drag_rect(const CL_Rect &new_rect);
00134 */
00136 public:
00137         CL_Signal_v1<int> &sig_value_changed();
00138         //: This signal is emitted when the scroll bar value has changed, with the new scroll bar value as an argument. 
00139         // See set_tracking() for specifics on this signal.
00140 
00141         CL_Signal_v0 &sig_slider_pressed();
00142         //: This signal is emitted when the user presses the slider with the mouse. 
00143 
00144         CL_Signal_v1<int> &sig_slider_moved();
00145         //: This signal is emitted when the slider is moved by the user, with the new scroll bar value as an argument. 
00146         // This signal is emitted even when tracking is turned off. 
00147 
00148         CL_Signal_v0 &sig_slider_released();
00149         //: This signal is emitted when the user releases the slider with the mouse. 
00150 
00152 private:
00153         CL_ScrollBar(const CL_ScrollBar &copy) : CL_Component(NULL, NULL) { return; } // disallow copy construction.
00154         class CL_ScrollBar_Generic *impl;
00155 };
00156 
00157 #endif

Generated at Wed Apr 4 19:54:03 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001