version update, bld tweaks, resize track booby, 10fps for images
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcbutton.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 BCBUTTON_H
23 #define BCBUTTON_H
24
25 #include "bcbitmap.inc"
26 #include "bcsubwindow.h"
27 #include "vframe.inc"
28
29 #include <stdint.h>
30
31 #define BUTTON_UP 0
32 #define BUTTON_UPHI 1
33 #define BUTTON_DOWNHI 2
34
35 class BC_Button : public BC_SubWindow
36 {
37 public:
38         BC_Button(int x, int y, VFrame **data);
39         BC_Button(int x, int y, int w, VFrame **data);
40         virtual ~BC_Button();
41
42         friend class BC_GenericButton;
43
44         virtual int handle_event() { return 0; };
45         int repeat_event(int64_t repeat_id);
46         virtual int draw_face(int flash = 1);
47         void disable();
48         void enable();
49
50         int initialize();
51         virtual int set_images(VFrame **data);
52         int cursor_enter_event();
53         int cursor_leave_event();
54         int button_press_event();
55         virtual int button_release_event();
56         virtual int cursor_motion_event();
57         int update_bitmaps(VFrame **data);
58         int reposition_window(int x, int y);
59         void set_underline(int number);
60         int get_status();
61
62
63 private:
64
65         BC_Pixmap *images[3];
66         VFrame **data;
67         int status;
68         int w_argument;
69         int underline_number;
70         int enabled;
71 };
72
73
74
75
76 class BC_GenericButton : public BC_Button
77 {
78 public:
79         BC_GenericButton(int x, int y,
80                 const char *text, VFrame **data = 0, int color=-1);
81         BC_GenericButton(int x, int y, int w,
82                 const char *text, VFrame **data = 0, int color=-1);
83         int set_images(VFrame **data);
84         void text_color(int color);
85         int draw_face(int flash = 1);
86         static int calculate_w(BC_WindowBase *gui, const char *text);
87         static int calculate_h();
88         const char *get_text () { return text; }
89 private:
90         int color;
91         char text[BCTEXTLEN];
92 };
93
94 class BC_OKTextButton : public BC_GenericButton
95 {
96 public:
97         BC_OKTextButton(BC_WindowBase *parent_window);
98         virtual int resize_event(int w, int h);
99         virtual int handle_event();
100         virtual int keypress_event();
101         BC_WindowBase *parent_window;
102 };
103
104 class BC_CancelTextButton : public BC_GenericButton
105 {
106 public:
107         BC_CancelTextButton(BC_WindowBase *parent_window);
108         virtual int resize_event(int w, int h);
109         virtual int handle_event();
110         virtual int keypress_event();
111         BC_WindowBase *parent_window;
112 };
113
114 class BC_OKButton : public BC_Button
115 {
116 public:
117         BC_OKButton(int x, int y);
118         BC_OKButton(BC_WindowBase *parent_window);
119         BC_OKButton(BC_WindowBase *parent_window, VFrame **images);
120         static int calculate_h();
121         static int calculate_w();
122         virtual int resize_event(int w, int h);
123         virtual int handle_event();
124         virtual int keypress_event();
125 };
126
127 class BC_CancelButton : public BC_Button
128 {
129 public:
130         BC_CancelButton(int x, int y);
131         BC_CancelButton(BC_WindowBase *parent_window);
132         BC_CancelButton(BC_WindowBase *parent_window, VFrame **images);
133         static int calculate_h();
134         static int calculate_w();
135         virtual int resize_event(int w, int h);
136         virtual int handle_event();
137         virtual int keypress_event();
138 };
139
140 #endif