00001 #ifndef BCSCROLLBAR_H
00002 #define BCSCROLLBAR_H
00003
00004 #include "bclistbox.inc"
00005 #include "bcsubwindow.h"
00006
00007
00008 #define SCROLL_HORIZ 0
00009 #define SCROLL_VERT 1
00010
00011
00012 #define SCROLL_HANDLE 1
00013 #define SCROLL_BACKPAGE 2
00014 #define SCROLL_FWDPAGE 3
00015 #define SCROLL_BACKARROW 4
00016 #define SCROLL_FWDARROW 5
00017
00018
00019 #define SCROLL_HANDLE_UP 0
00020 #define SCROLL_HANDLE_HI 1
00021 #define SCROLL_HANDLE_DN 2
00022 #define SCROLL_HANDLE_BG 3
00023 #define SCROLL_BACKARROW_UP 4
00024 #define SCROLL_BACKARROW_HI 5
00025 #define SCROLL_BACKARROW_DN 6
00026 #define SCROLL_FWDARROW_UP 7
00027 #define SCROLL_FWDARROW_HI 8
00028 #define SCROLL_FWDARROW_DN 9
00029 #define SCROLL_IMAGES 10
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 class BC_ScrollBar : public BC_SubWindow
00040 {
00041 public:
00042 BC_ScrollBar(int x,
00043 int y,
00044 int orientation,
00045 int pixels,
00046 int64_t length,
00047 int64_t position,
00048 int64_t handlelength,
00049 VFrame **data = 0);
00050 virtual ~BC_ScrollBar();
00051
00052 friend class BC_ListBox;
00053
00054 virtual int handle_event() { return 0; };
00055 int initialize();
00056 int cursor_motion_event();
00057 int cursor_leave_event();
00058 int cursor_enter_event();
00059 int button_press_event();
00060 int button_release_event();
00061 int repeat_event(int64_t repeat_id);
00062 int64_t get_value();
00063 int64_t get_position();
00064 int64_t get_length();
00065 int64_t get_handlelength();
00066 int get_pixels();
00067 void set_images(VFrame **data);
00068 int in_use();
00069 int update_value(int64_t value);
00070 int update_length(int64_t length, int64_t position, int64_t handlelength);
00071 int reposition_window(int x, int y, int pixels);
00072 int get_span();
00073 static int get_span(int orientation);
00074 int get_arrow_pixels();
00075
00076 private:
00077 void calculate_dimensions(int &w, int &h);
00078 int activate();
00079 void draw();
00080 void get_handle_dimensions();
00081 int get_cursor_zone(int cursor_x, int cursor_y);
00082
00083 int64_t length, position, handlelength;
00084 int selection_status, highlight_status;
00085 int orientation, pixels;
00086 int handle_pixel, handle_pixels;
00087 int min_pixel, max_pixel;
00088 int64_t repeat_count;
00089
00090 BC_WindowBase *bound_to;
00091 VFrame **data;
00092 BC_Pixmap *images[SCROLL_IMAGES];
00093 };
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 #endif