1 /*****************************************************************************
2 * preferences_widgets.cpp : wxWindows plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2004 VideoLAN
7 * Authors: Gildas Bazin <gbazin@videolan.org>
8 * Sigmund Augdal <sigmunau@idi.ntnu.no>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <stdlib.h> /* malloc(), free() */
29 #include <errno.h> /* ENOMEM */
30 #include <string.h> /* strerror() */
36 #include <vlc_config_cat.h>
38 #include "wxwindows.h"
39 #include "preferences_widgets.h"
41 #include <wx/statline.h>
43 /*****************************************************************************
44 * CreateConfigControl wrapper
45 *****************************************************************************/
46 ConfigControl *CreateConfigControl( vlc_object_t *p_this,
47 module_config_t *p_item, wxWindow *parent )
49 ConfigControl *p_control = NULL;
51 switch( p_item->i_type )
53 case CONFIG_ITEM_MODULE:
54 p_control = new ModuleConfigControl( p_this, p_item, parent );
56 case CONFIG_ITEM_MODULE_LIST_CAT:
57 p_control = new ModuleListCatConfigControl( p_this, p_item, parent );
60 case CONFIG_ITEM_STRING:
63 p_control = new StringConfigControl( p_this, p_item, parent );
67 p_control = new StringListConfigControl( p_this, p_item, parent );
71 case CONFIG_ITEM_FILE:
72 case CONFIG_ITEM_DIRECTORY:
73 p_control = new FileConfigControl( p_this, p_item, parent );
76 case CONFIG_ITEM_INTEGER:
79 p_control = new IntegerListConfigControl( p_this, p_item, parent );
81 else if( p_item->i_min != 0 || p_item->i_max != 0 )
83 p_control = new RangedIntConfigControl( p_this, p_item, parent );
87 p_control = new IntegerConfigControl( p_this, p_item, parent );
92 p_control = new KeyConfigControl( p_this, p_item, parent );
95 case CONFIG_ITEM_FLOAT:
96 p_control = new FloatConfigControl( p_this, p_item, parent );
99 case CONFIG_ITEM_BOOL:
100 p_control = new BoolConfigControl( p_this, p_item, parent );
104 p_control = new SectionConfigControl( p_this, p_item, parent );
114 /*****************************************************************************
115 * ConfigControl implementation
116 *****************************************************************************/
117 ConfigControl::ConfigControl( vlc_object_t *_p_this,
118 module_config_t *p_item, wxWindow *parent )
119 : wxPanel( parent ), p_this( _p_this ),
120 pf_update_callback( NULL ), p_update_data( NULL ),
121 name( wxU(p_item->psz_name) ), i_type( p_item->i_type ),
122 b_advanced( p_item->b_advanced )
125 sizer = new wxBoxSizer( wxHORIZONTAL );
128 ConfigControl::~ConfigControl()
132 wxSizer *ConfigControl::Sizer()
137 wxString ConfigControl::GetName()
142 int ConfigControl::GetType()
147 vlc_bool_t ConfigControl::IsAdvanced()
152 void ConfigControl::SetUpdateCallback( void (*p_callback)( void * ),
155 pf_update_callback = p_callback;
156 p_update_data = p_data;
159 void ConfigControl::OnUpdate( wxCommandEvent& WXUNUSED(event) )
161 if( pf_update_callback )
163 pf_update_callback( p_update_data );
167 /*****************************************************************************
168 * KeyConfigControl implementation
169 *****************************************************************************/
170 wxString *KeyConfigControl::m_keysList = NULL;
172 KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
173 module_config_t *p_item, wxWindow *parent )
174 : ConfigControl( p_this, p_item, parent )
176 // Number of keys descriptions
177 unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t);
179 // Init the keys decriptions array
180 if( m_keysList == NULL )
182 m_keysList = new wxString[i_keys];
183 for( unsigned int i = 0; i < i_keys; i++ )
185 m_keysList[i] = wxU(vlc_keys[i].psz_key_string);
189 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
190 alt = new wxCheckBox( this, -1, wxU(_("Alt")) );
191 alt->SetValue( p_item->i_value & KEY_MODIFIER_ALT );
192 ctrl = new wxCheckBox( this, -1, wxU(_("Ctrl")) );
193 ctrl->SetValue( p_item->i_value & KEY_MODIFIER_CTRL );
194 shift = new wxCheckBox( this, -1, wxU(_("Shift")) );
195 shift->SetValue( p_item->i_value & KEY_MODIFIER_SHIFT );
196 combo = new wxComboBox( this, -1, wxT(""), wxDefaultPosition,
197 wxDefaultSize, i_keys, m_keysList,
199 for( unsigned int i = 0; i < i_keys; i++ )
201 combo->SetClientData( i, (void*)vlc_keys[i].i_key_code );
202 if( (unsigned int)vlc_keys[i].i_key_code ==
203 ( ((unsigned int)p_item->i_value) & ~KEY_MODIFIER ) )
205 combo->SetSelection( i );
206 combo->SetValue( wxU(_(vlc_keys[i].psz_key_string)) );
210 sizer->Add( label, 2, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
211 sizer->Add( alt, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
212 sizer->Add( ctrl, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
213 sizer->Add( shift, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
214 sizer->Add( combo, 2, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
216 this->SetSizerAndFit( sizer );
219 KeyConfigControl::~KeyConfigControl()
228 int KeyConfigControl::GetIntValue()
231 if( alt->IsChecked() )
233 result |= KEY_MODIFIER_ALT;
235 if( ctrl->IsChecked() )
237 result |= KEY_MODIFIER_CTRL;
239 if( shift->IsChecked() )
241 result |= KEY_MODIFIER_SHIFT;
243 int selected = combo->GetSelection();
246 result |= (int)combo->GetClientData( selected );
251 /*****************************************************************************
252 * ModuleConfigControl implementation
253 *****************************************************************************/
254 ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this,
255 module_config_t *p_item,
257 : ConfigControl( p_this, p_item, parent )
262 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
263 combo = new wxComboBox( this, -1, wxL2U(p_item->psz_value),
264 wxDefaultPosition, wxDefaultSize,
265 0, NULL, wxCB_READONLY | wxCB_SORT );
267 /* build a list of available modules */
268 p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
269 combo->Append( wxU(_("Default")), (void *)NULL );
270 combo->SetSelection( 0 );
271 for( int i_index = 0; i_index < p_list->i_count; i_index++ )
273 p_parser = (module_t *)p_list->p_values[i_index].p_object ;
275 if( !strcmp( p_parser->psz_capability, p_item->psz_type ) )
277 combo->Append( wxU(p_parser->psz_longname),
278 p_parser->psz_object_name );
279 if( p_item->psz_value && !strcmp(p_item->psz_value,
280 p_parser->psz_object_name) )
281 combo->SetValue( wxU(p_parser->psz_longname) );
284 vlc_list_release( p_list );
286 combo->SetToolTip( wxU(p_item->psz_longtext) );
287 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
288 sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
290 this->SetSizerAndFit( sizer );
293 ModuleConfigControl::~ModuleConfigControl()
298 wxString ModuleConfigControl::GetPszValue()
300 return wxU( (char *)combo->GetClientData( combo->GetSelection() ));
303 /*****************************************************************************
304 * ModuleListCatonfigControl implementation
305 *****************************************************************************/
306 BEGIN_EVENT_TABLE(ModuleListCatConfigControl, wxPanel)
307 EVT_CHECKBOX( wxID_HIGHEST , ModuleListCatConfigControl::OnUpdate )
311 ModuleListCatConfigControl::ModuleListCatConfigControl( vlc_object_t *p_this,
312 module_config_t *p_item,
314 : ConfigControl( p_this, p_item, parent )
320 sizer = new wxBoxSizer( wxVERTICAL );
321 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
324 text = new wxTextCtrl( this, -1, wxU(p_item->psz_value),
325 wxDefaultPosition,wxSize( 300, 20 ) );
328 /* build a list of available modules */
329 p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
330 for( int i_index = 0; i_index < p_list->i_count; i_index++ )
332 p_parser = (module_t *)p_list->p_values[i_index].p_object ;
334 if( !strcmp( p_parser->psz_object_name, "main" ) )
337 module_config_t *p_config = p_parser->p_config;
340 /* Hack: required subcategory is stored in i_min */
341 if( p_config->i_type == CONFIG_SUBCATEGORY &&
342 p_config->i_value == p_item->i_min )
344 moduleCheckBox *mc = new moduleCheckBox;
345 mc->checkbox = new wxCheckBox( this, wxID_HIGHEST,
346 wxU(p_parser->psz_longname));
347 mc->psz_module = strdup( p_parser->psz_object_name );
348 pp_checkboxes.push_back( mc );
350 if( p_item->psz_value &&
351 strstr( p_item->psz_value, p_parser->psz_object_name ) )
353 mc->checkbox->SetValue( true );
355 sizer->Add( mc->checkbox );
357 } while( p_config->i_type != CONFIG_HINT_END && p_config++ );
359 vlc_list_release( p_list );
361 text->SetToolTip( wxU(p_item->psz_longtext) );
362 sizer->Add(text, wxEXPAND );
364 sizer->Add (new wxStaticText( this, -1, wxU( vlc_wraptext( _("Select modules that you want. To get more advanced control, you can also modify the resulting chain by yourself") , 72, ISUTF8 ) ) ) );
367 this->SetSizerAndFit( sizer );
370 ModuleListCatConfigControl::~ModuleListCatConfigControl()
375 wxString ModuleListCatConfigControl::GetPszValue()
377 return wxU( text->GetValue().c_str() ) ;
380 void ModuleListCatConfigControl::OnUpdate( wxCommandEvent &event )
382 wxString newtext = wxU("");
383 for( unsigned int i = 0 ; i< pp_checkboxes.size() ; i++ )
385 if( pp_checkboxes[i]->checkbox->IsChecked() )
387 if( newtext.Len() == 0 )
389 newtext = newtext + wxU( pp_checkboxes[i]->psz_module );
393 newtext += wxU( "," );
394 newtext += wxU(pp_checkboxes[i]->psz_module);
398 text->SetValue( newtext );
401 /*****************************************************************************
402 * StringConfigControl implementation
403 *****************************************************************************/
404 StringConfigControl::StringConfigControl( vlc_object_t *p_this,
405 module_config_t *p_item,
407 : ConfigControl( p_this, p_item, parent )
409 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
410 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
411 textctrl = new wxTextCtrl( this, -1,
412 wxL2U(p_item->psz_value),
416 textctrl->SetToolTip( wxU(p_item->psz_longtext) );
417 sizer->Add( textctrl, 1, wxALL, 5 );
419 this->SetSizerAndFit( sizer );
422 StringConfigControl::~StringConfigControl()
427 wxString StringConfigControl::GetPszValue()
429 return textctrl->GetValue();
432 BEGIN_EVENT_TABLE(StringConfigControl, wxPanel)
434 EVT_TEXT(-1, StringConfigControl::OnUpdate)
437 /*****************************************************************************
438 * StringListConfigControl implementation
439 *****************************************************************************/
440 StringListConfigControl::StringListConfigControl( vlc_object_t *p_this,
441 module_config_t *p_item,
443 : ConfigControl( p_this, p_item, parent )
445 psz_default_value = p_item->psz_value;
446 if( psz_default_value ) psz_default_value = strdup( psz_default_value );
448 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
449 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
450 combo = new wxComboBox( this, -1, wxT(""),
451 wxDefaultPosition, wxDefaultSize,
452 0, NULL, wxCB_READONLY );
453 UpdateCombo( p_item );
455 combo->SetToolTip( wxU(p_item->psz_longtext) );
456 sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
458 for( int i = 0; i < p_item->i_action; i++ )
461 new wxButton( this, wxID_HIGHEST+i,
462 wxU(p_item->ppsz_action_text[i]) );
463 sizer->Add( button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
467 this->SetSizerAndFit( sizer );
470 StringListConfigControl::~StringListConfigControl()
472 if( psz_default_value ) free( psz_default_value );
475 void StringListConfigControl::UpdateCombo( module_config_t *p_item )
477 vlc_bool_t b_found = VLC_FALSE;
480 /* build a list of available options */
481 for( i_index = 0; i_index < p_item->i_list; i_index++ )
483 combo->Append( ( p_item->ppsz_list_text &&
484 p_item->ppsz_list_text[i_index] ) ?
485 wxU(p_item->ppsz_list_text[i_index]) :
486 wxL2U(p_item->ppsz_list[i_index]) );
487 combo->SetClientData( i_index, (void *)p_item->ppsz_list[i_index] );
488 if( ( p_item->psz_value &&
489 !strcmp( p_item->psz_value, p_item->ppsz_list[i_index] ) ) ||
490 ( !p_item->psz_value && !*p_item->ppsz_list[i_index] ) )
492 combo->SetSelection( i_index );
493 combo->SetValue( ( p_item->ppsz_list_text &&
494 p_item->ppsz_list_text[i_index] ) ?
495 wxU(p_item->ppsz_list_text[i_index]) :
496 wxL2U(p_item->ppsz_list[i_index]) );
501 if( p_item->psz_value && !b_found )
503 /* Add custom entry to list */
504 combo->Append( wxL2U(p_item->psz_value) );
505 combo->SetClientData( i_index, (void *)psz_default_value );
506 combo->SetSelection( i_index );
507 combo->SetValue( wxL2U(p_item->psz_value) );
511 BEGIN_EVENT_TABLE(StringListConfigControl, wxPanel)
513 EVT_BUTTON(-1, StringListConfigControl::OnAction)
516 EVT_TEXT(-1, StringListConfigControl::OnUpdate)
519 void StringListConfigControl::OnAction( wxCommandEvent& event )
521 int i_action = event.GetId() - wxID_HIGHEST;
523 module_config_t *p_item = config_FindConfig( p_this, GetName().mb_str() );
524 if( !p_item ) return;
526 if( i_action < 0 || i_action >= p_item->i_action ) return;
529 wxString value = GetPszValue();
530 *((const char **)&val.psz_string) = value.mb_str();
531 p_item->ppf_action[i_action]( p_this, GetName().mb_str(), val, val, 0 );
533 if( p_item->b_dirty )
536 UpdateCombo( p_item );
537 p_item->b_dirty = VLC_FALSE;
541 wxString StringListConfigControl::GetPszValue()
543 int selected = combo->GetSelection();
546 return wxL2U((char *)combo->GetClientData( selected ));
551 /*****************************************************************************
552 * FileConfigControl implementation
553 *****************************************************************************/
554 FileConfigControl::FileConfigControl( vlc_object_t *p_this,
555 module_config_t *p_item,
557 : ConfigControl( p_this, p_item, parent )
559 directory = p_item->i_type == CONFIG_ITEM_DIRECTORY;
560 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
561 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
562 textctrl = new wxTextCtrl( this, -1,
563 wxL2U(p_item->psz_value),
567 textctrl->SetToolTip( wxU(p_item->psz_longtext) );
568 sizer->Add( textctrl, 1, wxALL, 5 );
569 browse = new wxButton( this, wxID_HIGHEST, wxU(_("Browse...")) );
570 sizer->Add( browse, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
572 this->SetSizerAndFit( sizer );
575 BEGIN_EVENT_TABLE(FileConfigControl, wxPanel)
577 EVT_BUTTON(wxID_HIGHEST, FileConfigControl::OnBrowse)
580 void FileConfigControl::OnBrowse( wxCommandEvent& event )
584 wxDirDialog dialog( this, wxU(_("Choose directory")) );
586 if( dialog.ShowModal() == wxID_OK )
588 textctrl->SetValue( dialog.GetPath() );
593 wxFileDialog dialog( this, wxU(_("Choose file")),
594 wxT(""), wxT(""), wxT("*.*"),
595 #if defined( __WXMSW__ )
601 if( dialog.ShowModal() == wxID_OK )
603 textctrl->SetValue( dialog.GetPath() );
608 FileConfigControl::~FileConfigControl()
613 wxString FileConfigControl::GetPszValue()
615 return textctrl->GetValue();
618 /*****************************************************************************
619 * IntegerConfigControl implementation
620 *****************************************************************************/
621 BEGIN_EVENT_TABLE(IntegerConfigControl, wxPanel)
622 EVT_TEXT(-1, IntegerConfigControl::OnUpdate)
623 EVT_COMMAND_SCROLL(-1, IntegerConfigControl::OnUpdate)
626 IntegerConfigControl::IntegerConfigControl( vlc_object_t *p_this,
627 module_config_t *p_item,
629 : ConfigControl( p_this, p_item, parent )
631 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
632 spin = new wxSpinCtrl( this, -1,
633 wxString::Format(wxT("%d"),
635 wxDefaultPosition, wxDefaultSize,
637 -100000000, 100000000, p_item->i_value);
638 spin->SetToolTip( wxU(p_item->psz_longtext) );
639 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
640 sizer->Add( spin, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
642 this->SetSizerAndFit( sizer );
643 i_value = p_item->i_value;
646 IntegerConfigControl::~IntegerConfigControl()
651 int IntegerConfigControl::GetIntValue()
653 /* We avoid using GetValue because of a recursion bug with wxSpinCtrl with
655 return i_value; //spin->GetValue();
658 void IntegerConfigControl::OnUpdate( wxCommandEvent &event )
660 i_value = event.GetInt();
661 ConfigControl::OnUpdate( event );
664 /*****************************************************************************
665 * IntegerListConfigControl implementation
666 *****************************************************************************/
667 IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *p_this,
668 module_config_t *p_item,
670 : ConfigControl( p_this, p_item, parent )
672 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
673 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
674 combo = new wxComboBox( this, -1, wxT(""),
675 wxDefaultPosition, wxDefaultSize,
676 0, NULL, wxCB_READONLY );
678 UpdateCombo( p_item );
680 combo->SetToolTip( wxU(p_item->psz_longtext) );
681 sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
684 this->SetSizerAndFit( sizer );
687 IntegerListConfigControl::~IntegerListConfigControl()
691 void IntegerListConfigControl::UpdateCombo( module_config_t *p_item )
693 /* build a list of available options */
694 for( int i_index = 0; i_index < p_item->i_list; i_index++ )
696 if( p_item->ppsz_list_text && p_item->ppsz_list_text[i_index] )
698 combo->Append( wxU(p_item->ppsz_list_text[i_index]) );
702 combo->Append( wxString::Format(wxT("%i"),
703 p_item->pi_list[i_index]) );
705 combo->SetClientData( i_index, (void *)p_item->pi_list[i_index] );
706 if( p_item->i_value == p_item->pi_list[i_index] )
708 combo->SetSelection( i_index );
709 if( p_item->ppsz_list_text && p_item->ppsz_list_text[i_index] )
711 combo->SetValue( wxU(p_item->ppsz_list_text[i_index]) );
715 combo->SetValue( wxString::Format(wxT("%i"),
716 p_item->pi_list[i_index]) );
722 BEGIN_EVENT_TABLE(IntegerListConfigControl, wxPanel)
724 EVT_BUTTON(-1, IntegerListConfigControl::OnAction)
727 void IntegerListConfigControl::OnAction( wxCommandEvent& event )
729 int i_action = event.GetId() - wxID_HIGHEST;
731 module_config_t *p_item;
732 p_item = config_FindConfig( p_this, GetName().mb_str() );
733 if( !p_item ) return;
735 if( i_action < 0 || i_action >= p_item->i_action ) return;
738 val.i_int = GetIntValue();
739 p_item->ppf_action[i_action]( p_this, GetName().mb_str(), val, val, 0 );
741 if( p_item->b_dirty )
744 UpdateCombo( p_item );
745 p_item->b_dirty = VLC_FALSE;
749 int IntegerListConfigControl::GetIntValue()
751 int selected = combo->GetSelection();
754 return (int)combo->GetClientData( selected );
759 /*****************************************************************************
760 * RangedIntConfigControl implementation
761 *****************************************************************************/
762 BEGIN_EVENT_TABLE(RangedIntConfigControl, wxPanel)
763 EVT_COMMAND_SCROLL(-1, RangedIntConfigControl::OnUpdate)
766 RangedIntConfigControl::RangedIntConfigControl( vlc_object_t *p_this,
767 module_config_t *p_item,
769 : ConfigControl( p_this, p_item, parent )
771 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
772 slider = new wxSlider( this, -1, p_item->i_value, p_item->i_min,
773 p_item->i_max, wxDefaultPosition, wxDefaultSize,
774 wxSL_LABELS | wxSL_HORIZONTAL );
775 slider->SetToolTip( wxU(p_item->psz_longtext) );
776 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
777 sizer->Add( slider, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
779 this->SetSizerAndFit( sizer );
782 RangedIntConfigControl::~RangedIntConfigControl()
787 int RangedIntConfigControl::GetIntValue()
789 return slider->GetValue();
792 /*****************************************************************************
793 * FloatConfigControl implementation
794 *****************************************************************************/
795 BEGIN_EVENT_TABLE(FloatConfigControl, wxPanel)
796 EVT_TEXT(-1, FloatConfigControl::OnUpdate)
799 FloatConfigControl::FloatConfigControl( vlc_object_t *p_this,
800 module_config_t *p_item,
802 : ConfigControl( p_this, p_item, parent )
804 label = new wxStaticText(this, -1, wxU(p_item->psz_text));
805 textctrl = new wxTextCtrl( this, -1,
806 wxString::Format(wxT("%f"),
808 wxDefaultPosition, wxDefaultSize,
809 wxTE_PROCESS_ENTER );
810 textctrl->SetToolTip( wxU(p_item->psz_longtext) );
811 sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
812 sizer->Add( textctrl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
814 this->SetSizerAndFit( sizer );
817 FloatConfigControl::~FloatConfigControl()
822 float FloatConfigControl::GetFloatValue()
825 if( (wxSscanf(textctrl->GetValue(), wxT("%f"), &f_value) == 1) )
830 /*****************************************************************************
831 * BoolConfigControl implementation
832 *****************************************************************************/
833 BEGIN_EVENT_TABLE(BoolConfigControl, wxPanel)
834 EVT_CHECKBOX(-1, BoolConfigControl::OnUpdate)
837 BoolConfigControl::BoolConfigControl( vlc_object_t *p_this,
838 module_config_t *p_item,
840 : ConfigControl( p_this, p_item, parent )
842 checkbox = new wxCheckBox( this, -1, wxU(p_item->psz_text) );
843 if( p_item->i_value ) checkbox->SetValue(TRUE);
844 checkbox->SetToolTip( wxU(p_item->psz_longtext) );
845 sizer->Add( checkbox, 0, wxALL, 5 );
847 this->SetSizerAndFit( sizer );
850 BoolConfigControl::~BoolConfigControl()
855 int BoolConfigControl::GetIntValue()
857 if( checkbox->IsChecked() ) return 1;
861 /*****************************************************************************
862 * SectionConfigControl implementation
863 *****************************************************************************/
864 SectionConfigControl::SectionConfigControl( vlc_object_t *p_this,
865 module_config_t *p_item,
867 : ConfigControl( p_this, p_item, parent )
870 sizer = new wxBoxSizer( wxVERTICAL );
871 sizer->Add( new wxStaticText( this, -1, wxU( p_item->psz_text ) ) );
872 sizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND, 5 );
874 this->SetSizerAndFit( sizer );
877 SectionConfigControl::~SectionConfigControl()