]> git.sesse.net Git - vlc/blob - modules/gui/beos/PreferencesWindow.h
f99c4505f187ab2d73528d38874c916a00588d6d
[vlc] / modules / gui / beos / PreferencesWindow.h
1 /*****************************************************************************
2  * PreferencesWindow.h
3  *****************************************************************************
4  * Copyright (C) 1999, 2000, 2001 VideoLAN
5  * $Id$
6  *
7  * Authors: Eric Petit <titer@m0k.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 VTextView : public BTextView
37 {
38     public:
39              VTextView( BRect frame, const char *name,
40                         uint32 resizingMode, uint32 flags );
41         void FrameResized( float width, float height );
42 };
43
44 class VTextControl : public BTextControl
45 {
46     public:
47              VTextControl( BRect frame, const char *name,
48                            const char *label, const char *text,
49                            BMessage * message, uint32 resizingMode );
50         void FrameResized( float width, float height );
51 };
52
53 class ConfigWidget : public BView
54 {
55     public:
56                         ConfigWidget( intf_thread_t * p_intf, BRect rect,
57                                       module_config_t * p_item );
58         bool            InitCheck() { return fInitOK; }
59         void            Apply( bool doIt );
60
61     private:
62         intf_thread_t * p_intf;
63
64         bool            fInitOK;
65         VTextControl  * fTextControl;
66         BCheckBox     * fCheckBox;
67         BPopUpMenu    * fPopUpMenu;
68         BMenuField    * fMenuField;
69         BSlider       * fSlider;
70         BStringView   * fStringView;
71         BCheckBox     * fAltCheck;
72         BCheckBox     * fCtrlCheck;
73         BCheckBox     * fShiftCheck;
74 };
75
76 class ConfigItem : public BStringItem
77 {
78     public:
79                       ConfigItem( intf_thread_t * p_intf,
80                                   char * name, bool subModule,
81                                   int objectId, int type, char * help );
82                       ~ConfigItem();
83         int           ObjectId() { return fObjectId; }
84         BBox        * Box() { return fBox; }
85         void          UpdateScrollBar();
86         void          ResetScroll();
87         void          Apply( bool doIt );
88
89     private:
90         intf_thread_t * p_intf;
91
92         bool            fSubModule;
93         int             fObjectId;
94         int             fType;
95         char          * fHelp;
96
97         BBox          * fBox;
98         VTextView     * fTextView;
99         BScrollView   * fScroll;
100         BView         * fView;
101 };
102
103 class PreferencesWindow : public BWindow
104 {
105   public:
106                             PreferencesWindow( intf_thread_t * p_intf,
107                                                BRect frame,
108                                                const char * name );
109     virtual                 ~PreferencesWindow();
110
111     virtual bool            QuitRequested();
112     virtual void            MessageReceived(BMessage* message);
113     virtual void            FrameResized( float, float );
114
115             void            Update();
116             void            ApplyChanges( bool doIt );
117             void            SaveChanges();
118
119             void            ReallyQuit();
120
121   private:
122     void                    BuildConfigView( ConfigItem * stringItem,
123                                              module_config_t ** pp_item,
124                                              bool stop_after_category );
125
126     BView                 * fPrefsView;
127     BOutlineListView      * fOutline;
128     BView                 * fDummyView;
129     ConfigItem            * fCurrent;
130
131     intf_thread_t         * p_intf;
132 };
133
134 #endif    // BEOS_PREFERENCES_WINDOW_H