~ubuntu-branches/debian/wheezy/vlc/wheezy

« back to all changes in this revision

Viewing changes to modules/gui/skins2/src/window_manager.hpp

Tags: upstream-0.7.2.final
Import upstream version 0.7.2.final

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 * window_manager.hpp
 
3
 *****************************************************************************
 
4
 * Copyright (C) 2003 VideoLAN
 
5
 * $Id: window_manager.hpp 7270 2004-04-03 23:21:47Z asmax $
 
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 
23
 *****************************************************************************/
 
24
 
 
25
#ifndef WINDOW_MANAGER_HPP
 
26
#define WINDOW_MANAGER_HPP
 
27
 
 
28
#include "skin_common.hpp"
 
29
#include "top_window.hpp"
 
30
#include <list>
 
31
#include <map>
 
32
#include <set>
 
33
#include <utility>
 
34
 
 
35
 
 
36
class GenericFont;
 
37
class GenericLayout;
 
38
class Anchor;
 
39
class Tooltip;
 
40
 
 
41
 
 
42
/// Window manager for skin windows
 
43
class WindowManager: public SkinObject
 
44
{
 
45
    public:
 
46
        /// Constructor
 
47
        WindowManager( intf_thread_t *pIntf);
 
48
 
 
49
        /// Destructor
 
50
        virtual ~WindowManager();
 
51
 
 
52
        /// Add a window to the list of known windows. Necessary if you want
 
53
        /// your window to be movable...
 
54
        void registerWindow( TopWindow &rWindow );
 
55
 
 
56
        /// Remove a previously registered window
 
57
        void unregisterWindow( TopWindow &rWindow );
 
58
 
 
59
        /// Tell the window manager that a move is initiated for pWindow.
 
60
        void startMove( TopWindow &rWindow );
 
61
 
 
62
        /// Tell the window manager that the current move ended.
 
63
        void stopMove();
 
64
 
 
65
        /// Move the pWindow window to (left, top), and move all its
 
66
        /// anchored windows.
 
67
        /// If a new anchoring is detected, the windows will move accordingly.
 
68
        void move( TopWindow &rWindow, int left, int top ) const;
 
69
 
 
70
        /// Show all the registered windows
 
71
        void showAll() const;
 
72
 
 
73
        /// Hide all the registered windows
 
74
        void hideAll() const;
 
75
 
 
76
        /// Synchronize the windows with their visibility variable
 
77
        void synchVisibility() const;
 
78
 
 
79
        /// Raise the given window
 
80
        void raise( TopWindow &rWindow ) const { rWindow.raise(); }
 
81
 
 
82
        /// Show the given window
 
83
        void show( TopWindow &rWindow ) const { rWindow.show(); }
 
84
 
 
85
        /// Hide the given window
 
86
        void hide( TopWindow &rWindow ) const { rWindow.hide(); }
 
87
 
 
88
        /// Toggle all the windows on top
 
89
        void toggleOnTop();
 
90
 
 
91
        /// Set the magnetism of screen edges
 
92
        void setMagnetValue( int magnet ) { m_magnet = magnet; }
 
93
 
 
94
        /// Set the alpha value of the static windows
 
95
        void setAlphaValue( int alpha ) { m_alpha = alpha; }
 
96
 
 
97
        /// Set the alpha value of the moving windows
 
98
        void setMoveAlphaValue( int moveAlpha ) { m_moveAlpha = moveAlpha; }
 
99
 
 
100
        /// Create the tooltip window
 
101
        void createTooltip( const GenericFont &rTipFont );
 
102
 
 
103
        /// Show the tooltip window
 
104
        void showTooltip();
 
105
 
 
106
        /// Hide the tooltip window
 
107
        void hideTooltip();
 
108
 
 
109
        /// Add a layout of the given window. This new layout will be the
 
110
        /// active one.
 
111
        void addLayout( TopWindow &rWindow, GenericLayout &rLayout );
 
112
 
 
113
        /// Change the active layout of the given window
 
114
        void setActiveLayout( TopWindow &rWindow, GenericLayout &rLayout );
 
115
 
 
116
    private:
 
117
        /// Some useful typedefs for lazy people like me
 
118
        typedef set<TopWindow*> WinSet_t;
 
119
        typedef list<Anchor*> AncList_t;
 
120
 
 
121
        /// This map represents the graph of anchored windows: it associates
 
122
        /// to a given window all the windows that are directly anchored by it.
 
123
        /// This is not transitive, i.e. if a is in m_dep[b] and if b is in
 
124
        /// m_dep[c], it doesn't mean that a is in m_dep[c] (in fact, it
 
125
        /// would be extremely rare...)
 
126
        map<TopWindow*, WinSet_t> m_dependencies;
 
127
        /// Store all the windows
 
128
        WinSet_t m_allWindows;
 
129
        /// Store the moving windows; this set is updated at every start of
 
130
        /// move.
 
131
        WinSet_t m_movingWindows;
 
132
        /// Indicate whether the windows are currently on top
 
133
        bool m_isOnTop;
 
134
        /// Magnetism of the screen edges (= scope of action)
 
135
        int m_magnet;
 
136
        /// Alpha value of the static windows
 
137
        int m_alpha;
 
138
        /// Alpha value of the moving windows
 
139
        int m_moveAlpha;
 
140
        /// Tooltip
 
141
        Tooltip *m_pTooltip;
 
142
 
 
143
        /// Recursively build a set of windows anchored to the one given.
 
144
        void buildDependSet( WinSet_t &rWinSet, TopWindow *pWindow );
 
145
 
 
146
        /// Check anchoring: this function updates xOffset and yOffset,
 
147
        /// to take care of a new anchoring (if any)
 
148
        void checkAnchors( TopWindow *pWindow,
 
149
                           int &xOffset, int &yOffset ) const;
 
150
};
 
151
 
 
152
 
 
153
#endif