LCOV - code coverage report
Current view: top level - vcl/source/window - menufloatingwindow.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 4 7 57.1 %
Date: 2014-11-03 Functions: 4 7 57.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_SOURCE_WINDOW_MENUFLOATINGWINDOW_HXX
      21             : #define INCLUDED_VCL_SOURCE_WINDOW_MENUFLOATINGWINDOW_HXX
      22             : 
      23             : #include "menuwindow.hxx"
      24             : 
      25             : #include <vcl/floatwin.hxx>
      26             : #include <vcl/menu.hxx>
      27             : 
      28             : #define EXTRASPACEY         2
      29             : #define GUTTERBORDER        8
      30             : 
      31             : /** Class that implements the actual window of the floating menu.
      32             : */
      33             : class MenuFloatingWindow : public FloatingWindow, public MenuWindow
      34             : {
      35             :     friend void Menu::ImplFillLayoutData() const;
      36             :     friend Menu::~Menu();
      37             : 
      38             : private:
      39             :     Menu*           pMenu;
      40             :     PopupMenu*      pActivePopup;
      41             :     Timer           aHighlightChangedTimer;
      42             :     Timer           aSubmenuCloseTimer;
      43             :     Timer           aScrollTimer;
      44             :     sal_uLong           nSaveFocusId;
      45             :     sal_uInt16          nHighlightedItem;       // highlighted/selected Item
      46             :     sal_uInt16          nMBDownPos;
      47             :     sal_uInt16          nScrollerHeight;
      48             :     sal_uInt16          nFirstEntry;
      49             :     sal_uInt16          nBorder;
      50             :     sal_uInt16          nPosInParent;
      51             :     bool            bInExecute;
      52             : 
      53             :     bool            bScrollMenu;
      54             :     bool            bScrollUp;
      55             :     bool            bScrollDown;
      56             :     bool            bIgnoreFirstMove;
      57             :     bool            bKeyInput;
      58             : 
      59             :                     DECL_LINK(PopupEnd, void *);
      60             :                     DECL_LINK( HighlightChanged, Timer* );
      61             :                     DECL_LINK(SubmenuClose, void *);
      62             :                     DECL_LINK(AutoScroll, void *);
      63             :                     DECL_LINK( ShowHideListener, VclWindowEvent* );
      64             : 
      65             :     virtual void    StateChanged( StateChangedType nType ) SAL_OVERRIDE;
      66             :     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
      67             : 
      68             :     void            InitMenuClipRegion();
      69             : 
      70             : protected:
      71             :     vcl::Region          ImplCalcClipRegion( bool bIncludeLogo = true ) const;
      72             :     void            ImplDrawScroller( bool bUp );
      73             :     using Window::ImplScroll;
      74             :     void            ImplScroll( const Point& rMousePos );
      75             :     void            ImplScroll( bool bUp );
      76             :     void            ImplCursorUpDown( bool bUp, bool bHomeEnd = false );
      77             :     void            ImplHighlightItem( const MouseEvent& rMEvt, bool bMBDown );
      78             :     long            ImplGetStartY() const;
      79             :     Rectangle       ImplGetItemRect( sal_uInt16 nPos );
      80             : 
      81             : public:
      82             :                     MenuFloatingWindow( Menu* pMenu, vcl::Window* pParent, WinBits nStyle );
      83             :                     virtual ~MenuFloatingWindow();
      84             : 
      85             :             void    doShutdown();
      86             : 
      87             :     virtual void    MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      88             :     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      89             :     virtual void    MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      90             :     virtual void    KeyInput( const KeyEvent& rKEvent ) SAL_OVERRIDE;
      91             :     virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
      92             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
      93             :     virtual void    RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
      94             :     virtual void    Resize() SAL_OVERRIDE;
      95             : 
      96          16 :     void            SetFocusId( sal_uLong nId ) { nSaveFocusId = nId; }
      97           0 :     sal_uLong           GetFocusId() const      { return nSaveFocusId; }
      98             : 
      99             :     void            EnableScrollMenu( bool b );
     100          30 :     bool            IsScrollMenu() const        { return bScrollMenu; }
     101           0 :     sal_uInt16          GetScrollerHeight() const   { return nScrollerHeight; }
     102             : 
     103             :     void            Execute();
     104             :     void            StopExecute( sal_uLong nFocusId = 0 );
     105             :     void            EndExecute();
     106             :     void            EndExecute( sal_uInt16 nSelectId );
     107             : 
     108           0 :     PopupMenu*      GetActivePopup() const  { return pActivePopup; }
     109             :     void            KillActivePopup( PopupMenu* pThisOnly = NULL );
     110             : 
     111             :     void            HighlightItem( sal_uInt16 nPos, bool bHighlight );
     112             :     void            ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTimer );
     113         136 :     sal_uInt16          GetHighlightedItem() const { return nHighlightedItem; }
     114             : 
     115          16 :     void            SetPosInParent( sal_uInt16 nPos ) { nPosInParent = nPos; }
     116             : 
     117             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     118             : };
     119             : 
     120             : #endif // INCLUDED_VCL_SOURCE_WINDOW_MENUFLOATINGWINDOW_HXX
     121             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10