]> git.sesse.net Git - vlc/blob - modules/gui/wxwidgets/dialogs/preferences_widgets.h
Merge branch 'master' of git@git.videolan.org:vlc
[vlc] / modules / gui / wxwidgets / dialogs / preferences_widgets.h
1 /*****************************************************************************
2  * preferences_widgets.h : wxWindows plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000-2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #include <vector>
25 #include <wx/spinctrl.h>
26
27 class ConfigControl: public wxPanel
28 {
29 public:
30     ConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
31     ~ConfigControl();
32     wxSizer *Sizer();
33
34     virtual int GetIntValue() {return 0;}
35     virtual float GetFloatValue() {return 0;}
36     virtual wxString GetPszValue() {return wxString();}
37
38     wxString GetName();
39     int GetType();
40     bool IsAdvanced();
41
42     void SetUpdateCallback( void (*)( void * ), void * );
43
44 protected:
45     wxBoxSizer *sizer;
46     wxStaticText *label;
47     vlc_object_t *p_this;
48
49     void (*pf_update_callback)( void * );
50     void *p_update_data;
51
52     void OnUpdate( wxCommandEvent& event );
53     void OnUpdateScroll( wxScrollEvent& event );
54
55 private:
56     wxString name;
57     int i_type;
58     bool b_advanced;
59 };
60
61 ConfigControl *CreateConfigControl( vlc_object_t *,
62                                     module_config_t *, wxWindow * );
63
64 class KeyConfigControl: public ConfigControl
65 {
66 public:
67     KeyConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
68     ~KeyConfigControl();
69     virtual int GetIntValue();
70 private:
71     wxCheckBox *alt;
72     wxCheckBox *ctrl;
73     wxCheckBox *shift;
74     wxComboBox *combo;
75     // Array of key descriptions, for the ComboBox
76     static wxString *m_keysList;
77 };
78
79 class ModuleConfigControl: public ConfigControl
80 {
81 public:
82     ModuleConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
83     ~ModuleConfigControl();
84     virtual wxString GetPszValue();
85 private:
86     wxComboBox *combo;
87 };
88
89 struct moduleCheckBox {
90     wxCheckBox *checkbox;
91     char *psz_module;
92 };
93
94 class ModuleCatConfigControl: public ConfigControl
95 {
96 public:
97     ModuleCatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
98     ~ModuleCatConfigControl();
99     virtual wxString GetPszValue();
100 private:
101     wxComboBox *combo;
102 };
103
104
105 class ModuleListCatConfigControl: public ConfigControl
106 {
107 public:
108     ModuleListCatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
109     ~ModuleListCatConfigControl();
110     virtual wxString GetPszValue();
111 private:
112     std::vector<moduleCheckBox *> pp_checkboxes;
113
114     void OnUpdate( wxCommandEvent& );
115
116     wxTextCtrl *text;
117     DECLARE_EVENT_TABLE()
118 };
119
120 ;
121
122 class StringConfigControl: public ConfigControl
123 {
124 public:
125     StringConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
126     ~StringConfigControl();
127     virtual wxString GetPszValue();
128 private:
129     wxTextCtrl *textctrl;
130
131     DECLARE_EVENT_TABLE()
132 };
133
134 class StringListConfigControl: public ConfigControl
135 {
136 public:
137     StringListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
138     ~StringListConfigControl();
139     virtual wxString GetPszValue();
140 private:
141     wxComboBox *combo;
142     char *psz_default_value;
143     void UpdateCombo( module_config_t *p_item );
144
145     void OnAction( wxCommandEvent& );
146
147     DECLARE_EVENT_TABLE()
148 };
149
150 class FileConfigControl: public ConfigControl
151 {
152 public:
153     FileConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
154     ~FileConfigControl();
155     void OnBrowse( wxCommandEvent& );
156     virtual wxString GetPszValue();
157 private:
158     wxTextCtrl *textctrl;
159     wxButton *browse;
160     bool directory;
161
162     DECLARE_EVENT_TABLE()
163 };
164
165 class IntegerConfigControl: public ConfigControl
166 {
167 public:
168     IntegerConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
169     ~IntegerConfigControl();
170     virtual int GetIntValue();
171 private:
172     wxSpinCtrl *spin;
173     int i_value;
174
175     void OnUpdate( wxCommandEvent& event );
176     void OnUpdateScroll( wxScrollEvent& event );
177
178     DECLARE_EVENT_TABLE()
179 };
180
181 class IntegerListConfigControl: public ConfigControl
182 {
183 public:
184     IntegerListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
185     ~IntegerListConfigControl();
186     virtual int GetIntValue();
187 private:
188     wxComboBox *combo;
189     void UpdateCombo( module_config_t *p_item );
190
191     void OnAction( wxCommandEvent& );
192
193     DECLARE_EVENT_TABLE()
194 };
195
196 class RangedIntConfigControl: public ConfigControl
197 {
198 public:
199     RangedIntConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
200     ~RangedIntConfigControl();
201     virtual int GetIntValue();
202 private:
203     wxSlider *slider;
204
205     DECLARE_EVENT_TABLE()
206 };
207
208 class FloatConfigControl: public ConfigControl
209 {
210 public:
211     FloatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
212     ~FloatConfigControl();
213     virtual float GetFloatValue();
214 private:
215     wxTextCtrl *textctrl;
216
217     DECLARE_EVENT_TABLE()
218 };
219
220 class BoolConfigControl: public ConfigControl
221 {
222 public:
223     BoolConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
224     ~BoolConfigControl();
225     virtual int GetIntValue();
226 private:
227     wxCheckBox *checkbox;
228
229     DECLARE_EVENT_TABLE()
230 };
231
232 class SectionConfigControl: public ConfigControl
233 {
234 public:
235     SectionConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
236     ~SectionConfigControl();
237 };