3 * Copyright (C) 2016-2020 William Morrow
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published
7 * by 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, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 #ifndef __SHBTNPREFS_H__
22 #define __SHBTNPREFS_H__
24 #include "arraylist.h"
25 #include "bcwindowbase.h"
28 #include "bclistbox.h"
29 #include "bclistboxitem.h"
30 #include "preferences.inc"
31 #include "preferencesthread.inc"
33 #include "shbtnprefs.inc"
36 class ShBtnRun : public Thread
41 char commands[BCTEXTLEN];
42 ArrayList<char *> argv;
43 void add_arg(const char *v);
45 ShBtnRun(const char *name, const char *cmds, int warn);
54 char commands[BCTEXTLEN];
57 void execute(ArrayList<Indexable*> &args);
59 ShBtnPref(const char *nm, const char *cmds, int warn=0, int run_script=0);
63 class ShBtnEditDialog : public BC_DialogThread
66 PreferencesWindow *pwindow;
68 ShBtnEditWindow *sb_window;
70 void handle_close_event(int result);
72 ShBtnEditDialog(PreferencesWindow *pwindow);
77 class ShBtnAddButton : public BC_GenericButton {
79 ShBtnEditWindow *sb_window;
82 ShBtnAddButton(ShBtnEditWindow *sb_window, int x, int y);
86 class ShBtnDelButton : public BC_GenericButton {
88 ShBtnEditWindow *sb_window;
91 ShBtnDelButton(ShBtnEditWindow *sb_window, int x, int y);
95 class ShBtnEditButton : public BC_GenericButton {
97 ShBtnEditWindow *sb_window;
101 ShBtnEditButton(ShBtnEditWindow *sb_window, int x, int y);
105 class ShBtnTextDialog : public BC_DialogThread
108 ShBtnEditWindow *sb_window;
109 ShBtnTextWindow *st_window;
112 BC_Window* new_gui();
113 void handle_close_event(int result);
114 int start_edit(ShBtnPref *pref);
116 ShBtnTextDialog(ShBtnEditWindow *sb_window);
120 class ShBtnTextOK : public BC_OKButton
123 ShBtnTextWindow *st_window;
126 ShBtnTextOK(ShBtnTextWindow *st_window, int x, int y);
130 class ShBtnErrWarnItem : public BC_MenuItem
133 ShBtnErrWarnItem(ShBtnErrWarn *popup, const char *text, int warn);
141 class ShBtnErrWarn : public BC_PopupMenu
144 ShBtnErrWarn(ShBtnTextWindow *st_window, int x, int y);
147 void create_objects();
150 ShBtnTextWindow *st_window;
153 class ShBtnRunScript : public BC_CheckBox
156 ShBtnRunScript(ShBtnTextWindow *st_window, int x, int y);
159 ShBtnTextWindow *st_window;
162 class ShBtnTextWindow : public BC_Window
165 BC_TextBox *cmd_name;
166 BC_ScrollTextBox *cmd_text;
167 ShBtnEditWindow *sb_window;
168 ShBtnErrWarn *st_err_warn;
169 ShBtnRunScript *st_run_script;
173 void create_objects();
175 ShBtnTextWindow(ShBtnEditWindow *sb_window, int x, int y);
179 class ShBtnPrefItem : public BC_ListBoxItem {
183 ShBtnPrefItem(ShBtnPref *item);
187 class ShBtnPrefList : public BC_ListBox
190 ShBtnEditWindow *sb_window;
193 ShBtnPrefList(ShBtnEditWindow *sb_window, int x, int y);
197 class ShBtnEditWindow : public BC_Window
200 ShBtnAddButton *add_button;
201 ShBtnDelButton *del_button;
202 ShBtnEditButton *edit_button;
203 ShBtnTextDialog *sb_dialog;
204 ArrayList<BC_ListBoxItem *> shbtn_items;
205 ShBtnPrefList *op_list;
207 void create_objects();
209 int start_edit(ShBtnPref *pref);
211 ShBtnEditWindow(ShBtnEditDialog *shbtn_edit, int x, int y);
214 ShBtnEditDialog *shbtn_edit;
217 class MainShBtnItem : public BC_MenuItem
220 MainShBtnItem(MainShBtns *shbtns, ShBtnPref *pref);
227 class MainShBtns : public BC_PopupMenu
230 MainShBtns(MWindow *mwindow, int x, int y);
231 int load(Preferences *preferences);