remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / guicast / bcscrollbar.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef BCSCROLLBAR_H
23 #define BCSCROLLBAR_H
24
25 #include "bclistbox.inc"
26 #include "bctextbox.inc"
27 #include "bcsubwindow.h"
28
29 // Orientations
30 #define SCROLL_HORIZ 0
31 #define SCROLL_VERT  1
32
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
39
40 // Image identifiers
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
52
53
54
55
56
57
58
59
60
61 class BC_ScrollBar : public BC_SubWindow
62 {
63 public:
64         BC_ScrollBar(int x,
65                 int y,
66                 int orientation,
67                 int pixels,
68                 int64_t length,
69                 int64_t position,
70                 int64_t handlelength,
71                 VFrame **data = 0);
72         virtual ~BC_ScrollBar();
73
74         friend class BC_ListBox;
75         friend class BC_ScrollTextBox;
76
77         virtual int handle_event() { return 0; };
78         int initialize();
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);
85         int64_t get_value();
86         int64_t get_position();
87         int64_t get_length();
88         int64_t get_handlelength();
89         int get_pixels();
90         void set_images(VFrame **data);
91         int in_use();
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);
95         int get_span();
96         static int get_span(int orientation);
97         int get_arrow_pixels();
98
99 private:
100         void calculate_dimensions(int &w, int &h);
101         int activate();
102         void draw(int flush);
103         void get_handle_dimensions();
104         int get_cursor_zone(int cursor_x, int cursor_y);
105
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;
114         VFrame **data;
115         BC_Pixmap *images[SCROLL_IMAGES];
116 };
117
118
119
120
121
122
123
124
125
126 #endif