4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "bclistbox.inc"
26 #include "bctextbox.inc"
27 #include "bcsubwindow.h"
30 #define SCROLL_HORIZ 0
33 // Selection identifiers
34 #define SCROLL_HANDLE 1
35 #define SCROLL_BACKPAGE 2
36 #define SCROLL_FWDPAGE 3
37 #define SCROLL_BACKARROW 4
38 #define SCROLL_FWDARROW 5
41 #define SCROLL_HANDLE_UP 0
42 #define SCROLL_HANDLE_HI 1
43 #define SCROLL_HANDLE_DN 2
44 #define SCROLL_HANDLE_BG 3
45 #define SCROLL_BACKARROW_UP 4
46 #define SCROLL_BACKARROW_HI 5
47 #define SCROLL_BACKARROW_DN 6
48 #define SCROLL_FWDARROW_UP 7
49 #define SCROLL_FWDARROW_HI 8
50 #define SCROLL_FWDARROW_DN 9
51 #define SCROLL_IMAGES 10
61 class BC_ScrollBar : public BC_SubWindow
72 virtual ~BC_ScrollBar();
74 friend class BC_ListBox;
75 friend class BC_ScrollTextBox;
77 virtual int handle_event() { return 0; };
79 int cursor_motion_event();
80 int cursor_leave_event();
81 int cursor_enter_event();
82 int button_press_event();
83 int button_release_event();
84 int repeat_event(int64_t repeat_id);
86 int64_t get_position();
88 int64_t get_handlelength();
90 void set_images(VFrame **data);
92 int update_value(int64_t value);
93 int update_length(int64_t length, int64_t position, int64_t handlelength, int flush);
94 int reposition_window(int x, int y, int pixels);
96 static int get_span(int orientation);
97 int get_arrow_pixels();
100 void calculate_dimensions(int &w, int &h);
102 void draw(int flush);
103 void get_handle_dimensions();
104 int get_cursor_zone(int cursor_x, int cursor_y);
106 int64_t length, position, handlelength; // handle position and size
107 int selection_status, highlight_status;
108 int orientation, pixels;
109 int handle_pixel, handle_pixels;
110 int min_pixel, max_pixel;
111 int64_t repeat_count;
112 // Don't deactivate if bound to another tool
113 BC_WindowBase *bound_to;
115 BC_Pixmap *images[SCROLL_IMAGES];