top_window.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * top_window.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: 254bdc7cb009bfcec8962f82b2d8682502564806 $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *          Olivier Teulière <ipkiss@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef TOP_WINDOW_HPP
00026 #define TOP_WINDOW_HPP
00027 
00028 #include "generic_window.hpp"
00029 #include "../utils/pointer.hpp"
00030 #include <list>
00031 
00032 class OSWindow;
00033 class OSGraphics;
00034 class GenericLayout;
00035 class CtrlGeneric;
00036 class WindowManager;
00037 
00038 
00039 /// Class to handle top-level windows
00040 class TopWindow: public GenericWindow
00041 {
00042 private:
00043     friend class WindowManager;
00044 public:
00045     TopWindow( intf_thread_t *pIntf, int xPos, int yPos,
00046                WindowManager &rWindowManager,
00047                bool dragDrop, bool playOnDrop, bool visible );
00048     virtual ~TopWindow();
00049 
00050     /// Methods to process OS events.
00051     virtual void processEvent( EvtFocus &rEvtFocus );
00052     virtual void processEvent( EvtMenu &rEvtMenu );
00053     virtual void processEvent( EvtMotion &rEvtMotion );
00054     virtual void processEvent( EvtMouse &rEvtMouse );
00055     virtual void processEvent( EvtLeave &rEvtLeave );
00056     virtual void processEvent( EvtKey &rEvtKey );
00057     virtual void processEvent( EvtScroll &rEvtScroll );
00058 
00059     /// Forward an event to a control
00060     virtual void forwardEvent( EvtGeneric &rEvt, CtrlGeneric &rCtrl );
00061 
00062     // Refresh an area of the window
00063     virtual void refresh( int left, int top, int width, int height );
00064 
00065     /// Get the active layout
00066     virtual const GenericLayout& getActiveLayout() const;
00067 
00068     /// Update the shape of the window from the active layout
00069     virtual void updateShape();
00070 
00071     /// Called by a control that wants to capture the mouse
00072     virtual void onControlCapture( const CtrlGeneric &rCtrl );
00073 
00074     /// Called by a control that wants to release the mouse
00075     virtual void onControlRelease( const CtrlGeneric &rCtrl );
00076 
00077     /// Called by a control when its tooltip changed
00078     virtual void onTooltipChange( const CtrlGeneric &rCtrl );
00079 
00080     /// Get the "maximized" variable
00081     VarBool &getMaximizedVar() { return *m_pVarMaximized; }
00082 
00083     /// Get the initial visibility status
00084     bool isVisible() const { return m_visible; }
00085 
00086 protected:
00087     /// Actually show the window
00088     virtual void innerShow();
00089 
00090     /// Actually hide the window
00091     virtual void innerHide();
00092 
00093 private:
00094     /**
00095      * These methods are only used by the window manager
00096      */
00097     //@{
00098     /// Change the active layout
00099     virtual void setActiveLayout( GenericLayout *pLayout );
00100     //@}
00101 
00102     /// Initial visibility status
00103     bool m_visible;
00104     /// Window manager
00105     WindowManager &m_rWindowManager;
00106     /// Current active layout of the window
00107     GenericLayout *m_pActiveLayout;
00108     /// Last control on which the mouse was over
00109     CtrlGeneric *m_pLastHitControl;
00110     /// Control that has captured the mouse
00111     CtrlGeneric *m_pCapturingControl;
00112     /// Control that has the focus
00113     CtrlGeneric *m_pFocusControl;
00114     /// Current key modifier (also used for mouse)
00115     int m_currModifier;
00116 
00117     /// Variable for the visibility of the window
00118     VarBoolImpl *m_pVarMaximized;
00119 
00120     /**
00121      * Find the uppest control in the layout hit by the mouse, and send
00122      * it an enter event if needed
00123      */
00124     CtrlGeneric *findHitControl( int xPos, int yPos );
00125 
00126     /**
00127      * Update the lastHitControl pointer and send a leave event to the
00128      * right control
00129      */
00130     void setLastHit( CtrlGeneric *pNewHitControl );
00131 };
00132 
00133 typedef CountedPtr<TopWindow> TopWindowPtr;
00134 
00135 
00136 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6