]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/preferences_widgets.h
* wxwin: at start up, restore last size+position+state of windows.
[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 ModuleCatConfigControl: public ConfigControl
93 {
94 public:
95     ModuleCatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
96     ~ModuleCatConfigControl();
97     virtual wxString GetPszValue();
98 private:
99     wxComboBox *combo;
100 };
101
102
103 class ModuleListCatConfigControl: public ConfigControl
104 {
105 public:
106     ModuleListCatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
107     ~ModuleListCatConfigControl();
108     virtual wxString GetPszValue();
109 private:
110     std::vector<moduleCheckBox *> pp_checkboxes;
111
112     void OnUpdate( wxCommandEvent& );
113
114     wxTextCtrl *text;
115     DECLARE_EVENT_TABLE()
116 };
117
118 ;
119
120 class StringConfigControl: public ConfigControl
121 {
122 public:
123     StringConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
124     ~StringConfigControl();
125     virtual wxString GetPszValue();
126 private:
127     wxTextCtrl *textctrl;
128
129     DECLARE_EVENT_TABLE()
130 };
131
132 class StringListConfigControl: public ConfigControl
133 {
134 public:
135     StringListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
136     ~StringListConfigControl();
137     virtual wxString GetPszValue();
138 private:
139     wxComboBox *combo;
140     char *psz_default_value;
141     void UpdateCombo( module_config_t *p_item );
142
143     void OnAction( wxCommandEvent& );
144
145     DECLARE_EVENT_TABLE()
146 };
147
148 class FileConfigControl: public ConfigControl
149 {
150 public:
151     FileConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
152     ~FileConfigControl();
153     void OnBrowse( wxCommandEvent& );
154     virtual wxString GetPszValue();
155 private:
156     wxTextCtrl *textctrl;
157     wxButton *browse;
158     bool directory;
159
160     DECLARE_EVENT_TABLE()
161 };
162
163 class IntegerConfigControl: public ConfigControl
164 {
165 public:
166     IntegerConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
167     ~IntegerConfigControl();
168     virtual int GetIntValue();
169 private:
170     wxSpinCtrl *spin;
171     int i_value;
172
173     void OnUpdate( wxCommandEvent& );
174
175     DECLARE_EVENT_TABLE()
176 };
177
178 class IntegerListConfigControl: public ConfigControl
179 {
180 public:
181     IntegerListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
182     ~IntegerListConfigControl();
183     virtual int GetIntValue();
184 private:
185     wxComboBox *combo;
186     void UpdateCombo( module_config_t *p_item );
187
188     void OnAction( wxCommandEvent& );
189
190     DECLARE_EVENT_TABLE()
191 };
192
193 class RangedIntConfigControl: public ConfigControl
194 {
195 public:
196     RangedIntConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
197     ~RangedIntConfigControl();
198     virtual int GetIntValue();
199 private:
200     wxSlider *slider;
201
202     DECLARE_EVENT_TABLE()
203 };
204
205 class FloatConfigControl: public ConfigControl
206 {
207 public:
208     FloatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
209     ~FloatConfigControl();
210     virtual float GetFloatValue();
211 private:
212     wxTextCtrl *textctrl;
213
214     DECLARE_EVENT_TABLE()
215 };
216
217 class BoolConfigControl: public ConfigControl
218 {
219 public:
220     BoolConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
221     ~BoolConfigControl();
222     virtual int GetIntValue();
223 private:
224     wxCheckBox *checkbox;
225
226     DECLARE_EVENT_TABLE()
227 };
228
229 class SectionConfigControl: public ConfigControl
230 {
231 public:
232     SectionConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
233     ~SectionConfigControl();
234 };