]> git.sesse.net Git - vlc/blob - modules/gui/beos/PreferencesWindow.h
57bb9d0784792ea3009d1e68fef21b8571a4da62
[vlc] / modules / gui / beos / PreferencesWindow.h
1 /*****************************************************************************
2  * PreferencesWindow.h
3  *****************************************************************************
4  * Copyright (C) 1999, 2000, 2001 VideoLAN
5  * $Id: PreferencesWindow.h,v 1.18 2003/12/21 21:30:43 titer Exp $
6  *
7  * Authors: Eric Petit <titer@videolan.org>
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 #ifndef BEOS_PREFERENCES_WINDOW_H
25 #define BEOS_PREFERENCES_WINDOW_H
26
27 #include <InterfaceKit.h>
28
29 #define PREFS_WINDOW_WIDTH   700
30 #define PREFS_WINDOW_HEIGHT  400
31 #define PREFS_ITEM_SELECTED  'pris'
32 #define PREFS_DEFAULTS       'prde'
33 #define PREFS_APPLY          'prap'
34 #define PREFS_SAVE           'prsa'
35
36 class StringItemWithView : public BStringItem
37 {
38   public:
39                             StringItemWithView( const char * text )
40                                 : BStringItem( text )
41                             {
42                                 fConfigBox = NULL;
43                                 fConfigScroll = NULL;
44                                 fConfigView = NULL;
45                                 fText = strdup( text );
46                             }
47
48     /* Here we store the config BBox associated to this module */
49     BBox *                  fConfigBox;
50     BScrollView *           fConfigScroll;
51     BView *                 fConfigView;
52     char *                  fText;
53 };
54
55 class ConfigWidget : public BView
56 {
57     public:
58         ConfigWidget( BRect rect, int type, char * configName );
59         virtual void Apply( intf_thread_t * p_intf, bool doIt ) = 0;
60
61     protected:
62         int          fConfigType;
63         char       * fConfigName;
64 };
65
66 class ConfigTextControl : public ConfigWidget
67 {
68     public:
69         ConfigTextControl( BRect rect, int type, char * label,
70                            char * configName );
71         void Apply( intf_thread_t * p_intf, bool doIt );
72
73     private:
74         BTextControl * fTextControl;
75 };
76
77 class ConfigCheckBox : public ConfigWidget
78 {
79     public:
80         ConfigCheckBox( BRect rect, int type, char * label,
81                         char * configName );
82         void Apply( intf_thread_t * p_intf, bool doIt );
83
84     private:
85         BCheckBox * fCheckBox;
86 };
87
88 class ConfigMenuField : public ConfigWidget
89 {
90     public:
91         ConfigMenuField( BRect rect, int type, char * label,
92                          char * configName, char ** list );
93         void Apply( intf_thread_t * p_intf, bool doIt );
94
95     private:
96         BPopUpMenu * fPopUpMenu;
97         BMenuField * fMenuField;
98 };
99
100 class ConfigSlider : public ConfigWidget
101 {
102     public:
103         ConfigSlider( BRect rect, int type, char * label,
104                       char * configName, int min, int max );
105         void Apply( intf_thread_t * p_intf, bool doIt );
106
107     private:
108         BSlider * fSlider;
109 };
110
111 class ConfigKey : public ConfigWidget
112 {
113     public:
114         ConfigKey( BRect rect, int type, char * label,
115                    char * configName );
116         void Apply( intf_thread_t * p_intf, bool doIt );
117
118     private:
119         BStringView * fStringView;
120         BCheckBox   * fAltCheck;
121         BCheckBox   * fCtrlCheck;
122         BCheckBox   * fShiftCheck;
123         BPopUpMenu  * fPopUpMenu;
124         BMenuField  * fMenuField;
125 };
126
127 class PreferencesWindow : public BWindow
128 {
129   public:
130                             PreferencesWindow( intf_thread_t * p_intf,
131                                                BRect frame,
132                                                const char * name );
133     virtual                 ~PreferencesWindow();
134
135     virtual bool            QuitRequested();
136     virtual void            MessageReceived(BMessage* message);
137     virtual void            FrameResized( float, float );
138
139             void            Update();
140             void            UpdateScrollBar();
141             void            ApplyChanges( bool doIt );
142             void            SaveChanges();
143
144             void            ReallyQuit();
145
146   private:
147     void                    BuildConfigView( StringItemWithView * stringItem,
148                                              module_config_t ** pp_item,
149                                              bool stop_after_category );
150
151     BView *                 fPrefsView;
152     BOutlineListView *      fOutline;
153     BView *                 fDummyView;
154     BScrollView *           fConfigScroll;
155     StringItemWithView *    fCurrent;
156
157     intf_thread_t *         p_intf;
158 };
159
160 #endif    // BEOS_PREFERENCES_WINDOW_H