LibreOffice Module vcl (master)
1
vcl
source
window
menufloatingwindow.hxx
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
#pragma once
21
22
#include "
menuwindow.hxx
"
23
24
#include <
vcl/toolkit/floatwin.hxx
>
25
#include <
vcl/menu.hxx
>
26
27
#define EXTRASPACEY 2
28
#define GUTTERBORDER 8
29
32
class
MenuFloatingWindow
:
public
FloatingWindow
,
public
MenuWindow
33
{
34
friend
void
Menu::ImplFillLayoutData
()
const
;
35
friend
void
Menu::dispose
();
36
37
private
:
38
VclPtr<Menu>
pMenu
;
39
VclPtr<PopupMenu>
pActivePopup
;
40
Timer
aHighlightChangedTimer
;
41
Timer
aSubmenuCloseTimer
;
42
Timer
aScrollTimer
;
43
VclPtr<vcl::Window>
xSaveFocusId
;
44
sal_uInt16
nHighlightedItem
;
// highlighted/selected Item
45
sal_uInt16
nMBDownPos
;
46
sal_uInt16
nScrollerHeight
;
47
sal_uInt16
nFirstEntry
;
48
sal_uInt16
nPosInParent
;
49
50
bool
bInExecute
: 1;
51
bool
bScrollMenu
: 1;
52
bool
bScrollUp
: 1;
53
bool
bScrollDown
: 1;
54
bool
bIgnoreFirstMove
: 1;
55
bool
bKeyInput
: 1;
56
57
DECL_LINK
( PopupEnd,
FloatingWindow
*,
void
);
58
DECL_LINK
( HighlightChanged,
Timer
*,
void
);
59
DECL_LINK
( SubmenuClose,
Timer
*,
void
);
60
DECL_LINK
(
AutoScroll
,
Timer
*,
void
);
61
DECL_LINK
( ShowHideListener,
VclWindowEvent
&,
void
);
62
63
virtual
void
StateChanged
(
StateChangedType
nType )
override
;
64
virtual
void
DataChanged
(
const
DataChangedEvent
& rDCEvt )
override
;
65
66
void
InitMenuClipRegion
(
vcl::RenderContext
& rRenderContext);
67
68
void
Start
();
69
void
End
();
70
71
protected
:
72
vcl::Region
ImplCalcClipRegion
()
const
;
73
void
ImplDrawScroller
(
vcl::RenderContext
& rRenderContext,
bool
bUp);
74
using
Window::ImplScroll;
75
void
ImplScroll
(
const
Point
& rMousePos );
76
void
ImplScroll
(
bool
bUp );
77
void
ImplCursorUpDown
(
bool
bUp,
bool
bHomeEnd =
false
);
78
void
ImplHighlightItem
(
const
MouseEvent
& rMEvt,
bool
bMBDown );
79
tools::Long
ImplGetStartY
()
const
;
80
tools::Rectangle
ImplGetItemRect
( sal_uInt16 nPos )
const
;
81
void
RenderHighlightItem
(
vcl::RenderContext
& rRenderContext, sal_uInt16 nPos );
82
tools::Long
GetInitialItemY
(
tools::Long
*pOptStartY =
nullptr
)
const
;
83
void
InvalidateItem
( sal_uInt16 nPos );
84
85
public
:
86
MenuFloatingWindow
(
Menu
*
pMenu
,
vcl::Window
* pParent,
WinBits
nStyle);
87
virtual
~MenuFloatingWindow
()
override
;
88
89
virtual
void
dispose
()
override
;
90
void
doShutdown
();
91
92
virtual
void
MouseMove
(
const
MouseEvent
& rMEvt)
override
;
93
virtual
void
MouseButtonDown
(
const
MouseEvent
& rMEvt)
override
;
94
virtual
void
MouseButtonUp
(
const
MouseEvent
& rMEvt)
override
;
95
virtual
void
KeyInput
(
const
KeyEvent
& rKEvent)
override
;
96
virtual
void
Command
(
const
CommandEvent
& rCEvt)
override
;
97
virtual
void
Paint
(
vcl::RenderContext
& rRenderContext,
const
tools::Rectangle
& rRect)
override
;
98
virtual
void
RequestHelp
(
const
HelpEvent
& rHEvt )
override
;
99
virtual
void
Resize
()
override
;
100
101
virtual
void
ApplySettings
(
vcl::RenderContext
& rRenderContext)
override
;
102
103
void
SetFocusId
(
const
VclPtr<vcl::Window>
& xId ) {
xSaveFocusId
= xId; }
104
const
VclPtr<vcl::Window>
&
GetFocusId
()
const
{
return
xSaveFocusId
; }
105
106
void
EnableScrollMenu
(
bool
b );
107
bool
IsScrollMenu
()
const
{
return
bScrollMenu
; }
108
sal_uInt16
GetScrollerHeight
()
const
{
return
nScrollerHeight
; }
109
110
void
Execute
();
111
void
StopExecute
();
112
void
EndExecute
();
113
void
EndExecute
( sal_uInt16 nSelectId );
114
115
PopupMenu
*
GetActivePopup
()
const
{
return
pActivePopup
; }
116
void
KillActivePopup
(
PopupMenu
* pThisOnly =
nullptr
);
117
118
void
ChangeHighlightItem
(sal_uInt16 n,
bool
bStartPopupTimer);
119
sal_uInt16
GetHighlightedItem
()
const
{
return
nHighlightedItem
; }
120
121
void
SetPosInParent
( sal_uInt16 nPos ) {
nPosInParent
=
nPos
; }
122
123
bool
MenuInHierarchyHasFocus
()
const
;
124
125
virtual
css::uno::Reference<css::accessibility::XAccessible>
CreateAccessible
()
override
;
126
};
127
128
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CommandEvent
Definition:
commandevent.hxx:71
DataChangedEvent
Definition:
event.hxx:351
FloatingWindow
Definition:
floatwin.hxx:57
HelpEvent
Definition:
event.hxx:198
KeyEvent
Definition:
event.hxx:45
MenuFloatingWindow
Class that implements the actual window of the floating menu.
Definition:
menufloatingwindow.hxx:33
MenuFloatingWindow::bScrollMenu
bool bScrollMenu
Definition:
menufloatingwindow.hxx:51
MenuFloatingWindow::ImplGetItemRect
tools::Rectangle ImplGetItemRect(sal_uInt16 nPos) const
Definition:
menufloatingwindow.cxx:913
MenuFloatingWindow::IsScrollMenu
bool IsScrollMenu() const
Definition:
menufloatingwindow.hxx:107
MenuFloatingWindow::nHighlightedItem
sal_uInt16 nHighlightedItem
Definition:
menufloatingwindow.hxx:44
MenuFloatingWindow::GetActivePopup
PopupMenu * GetActivePopup() const
Definition:
menufloatingwindow.hxx:115
MenuFloatingWindow::GetFocusId
const VclPtr< vcl::Window > & GetFocusId() const
Definition:
menufloatingwindow.hxx:104
MenuFloatingWindow::xSaveFocusId
VclPtr< vcl::Window > xSaveFocusId
Definition:
menufloatingwindow.hxx:43
MenuFloatingWindow::SetPosInParent
void SetPosInParent(sal_uInt16 nPos)
Definition:
menufloatingwindow.hxx:121
MenuFloatingWindow::DataChanged
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition:
menufloatingwindow.cxx:1281
MenuFloatingWindow::ImplScroll
void ImplScroll(const Point &rMousePos)
Definition:
menufloatingwindow.cxx:695
MenuFloatingWindow::nFirstEntry
sal_uInt16 nFirstEntry
Definition:
menufloatingwindow.hxx:47
MenuFloatingWindow::RequestHelp
virtual void RequestHelp(const HelpEvent &rHEvt) override
Definition:
menufloatingwindow.cxx:1250
MenuFloatingWindow::DECL_LINK
DECL_LINK(ShowHideListener, VclWindowEvent &, void)
MenuFloatingWindow::bScrollUp
bool bScrollUp
Definition:
menufloatingwindow.hxx:52
MenuFloatingWindow::pActivePopup
VclPtr< PopupMenu > pActivePopup
Definition:
menufloatingwindow.hxx:39
MenuFloatingWindow::StateChanged
virtual void StateChanged(StateChangedType nType) override
Definition:
menufloatingwindow.cxx:1270
MenuFloatingWindow::bInExecute
bool bInExecute
Definition:
menufloatingwindow.hxx:50
MenuFloatingWindow::DECL_LINK
DECL_LINK(HighlightChanged, Timer *, void)
MenuFloatingWindow::doShutdown
void doShutdown()
Definition:
menufloatingwindow.cxx:66
MenuFloatingWindow::aSubmenuCloseTimer
Timer aSubmenuCloseTimer
Definition:
menufloatingwindow.hxx:41
MenuFloatingWindow::CreateAccessible
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Definition:
menufloatingwindow.cxx:1308
MenuFloatingWindow::DECL_LINK
DECL_LINK(PopupEnd, FloatingWindow *, void)
MenuFloatingWindow::GetHighlightedItem
sal_uInt16 GetHighlightedItem() const
Definition:
menufloatingwindow.hxx:119
MenuFloatingWindow::GetInitialItemY
tools::Long GetInitialItemY(tools::Long *pOptStartY=nullptr) const
Calculate the initial vertical pixel offset of the first item.
Definition:
menufloatingwindow.cxx:799
MenuFloatingWindow::RenderHighlightItem
void RenderHighlightItem(vcl::RenderContext &rRenderContext, sal_uInt16 nPos)
Definition:
menufloatingwindow.cxx:830
MenuFloatingWindow::MouseButtonUp
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition:
menufloatingwindow.cxx:570
MenuFloatingWindow::SetFocusId
void SetFocusId(const VclPtr< vcl::Window > &xId)
Definition:
menufloatingwindow.hxx:103
MenuFloatingWindow::MenuFloatingWindow
MenuFloatingWindow(Menu *pMenu, vcl::Window *pParent, WinBits nStyle)
Definition:
menufloatingwindow.cxx:31
MenuFloatingWindow::End
void End()
Definition:
menufloatingwindow.cxx:429
MenuFloatingWindow::ImplCalcClipRegion
vcl::Region ImplCalcClipRegion() const
Definition:
menufloatingwindow.cxx:188
MenuFloatingWindow::Resize
virtual void Resize() override
Definition:
menufloatingwindow.cxx:130
MenuFloatingWindow::ApplySettings
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition:
menufloatingwindow.cxx:135
MenuFloatingWindow::nMBDownPos
sal_uInt16 nMBDownPos
Definition:
menufloatingwindow.hxx:45
MenuFloatingWindow::InitMenuClipRegion
void InitMenuClipRegion(vcl::RenderContext &rRenderContext)
Definition:
menufloatingwindow.cxx:200
MenuFloatingWindow::EnableScrollMenu
void EnableScrollMenu(bool b)
Definition:
menufloatingwindow.cxx:402
MenuFloatingWindow::pMenu
VclPtr< Menu > pMenu
Definition:
menufloatingwindow.hxx:38
MenuFloatingWindow::nPosInParent
sal_uInt16 nPosInParent
Definition:
menufloatingwindow.hxx:48
MenuFloatingWindow::bIgnoreFirstMove
bool bIgnoreFirstMove
Definition:
menufloatingwindow.hxx:54
MenuFloatingWindow::GetScrollerHeight
sal_uInt16 GetScrollerHeight() const
Definition:
menufloatingwindow.hxx:108
MenuFloatingWindow::bKeyInput
bool bKeyInput
Definition:
menufloatingwindow.hxx:55
MenuFloatingWindow::KeyInput
virtual void KeyInput(const KeyEvent &rKEvent) override
Definition:
menufloatingwindow.cxx:1030
MenuFloatingWindow::EndExecute
void EndExecute()
Definition:
menufloatingwindow.cxx:507
MenuFloatingWindow::dispose
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition:
menufloatingwindow.cxx:121
MenuFloatingWindow::~MenuFloatingWindow
virtual ~MenuFloatingWindow() override
Definition:
menufloatingwindow.cxx:116
MenuFloatingWindow::nScrollerHeight
sal_uInt16 nScrollerHeight
Definition:
menufloatingwindow.hxx:46
MenuFloatingWindow::ChangeHighlightItem
void ChangeHighlightItem(sal_uInt16 n, bool bStartPopupTimer)
Definition:
menufloatingwindow.cxx:732
MenuFloatingWindow::InvalidateItem
void InvalidateItem(sal_uInt16 nPos)
Emit an Invalidate just for this item's area.
Definition:
menufloatingwindow.cxx:809
MenuFloatingWindow::Execute
void Execute()
Definition:
menufloatingwindow.cxx:449
MenuFloatingWindow::DECL_LINK
DECL_LINK(AutoScroll, Timer *, void)
MenuFloatingWindow::Start
void Start()
Definition:
menufloatingwindow.cxx:410
MenuFloatingWindow::aScrollTimer
Timer aScrollTimer
Definition:
menufloatingwindow.hxx:42
MenuFloatingWindow::bScrollDown
bool bScrollDown
Definition:
menufloatingwindow.hxx:53
MenuFloatingWindow::StopExecute
void StopExecute()
Definition:
menufloatingwindow.cxx:463
MenuFloatingWindow::Paint
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition:
menufloatingwindow.cxx:1187
MenuFloatingWindow::Command
virtual void Command(const CommandEvent &rCEvt) override
Definition:
menufloatingwindow.cxx:1295
MenuFloatingWindow::MouseMove
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition:
menufloatingwindow.cxx:595
MenuFloatingWindow::ImplDrawScroller
void ImplDrawScroller(vcl::RenderContext &rRenderContext, bool bUp)
Definition:
menufloatingwindow.cxx:1226
MenuFloatingWindow::aHighlightChangedTimer
Timer aHighlightChangedTimer
Definition:
menufloatingwindow.hxx:40
MenuFloatingWindow::ImplCursorUpDown
void ImplCursorUpDown(bool bUp, bool bHomeEnd=false)
Definition:
menufloatingwindow.cxx:946
MenuFloatingWindow::KillActivePopup
void KillActivePopup(PopupMenu *pThisOnly=nullptr)
Definition:
menufloatingwindow.cxx:479
MenuFloatingWindow::DECL_LINK
DECL_LINK(SubmenuClose, Timer *, void)
MenuFloatingWindow::ImplGetStartY
tools::Long ImplGetStartY() const
Get a negative pixel offset for an offset menu.
Definition:
menufloatingwindow.cxx:170
MenuFloatingWindow::MenuInHierarchyHasFocus
bool MenuInHierarchyHasFocus() const
Definition:
menufloatingwindow.cxx:419
MenuFloatingWindow::MouseButtonDown
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition:
menufloatingwindow.cxx:557
MenuFloatingWindow::ImplHighlightItem
void ImplHighlightItem(const MouseEvent &rMEvt, bool bMBDown)
Definition:
menufloatingwindow.cxx:212
MenuWindow
Common ancestor for MenuFloatingWindow and MenuBarWindow.
Definition:
menuwindow.hxx:49
Menu
Definition:
menu.hxx:116
Menu::ImplFillLayoutData
SAL_DLLPRIVATE void ImplFillLayoutData() const
Definition:
menu.cxx:2220
Menu::dispose
virtual void dispose() override
Definition:
menu.cxx:181
MouseEvent
Definition:
event.hxx:107
OutputDevice
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition:
outdev.hxx:170
Point
PopupMenu
Definition:
menu.hxx:495
Timer
Definition:
timer.hxx:27
VclPtr< Menu >
VclWindowEvent
Definition:
vclevent.hxx:189
tools::Rectangle
vcl::Region
Definition:
region.hxx:41
vcl::Window
Definition:
window.hxx:443
CommandEventId::AutoScroll
@ AutoScroll
floatwin.hxx
nPos
sal_uInt16 nPos
menu.hxx
menuwindow.hxx
tools::Long
long Long
StateChangedType
StateChangedType
Definition:
window.hxx:291
WinBits
sal_Int64 WinBits
Definition:
wintypes.hxx:109
Generated on Sun Jul 30 2023 04:35:50 for LibreOffice Module vcl (master) by
1.9.3