LCOV - code coverage report
Current view: top level - include/vcl - tabctrl.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 9 0.0 %
Date: 2014-04-14 Functions: 0 5 0.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_TABCTRL_HXX
      21             : #define INCLUDED_VCL_TABCTRL_HXX
      22             : 
      23             : #include <vcl/dllapi.h>
      24             : #include <vcl/ctrl.hxx>
      25             : 
      26             : struct ImplTabItem;
      27             : struct ImplTabCtrlData;
      28             : class TabPage;
      29             : class PushButton;
      30             : class ListBox;
      31             : 
      32             : #ifndef TAB_APPEND
      33             : #define TAB_APPEND          ((sal_uInt16)0xFFFF)
      34             : #define TAB_PAGE_NOTFOUND   ((sal_uInt16)0xFFFF)
      35             : #endif /* !TAB_APPEND */
      36             : 
      37             : class VCL_DLLPUBLIC TabControl : public Control
      38             : {
      39             : private:
      40             :     ImplTabCtrlData*    mpTabCtrlData;
      41             :     long                mnLastWidth;
      42             :     long                mnLastHeight;
      43             :     long                mnBtnSize;
      44             :     long                mnMaxPageWidth;
      45             :     sal_uInt16              mnActPageId;
      46             :     sal_uInt16              mnCurPageId;
      47             :     bool                mbFormat;
      48             :     bool                mbRestoreHelpId;
      49             :     bool                mbRestoreUnqId;
      50             :     bool                mbSmallInvalidate;
      51             :     bool                    mbLayoutDirty;
      52             :     Link                maActivateHdl;
      53             :     Link                maDeactivateHdl;
      54             : 
      55             :     using Control::ImplInitSettings;
      56             :     SAL_DLLPRIVATE void         ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
      57             :     SAL_DLLPRIVATE ImplTabItem* ImplGetItem( sal_uInt16 nId ) const;
      58             :     SAL_DLLPRIVATE Size         ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth );
      59             :     SAL_DLLPRIVATE Rectangle    ImplGetTabRect( sal_uInt16 nPos, long nWidth = -1, long nHeight = -1 );
      60             :     SAL_DLLPRIVATE void         ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId );
      61             :     SAL_DLLPRIVATE bool         ImplPosCurTabPage();
      62             :     SAL_DLLPRIVATE void         ImplActivateTabPage( bool bNext );
      63             :     SAL_DLLPRIVATE void         ImplShowFocus();
      64             :     SAL_DLLPRIVATE void         ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bool bLayout = false, bool bFirstInGroup = false, bool bLastInGroup = false, bool bIsCurrentItem = false );
      65             :     SAL_DLLPRIVATE void         ImplPaint( const Rectangle& rRect, bool bLayout = false );
      66             :     SAL_DLLPRIVATE void         ImplFreeLayoutData();
      67             :     SAL_DLLPRIVATE bool         ImplHandleKeyEvent( const KeyEvent& rKeyEvent );
      68             : 
      69             :     DECL_DLLPRIVATE_LINK(       ImplListBoxSelectHdl, void* );
      70             :     DECL_DLLPRIVATE_LINK(       ImplWindowEventListener, VclSimpleEvent* );
      71             : 
      72             : 
      73             : protected:
      74             :     using Window::ImplInit;
      75             :     SAL_DLLPRIVATE void         ImplInit( Window* pParent, WinBits nStyle );
      76             :     SAL_DLLPRIVATE void         ImplLoadRes( const ResId& rResId );
      77             : 
      78             :     virtual void                FillLayoutData() const SAL_OVERRIDE;
      79             :     virtual const Font&         GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
      80             :     virtual const Color&        GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
      81             :     SAL_DLLPRIVATE Rectangle*   ImplFindPartRect( const Point& rPt );
      82             : 
      83             : public:
      84             :                         TabControl( Window* pParent,
      85             :                                     WinBits nStyle = WB_STDTABCONTROL );
      86             :                         TabControl( Window* pParent, const ResId& rResId );
      87             :                         virtual ~TabControl();
      88             : 
      89             :     virtual void        MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      90             :     virtual void        KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
      91             :     virtual void        Paint( const Rectangle& rRect ) SAL_OVERRIDE;
      92             :     virtual void        Resize() SAL_OVERRIDE;
      93             :     virtual void        GetFocus() SAL_OVERRIDE;
      94             :     virtual void        LoseFocus() SAL_OVERRIDE;
      95             :     virtual void        RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
      96             :     virtual void        Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
      97             :     virtual bool        Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
      98             :     virtual void        StateChanged( StateChangedType nType ) SAL_OVERRIDE;
      99             :     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     100             :     virtual bool        PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     101             : 
     102             :     virtual void        ActivatePage();
     103             :     virtual bool        DeactivatePage();
     104             : 
     105             :     virtual Size GetOptimalSize() const SAL_OVERRIDE;
     106             : 
     107             :     void                SetTabPageSizePixel( const Size& rSize );
     108             :     Size                GetTabPageSizePixel() const;
     109             : 
     110             :     //  pixel offset for the tab items, default is (0,0)
     111             :     void                SetItemsOffset( const Point& rOffs );
     112             :     Point               GetItemsOffset() const;
     113             : 
     114             :     void                InsertPage( const ResId& rResId,
     115             :                                     sal_uInt16 nPos = TAB_APPEND );
     116             :     void                InsertPage( sal_uInt16 nPageId, const OUString& rText,
     117             :                                     sal_uInt16 nPos = TAB_APPEND );
     118             :     void                RemovePage( sal_uInt16 nPageId );
     119             :     void                Clear();
     120             :     void                EnablePage( sal_uInt16 nPageId, bool bEnable = true );
     121             : 
     122             :     sal_uInt16          GetPagePos( sal_uInt16 nPageId ) const;
     123             :     sal_uInt16          GetPageCount() const;
     124             :     sal_uInt16          GetPageId( sal_uInt16 nPos ) const;
     125             :     sal_uInt16          GetPageId( const Point& rPos ) const;
     126             :     sal_uInt16          GetPageId( const TabPage& rPage ) const;
     127             :     sal_uInt16          GetPageId( const OString& rName ) const;
     128             : 
     129             :     void                SetCurPageId( sal_uInt16 nPageId );
     130             :     sal_uInt16              GetCurPageId() const;
     131             : 
     132             :     void                SelectTabPage( sal_uInt16 nPageId );
     133             : 
     134             :     void                SetMaxPageWidth( long nMaxWidth ) { mnMaxPageWidth = nMaxWidth; }
     135             :     long                GetMaxPageWidth() const { return mnMaxPageWidth; }
     136             :     void                ResetMaxPageWidth() { SetMaxPageWidth( 0 ); }
     137             :     bool                IsMaxPageWidth() const { return mnMaxPageWidth != 0; }
     138             : 
     139             :     void                SetTabPage( sal_uInt16 nPageId, TabPage* pPage );
     140             :     TabPage*            GetTabPage( sal_uInt16 nPageId ) const;
     141             : 
     142             :     void                SetPageText( sal_uInt16 nPageId, const OUString& rText );
     143             :     OUString            GetPageText( sal_uInt16 nPageId ) const;
     144             : 
     145             :     void                SetHelpText( sal_uInt16 nPageId, const OUString& rText );
     146             :     const OUString&     GetHelpText( sal_uInt16 nPageId ) const;
     147             : 
     148             :     void                SetHelpId( sal_uInt16 nPageId, const OString& rId ) const;
     149             :     OString             GetHelpId( sal_uInt16 nPageId ) const;
     150             : 
     151             :     void                SetPageName( sal_uInt16 nPageId, const OString& rName ) const;
     152             :     OString             GetPageName( sal_uInt16 nPageId ) const;
     153             : 
     154             :     void                SetPageImage( sal_uInt16 nPageId, const Image& rImage );
     155             : 
     156             :     void                SetHelpText( const OUString& rText )
     157             :                             { Control::SetHelpText( rText ); }
     158             :     const OUString&     GetHelpText() const
     159             :                             { return Control::GetHelpText(); }
     160             : 
     161           0 :     void                SetHelpId( const OString& rId )
     162           0 :                             { Control::SetHelpId( rId ); }
     163           0 :     const OString&      GetHelpId() const
     164           0 :                             { return Control::GetHelpId(); }
     165             : 
     166           0 :     void                SetActivatePageHdl( const Link& rLink ) { maActivateHdl = rLink; }
     167             :     const Link&         GetActivatePageHdl() const { return maActivateHdl; }
     168           0 :     void                SetDeactivatePageHdl( const Link& rLink ) { maDeactivateHdl = rLink; }
     169             :     const Link&         GetDeactivatePageHdl() const { return maDeactivateHdl; }
     170             : 
     171             :     // returns (control relative) bounding rectangle for the
     172             :     // character at index nIndex relative to the text of page nPageId
     173             :     using Control::GetCharacterBounds;
     174             :     Rectangle GetCharacterBounds( sal_uInt16 nPageId, long nIndex ) const;
     175             : 
     176             :     // returns the index relative to the text of page nPageId (also returned)
     177             :     // at position rPoint (control relative)
     178             :     using Control::GetIndexForPoint;
     179             :     long GetIndexForPoint( const Point& rPoint, sal_uInt16& rPageId ) const;
     180             : 
     181             :     // returns the rectangle of the tab for page nPageId
     182             :     Rectangle GetTabBounds( sal_uInt16 nPageId ) const;
     183             : 
     184             :     virtual void SetPosPixel(const Point& rPos) SAL_OVERRIDE;
     185             :     virtual void SetSizePixel(const Size& rNewSize) SAL_OVERRIDE;
     186             :     virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize) SAL_OVERRIDE;
     187             : 
     188             :     Size calculateRequisition() const;
     189             :     void setAllocation(const Size &rAllocation);
     190             : 
     191           0 :     void markLayoutDirty()
     192             :     {
     193           0 :         mbLayoutDirty = true;
     194           0 :     }
     195             : 
     196             :     virtual void queue_resize() SAL_OVERRIDE;
     197             : };
     198             : 
     199             : #endif // INCLUDED_VCL_TABCTRL_HXX
     200             : 
     201             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10