]> git.sesse.net Git - vlc/blob - modules/gui/win32/preferences.h
* ./modules/gui/win32/preferences.cpp: fixed a segfault when a module
[vlc] / modules / gui / win32 / preferences.h
1 /*****************************************************************************\r
2  * preferences.h: the "Preferences" dialog box\r
3  *****************************************************************************\r
4  * Copyright (C) 2002 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 automatically disposes any TObject\r
38    associated with the string items */\r
39 class TCleanCheckListBox : public TCheckListBox\r
40 {\r
41 public:\r
42     __fastcall TCleanCheckListBox( Classes::TComponent* AOwner )\r
43         : TCheckListBox( AOwner ) {};\r
44     virtual __fastcall ~TCleanCheckListBox();\r
45 };\r
46 //---------------------------------------------------------------------------\r
47 /* A THintWindow with a limited width */\r
48 class TNarrowHintWindow : public THintWindow\r
49 {\r
50 public:\r
51    virtual void __fastcall ActivateHint( const Windows::TRect &Rect,\r
52        const System::AnsiString AHint );\r
53 };\r
54 //---------------------------------------------------------------------------\r
55 /* Just a wrapper to embed an AnsiString into a TObject */\r
56 class TObjectString : public TObject\r
57 {\r
58 private:\r
59     AnsiString FString;\r
60 public:\r
61     __fastcall TObjectString( char * String );\r
62     AnsiString __fastcall String();\r
63 };\r
64 //---------------------------------------------------------------------------\r
65 class TPanelPref : public TPanel\r
66 {\r
67 public:\r
68     __fastcall TPanelPref( TComponent* Owner, module_config_t *p_config_arg );\r
69     module_config_t *p_config;\r
70     virtual void __fastcall UpdateChanges() = 0;\r
71     TCleanCheckListBox * __fastcall CreateCleanCheckListBox( TWinControl *Parent,\r
72             int Left, int Width, int Top, int Height );\r
73     TButton * __fastcall CreateButton( TWinControl *Parent,\r
74             int Left, int Width, int Top, int Height, AnsiString Caption );\r
75     TCheckBox * __fastcall CreateCheckBox( TWinControl *Parent,\r
76             int Left, int Width, int Top, int Height, AnsiString Caption );\r
77     TLabel * __fastcall CreateLabel( TWinControl *Parent,\r
78             int Left, int Width, int Top, int Height, AnsiString Caption,\r
79             bool WordWrap );\r
80     TEdit * __fastcall CreateEdit( TWinControl *Parent,\r
81             int Left, int Width, int Top, int Height, AnsiString Text );\r
82     TCSpinEdit * __fastcall CreateSpinEdit( TWinControl *Parent,\r
83             int Left, int Width, int Top, int Height,\r
84             long Min, long Max, long Value );\r
85 };\r
86 //---------------------------------------------------------------------------\r
87 class TPanelPlugin : public TPanelPref\r
88 {\r
89 public:\r
90     __fastcall TPanelPlugin( TComponent* Owner, module_config_t *p_config,\r
91         intf_thread_t *_p_intf );\r
92     TCleanCheckListBox *CleanCheckListBox;\r
93     TButton *ButtonConfig;\r
94     TLabel *Label;\r
95     module_t *ModuleSelected;\r
96     virtual void __fastcall UpdateChanges();\r
97     void __fastcall CheckListBoxClick( TObject *Sender );\r
98     void __fastcall CheckListBoxClickCheck( TObject *Sender );\r
99     void __fastcall ButtonConfigClick( TObject *Sender );\r
100 private:\r
101     intf_thread_t *p_intf;\r
102 };\r
103 //---------------------------------------------------------------------------\r
104 class TPanelString : public TPanelPref\r
105 {\r
106 public:\r
107     __fastcall TPanelString( TComponent* Owner, module_config_t *p_config );\r
108     TLabel *Label;\r
109     TEdit *Edit;\r
110     virtual void __fastcall UpdateChanges();\r
111 };\r
112 //---------------------------------------------------------------------------\r
113 class TPanelInteger : public TPanelPref\r
114 {\r
115 public:\r
116     __fastcall TPanelInteger( TComponent* Owner, module_config_t *p_config );\r
117     TLabel *Label;\r
118     TCSpinEdit *SpinEdit;\r
119     virtual void __fastcall UpdateChanges();\r
120 };\r
121 //---------------------------------------------------------------------------\r
122 class TPanelFloat : public TPanelPref\r
123 {\r
124 public:\r
125     __fastcall TPanelFloat( TComponent* Owner, module_config_t *p_config );\r
126     TLabel *Label;\r
127     TEdit *Edit;\r
128     virtual void __fastcall UpdateChanges();\r
129 };\r
130 //---------------------------------------------------------------------------\r
131 class TPanelBool : public TPanelPref\r
132 {\r
133 public:\r
134     __fastcall TPanelBool( TComponent* Owner, module_config_t *p_config );\r
135     TCheckBox *CheckBox;\r
136     virtual void __fastcall UpdateChanges();\r
137 };\r
138 //---------------------------------------------------------------------------\r
139 class TPreferencesDlg : public TForm\r
140 {\r
141 __published:    // IDE-managed Components\r
142     TPageControl *PageControlPref;\r
143     TButton *ButtonApply;\r
144     TButton *ButtonSave;\r
145     TButton *ButtonOK;\r
146     TButton *ButtonCancel;\r
147     void __fastcall ButtonOkClick( TObject *Sender );\r
148     void __fastcall ButtonApplyClick( TObject *Sender );\r
149     void __fastcall ButtonSaveClick( TObject *Sender );\r
150     void __fastcall ButtonCancelClick( TObject *Sender );\r
151     void __fastcall FormClose( TObject *Sender, TCloseAction &Action );\r
152 private:        // User declarations\r
153     intf_thread_t *p_intf;\r
154 public:         // User declarations\r
155     __fastcall TPreferencesDlg( TComponent* Owner, intf_thread_t *_p_intf );\r
156     void __fastcall CreateConfigDialog( char *psz_module_name );\r
157     void __fastcall SaveValue( module_config_t *p_config );\r
158 };\r
159 //---------------------------------------------------------------------------\r
160 #endif\r