LCOV - code coverage report
Current view: top level - vcl/source/window - menufloatingwindow.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 7 57.1 %
Date: 2015-06-13 12:38:46 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             : 
      52             :     bool bInExecute : 1;
      53             : 
      54             :     bool bScrollMenu : 1;
      55             :     bool bScrollUp : 1;
      56             :     bool bScrollDown : 1;
      57             :     bool bIgnoreFirstMove : 1;
      58             :     bool bKeyInput : 1;
      59             : 
      60             :     DECL_LINK(PopupEnd, void *);
      61             :     DECL_LINK_TYPED( HighlightChanged, Timer*, void );
      62             :     DECL_LINK_TYPED(SubmenuClose, Timer *, void);
      63             :     DECL_LINK_TYPED(AutoScroll, Timer *, void);
      64             :     DECL_LINK( ShowHideListener, VclWindowEvent* );
      65             : 
      66             :     virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
      67             :     virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
      68             : 
      69             :     void InitMenuClipRegion(vcl::RenderContext& rRenderContext);
      70             : 
      71             : protected:
      72             :     vcl::Region ImplCalcClipRegion( bool bIncludeLogo = true ) const;
      73             :     void ImplDrawScroller(vcl::RenderContext& rRenderContext, bool bUp);
      74             :     using Window::ImplScroll;
      75             :     void ImplScroll( const Point& rMousePos );
      76             :     void ImplScroll( bool bUp );
      77             :     void ImplCursorUpDown( bool bUp, bool bHomeEnd = false );
      78             :     void ImplHighlightItem( const MouseEvent& rMEvt, bool bMBDown );
      79             :     long ImplGetStartY() const;
      80             :     Rectangle ImplGetItemRect( sal_uInt16 nPos );
      81             :     void RenderHighlightItem( vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight );
      82             :     long GetInitialItemY( long *pOptStartY = NULL ) const;
      83             :     void InvalidateItem( sal_uInt16 nPos );
      84             : 
      85             : public:
      86             :     MenuFloatingWindow(Menu* pMenu, vcl::Window* pParent, WinBits nStyle);
      87             :     virtual ~MenuFloatingWindow();
      88             : 
      89             :     virtual void dispose() SAL_OVERRIDE;
      90             :     void doShutdown();
      91             : 
      92             :     virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE;
      93             :     virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
      94             :     virtual void MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
      95             :     virtual void KeyInput(const KeyEvent& rKEvent) SAL_OVERRIDE;
      96             :     virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
      97             :     virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
      98             :     virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
      99             :     virtual void Resize() SAL_OVERRIDE;
     100             : 
     101             :     virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
     102             : 
     103           8 :     void SetFocusId( sal_uLong nId ) { nSaveFocusId = nId; }
     104           0 :     sal_uLong GetFocusId() const      { return nSaveFocusId; }
     105             : 
     106             :     void EnableScrollMenu( bool b );
     107          16 :     bool IsScrollMenu() const        { return bScrollMenu; }
     108           0 :     sal_uInt16 GetScrollerHeight() const   { return nScrollerHeight; }
     109             : 
     110             :     void Execute();
     111             :     void StopExecute( sal_uLong nFocusId = 0 );
     112             :     void EndExecute();
     113             :     void EndExecute( sal_uInt16 nSelectId );
     114             : 
     115           0 :     PopupMenu* GetActivePopup() const  { return pActivePopup; }
     116             :     void KillActivePopup( PopupMenu* pThisOnly = NULL );
     117             : 
     118             :     void ChangeHighlightItem(sal_uInt16 n, bool bStartPopupTimer);
     119          88 :     sal_uInt16 GetHighlightedItem() const { return nHighlightedItem; }
     120             : 
     121           8 :     void SetPosInParent( sal_uInt16 nPos ) { nPosInParent = nPos; }
     122             : 
     123             :     virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
     124             : };
     125             : 
     126             : #endif // INCLUDED_VCL_SOURCE_WINDOW_MENUFLOATINGWINDOW_HXX
     127             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11