]> git.sesse.net Git - vlc/blob - modules/gui/win32/preferences.h
- fixed a segfault occuring when the preference dialog box was destroyed
[vlc] / modules / gui / win32 / preferences.h
1 /*****************************************************************************\r
2  * preferences.h: the "Preferences" dialog box\r
3  *****************************************************************************\r
4  * Copyright (C) 2002-2003 VideoLAN\r
5  *\r
6  * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>\r
7  *          Boris Dores <babal@via.ecp.fr>\r
8  *\r
9  * This program is free software; you can redistribute it and/or modify\r
10  * it under the terms of the GNU General Public License as published by\r
11  * the Free Software Foundation; either version 2 of the License, or\r
12  * (at your option) any later version.\r
13  *\r
14  * This program is distributed in the hope that it will be useful,\r
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  * GNU General Public License for more details.\r
18  *\r
19  * You should have received a copy of the GNU General Public License\r
20  * along with this program; if not, write to the Free Software\r
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.\r
22  *****************************************************************************/\r
23 \r
24 #ifndef preferencesH\r
25 #define preferencesH\r
26 //---------------------------------------------------------------------------\r
27 #include <Classes.hpp>\r
28 #include <Controls.hpp>\r
29 #include <StdCtrls.hpp>\r
30 #include <Forms.hpp>\r
31 #include <Buttons.hpp>\r
32 #include <ComCtrls.hpp>\r
33 #include <CheckLst.hpp>\r
34 #include <ExtCtrls.hpp>\r
35 #include "CSPIN.h"\r
36 //---------------------------------------------------------------------------\r
37 /* A TCheckListBox that can associate an integer to each string item */\r
38 class TExtCheckListBox : public TCheckListBox\r
39 {\r
40 public:\r
41     DYNAMIC void __fastcall SetItemData(int Index, int AData) {\r
42         TCheckListBox::SetItemData ( Index , AData );\r
43     }\r
44     DYNAMIC int __fastcall GetItemData(int Index) {\r
45         return TCheckListBox::GetItemData ( Index );\r
46     }\r
47     __fastcall TExtCheckListBox( Classes::TComponent* AOwner )\r
48         : TCheckListBox( AOwner ) {};\r
49 };\r
50 //---------------------------------------------------------------------------\r
51 /* A THintWindow with a limited width */\r
52 class TNarrowHintWindow : public THintWindow\r
53 {\r
54 public:\r
55    virtual void __fastcall ActivateHint( const Windows::TRect &Rect,\r
56        const System::AnsiString AHint );\r
57 };\r
58 //---------------------------------------------------------------------------\r
59 class TPanelPref : public TPanel\r
60 {\r
61 public:\r
62     __fastcall TPanelPref( TComponent* Owner, module_config_t *_p_config,\r
63             intf_thread_t *_p_intf );\r
64     virtual void __fastcall UpdateChanges() = 0;\r
65 protected:\r
66     module_config_t * p_config;\r
67     intf_thread_t * p_intf;\r
68     TExtCheckListBox * __fastcall CreateExtCheckListBox(TWinControl *Parent,\r
69             int Left, int Width, int Top, int Height );\r
70     TButton * __fastcall CreateButton( TWinControl *Parent,\r
71             int Left, int Width, int Top, int Height, AnsiString Caption );\r
72     TCheckBox * __fastcall CreateCheckBox( TWinControl *Parent,\r
73             int Left, int Width, int Top, int Height, AnsiString Caption );\r
74     TLabel * __fastcall CreateLabel( TWinControl *Parent,\r
75             int Left, int Width, int Top, int Height, AnsiString Caption,\r
76             bool WordWrap );\r
77     TEdit * __fastcall CreateEdit( TWinControl *Parent,\r
78             int Left, int Width, int Top, int Height, AnsiString Text );\r
79     TCSpinEdit * __fastcall CreateSpinEdit( TWinControl *Parent,\r
80             int Left, int Width, int Top, int Height,\r
81             long Min, long Max, long Value );\r
82 };\r
83 //---------------------------------------------------------------------------\r
84 class TPanelPlugin : public TPanelPref\r
85 {\r
86     module_t *ModuleSelected;\r
87 public:\r
88     __fastcall TPanelPlugin( TComponent* Owner, module_config_t *p_config,\r
89             intf_thread_t *_p_intf, TStringList * ModuleNames,\r
90             bool b_multi_plugins );\r
91     bool b_multi_plugins;\r
92     TExtCheckListBox *ExtCheckListBox;\r
93     TButton *ButtonConfig;\r
94     TButton *ButtonUp;\r
95     TButton *ButtonDown;\r
96     TLabel *Label;\r
97     TStringList * ModuleNames;\r
98     virtual void __fastcall TPanelPlugin::SetValue ( AnsiString Values );\r
99     virtual void __fastcall UpdateChanges();\r
100     void __fastcall CheckListBoxClick( TObject *Sender );\r
101     void __fastcall CheckListBoxClickCheck( TObject *Sender );\r
102     void __fastcall ButtonConfigClick( TObject *Sender );\r
103     void __fastcall ButtonUpClick( TObject *Sender );\r
104     void __fastcall ButtonDownClick( TObject *Sender );\r
105 };\r
106 //---------------------------------------------------------------------------\r
107 class TPanelString : public TPanelPref\r
108 {\r
109 public:\r
110     __fastcall TPanelString( TComponent* Owner, module_config_t *p_config,\r
111             intf_thread_t *_p_intf );\r
112     TLabel *Label;\r
113     TEdit *Edit;\r
114     virtual void __fastcall UpdateChanges();\r
115 };\r
116 //---------------------------------------------------------------------------\r
117 class TPanelInteger : public TPanelPref\r
118 {\r
119 public:\r
120     __fastcall TPanelInteger( TComponent* Owner, module_config_t *p_config,\r
121             intf_thread_t *_p_intf );\r
122     TLabel *Label;\r
123     TCSpinEdit *SpinEdit;\r
124     virtual void __fastcall UpdateChanges();\r
125 };\r
126 //---------------------------------------------------------------------------\r
127 class TPanelFloat : public TPanelPref\r
128 {\r
129 public:\r
130     __fastcall TPanelFloat( TComponent* Owner, module_config_t *p_config,\r
131             intf_thread_t *_p_intf );\r
132     TLabel *Label;\r
133     TEdit *Edit;\r
134     virtual void __fastcall UpdateChanges();\r
135 };\r
136 //---------------------------------------------------------------------------\r
137 class TPanelBool : public TPanelPref\r
138 {\r
139 public:\r
140     __fastcall TPanelBool( TComponent* Owner, module_config_t *p_config,\r
141             intf_thread_t *_p_intf );\r
142     TCheckBox *CheckBox;\r
143     virtual void __fastcall UpdateChanges();\r
144 };\r
145 //---------------------------------------------------------------------------\r
146 class TPreferencesDlg : public TForm\r
147 {\r
148 __published:    // IDE-managed Components\r
149     TPageControl *PageControlPref;\r
150     TButton *ButtonApply;\r
151     TButton *ButtonSave;\r
152     TButton *ButtonOK;\r
153     TButton *ButtonCancel;\r
154     void __fastcall ButtonOkClick( TObject *Sender );\r
155     void __fastcall ButtonApplyClick( TObject *Sender );\r
156     void __fastcall ButtonSaveClick( TObject *Sender );\r
157     void __fastcall ButtonCancelClick( TObject *Sender );\r
158     void __fastcall FormClose( TObject *Sender, TCloseAction &Action );\r
159 private:        // User declarations\r
160     intf_thread_t *p_intf;\r
161     TStringList * ModuleNames;\r
162 public:         // User declarations\r
163     __fastcall TPreferencesDlg( TComponent* Owner, intf_thread_t *_p_intf );\r
164     virtual __fastcall ~TPreferencesDlg();\r
165     void __fastcall CreateConfigDialog( char *psz_module_name );\r
166 };\r
167 //---------------------------------------------------------------------------\r
168 #endif\r