scrollbar.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SCROLLBAR_H
00022 #define SCROLLBAR_H
00023
00024 #include "widget.h"
00025
00026 namespace cwidget
00027 {
00028 namespace widgets
00029 {
00030 class scrollbar : public widget
00031 {
00032 public:
00033 enum direction {HORIZONTAL, VERTICAL};
00034
00035 private:
00036 direction dir;
00037
00038 int max, val;
00039
00040
00045 int get_slider();
00046 protected:
00047 scrollbar(direction _dir, int _val, int _max)
00048 :dir(_dir), max(_max), val(_val) {}
00049
00050 scrollbar(direction _dir)
00051 :dir(_dir), max(0), val(0) {}
00052 public:
00053 static
00054 util::ref_ptr<scrollbar> create(direction dir, int val, int max)
00055 {
00056 util::ref_ptr<scrollbar> rval(new scrollbar(dir, val, max));
00057 rval->decref();
00058 return rval;
00059 }
00060
00061 static
00062 util::ref_ptr<scrollbar> create(direction dir)
00063 {
00064 util::ref_ptr<scrollbar> rval(new scrollbar(dir));
00065 rval->decref();
00066 return rval;
00067 }
00068
00069 void paint(const style &st);
00070
00071 int width_request();
00072 int height_request(int w);
00073
00074 bool get_cursorvisible();
00075 point get_cursorloc();
00076 void dispatch_mouse(short id, int x, int y, int z, mmask_t bstate);
00077
00078 void set_slider(int newval, int newmax);
00079
00084 sigc::signal1<void, bool> scrollbar_interaction;
00085 };
00086
00087 typedef util::ref_ptr<scrollbar> scrollbar_ref;
00088 }
00089 }
00090
00091 #endif