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
22 #ifndef PREFERENCESTHREAD_H
23 #define PREFERENCESTHREAD_H
29 #include "mwindow.inc"
31 #include "preferences.inc"
32 #include "preferencesthread.inc"
35 class PreferencesMenuitem : public BC_MenuItem
38 PreferencesMenuitem(MWindow *mwindow);
39 ~PreferencesMenuitem();
44 PreferencesThread *thread;
47 class PreferencesThread : public BC_DialogThread
50 PreferencesThread(MWindow *mwindow);
54 void handle_close_event(int result);
55 // update rendering rates
57 // update playback rate
58 int update_framerate();
60 const char* category_to_text(int category);
61 int text_to_category(const char *category);
75 PreferencesWindow *window;
77 // Copy of mwindow preferences
78 Preferences *preferences;
95 class PreferencesDialog : public BC_SubWindow
98 PreferencesDialog(MWindow *mwindow, PreferencesWindow *pwindow);
99 virtual ~PreferencesDialog();
101 virtual void create_objects() {}
102 // update playback rate
103 virtual int draw_framerate(int flush) { return 0; }
104 // update rendering rates
105 virtual void update_rates() {}
106 virtual int show_window(int flush) { return BC_SubWindow::show_window(flush); }
108 PreferencesWindow *pwindow;
110 Preferences *preferences;
113 class PreferencesCategory;
114 class PreferencesButton;
116 class PreferencesWindow : public BC_Window
119 PreferencesWindow(MWindow *mwindow,
120 PreferencesThread *thread,
121 int x, int y, int w, int h);
122 ~PreferencesWindow();
124 void create_objects();
125 int delete_current_dialog();
126 int set_current_dialog(int number);
127 int update_framerate();
129 void confirm_update(const char *reason, int close);
130 void show_dialog() { dialog->show_window(0); }
132 PreferencesThread *thread;
133 ArrayList<BC_ListBoxItem*> categories;
134 PreferencesCategory *category;
135 PreferencesButton *category_button[CATEGORIES];
136 PreferencesDialog *dialog;
137 PreferencesConfirmDialog *confirm_dialog;
140 class PreferencesButton : public BC_GenericButton
143 PreferencesButton(MWindow *mwindow,
144 PreferencesThread *thread,
154 PreferencesThread *thread;
158 class PreferencesCategory : public BC_PopupTextBox
161 PreferencesCategory(MWindow *mwindow, PreferencesThread *thread, int x, int y);
162 ~PreferencesCategory();
165 PreferencesThread *thread;
168 class PreferencesApply : public BC_GenericButton
171 PreferencesApply(MWindow *mwindow, PreferencesThread *thread);
173 int resize_event(int w, int h);
175 PreferencesThread *thread;
178 class PreferencesOK : public BC_GenericButton
181 PreferencesOK(MWindow *mwindow, PreferencesThread *thread);
183 int keypress_event();
185 int resize_event(int w, int h);
187 PreferencesThread *thread;
188 PreferencesConfirmDialog *confirm_dialog;
191 class PreferencesConfirmDialog : public BC_DialogThread
194 PreferencesConfirmDialog(PreferencesThread *thread,
195 const char *reason, int close);
196 ~PreferencesConfirmDialog();
197 BC_Window *new_gui();
198 void handle_done_event(int result);
200 PreferencesThread *thread;
201 PreferencesConfirmWindow *qwindow;
202 char query[BCTEXTLEN];
206 class PreferencesConfirmWindow : public QuestionWindow
209 PreferencesConfirmWindow(PreferencesConfirmDialog *dialog);
210 ~PreferencesConfirmWindow();
212 PreferencesConfirmDialog *dialog;
216 class PreferencesCancel : public BC_GenericButton
219 PreferencesCancel(MWindow *mwindow, PreferencesThread *thread);
220 int keypress_event();
222 int resize_event(int w, int h);
224 PreferencesThread *thread;