]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/preferences_widgets.h
f7cfc33a1deeb1ddfee4780411594317b1b24777
[vlc] / modules / gui / wxwindows / preferences_widgets.h
1 /*****************************************************************************
2  * preferences_widgets.h : wxWindows plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000-2003 VideoLAN (Centrale Réseaux) and its contributors
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& event );
52     void OnUpdateScroll( wxScrollEvent& event );
53
54 private:
55     wxString name;
56     int i_type;
57     vlc_bool_t b_advanced;
58 };
59
60 ConfigControl *CreateConfigControl( vlc_object_t *,
61                                     module_config_t *, wxWindow * );
62
63 class KeyConfigControl: public ConfigControl
64 {
65 public:
66     KeyConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
67     ~KeyConfigControl();
68     virtual int GetIntValue();
69 private:
70     wxCheckBox *alt;
71     wxCheckBox *ctrl;
72     wxCheckBox *shift;
73     wxComboBox *combo;
74     // Array of key descriptions, for the ComboBox
75     static wxString *m_keysList;
76 };
77
78 class ModuleConfigControl: public ConfigControl
79 {
80 public:
81     ModuleConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
82     ~ModuleConfigControl();
83     virtual wxString GetPszValue();
84 private:
85     wxComboBox *combo;
86 };
87
88 struct moduleCheckBox {
89     wxCheckBox *checkbox;
90     char *psz_module;
91 };
92
93 class ModuleCatConfigControl: public ConfigControl
94 {
95 public:
96     ModuleCatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
97     ~ModuleCatConfigControl();
98     virtual wxString GetPszValue();
99 private:
100     wxComboBox *combo;
101 };
102
103
104 class ModuleListCatConfigControl: public ConfigControl
105 {
106 public:
107     ModuleListCatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
108     ~ModuleListCatConfigControl();
109     virtual wxString GetPszValue();
110 private:
111     std::vector<moduleCheckBox *> pp_checkboxes;
112
113     void OnUpdate( wxCommandEvent& );
114
115     wxTextCtrl *text;
116     DECLARE_EVENT_TABLE()
117 };
118
119 ;
120
121 class StringConfigControl: public ConfigControl
122 {
123 public:
124     StringConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
125     ~StringConfigControl();
126     virtual wxString GetPszValue();
127 private:
128     wxTextCtrl *textctrl;
129
130     DECLARE_EVENT_TABLE()
131 };
132
133 class StringListConfigControl: public ConfigControl
134 {
135 public:
136     StringListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
137     ~StringListConfigControl();
138     virtual wxString GetPszValue();
139 private:
140     wxComboBox *combo;
141     char *psz_default_value;
142     void UpdateCombo( module_config_t *p_item );
143
144     void OnAction( wxCommandEvent& );
145
146     DECLARE_EVENT_TABLE()
147 };
148
149 class FileConfigControl: public ConfigControl
150 {
151 public:
152     FileConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
153     ~FileConfigControl();
154     void OnBrowse( wxCommandEvent& );
155     virtual wxString GetPszValue();
156 private:
157     wxTextCtrl *textctrl;
158     wxButton *browse;
159     bool directory;
160
161     DECLARE_EVENT_TABLE()
162 };
163
164 class IntegerConfigControl: public ConfigControl
165 {
166 public:
167     IntegerConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
168     ~IntegerConfigControl();
169     virtual int GetIntValue();
170 private:
171     wxSpinCtrl *spin;
172     int i_value;
173
174     void OnUpdate( wxCommandEvent& event );
175     void OnUpdateScroll( wxScrollEvent& event );
176
177     DECLARE_EVENT_TABLE()
178 };
179
180 class IntegerListConfigControl: public ConfigControl
181 {
182 public:
183     IntegerListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
184     ~IntegerListConfigControl();
185     virtual int GetIntValue();
186 private:
187     wxComboBox *combo;
188     void UpdateCombo( module_config_t *p_item );
189
190     void OnAction( wxCommandEvent& );
191
192     DECLARE_EVENT_TABLE()
193 };
194
195 class RangedIntConfigControl: public ConfigControl
196 {
197 public:
198     RangedIntConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
199     ~RangedIntConfigControl();
200     virtual int GetIntValue();
201 private:
202     wxSlider *slider;
203
204     DECLARE_EVENT_TABLE()
205 };
206
207 class FloatConfigControl: public ConfigControl
208 {
209 public:
210     FloatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
211     ~FloatConfigControl();
212     virtual float GetFloatValue();
213 private:
214     wxTextCtrl *textctrl;
215
216     DECLARE_EVENT_TABLE()
217 };
218
219 class BoolConfigControl: public ConfigControl
220 {
221 public:
222     BoolConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
223     ~BoolConfigControl();
224     virtual int GetIntValue();
225 private:
226     wxCheckBox *checkbox;
227
228     DECLARE_EVENT_TABLE()
229 };
230
231 class SectionConfigControl: public ConfigControl
232 {
233 public:
234     SectionConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
235     ~SectionConfigControl();
236 };