LibreOffice Module vcl (master) 1
toolbox.h
Go to the documentation of this file.
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 <vcl/toolbox.hxx>
24
25#include <optional>
26#include <vector>
27
28#define TB_DROPDOWNARROWWIDTH 11
29
30#define TB_MENUBUTTON_SIZE 12
31#define TB_MENUBUTTON_OFFSET 2
32
33namespace vcl { class Window; }
34
36{
37 VclPtr<vcl::Window> mpWindow; //don't dispose mpWindow - we get copied around
43 OUString maText;
45 OUString maHelpText;
46 OUString maCommandStr;
47 OString maHelpId;
62 bool mbEnabled:1,
67 mbVisibleText:1, // indicates if text will definitely be drawn, influences dropdown pos
69
71 ImplToolItem( ToolBoxItemId nItemId, Image aImage,
72 ToolBoxItemBits nItemBits );
73 ImplToolItem( ToolBoxItemId nItemId, OUString aTxt,
74 OUString aCommand,
75 ToolBoxItemBits nItemBits );
76 ImplToolItem( ToolBoxItemId nItemId, Image aImage,
77 OUString aTxt,
78 ToolBoxItemBits nItemBits );
79
80 // returns the size of an item, taking toolbox orientation into account
81 // the default size is the precomputed size for standard items
82 // ie those that are just ordinary buttons (no windows or text etc.)
83 // bCheckMaxWidth indicates that item windows must not exceed maxWidth in which case they will be painted as buttons
84 Size GetSize( bool bHorz, bool bCheckMaxWidth, tools::Long maxWidth, const Size& rDefaultSize );
85
86 // only useful for buttons: returns if the text or image part or both can be drawn according to current button drawing style
87 void DetermineButtonDrawStyle( ButtonType eButtonType, bool& rbImage, bool& rbText ) const;
88
89 // returns the rectangle which contains the drop down arrow
90 // or an empty rect if there is none
91 // bHorz denotes the toolbox alignment
92 tools::Rectangle GetDropDownRect( bool bHorz ) const;
93
94 // returns sal_True if the toolbar item is currently clipped, which can happen for docked toolbars
95 bool IsClipped() const;
96
97 // returns sal_True if the toolbar item is currently hidden i.e. they are unchecked in the toolbar Customize menu
98 bool IsItemHidden() const;
99
100private:
101 void init(ToolBoxItemId nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn);
102};
103
104namespace vcl
105{
106
108{
109 std::vector< ToolBoxItemId > m_aLineItemIds;
110};
111
112} /* namespace vcl */
113
115{
116 std::optional<vcl::ToolBoxLayoutData> m_pLayoutData;
118
121
123
124 // called when dropdown items are clicked
126 Timer maDropdownTimer { "vcl::ToolBox mpData->maDropdownTimer" }; // for opening dropdown items on "long click"
127
128 // large or small buttons ?
130
131 // the optional custom menu
134
135 // called when menu button is clicked and before the popup menu is executed
137
138 // a dummy item representing the custom menu button
141
143
144 bool mbIsLocked:1, // keeps last lock state from ImplDockingWindowWrapper
145 mbAssumeDocked:1, // only used during calculations to override current floating/popup mode
148 mbKeyInputDisabled:1, // no KEY input if all items disabled, closing/docking will be allowed though
149 mbIsPaintLocked:1, // don't allow paints
150 mbMenubuttonSelected:1, // menu button is highlighted
151 mbMenubuttonWasLastSelected:1, // menu button was highlighted when focus was lost
152 mbNativeButtons:1, // system supports native toolbar buttons
153 mbWillUsePopupMode:1, // this toolbox will be opened in popup mode
154 mbDropDownByKeyboard:1; // tells whether a dropdown was started by key input
155};
156
157#endif // INCLUDED_VCL_INC_TOOLBOX_H
158
159/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: image.hxx:40
Definition: timer.hxx:27
std::vector< ImplToolItem > ImplToolItems
Definition: toolbox.hxx:79
TriState
long Long
tools::Long mnMenuButtonWidth
Definition: toolbox.h:140
ToolBoxButtonSize meButtonSize
Definition: toolbox.h:129
void ImplClearLayoutData()
Definition: toolbox.h:122
Link< ToolBox *, void > maMenuButtonHdl
Definition: toolbox.h:136
Wallpaper maDisplayBackground
Definition: toolbox.h:142
VclPtr< PopupMenu > mpMenu
Definition: toolbox.h:132
bool mbMenubuttonWasLastSelected
Definition: toolbox.h:151
ToolBoxMenuType maMenuType
Definition: toolbox.h:133
ImplToolItem maMenubuttonItem
Definition: toolbox.h:139
Link< ToolBox *, void > maDropdownClickHdl
Definition: toolbox.h:125
std::optional< vcl::ToolBoxLayoutData > m_pLayoutData
Definition: toolbox.h:116
ToolBox::ImplToolItems m_aItems
Definition: toolbox.h:117
OUString maCommandStr
Definition: toolbox.h:46
ToolBoxItemBits mnBits
Definition: toolbox.h:59
void init(ToolBoxItemId nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn)
Definition: toolbox2.cxx:86
tools::Rectangle maRect
Definition: toolbox.h:48
bool mbExpand
Definition: toolbox.h:68
bool mbShowWindow
Definition: toolbox.h:65
OString maHelpId
Definition: toolbox.h:47
bool mbEnabled
Definition: toolbox.h:62
ToolBoxItemId mnId
Definition: toolbox.h:61
OUString maText
Definition: toolbox.h:43
tools::Long mnDropDownArrowWidth
Definition: toolbox.h:55
Size maMinimalItemSize
Widget layout may request size; set it as the minimal size (like, the item will always have at least ...
Definition: toolbox.h:51
ToolBoxItemType meType
Definition: toolbox.h:58
Size GetSize(bool bHorz, bool bCheckMaxWidth, tools::Long maxWidth, const Size &rDefaultSize)
Definition: toolbox2.cxx:137
tools::Rectangle GetDropDownRect(bool bHorz) const
Definition: toolbox2.cxx:247
bool mbVisibleText
Definition: toolbox.h:67
bool mbBreak
Definition: toolbox.h:66
bool IsItemHidden() const
Definition: toolbox2.cxx:268
VclPtr< vcl::Window > mpWindow
Definition: toolbox.h:37
Degree10 mnImageAngle
Definition: toolbox.h:41
Size maItemSize
The overall horizontal item size, including one or more of [image size + textlength + dropdown arrow]...
Definition: toolbox.h:53
OUString maQuickHelpText
Definition: toolbox.h:44
tools::Rectangle maCalcRect
Definition: toolbox.h:49
bool mbVisible
Definition: toolbox.h:63
tools::Long mnSepSize
Definition: toolbox.h:54
bool mbMirrorMode
Definition: toolbox.h:42
TriState meState
Definition: toolbox.h:60
bool IsClipped() const
Definition: toolbox2.cxx:263
void * mpUserData
Definition: toolbox.h:39
bool mbEmptyBtn
Definition: toolbox.h:64
void DetermineButtonDrawStyle(ButtonType eButtonType, bool &rbImage, bool &rbText) const
Definition: toolbox2.cxx:195
OUString maHelpText
Definition: toolbox.h:45
Image maImage
Definition: toolbox.h:40
Size maContentSize
Size of the content (bitmap or text, without dropdown) that we have in the item.
Definition: toolbox.h:57
bool mbNonInteractiveWindow
Definition: toolbox.h:38
std::vector< ToolBoxItemId > m_aLineItemIds
Definition: toolbox.h:109
ToolBoxMenuType
Definition: toolbox.hxx:49
ToolBoxButtonSize
Definition: vclenum.hxx:274
ToolBoxItemType
Definition: vclenum.hxx:69
ToolBoxItemBits
Definition: vclenum.hxx:51
ButtonType
Definition: vclenum.hxx:71