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

Generated by: LCOV version 1.10