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
32 #define SCROLL_STRETCH 2
34 // Selection identifiers
35 #define SCROLL_HANDLE 1
36 #define SCROLL_BACKPAGE 2
37 #define SCROLL_FWDPAGE 3
38 #define SCROLL_BACKARROW 4
39 #define SCROLL_FWDARROW 5
42 #define SCROLL_HANDLE_UP 0
43 #define SCROLL_HANDLE_HI 1
44 #define SCROLL_HANDLE_DN 2
45 #define SCROLL_HANDLE_BG 3
46 #define SCROLL_BACKARROW_UP 4
47 #define SCROLL_BACKARROW_HI 5
48 #define SCROLL_BACKARROW_DN 6
49 #define SCROLL_FWDARROW_UP 7
50 #define SCROLL_FWDARROW_HI 8
51 #define SCROLL_FWDARROW_DN 9
52 #define SCROLL_IMAGES 10
62 class BC_ScrollBar : public BC_SubWindow
65 BC_ScrollBar(int x, int y, int orientation, int pixels, int64_t length,
66 int64_t position, int64_t handlelength, VFrame **data = 0);
67 virtual ~BC_ScrollBar();
69 friend class BC_ListBox;
70 friend class BC_ScrollTextBox;
72 virtual int handle_event() { return 0; };
74 int cursor_motion_event();
75 int cursor_leave_event();
76 int cursor_enter_event();
77 int button_press_event();
78 int button_release_event();
79 int repeat_event(int64_t repeat_id);
81 int64_t get_position();
83 int64_t get_handlelength();
85 void set_images(VFrame **data);
87 int update_value(int64_t value);
88 int update_length(int64_t length, int64_t position, int64_t handlelength, int flush);
89 int reposition_window(int x, int y, int pixels);
91 static int get_span(int orientation);
92 int get_arrow_pixels();
94 void calculate_dimensions(int &w, int &h);
97 void get_handle_dimensions();
98 int get_cursor_zone(int cursor_x, int cursor_y);
100 int64_t length, position, handlelength; // handle position and size
101 int selection_status, highlight_status;
102 int orientation, pixels, stretch;
103 int handle_pixel, handle_pixels;
104 int min_pixel, max_pixel;
105 int64_t repeat_count;
106 // Don't deactivate if bound to another tool
107 BC_WindowBase *bound_to;
109 BC_Pixmap *images[SCROLL_IMAGES];