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

Generated by: LCOV version 1.10