LibreOffice Module vcl (master)
1
vcl
inc
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
33
namespace
vcl
{
class
Window
; }
34
35
struct
ImplToolItem
36
{
37
VclPtr<vcl::Window>
mpWindow
;
//don't dispose mpWindow - we get copied around
38
bool
mbNonInteractiveWindow
;
39
void
*
mpUserData
;
40
Image
maImage
;
41
Degree10
mnImageAngle
;
42
bool
mbMirrorMode
;
43
OUString
maText
;
44
OUString
maQuickHelpText
;
45
OUString
maHelpText
;
46
OUString
maCommandStr
;
47
OUString
maHelpId
;
48
tools::Rectangle
maRect
;
49
tools::Rectangle
maCalcRect
;
51
Size
maMinimalItemSize
;
53
Size
maItemSize
;
54
tools::Long
mnSepSize
;
55
tools::Long
mnDropDownArrowWidth
;
57
Size
maContentSize
;
58
ToolBoxItemType
meType
;
59
ToolBoxItemBits
mnBits
;
60
TriState
meState
;
61
ToolBoxItemId
mnId
;
62
bool
mbEnabled
:1,
63
mbVisible
:1,
64
mbEmptyBtn
:1,
65
mbShowWindow
:1,
66
mbBreak
:1,
67
mbVisibleText
:1,
// indicates if text will definitely be drawn, influences dropdown pos
68
mbExpand
:1;
69
70
ImplToolItem
();
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
100
private
:
101
void
init
(
ToolBoxItemId
nItemId,
ToolBoxItemBits
nItemBits,
bool
bEmptyBtn);
102
};
103
104
namespace
vcl
105
{
106
107
struct
ToolBoxLayoutData
:
public
ControlLayoutData
108
{
109
std::vector< ToolBoxItemId >
m_aLineItemIds
;
110
};
111
112
}
/* namespace vcl */
113
114
struct
ImplToolBoxPrivateData
115
{
116
std::optional<vcl::ToolBoxLayoutData>
m_pLayoutData
;
117
ToolBox::ImplToolItems
m_aItems
;
118
119
ImplToolBoxPrivateData
();
120
~ImplToolBoxPrivateData
();
121
122
void
ImplClearLayoutData
() {
m_pLayoutData
.reset(); }
123
124
// called when dropdown items are clicked
125
Link<ToolBox *, void>
maDropdownClickHdl
;
126
Timer
maDropdownTimer
{
"vcl::ToolBox mpData->maDropdownTimer"
};
// for opening dropdown items on "long click"
127
128
// large or small buttons ?
129
ToolBoxButtonSize
meButtonSize
;
130
131
// the optional custom menu
132
VclPtr<PopupMenu>
mpMenu
;
133
ToolBoxMenuType
maMenuType
;
134
135
// called when menu button is clicked and before the popup menu is executed
136
Link<ToolBox *, void>
maMenuButtonHdl
;
137
138
// a dummy item representing the custom menu button
139
ImplToolItem
maMenubuttonItem
;
140
tools::Long
mnMenuButtonWidth
;
141
142
Wallpaper
maDisplayBackground
;
143
144
bool
mbIsLocked
:1,
// keeps last lock state from ImplDockingWindowWrapper
145
mbAssumeDocked
:1,
// only used during calculations to override current floating/popup mode
146
mbAssumeFloating
:1,
147
mbAssumePopupMode
:1,
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: */
Image
Definition:
image.hxx:40
Link< ToolBox *, void >
Size
Timer
Definition:
timer.hxx:27
ToolBox::ImplToolItems
std::vector< ImplToolItem > ImplToolItems
Definition:
toolbox.hxx:79
VclPtr< vcl::Window >
Wallpaper
Definition:
wall.hxx:53
tools::Rectangle
TriState
TriState
tools::Long
long Long
vcl
ImplToolBoxPrivateData
Definition:
toolbox.h:115
ImplToolBoxPrivateData::mbAssumeDocked
bool mbAssumeDocked
Definition:
toolbox.h:145
ImplToolBoxPrivateData::mbNativeButtons
bool mbNativeButtons
Definition:
toolbox.h:152
ImplToolBoxPrivateData::mbAssumePopupMode
bool mbAssumePopupMode
Definition:
toolbox.h:147
ImplToolBoxPrivateData::mnMenuButtonWidth
tools::Long mnMenuButtonWidth
Definition:
toolbox.h:140
ImplToolBoxPrivateData::meButtonSize
ToolBoxButtonSize meButtonSize
Definition:
toolbox.h:129
ImplToolBoxPrivateData::mbDropDownByKeyboard
bool mbDropDownByKeyboard
Definition:
toolbox.h:154
ImplToolBoxPrivateData::ImplClearLayoutData
void ImplClearLayoutData()
Definition:
toolbox.h:122
ImplToolBoxPrivateData::maMenuButtonHdl
Link< ToolBox *, void > maMenuButtonHdl
Definition:
toolbox.h:136
ImplToolBoxPrivateData::maDisplayBackground
Wallpaper maDisplayBackground
Definition:
toolbox.h:142
ImplToolBoxPrivateData::mpMenu
VclPtr< PopupMenu > mpMenu
Definition:
toolbox.h:132
ImplToolBoxPrivateData::~ImplToolBoxPrivateData
~ImplToolBoxPrivateData()
Definition:
toolbox2.cxx:80
ImplToolBoxPrivateData::mbMenubuttonWasLastSelected
bool mbMenubuttonWasLastSelected
Definition:
toolbox.h:151
ImplToolBoxPrivateData::mbKeyInputDisabled
bool mbKeyInputDisabled
Definition:
toolbox.h:148
ImplToolBoxPrivateData::mbMenubuttonSelected
bool mbMenubuttonSelected
Definition:
toolbox.h:150
ImplToolBoxPrivateData::mbIsLocked
bool mbIsLocked
Definition:
toolbox.h:144
ImplToolBoxPrivateData::mbAssumeFloating
bool mbAssumeFloating
Definition:
toolbox.h:146
ImplToolBoxPrivateData::maMenuType
ToolBoxMenuType maMenuType
Definition:
toolbox.h:133
ImplToolBoxPrivateData::maMenubuttonItem
ImplToolItem maMenubuttonItem
Definition:
toolbox.h:139
ImplToolBoxPrivateData::mbIsPaintLocked
bool mbIsPaintLocked
Definition:
toolbox.h:149
ImplToolBoxPrivateData::maDropdownClickHdl
Link< ToolBox *, void > maDropdownClickHdl
Definition:
toolbox.h:125
ImplToolBoxPrivateData::mbWillUsePopupMode
bool mbWillUsePopupMode
Definition:
toolbox.h:153
ImplToolBoxPrivateData::ImplToolBoxPrivateData
ImplToolBoxPrivateData()
Definition:
toolbox2.cxx:57
ImplToolBoxPrivateData::m_pLayoutData
std::optional< vcl::ToolBoxLayoutData > m_pLayoutData
Definition:
toolbox.h:116
ImplToolBoxPrivateData::m_aItems
ToolBox::ImplToolItems m_aItems
Definition:
toolbox.h:117
ImplToolBoxPrivateData::maDropdownTimer
Timer maDropdownTimer
Definition:
toolbox.h:126
ImplToolItem
Definition:
toolbox.h:36
ImplToolItem::maCommandStr
OUString maCommandStr
Definition:
toolbox.h:46
ImplToolItem::mnBits
ToolBoxItemBits mnBits
Definition:
toolbox.h:59
ImplToolItem::init
void init(ToolBoxItemId nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn)
Definition:
toolbox2.cxx:86
ImplToolItem::maRect
tools::Rectangle maRect
Definition:
toolbox.h:48
ImplToolItem::mbExpand
bool mbExpand
Definition:
toolbox.h:68
ImplToolItem::mbShowWindow
bool mbShowWindow
Definition:
toolbox.h:65
ImplToolItem::mbEnabled
bool mbEnabled
Definition:
toolbox.h:62
ImplToolItem::mnId
ToolBoxItemId mnId
Definition:
toolbox.h:61
ImplToolItem::maText
OUString maText
Definition:
toolbox.h:43
ImplToolItem::mnDropDownArrowWidth
tools::Long mnDropDownArrowWidth
Definition:
toolbox.h:55
ImplToolItem::maMinimalItemSize
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
ImplToolItem::meType
ToolBoxItemType meType
Definition:
toolbox.h:58
ImplToolItem::GetSize
Size GetSize(bool bHorz, bool bCheckMaxWidth, tools::Long maxWidth, const Size &rDefaultSize)
Definition:
toolbox2.cxx:137
ImplToolItem::GetDropDownRect
tools::Rectangle GetDropDownRect(bool bHorz) const
Definition:
toolbox2.cxx:247
ImplToolItem::mbVisibleText
bool mbVisibleText
Definition:
toolbox.h:67
ImplToolItem::mbBreak
bool mbBreak
Definition:
toolbox.h:66
ImplToolItem::IsItemHidden
bool IsItemHidden() const
Definition:
toolbox2.cxx:268
ImplToolItem::mpWindow
VclPtr< vcl::Window > mpWindow
Definition:
toolbox.h:37
ImplToolItem::mnImageAngle
Degree10 mnImageAngle
Definition:
toolbox.h:41
ImplToolItem::maItemSize
Size maItemSize
The overall horizontal item size, including one or more of [image size + textlength + dropdown arrow]...
Definition:
toolbox.h:53
ImplToolItem::maQuickHelpText
OUString maQuickHelpText
Definition:
toolbox.h:44
ImplToolItem::maCalcRect
tools::Rectangle maCalcRect
Definition:
toolbox.h:49
ImplToolItem::mbVisible
bool mbVisible
Definition:
toolbox.h:63
ImplToolItem::mnSepSize
tools::Long mnSepSize
Definition:
toolbox.h:54
ImplToolItem::mbMirrorMode
bool mbMirrorMode
Definition:
toolbox.h:42
ImplToolItem::meState
TriState meState
Definition:
toolbox.h:60
ImplToolItem::IsClipped
bool IsClipped() const
Definition:
toolbox2.cxx:263
ImplToolItem::mpUserData
void * mpUserData
Definition:
toolbox.h:39
ImplToolItem::mbEmptyBtn
bool mbEmptyBtn
Definition:
toolbox.h:64
ImplToolItem::DetermineButtonDrawStyle
void DetermineButtonDrawStyle(ButtonType eButtonType, bool &rbImage, bool &rbText) const
Definition:
toolbox2.cxx:195
ImplToolItem::maHelpText
OUString maHelpText
Definition:
toolbox.h:45
ImplToolItem::maHelpId
OUString maHelpId
Definition:
toolbox.h:47
ImplToolItem::ImplToolItem
ImplToolItem()
Definition:
toolbox2.cxx:109
ImplToolItem::maImage
Image maImage
Definition:
toolbox.h:40
ImplToolItem::maContentSize
Size maContentSize
Size of the content (bitmap or text, without dropdown) that we have in the item.
Definition:
toolbox.h:57
ImplToolItem::mbNonInteractiveWindow
bool mbNonInteractiveWindow
Definition:
toolbox.h:38
o3tl::strong_int
vcl::ControlLayoutData
Definition:
ctrl.hxx:39
vcl::ToolBoxLayoutData
Definition:
toolbox.h:108
vcl::ToolBoxLayoutData::m_aLineItemIds
std::vector< ToolBoxItemId > m_aLineItemIds
Definition:
toolbox.h:109
toolbox.hxx
ToolBoxMenuType
ToolBoxMenuType
Definition:
toolbox.hxx:49
ToolBoxButtonSize
ToolBoxButtonSize
Definition:
vclenum.hxx:267
ToolBoxItemType
ToolBoxItemType
Definition:
vclenum.hxx:69
ToolBoxItemBits
ToolBoxItemBits
Definition:
vclenum.hxx:51
ButtonType
ButtonType
Definition:
vclenum.hxx:71
EViewType::Window
@ Window
Generated on Sun Jul 30 2023 04:35:01 for LibreOffice Module vcl (master) by
1.9.3