~ubuntu-branches/ubuntu/natty/vlc/natty

« back to all changes in this revision

Viewing changes to modules/gui/skins2/utils/var_list.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-06-25 01:09:16 UTC
  • mfrom: (1.1.30 upstream)
  • Revision ID: james.westby@ubuntu.com-20100625010916-asxhep2mutg6g6pd
Tags: 1.1.0-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - build and install the libx264 plugin
  - add Xb-Npp header to vlc package
  - Add apport hook to include more vlc dependencies in bug reports
* Drop xulrunner patches.
* Drop 502_xulrunner_191.diff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * var_list.hpp
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2003 the VideoLAN team
5
 
 * $Id: d8d7f09cd92a79b5fee0d15e1ea5284ead4adb8f $
 
5
 * $Id: 49d70e636a44482febc95c069472eb8160c757b6 $
6
6
 *
7
7
 * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8
8
 *          Olivier Teulière <ipkiss@via.ecp.fr>
17
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
18
 * GNU General Public License for more details.
19
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.
 
20
 * You should have received a copy of the GNU General Public License along
 
21
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
22
 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23
23
 *****************************************************************************/
24
24
 
25
25
#ifndef VAR_LIST_HPP
36
36
/// List variable
37
37
class VarList: public Variable, public Subject<VarList>
38
38
{
39
 
    public:
40
 
        VarList( intf_thread_t *pIntf );
41
 
        virtual ~VarList();
42
 
 
43
 
        /// Get the variable type
44
 
        virtual const string &getType() const { return m_type; }
45
 
 
46
 
        /// Add a pointer on a string in the list
47
 
        virtual void add( const UStringPtr &rcString );
48
 
 
49
 
        /// Remove the selected elements from the list
50
 
        virtual void delSelected();
51
 
 
52
 
        /// Remove all the elements from the list
53
 
        virtual void clear();
54
 
 
55
 
        /// Get the number of items in the list
56
 
        int size() const { return m_list.size(); }
57
 
 
58
 
        /// Type of an element in the list
59
 
        struct Elem_t
60
 
        {
61
 
            UStringPtr m_cString;
62
 
            bool m_selected;
63
 
            bool m_playing;
64
 
 
65
 
            Elem_t( const UStringPtr &rcString, bool selected = false, bool
66
 
                    playing = false ):
67
 
                m_cString( rcString ), m_selected( selected ),
68
 
                m_playing( playing) {}
69
 
        };
70
 
 
71
 
        /// Iterators
72
 
        typedef list<Elem_t>::iterator Iterator;
73
 
        typedef list<Elem_t>::const_iterator ConstIterator;
74
 
 
75
 
        /// Beginning of the list
76
 
        Iterator begin() { return m_list.begin(); }
77
 
        ConstIterator begin() const { return m_list.begin(); }
78
 
 
79
 
        /// End of the list
80
 
        Iterator end() { return m_list.end(); }
81
 
        ConstIterator end() const { return m_list.end(); }
82
 
 
83
 
        /// Return an iterator on the n'th element of the list
84
 
        Iterator operator[]( int n );
85
 
        ConstIterator operator[]( int n ) const;
86
 
 
87
 
        /// Execute the action associated to this item
88
 
        virtual void action( Elem_t *pItem ) {}
89
 
 
90
 
        /// Get a reference on the position variable
91
 
        VarPercent &getPositionVar() const
92
 
            { return *((VarPercent*)m_cPosition.get()); }
93
 
 
94
 
        /// Get a counted pointer on the position variable
95
 
        const VariablePtr &getPositionVarPtr() const { return m_cPosition; }
96
 
 
97
 
    protected:
98
 
        /// List of elements
99
 
        list<Elem_t> m_list;
100
 
 
101
 
    private:
102
 
        /// Variable type
103
 
        static const string m_type;
104
 
        /// Position variable
105
 
        VariablePtr m_cPosition;
 
39
public:
 
40
    VarList( intf_thread_t *pIntf );
 
41
    virtual ~VarList();
 
42
 
 
43
    /// Get the variable type
 
44
    virtual const string &getType() const { return m_type; }
 
45
 
 
46
    /// Add a pointer on a string in the list
 
47
    virtual void add( const UStringPtr &rcString );
 
48
 
 
49
    /// Remove the selected elements from the list
 
50
    virtual void delSelected();
 
51
 
 
52
    /// Remove all the elements from the list
 
53
    virtual void clear();
 
54
 
 
55
    /// Get the number of items in the list
 
56
    int size() const { return m_list.size(); }
 
57
 
 
58
    /// Type of an element in the list
 
59
    struct Elem_t
 
60
    {
 
61
        UStringPtr m_cString;
 
62
        bool m_selected;
 
63
        bool m_playing;
 
64
 
 
65
        Elem_t( const UStringPtr &rcString,
 
66
                bool selected = false, bool playing = false )
 
67
              : m_cString( rcString ),
 
68
                m_selected( selected ), m_playing( playing ) { }
 
69
    };
 
70
 
 
71
    /// Iterators
 
72
    typedef list<Elem_t>::iterator Iterator;
 
73
    typedef list<Elem_t>::const_iterator ConstIterator;
 
74
 
 
75
    /// Beginning of the list
 
76
    Iterator begin() { return m_list.begin(); }
 
77
    ConstIterator begin() const { return m_list.begin(); }
 
78
 
 
79
    /// End of the list
 
80
    Iterator end() { return m_list.end(); }
 
81
    ConstIterator end() const { return m_list.end(); }
 
82
 
 
83
    /// Return an iterator on the n'th element of the list
 
84
    Iterator operator[]( int n );
 
85
    ConstIterator operator[]( int n ) const;
 
86
 
 
87
    /// Execute the action associated to this item
 
88
    virtual void action( Elem_t *pItem ) { }
 
89
 
 
90
    /// Get a reference on the position variable
 
91
    VarPercent &getPositionVar() const
 
92
        { return *((VarPercent*)m_cPosition.get()); }
 
93
 
 
94
    /// Get a counted pointer on the position variable
 
95
    const VariablePtr &getPositionVarPtr() const { return m_cPosition; }
 
96
 
 
97
protected:
 
98
    /// List of elements
 
99
    list<Elem_t> m_list;
 
100
 
 
101
private:
 
102
    /// Variable type
 
103
    static const string m_type;
 
104
    /// Position variable
 
105
    VariablePtr m_cPosition;
106
106
};
107
107
 
108
108