00001 #ifndef SLIDER_CLASS
00002 #define SLIDER_CLASS
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "dll_wp_active.h"
00026
00027 #include <basis/istring.h>
00028 #include <wp_passive/worker.h>
00029
00030 enum slider_orientation { HORIZONTAL_SLIDER, VERTICAL_SLIDER };
00031
00032 class WP_ACTIVE_CLASS_STYLE slider : public worker
00033 {
00034 public:
00035 slider(manager &parent, const c_point &origin, const char *name,
00036 slider_orientation h_or_v, double minValue, double maxValue,
00037 double granularity = 0.0, const color &foreground = colors::WHITE,
00038 const color &background = colors::BLACK);
00039
00040
00041
00042
00043
00044
00045 ~slider();
00046
00047 IMPLEMENT_CLASS_NAME("slider");
00048
00049 double value();
00050 void value(double value, bool trigger_event = true);
00051
00052
00053
00054 virtual void slider_moved_event(double value);
00055
00056
00057
00058 static void slider_callback(window_handle w, slider *the_slider,
00059 XmScaleCallbackStruct *call_data);
00060 static void less_arrow_callback(window_handle w, slider *the_slider,
00061 XmAnyCallbackStruct *call_data);
00062 static void more_arrow_callback(window_handle w, slider *the_slider,
00063 XmAnyCallbackStruct *call_data);
00064
00065 private:
00066 window_handle maximum_Arrow;
00067 window_handle minimum_Arrow;
00068 window_handle slider_w;
00069 istring maximum_ArrowName;
00070 istring minimum_ArrowName;
00071 istring sliderName;
00072
00073 double current_value;
00074 double minimum_value;
00075 double maximum_value;
00076 double granularity;
00077
00078 window_handle create_holder
00079 (window_handle parent, const char *name, slider_orientation h_or_v);
00080
00081 window_handle create_slider(window_handle parent, const char *name,
00082 slider_orientation h_or_v, int minimum_value, int maximum_Value);
00083
00084 void check_value(double value);
00085
00086 double round_to_granularity
00087 (double unrounded, double minimum_value, double granularity);
00088
00089 int real_orientation(slider_orientation to_translate);
00090 };
00091
00092 #endif