]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/top_window.hpp
* skins2: Anchors are now stored in the layouts, not in the windows.
[vlc] / modules / gui / skins2 / src / top_window.hpp
1 /*****************************************************************************
2  * top_window.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 VideoLAN
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 #ifndef TOP_WINDOW_HPP
26 #define TOP_WINDOW_HPP
27
28 #include "generic_window.hpp"
29 #include "../utils/pointer.hpp"
30 #include <list>
31
32 class OSWindow;
33 class OSGraphics;
34 class GenericLayout;
35 class CtrlGeneric;
36 class WindowManager;
37
38
39 /// Class to handle top-level windows
40 class TopWindow: public GenericWindow
41 {
42     public:
43         TopWindow( intf_thread_t *pIntf, int xPos, int yPos,
44                        WindowManager &rWindowManager,
45                        bool dragDrop, bool playOnDrop );
46         virtual ~TopWindow();
47
48         /// Methods to process OS events.
49         virtual void processEvent( EvtFocus &rEvtFocus );
50         virtual void processEvent( EvtMotion &rEvtMotion );
51         virtual void processEvent( EvtMouse &rEvtMouse );
52         virtual void processEvent( EvtLeave &rEvtLeave );
53         virtual void processEvent( EvtKey &rEvtKey );
54         virtual void processEvent( EvtScroll &rEvtScroll );
55
56         /// Forward an event to a control
57         virtual void forwardEvent( EvtGeneric &rEvt, CtrlGeneric &rCtrl );
58
59         // Refresh an area of the window
60         virtual void refresh( int left, int top, int width, int height );
61
62         /// Change the active layout
63         virtual void setActiveLayout( GenericLayout *pLayout );
64
65         /// Get the active layout
66         virtual const GenericLayout& getActiveLayout() const;
67
68         /// Update the shape of the window from the active layout
69         virtual void updateShape();
70
71         /// Called by a control that wants to capture the mouse
72         virtual void onControlCapture( const CtrlGeneric &rCtrl );
73
74         /// Called by a control that wants to release the mouse
75         virtual void onControlRelease( const CtrlGeneric &rCtrl );
76
77         /// Called by a control when its tooltip changed
78         virtual void onTooltipChange( const CtrlGeneric &rCtrl );
79
80     protected:
81         /// Actually show the window
82         virtual void innerShow();
83
84     private:
85         /// Window manager
86         WindowManager &m_rWindowManager;
87         /// Current active layout of the window
88         GenericLayout *m_pActiveLayout;
89         /// Last control on which the mouse was over
90         CtrlGeneric *m_pLastHitControl;
91         /// Control that has captured the mouse
92         CtrlGeneric *m_pCapturingControl;
93         /// Control that has the focus
94         CtrlGeneric *m_pFocusControl;
95         /// Current key modifier (also used for mouse)
96         int m_currModifier;
97
98         /// Find the uppest control in the layout hit by the mouse, and send
99         /// it an enter event if needed
100         CtrlGeneric *findHitControl( int xPos, int yPos );
101
102         /// Update the lastHitControl pointer and send a leave event to the
103         /// right control
104         void setLastHit( CtrlGeneric *pNewHitControl );
105 };
106
107 typedef CountedPtr<TopWindow> TopWindowPtr;
108
109
110 #endif