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 "bcbitmap.inc"
26 #include "bcsubwindow.h"
33 #define BUTTON_DOWNHI 2
35 class BC_Button : public BC_SubWindow
38 BC_Button(int x, int y, VFrame **data);
39 BC_Button(int x, int y, int w, VFrame **data);
42 friend class BC_GenericButton;
44 virtual int handle_event() { return 0; };
45 int repeat_event(int64_t repeat_id);
46 virtual int draw_face(int flash = 1);
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);
76 class BC_GenericButton : public BC_Button
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; }
94 class BC_OKTextButton : public BC_GenericButton
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;
104 class BC_CancelTextButton : public BC_GenericButton
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;
114 class BC_OKButton : public BC_Button
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();
127 class BC_CancelButton : public BC_Button
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();