]> git.sesse.net Git - vlc/blob - modules/gui/beos/PreferencesWindow.h
playlist: Make sure we don't pl_Release(p_playlist).
[vlc] / modules / gui / beos / PreferencesWindow.h
1 /*****************************************************************************
2  * PreferencesWindow.h
3  *****************************************************************************
4  * Copyright (C) 1999, 2000, 2001 the VideoLAN team
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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                         ~ConfigWidget();
59         bool            InitCheck() { return fInitOK; }
60         void            Apply( bool doIt );
61
62     private:
63         intf_thread_t * p_intf;
64
65         bool            fInitOK;
66         int             fType;
67         char          * fName;
68
69         VTextControl  * fTextControl;
70         BCheckBox     * fCheckBox;
71         BPopUpMenu    * fPopUpMenu;
72         BMenuField    * fMenuField;
73         BSlider       * fSlider;
74         BStringView   * fStringView;
75         BCheckBox     * fAltCheck;
76         BCheckBox     * fCtrlCheck;
77         BCheckBox     * fShiftCheck;
78 };
79
80 class ConfigItem : public BStringItem
81 {
82     public:
83                       ConfigItem( intf_thread_t * p_intf,
84                                   char * name, bool subModule,
85                                   int objectId, int type, char * help );
86                       ~ConfigItem();
87         int           ObjectId() { return fObjectId; }
88         BBox        * Box() { return fBox; }
89         void          UpdateScrollBar();
90         void          ResetScroll();
91         void          Apply( bool doIt );
92
93     private:
94         intf_thread_t * p_intf;
95
96         bool            fSubModule;
97         int             fObjectId;
98         int             fType;
99         char          * fHelp;
100
101         BBox          * fBox;
102         VTextView     * fTextView;
103         BScrollView   * fScroll;
104         BView         * fView;
105 };
106
107 class PreferencesWindow : public BWindow
108 {
109   public:
110                             PreferencesWindow( intf_thread_t * p_intf,
111                                                BRect frame,
112                                                const char * name );
113     virtual                 ~PreferencesWindow();
114
115     virtual bool            QuitRequested();
116     virtual void            MessageReceived(BMessage* message);
117     virtual void            FrameResized( float, float );
118
119             void            Update();
120             void            Apply( bool doIt );
121
122             void            ReallyQuit();
123
124   private:
125     void                    BuildConfigView( ConfigItem * stringItem,
126                                              module_config_t ** pp_item,
127                                              bool stop_after_category );
128
129     BView                 * fPrefsView;
130     BOutlineListView      * fOutline;
131     BView                 * fDummyView;
132     ConfigItem            * fCurrent;
133
134     intf_thread_t         * p_intf;
135 };
136
137 #endif    // BEOS_PREFERENCES_WINDOW_H