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);
74 PreferencesWindow *window;
76 // Copy of mwindow preferences
77 Preferences *preferences;
94 class PreferencesDialog : public BC_SubWindow
97 PreferencesDialog(MWindow *mwindow, PreferencesWindow *pwindow);
98 virtual ~PreferencesDialog();
100 virtual void create_objects() {}
101 // update playback rate
102 virtual int draw_framerate(int flush) { return 0; }
103 // update rendering rates
104 virtual void update_rates() {}
105 virtual int show_window(int flush) { return BC_SubWindow::show_window(flush); }
107 PreferencesWindow *pwindow;
109 Preferences *preferences;
112 class PreferencesCategory;
113 class PreferencesButton;
115 class PreferencesWindow : public BC_Window
118 PreferencesWindow(MWindow *mwindow,
119 PreferencesThread *thread,
120 int x, int y, int w, int h);
121 ~PreferencesWindow();
123 void create_objects();
124 int delete_current_dialog();
125 int set_current_dialog(int number);
126 int update_framerate();
128 void confirm_update(const char *reason, int close);
129 void show_dialog() { dialog->show_window(0); }
131 PreferencesThread *thread;
132 ArrayList<BC_ListBoxItem*> categories;
133 PreferencesCategory *category;
134 PreferencesButton *category_button[CATEGORIES];
135 PreferencesDialog *dialog;
136 PreferencesConfirmDialog *confirm_dialog;
139 class PreferencesButton : public BC_GenericButton
142 PreferencesButton(MWindow *mwindow,
143 PreferencesThread *thread,
153 PreferencesThread *thread;
157 class PreferencesCategory : public BC_PopupTextBox
160 PreferencesCategory(MWindow *mwindow, PreferencesThread *thread, int x, int y);
161 ~PreferencesCategory();
164 PreferencesThread *thread;
167 class PreferencesApply : public BC_GenericButton
170 PreferencesApply(MWindow *mwindow, PreferencesThread *thread);
172 int resize_event(int w, int h);
174 PreferencesThread *thread;
177 class PreferencesOK : public BC_GenericButton
180 PreferencesOK(MWindow *mwindow, PreferencesThread *thread);
182 int keypress_event();
184 int resize_event(int w, int h);
186 PreferencesThread *thread;
187 PreferencesConfirmDialog *confirm_dialog;
190 class PreferencesConfirmDialog : public BC_DialogThread
193 PreferencesConfirmDialog(PreferencesThread *thread,
194 const char *reason, int close);
195 ~PreferencesConfirmDialog();
196 BC_Window *new_gui();
197 void handle_done_event(int result);
199 PreferencesThread *thread;
200 PreferencesConfirmWindow *qwindow;
201 char query[BCTEXTLEN];
205 class PreferencesConfirmWindow : public QuestionWindow
208 PreferencesConfirmWindow(PreferencesConfirmDialog *dialog);
209 ~PreferencesConfirmWindow();
211 PreferencesConfirmDialog *dialog;
215 class PreferencesCancel : public BC_GenericButton
218 PreferencesCancel(MWindow *mwindow, PreferencesThread *thread);
219 int keypress_event();
221 int resize_event(int w, int h);
223 PreferencesThread *thread;