00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef header_scrollbar_generic
00010 #define header_scrollbar_generic
00011
00012 #include <API/Core/System/timer.h>
00013 #include <API/Display/Input/key.h>
00014 #include <API/Core/Math/rect.h>
00015 #include <API/signals.h>
00016
00017 class CL_ScrollBar;
00018 class CL_Button;
00019 class CL_InputDevice;
00020 class CL_Component;
00021 class CL_ComponentOptions;
00022 class CL_StyleManager;
00023
00024 class CL_ScrollBar_Generic
00025 {
00026
00027 public:
00028 static CL_ComponentOptions create_options(
00029 const CL_Rect &pos,
00030 int min,
00031 int max,
00032 int value,
00033 bool orientation,
00034 bool tracking);
00035
00036 CL_ScrollBar_Generic(CL_ScrollBar *self, const CL_ComponentOptions &options, CL_StyleManager *style);
00037 ~CL_ScrollBar_Generic() {};
00038
00039
00040 public:
00041 int get_range() const;
00042
00043 CL_Component *client_area;
00044
00045 int min_value;
00046 int max_value;
00047 int cur_value;
00048
00049 bool tracking;
00050 bool vertical;
00051 bool fixed_length;
00052
00053 bool dragging;
00054 CL_Rect rect_slider;
00055 int slider_length;
00056
00057
00058 public:
00059 void set_vertical(bool enable);
00060 void set_min_value(int value);
00061 void set_max_value(int value);
00062 void set_value(int value);
00063
00064
00065 public:
00066 CL_Signal_v1<int> sig_value_changed;
00067 CL_Signal_v0 sig_slider_pressed;
00068 CL_Signal_v1<int> sig_slider_moved;
00069 CL_Signal_v0 sig_slider_released;
00070
00071
00072 private:
00073 CL_Slot slot_timer;
00074 CL_Slot slot_keydown, slot_keyup, slot_mousemove;
00075 CL_Slot slot_resize;
00076 CL_Slot slot_button_decrease, slot_button_increase;
00077 CL_Slot slot_child_add, slot_child_remove;
00078
00079
00080 private:
00081 void on_child_add(CL_Component *child);
00082 void on_child_remove(CL_Component *child);
00083 void on_key_down(CL_Component *comp, CL_InputDevice *device, CL_Key key);
00084 void on_key_up(CL_Component *comp, CL_InputDevice *device, CL_Key key);
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 private:
00095 void calculate_slider_size();
00096
00097 CL_ScrollBar *scrollbar;
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 bool initialized;
00114 };
00115
00116 #endif