]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/preferences_widgets.h
Improvements to preferences
[vlc] / modules / gui / wxwindows / preferences_widgets.h
1 /*****************************************************************************
2  * preferences_widgets.h : wxWindows plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000-2003 VideoLAN
5  * $Id$
6  *
7  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #include <vector>
25
26 class ConfigControl: public wxPanel
27 {
28 public:
29     ConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
30     ~ConfigControl();
31     wxSizer *Sizer();
32
33     virtual int GetIntValue() {return 0;}
34     virtual float GetFloatValue() {return 0;}
35     virtual wxString GetPszValue() {return wxString();}
36
37     wxString GetName();
38     int GetType();
39     vlc_bool_t IsAdvanced();
40
41     void SetUpdateCallback( void (*)( void * ), void * );
42
43 protected:
44     wxBoxSizer *sizer;
45     wxStaticText *label;
46     vlc_object_t *p_this;
47
48     void (*pf_update_callback)( void * );
49     void *p_update_data;
50
51     void OnUpdate( wxCommandEvent& );
52
53 private:
54     wxString name;
55     int i_type;
56     vlc_bool_t b_advanced;
57 };
58
59 ConfigControl *CreateConfigControl( vlc_object_t *,
60                                     module_config_t *, wxWindow * );
61
62 class KeyConfigControl: public ConfigControl
63 {
64 public:
65     KeyConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
66     ~KeyConfigControl();
67     virtual int GetIntValue();
68 private:
69     wxCheckBox *alt;
70     wxCheckBox *ctrl;
71     wxCheckBox *shift;
72     wxComboBox *combo;
73     // Array of key descriptions, for the ComboBox
74     static wxString *m_keysList;
75 };
76
77 class ModuleConfigControl: public ConfigControl
78 {
79 public:
80     ModuleConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
81     ~ModuleConfigControl();
82     virtual wxString GetPszValue();
83 private:
84     wxComboBox *combo;
85 };
86
87 struct moduleCheckBox {
88     wxCheckBox *checkbox;
89     char *psz_module;
90 };
91
92 class ModuleListCatConfigControl: public ConfigControl
93 {
94 public:
95     ModuleListCatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
96     ~ModuleListCatConfigControl();
97     virtual wxString GetPszValue();
98 private:
99     std::vector<moduleCheckBox *> pp_checkboxes;
100
101     void OnUpdate( wxCommandEvent& );
102     
103     wxTextCtrl *text;
104     DECLARE_EVENT_TABLE()
105 };
106
107 ;
108
109 class StringConfigControl: public ConfigControl
110 {
111 public:
112     StringConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
113     ~StringConfigControl();
114     virtual wxString GetPszValue();
115 private:
116     wxTextCtrl *textctrl;
117
118     DECLARE_EVENT_TABLE()
119 };
120
121 class StringListConfigControl: public ConfigControl
122 {
123 public:
124     StringListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
125     ~StringListConfigControl();
126     virtual wxString GetPszValue();
127 private:
128     wxComboBox *combo;
129     char *psz_default_value;
130     void UpdateCombo( module_config_t *p_item );
131
132     void OnAction( wxCommandEvent& );
133
134     DECLARE_EVENT_TABLE()
135 };
136
137 class FileConfigControl: public ConfigControl
138 {
139 public:
140     FileConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
141     ~FileConfigControl();
142     void OnBrowse( wxCommandEvent& );
143     virtual wxString GetPszValue();
144 private:
145     wxTextCtrl *textctrl;
146     wxButton *browse;
147     bool directory;
148
149     DECLARE_EVENT_TABLE()
150 };
151
152 class IntegerConfigControl: public ConfigControl
153 {
154 public:
155     IntegerConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
156     ~IntegerConfigControl();
157     virtual int GetIntValue();
158 private:
159     wxSpinCtrl *spin;
160     int i_value;
161
162     void OnUpdate( wxCommandEvent& );
163
164     DECLARE_EVENT_TABLE()
165 };
166
167 class IntegerListConfigControl: public ConfigControl
168 {
169 public:
170     IntegerListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
171     ~IntegerListConfigControl();
172     virtual int GetIntValue();
173 private:
174     wxComboBox *combo;
175     void UpdateCombo( module_config_t *p_item );
176
177     void OnAction( wxCommandEvent& );
178
179     DECLARE_EVENT_TABLE()
180 };
181
182 class RangedIntConfigControl: public ConfigControl
183 {
184 public:
185     RangedIntConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
186     ~RangedIntConfigControl();
187     virtual int GetIntValue();
188 private:
189     wxSlider *slider;
190
191     DECLARE_EVENT_TABLE()
192 };
193
194 class FloatConfigControl: public ConfigControl
195 {
196 public:
197     FloatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
198     ~FloatConfigControl();
199     virtual float GetFloatValue();
200 private:
201     wxTextCtrl *textctrl;
202
203     DECLARE_EVENT_TABLE()
204 };
205
206 class BoolConfigControl: public ConfigControl
207 {
208 public:
209     BoolConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
210     ~BoolConfigControl();
211     virtual int GetIntValue();
212 private:
213     wxCheckBox *checkbox;
214
215     DECLARE_EVENT_TABLE()
216 };
217
218 class SectionConfigControl: public ConfigControl
219 {
220 public:
221     SectionConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
222     ~SectionConfigControl();
223 };