]> git.sesse.net Git - vlc/blob - modules/gui/skins2/commands/cmd_vars.hpp
macosx: add option to hide effects button in control bar
[vlc] / modules / gui / skins2 / commands / cmd_vars.hpp
1 /*****************************************************************************
2  * cmd_vars.hpp
3  *****************************************************************************
4  * Copyright (C) 2004 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
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 along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef CMD_VARS_HPP
25 #define CMD_VARS_HPP
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <vlc_common.h>
32 #include <vlc_playlist.h>
33
34 #include "cmd_generic.hpp"
35 #include "../utils/ustring.hpp"
36
37 class EqualizerBands;
38 class EqualizerPreamp;
39 class VarText;
40
41 /// Command to notify the playtree of an item update
42 class CmdItemUpdate: public CmdGeneric
43 {
44 public:
45     CmdItemUpdate( intf_thread_t *pIntf, input_item_t* pItem ):
46         CmdGeneric( pIntf ), m_pItem( pItem )
47     {
48         if( pItem )
49             vlc_gc_incref( pItem );
50     }
51     virtual ~CmdItemUpdate()
52     {
53         if( m_pItem )
54             vlc_gc_decref( m_pItem );
55     }
56     virtual void execute();
57     virtual string getType() const { return "playtree update"; }
58
59     /// Only accept removal of command if they concern the same item
60     virtual bool checkRemove( CmdGeneric * ) const;
61
62 private:
63     /// input item changed
64     input_item_t* m_pItem;
65 };
66
67 /// Command to notify the playtree of an item append
68 class CmdPlaytreeAppend: public CmdGeneric
69 {
70 public:
71     CmdPlaytreeAppend( intf_thread_t *pIntf, playlist_add_t *p_add ):
72         CmdGeneric( pIntf ), m_pAdd( NULL )
73     {
74         if( p_add )
75         {
76             m_pAdd = new playlist_add_t;
77             *m_pAdd = *p_add;
78         }
79     }
80     virtual ~CmdPlaytreeAppend()
81     {
82         delete m_pAdd;
83     }
84     virtual void execute();
85     virtual string getType() const { return "playtree append"; }
86
87 private:
88     playlist_add_t * m_pAdd;
89 };
90
91 /// Command to notify the playtree of an item deletion
92 class CmdPlaytreeDelete: public CmdGeneric
93 {
94 public:
95     CmdPlaytreeDelete( intf_thread_t *pIntf, int i_id ):
96         CmdGeneric( pIntf ), m_id( i_id ) { }
97     virtual ~CmdPlaytreeDelete() { }
98     virtual void execute();
99     virtual string getType() const { return "playtree append"; }
100
101 private:
102     int m_id;
103 };
104
105
106 /// Command to set a text variable
107 class CmdSetText: public CmdGeneric
108 {
109 public:
110     CmdSetText( intf_thread_t *pIntf, VarText &rText, const UString &rValue ):
111         CmdGeneric( pIntf ), m_rText( rText ), m_value( rValue ) { }
112     virtual ~CmdSetText() { }
113     virtual void execute();
114     virtual string getType() const { return "set text"; }
115
116 private:
117     /// Text variable to set
118     VarText &m_rText;
119     /// Value to set
120     const UString m_value;
121 };
122
123
124 /// Command to set the equalizer preamp
125 class CmdSetEqPreamp: public CmdGeneric
126 {
127 public:
128     CmdSetEqPreamp( intf_thread_t *I, EqualizerPreamp &P, float v )
129                   : CmdGeneric( I ), m_rPreamp( P ), m_value( v ) { }
130     virtual ~CmdSetEqPreamp() { }
131     virtual void execute();
132     virtual string getType() const { return "set equalizer preamp"; }
133
134 private:
135     /// Preamp variable to set
136     EqualizerPreamp &m_rPreamp;
137     /// Value to set
138     float m_value;
139 };
140
141
142 /// Command to set the equalizerbands
143 class CmdSetEqBands: public CmdGeneric
144 {
145 public:
146     CmdSetEqBands( intf_thread_t *I, EqualizerBands &B, const string &V )
147                  : CmdGeneric( I ), m_rEqBands( B ), m_value( V ) { }
148     virtual ~CmdSetEqBands() { }
149     virtual void execute();
150     virtual string getType() const { return "set equalizer bands"; }
151
152 private:
153     /// Equalizer variable to set
154     EqualizerBands &m_rEqBands;
155     /// Value to set
156     const string m_value;
157 };
158
159
160 #endif