LCOV - code coverage report
Current view: top level - include/vcl - splitwin.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 6 50.0 %
Date: 2015-06-13 12:38:46 Functions: 3 6 50.0 %
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_SPLITWIN_HXX
      21             : #define INCLUDED_VCL_SPLITWIN_HXX
      22             : 
      23             : #include <vcl/dllapi.h>
      24             : #include <vcl/dockwin.hxx>
      25             : #include <o3tl/typed_flags_set.hxx>
      26             : 
      27             : class Wallpaper;
      28             : class ImplSplitSet;
      29             : 
      30             : enum class SplitWindowItemFlags
      31             : {
      32             :     NONE           = 0x0000,
      33             :     Fixed          = 0x0001,
      34             :     RelativeSize   = 0x0002,
      35             :     PercentSize    = 0x0004,
      36             :     ColSet         = 0x0008,
      37             :     Invisible      = 0x0010,
      38             : };
      39             : namespace o3tl
      40             : {
      41             :     template<> struct typed_flags<SplitWindowItemFlags> : is_typed_flags<SplitWindowItemFlags, 0x1f> {};
      42             : }
      43             : 
      44             : #define SPLITWINDOW_APPEND          ((sal_uInt16)0xFFFF)
      45             : #define SPLITWINDOW_ITEM_NOTFOUND   ((sal_uInt16)0xFFFF)
      46             : 
      47             : class VCL_DLLPUBLIC SplitWindow : public DockingWindow
      48             : {
      49             : private:
      50             :     ImplSplitSet*       mpMainSet;
      51             :     ImplSplitSet*       mpBaseSet;
      52             :     ImplSplitSet*       mpSplitSet;
      53             :     long*               mpLastSizes;
      54             :     Rectangle           maDragRect;
      55             :     long                mnDX;
      56             :     long                mnDY;
      57             :     long                mnLeftBorder;
      58             :     long                mnTopBorder;
      59             :     long                mnRightBorder;
      60             :     long                mnBottomBorder;
      61             :     long                mnMaxSize;
      62             :     long                mnMouseOff;
      63             :     long                mnMStartPos;
      64             :     long                mnMSplitPos;
      65             :     WinBits             mnWinStyle;
      66             :     WindowAlign         meAlign;
      67             :     sal_uInt16          mnSplitTest;
      68             :     sal_uInt16          mnSplitPos;
      69             :     sal_uInt16          mnMouseModifier;
      70             :     bool                mbDragFull:1,
      71             :                         mbHorz:1,
      72             :                         mbBottomRight:1,
      73             :                         mbCalc:1,
      74             :                         mbRecalc:1,
      75             :                         mbInvalidate:1,
      76             :                         mbAutoHide:1,
      77             :                         mbFadeIn:1,
      78             :                         mbFadeOut:1,
      79             :                         mbAutoHideIn:1,
      80             :                         mbAutoHideDown:1,
      81             :                         mbFadeInDown:1,
      82             :                         mbFadeOutDown:1,
      83             :                         mbAutoHidePressed:1,
      84             :                         mbFadeInPressed:1,
      85             :                         mbFadeOutPressed:1,
      86             :                         mbFadeNoButtonMode:1,
      87             :                         mbNoAlign:1;
      88             :     Link<>              maStartSplitHdl;
      89             :     Link<>              maSplitHdl;
      90             :     Link<>              maSplitResizeHdl;
      91             :     Link<>              maAutoHideHdl;
      92             :     Link<>              maFadeInHdl;
      93             :     Link<>              maFadeOutHdl;
      94             : 
      95             :     using Window::ImplInit;
      96             :     SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
      97             :     SAL_DLLPRIVATE void ImplInitSettings();
      98             :     SAL_DLLPRIVATE void ImplCalcLayout();
      99             :     SAL_DLLPRIVATE void ImplUpdate();
     100             :     SAL_DLLPRIVATE void ImplSetWindowSize( long nDelta );
     101             :     SAL_DLLPRIVATE void ImplSplitMousePos( Point& rMousePos );
     102             :     SAL_DLLPRIVATE void ImplGetButtonRect( Rectangle& rRect, long nEx, bool bTest ) const;
     103             :     SAL_DLLPRIVATE void ImplGetAutoHideRect( Rectangle& rRect, bool bTest = false ) const;
     104             :     SAL_DLLPRIVATE void ImplGetFadeInRect( Rectangle& rRect, bool bTest = false ) const;
     105             :     SAL_DLLPRIVATE void ImplGetFadeOutRect( Rectangle& rRect, bool bTest = false ) const;
     106             :     SAL_DLLPRIVATE void ImplDrawButtonRect(vcl::RenderContext& rRenderContext, const Rectangle& rRect, long nSize);
     107             :     SAL_DLLPRIVATE void ImplDrawAutoHide(vcl::RenderContext& rRenderContext, bool bInPaint);
     108             :     SAL_DLLPRIVATE void ImplDrawFadeIn(vcl::RenderContext& rRenderContext, bool bInPaint);
     109             :     SAL_DLLPRIVATE void ImplDrawFadeOut(vcl::RenderContext& rRenderContext, bool bInPaint);
     110             :     SAL_DLLPRIVATE void ImplNewAlign();
     111             :     SAL_DLLPRIVATE void ImplDrawGrip(vcl::RenderContext& rRenderContext, const Rectangle& rRect, bool bHorz, bool bLeft);
     112             :     SAL_DLLPRIVATE void ImplDrawFadeArrow(vcl::RenderContext& rRenderContext, const Point& rPt, bool bHorz, bool bLeft);
     113             :     SAL_DLLPRIVATE void ImplStartSplit( const MouseEvent& rMEvt );
     114             : 
     115             :     SAL_DLLPRIVATE void ImplDrawBorder(vcl::RenderContext& rRenderContext);
     116             :     SAL_DLLPRIVATE void ImplDrawBorderLine(vcl::RenderContext& rRenderContext);
     117             :     static SAL_DLLPRIVATE void ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool bHide,
     118             :                                              bool bRows, bool bDown = true );
     119             :     SAL_DLLPRIVATE void ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet );
     120             :     SAL_DLLPRIVATE void ImplDrawBack(vcl::RenderContext& rRenderContext, const Rectangle& rRect,
     121             :                                              const Wallpaper* pWall, const Bitmap* pBitmap );
     122             :     static SAL_DLLPRIVATE sal_uInt16 ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
     123             :                                                 long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos,
     124             :                                                 bool bRows, bool bDown = true );
     125             :     static SAL_DLLPRIVATE sal_uInt16 ImplTestSplit( SplitWindow* pWindow, const Point& rPos,
     126             :                                                 long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos );
     127             :     SAL_DLLPRIVATE void ImplDrawSplitTracking(const Point& rPos);
     128             : 
     129             :                         SplitWindow (const SplitWindow &) SAL_DELETED_FUNCTION;
     130             :                         SplitWindow & operator= (const SplitWindow &) SAL_DELETED_FUNCTION;
     131             : public:
     132             :                         SplitWindow( vcl::Window* pParent, WinBits nStyle = 0 );
     133             :     virtual             ~SplitWindow();
     134             :     virtual void        dispose() SAL_OVERRIDE;
     135             : 
     136             :     virtual void        StartSplit();
     137             :     virtual void        Split();
     138             :     virtual void        SplitResize();
     139             :     virtual void        AutoHide();
     140             :     virtual void        FadeIn();
     141             :     virtual void        FadeOut();
     142             : 
     143             :     virtual void        MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     144             :     virtual void        MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     145             :     virtual void        Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     146             :     virtual void        Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
     147             :     virtual void        Move() SAL_OVERRIDE;
     148             :     virtual void        Resize() SAL_OVERRIDE;
     149             :     virtual void        RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
     150             :     virtual void        StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     151             :     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     152             :     virtual bool        PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     153             : 
     154             :     void                InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize,
     155             :                                     sal_uInt16 nPos = SPLITWINDOW_APPEND, sal_uInt16 nIntoSetId = 0,
     156             :                                     SplitWindowItemFlags nBits = SplitWindowItemFlags::NONE );
     157             :     void                InsertItem( sal_uInt16 nId, long nSize,
     158             :                                     sal_uInt16 nPos = SPLITWINDOW_APPEND, sal_uInt16 nIntoSetId = 0,
     159             :                                     SplitWindowItemFlags nBits = SplitWindowItemFlags::NONE );
     160             :     void                RemoveItem( sal_uInt16 nId, bool bHide = true );
     161             :     void                Clear();
     162             : 
     163             :     void                SplitItem( sal_uInt16 nId, long nNewSize,
     164             :                                    bool bPropSmall = false,
     165             :                                    bool bPropGreat = false );
     166             :     void                SetItemSize( sal_uInt16 nId, long nNewSize );
     167             :     long                GetItemSize( sal_uInt16 nId ) const;
     168             :     /** Set a range that limits the (variable part of the) size with an
     169             :         upper and a lower bound (both are valid values themselves.)
     170             :         @param nId
     171             :             Id of the item for which the size limits are set.
     172             :         @param rRange
     173             :             Values of -1 define missing bounds, thus setting a range (-1,-1)
     174             :             (the default) removes the size limitiation.
     175             :     */
     176             :     void                SetItemSizeRange (sal_uInt16 nId, const Range& rRange);
     177             :     /** Return the current size limits for the specified item.
     178             :     */
     179             :     long                GetItemSize( sal_uInt16 nId, SplitWindowItemFlags nBits ) const;
     180             :     sal_uInt16              GetSet( sal_uInt16 nId ) const;
     181             :     sal_uInt16              GetItemId( vcl::Window* pWindow ) const;
     182             :     sal_uInt16              GetItemId( const Point& rPos ) const;
     183             :     sal_uInt16              GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId = 0 ) const;
     184             :     sal_uInt16              GetItemId( sal_uInt16 nPos, sal_uInt16 nSetId = 0 ) const;
     185             :     sal_uInt16              GetItemCount( sal_uInt16 nSetId = 0 ) const;
     186             :     bool                IsItemValid( sal_uInt16 nId ) const;
     187             : 
     188             :     bool                IsNoAlign() const { return mbNoAlign; }
     189             :     void                SetAlign( WindowAlign eNewAlign = WINDOWALIGN_TOP );
     190       65574 :     WindowAlign         GetAlign() const { return meAlign; }
     191        3471 :     bool                IsHorizontal() const { return mbHorz; }
     192             : 
     193             :     bool                IsSplitting() const { return IsTracking(); }
     194             : 
     195           0 :     void                SetMaxSizePixel( long nNewMaxSize ) { mnMaxSize = nNewMaxSize; }
     196             :     long                GetMaxSizePixel() const { return mnMaxSize; }
     197             : 
     198             :     Size                CalcLayoutSizePixel( const Size& aNewSize );
     199             : 
     200             :     void                ShowAutoHideButton( bool bShow = true );
     201       13000 :     bool                IsAutoHideButtonVisible() const { return mbAutoHide; }
     202             :     void                ShowFadeInHideButton( bool bShow = true );
     203             :     void                ShowFadeInButton( bool bShow = true ) { ShowFadeInHideButton( bShow ); }
     204             :     bool                IsFadeInButtonVisible() const { return mbFadeIn; }
     205             :     void                ShowFadeOutButton( bool bShow = true );
     206             :     bool                IsFadeOutButtonVisible() const { return mbFadeOut; }
     207             :     long                GetFadeInSize() const;
     208           0 :     bool                IsFadeNoButtonMode() const { return mbFadeNoButtonMode; }
     209             : 
     210             :     void                SetAutoHideState( bool bAutoHide );
     211             :     bool                GetAutoHideState() const { return mbAutoHideIn; }
     212             : 
     213             :     void                SetStartSplitHdl( const Link<>& rLink ) { maStartSplitHdl = rLink; }
     214             :     const Link<>&       GetStartSplitHdl() const { return maStartSplitHdl; }
     215           0 :     void                SetSplitHdl( const Link<>& rLink ) { maSplitHdl = rLink; }
     216             :     const Link<>&       GetSplitHdl() const { return maSplitHdl; }
     217             :     void                SetSplitResizeHdl( const Link<>& rLink ) { maSplitResizeHdl = rLink; }
     218             :     const Link<>&       GetSplitResizeHdl() const { return maSplitResizeHdl; }
     219             :     void                SetAutoHideHdl( const Link<>& rLink ) { maAutoHideHdl = rLink; }
     220             :     const Link<>&       GetAutoHideHdl() const { return maAutoHideHdl; }
     221             :     void                SetFadeInHdl( const Link<>& rLink ) { maFadeInHdl = rLink; }
     222             :     const Link<>&       GetFadeInHdl() const { return maFadeInHdl; }
     223             :     void                SetFadeOutHdl( const Link<>& rLink ) { maFadeOutHdl = rLink; }
     224             :     const Link<>&       GetFadeOutHdl() const { return maFadeOutHdl; }
     225             : };
     226             : 
     227             : #endif // INCLUDED_VCL_SPLITWIN_HXX
     228             : 
     229             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11