3 * Copyright (C) 2008-2015 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __CRIKEYWINDOW_H__
22 #define __CRIKEYWINDOW_H__
25 #include "colorpicker.h"
32 class CriKeyColorButton;
33 class CriKeyColorPicker;
35 class CriKeyDrawModeItem;
36 class CriKeyThreshold;
46 class CriKeyNum : public BC_TumbleTextBox
51 CriKeyNum(CriKeyWindow *gui, int x, int y, float output);
54 class CriKeyPointX : public CriKeyNum
57 CriKeyPointX(CriKeyWindow *gui, int x, int y, float output)
58 : CriKeyNum(gui, x, y, output) {}
63 class CriKeyPointY : public CriKeyNum
66 CriKeyPointY(CriKeyWindow *gui, int x, int y, float output)
67 : CriKeyNum(gui, x, y, output) {}
73 class CriKeyColorButton : public BC_GenericButton
76 CriKeyColorButton(CriKeyWindow *gui, int x, int y);
82 class CriKeyColorPicker : public ColorPicker
85 CriKeyColorPicker(CriKeyColorButton *color_button);
87 void start(int color);
88 int handle_new_color(int color, int alpha);
89 void handle_done_event(int result);
91 CriKeyColorButton *color_button;
92 int color, orig_color;
95 class CriKeyDrawMode : public BC_PopupMenu
97 const char *draw_modes[DRAW_MODES];
99 CriKeyDrawMode(CriKeyWindow *gui, int x, int y);
101 void create_objects();
102 void update(int mode, int send=1);
106 class CriKeyDrawModeItem : public BC_MenuItem
109 CriKeyDrawModeItem(const char *txt, int id)
110 : BC_MenuItem(txt) { this->id = id; }
117 class CriKeyThreshold : public BC_FSlider
120 CriKeyThreshold(CriKeyWindow *gui, int x, int y, int w);
125 class CriKeyDrag : public BC_CheckBox
128 CriKeyDrag(CriKeyWindow *gui, int x, int y);
134 class CriKeyPoints : public BC_ListBox
137 CriKeyPoints(CriKeyWindow *gui, CriKey *plugin, int x, int y);
141 int selection_changed();
142 int column_resize_event();
143 ArrayList<BC_ListBoxItem*> cols[PT_SZ];
145 void new_point(const char *ep, const char *xp, const char *yp, const char *tp);
146 void del_point(int i);
147 void set_point(int i, int c, float v);
148 void set_point(int i, int c, const char *cp);
149 int set_selected(int k);
156 const char *titles[PT_SZ];
160 class CriKeyNewPoint : public BC_GenericButton
163 CriKeyNewPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
172 class CriKeyDelPoint : public BC_GenericButton
175 CriKeyDelPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
184 class CriKeyPointUp : public BC_GenericButton
187 CriKeyPointUp(CriKeyWindow *gui, int x, int y);
195 class CriKeyPointDn : public BC_GenericButton
198 CriKeyPointDn(CriKeyWindow *gui, int x, int y);
206 class CriKeyCurPoint : public BC_Title
209 CriKeyCurPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y);
218 class CriKeyWindow : public PluginClientWindow
221 CriKeyWindow(CriKey *plugin);
224 void create_objects();
225 void update_color(int color);
227 void start_color_thread();
228 int grab_event(XEvent *event);
229 void done_event(int result);
232 CriKeyThreshold *threshold;
233 CriKeyDrawMode *draw_mode;
235 CriKeyColorButton *color_button;
236 CriKeyColorPicker *color_picker;
237 int color_x, color_y;
238 BC_Title *title_x, *title_y;
239 CriKeyPointX *point_x;
240 CriKeyPointY *point_y;
241 CriKeyNewPoint *new_point;
242 CriKeyDelPoint *del_point;
243 CriKeyPointUp *point_up;
244 CriKeyPointDn *point_dn;
245 CriKeyCurPoint *cur_point;
247 float last_x, last_y;
249 CriKeyPoints *points;