]> git.sesse.net Git - vlc/blob - modules/gui/skins2/utils/var_bool.cpp
FSF address change.
[vlc] / modules / gui / skins2 / utils / var_bool.cpp
1 /*****************************************************************************
2  * var_bool.cpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #include "var_bool.hpp"
26
27
28 const string VarBool::m_type = "bool";
29
30
31 VarBoolImpl::VarBoolImpl( intf_thread_t *pIntf ):
32     VarBool( pIntf ), m_value( false )
33 {
34 }
35
36
37 void VarBoolImpl::set( bool value )
38 {
39     if( value != m_value )
40     {
41         m_value = value;
42         notify();
43     }
44 }
45
46
47 VarBoolAndBool::VarBoolAndBool( intf_thread_t *pIntf, VarBool &rVar1,
48                                 VarBool &rVar2 ):
49     VarBool( pIntf ), m_rVar1( rVar1 ), m_rVar2( rVar2 )
50 {
51     m_rVar1.addObserver( this );
52     m_rVar2.addObserver( this );
53 }
54
55
56 VarBoolAndBool::~VarBoolAndBool()
57 {
58     m_rVar1.delObserver( this );
59     m_rVar2.delObserver( this );
60 }
61
62
63 void VarBoolAndBool::onUpdate( Subject<VarBool,void *> &rVariable, void *arg )
64 {
65     notify();
66 }
67
68
69 VarBoolOrBool::VarBoolOrBool( intf_thread_t *pIntf, VarBool &rVar1,
70                               VarBool &rVar2 ):
71     VarBool( pIntf ), m_rVar1( rVar1 ), m_rVar2( rVar2 )
72 {
73     m_rVar1.addObserver( this );
74     m_rVar2.addObserver( this );
75 }
76
77
78 VarBoolOrBool::~VarBoolOrBool()
79 {
80     m_rVar1.delObserver( this );
81     m_rVar2.delObserver( this );
82 }
83
84
85 void VarBoolOrBool::onUpdate( Subject<VarBool,void*> &rVariable , void*arg)
86 {
87     notify();
88 }
89
90
91 VarNotBool::VarNotBool( intf_thread_t *pIntf, VarBool &rVar ):
92     VarBool( pIntf ), m_rVar( rVar )
93 {
94     m_rVar.addObserver( this );
95 }
96
97
98 VarNotBool::~VarNotBool()
99 {
100     m_rVar.delObserver( this );
101 }
102
103
104 void VarNotBool::onUpdate( Subject<VarBool, void*> &rVariable, void*arg )
105 {
106     notify();
107 }
108
109