LCOV - code coverage report
Current view: top level - vcl/inc - toolbox.h (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 3 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_INC_TOOLBOX_H
      21             : #define INCLUDED_VCL_INC_TOOLBOX_H
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <tools/gen.hxx>
      25             : #include <vcl/image.hxx>
      26             : #include <vcl/toolbox.hxx>
      27             : #include <vcl/controllayout.hxx>
      28             : #include <vcl/ImageListProvider.hxx>
      29             : 
      30             : #include <vector>
      31             : 
      32             : #define TB_DROPDOWNARROWWIDTH   11
      33             : 
      34             : #define TB_MENUBUTTON_SIZE      12
      35             : #define TB_MENUBUTTON_OFFSET    2
      36             : 
      37             : class Window;
      38             : 
      39             : struct ImplToolItem
      40             : {
      41             :     Window*             mpWindow;
      42             :     void*               mpUserData;
      43             :     Image               maImage;
      44             :     Image               maHighImage;
      45             :     long                mnImageAngle;
      46             :     bool                mbMirrorMode;
      47             :     OUString            maText;
      48             :     OUString            maQuickHelpText;
      49             :     OUString            maHelpText;
      50             :     OUString            maCommandStr;
      51             :     OString             maHelpId;
      52             :     Rectangle           maRect;
      53             :     Rectangle           maCalcRect;
      54             :     /// Widget layout may request size; set it as the minimal size (like, the item will always have at least this size).
      55             :     Size                maMinimalItemSize;
      56             :     /// The overall horizontal item size, including one or more of [image size + textlength + dropdown arrow]
      57             :     Size                maItemSize;
      58             :     long                mnSepSize;
      59             :     long                mnDropDownArrowWidth;
      60             :     /// Size of the content (bitmap or text, without dropdown) that we have in the item.
      61             :     Size                maContentSize;
      62             :     ToolBoxItemType     meType;
      63             :     ToolBoxItemBits     mnBits;
      64             :     TriState            meState;
      65             :     sal_uInt16          mnId;
      66             :     bool                mbEnabled:1,
      67             :                         mbVisible:1,
      68             :                         mbEmptyBtn:1,
      69             :                         mbShowWindow:1,
      70             :                         mbBreak:1,
      71             :                         mbVisibleText:1,    // indicates if text will definitely be drawn, influences dropdown pos
      72             :                         mbExpand:1;
      73             : 
      74             :                         ImplToolItem();
      75             :                         ImplToolItem( sal_uInt16 nItemId, const Image& rImage,
      76             :                                       ToolBoxItemBits nItemBits );
      77             :                         ImplToolItem( sal_uInt16 nItemId, const OUString& rTxt,
      78             :                                       ToolBoxItemBits nItemBits );
      79             :                         ImplToolItem( sal_uInt16 nItemId, const Image& rImage,
      80             :                                       const OUString& rTxt,
      81             :                                       ToolBoxItemBits nItemBits );
      82             :                         ~ImplToolItem();
      83             : 
      84             :     ImplToolItem( const ImplToolItem& );
      85             :     ImplToolItem& operator=(const ImplToolItem&);
      86             : 
      87             :     // returns the size of a item, taking toolbox orientation into account
      88             :     // the default size is the precomputed size for standard items
      89             :     // ie those that are just ordinary buttons (no windows or text etc.)
      90             :     // bCheckMaxWidth indicates that item windows must not exceed maxWidth in which case they will be painted as buttons
      91             :     Size                GetSize( bool bHorz, bool bCheckMaxWidth, long maxWidth, const Size& rDefaultSize );
      92             : 
      93             :     // only useful for buttons: returns if the text or image part or both can be drawn according to current button drawing style
      94             :     void DetermineButtonDrawStyle( ButtonType eButtonType, bool& rbImage, bool& rbText ) const;
      95             : 
      96             :     // returns the rectangle which contains the drop down arrow
      97             :     // or an empty rect if there is none
      98             :     // bHorz denotes the toolbox alignment
      99             :     Rectangle   GetDropDownRect( bool bHorz ) const;
     100             : 
     101             :     // returns sal_True if the toolbar item is currently clipped, which can happen for docked toolbars
     102             :     bool IsClipped() const;
     103             : 
     104             :     // returns sal_True if the toolbar item is currently hidden i.e. they are unchecked in the toolbar Customize menu
     105             :     bool IsItemHidden() const;
     106             : 
     107             : private:
     108             :     void init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn);
     109             : };
     110             : 
     111             : namespace vcl
     112             : {
     113             : 
     114           0 : struct ToolBoxLayoutData : public ControlLayoutData
     115             : {
     116             :     std::vector< sal_uInt16 >               m_aLineItemIds;
     117             :     std::vector< sal_uInt16 >               m_aLineItemPositions;
     118             : };
     119             : 
     120             : } /* namespace vcl */
     121             : 
     122             : struct ImplToolBoxPrivateData
     123             : {
     124             :     vcl::ToolBoxLayoutData*         m_pLayoutData;
     125             :     std::vector< ImplToolItem >     m_aItems;
     126             : 
     127             :     ImplToolBoxPrivateData();
     128             :     ~ImplToolBoxPrivateData();
     129             : 
     130           0 :     void ImplClearLayoutData() { delete m_pLayoutData; m_pLayoutData = NULL; }
     131             : 
     132             :     // called when dropdown items are clicked
     133             :     Link    maDropdownClickHdl;
     134             :     Timer   maDropdownTimer; // for opening dropdown items on "long click"
     135             : 
     136             :     // large or small buttons ?
     137             :     ToolBoxButtonSize   meButtonSize;
     138             : 
     139             :     // the optional custom menu
     140             :     PopupMenu*  mpMenu;
     141             :     sal_uInt16      maMenuType;
     142             :     sal_uIntPtr       mnEventId;
     143             : 
     144             :     // called when menu button is clicked and before the popup menu is executed
     145             :     Link        maMenuButtonHdl;
     146             : 
     147             :     // a dummy item representing the custom menu button
     148             :     ImplToolItem   maMenubuttonItem;
     149             :     long           mnMenuButtonWidth;
     150             : 
     151             :     Wallpaper   maDisplayBackground;
     152             : 
     153             :     // support for highcontrast
     154             :     vcl::IImageListProvider* mpImageListProvider;
     155             :     vcl::ImageListType       meImageListType;
     156             : 
     157             :     bool    mbIsLocked:1,           // keeps last lock state from ImplDockingWindowWrapper
     158             :             mbAssumeDocked:1,       // only used during calculations to override current floating/popup mode
     159             :             mbAssumeFloating:1,
     160             :             mbAssumePopupMode:1,
     161             :             mbKeyInputDisabled:1,   // no KEY input if all items disabled, closing/docking will be allowed though
     162             :             mbIsPaintLocked:1,      // don't allow paints
     163             :             mbMenubuttonSelected:1, // menu button is highlighted
     164             :             mbPageScroll:1,         // determines if we scroll a page at a time
     165             :             mbNativeButtons:1,      // system supports native toolbar buttons
     166             :             mbWillUsePopupMode:1,   // this toolbox will be opened in popup mode
     167             :             mbDropDownByKeyboard:1; // tells whether a dropdown was started by key input
     168             : };
     169             : 
     170             : #endif // INCLUDED_VCL_INC_TOOLBOX_H
     171             : 
     172             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10