LibreOffice Module sfx2 (master) 1
FocusManager.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#pragma once
20
22#include <tools/link.hxx>
23#include <vcl/keycod.hxx>
24
25namespace weld {
26class Widget;
27}
28
29namespace sfx2::sidebar {
30
31class DeckTitleBar;
32
51{
52public:
53 FocusManager(std::function<void(const Panel&)> aShowPanelFunctor);
55
58 void Clear();
59
64 void GrabFocus();
65 void GrabFocusPanel();
66
67 void SetDeck(Deck* pDeck);
68 void SetPanels(const SharedPanelContainer& rPanels);
69 void SetButtons(const std::vector<weld::Widget*>& rButtons);
70
71private:
75 std::vector<weld::Widget*> maButtons;
76 const std::function<void(const Panel&)> maShowPanelFunctor;
77
79 {
86 };
88 {
89 public:
91 sal_Int32 mnIndex;
92 FocusLocation(const PanelComponent eComponent, const sal_Int32 nIndex);
93 };
94
97 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
98
99 void ClearPanels();
100 void ClearButtons();
101
105 void RegisterWindow(weld::Widget& rWidget);
106 static void UnregisterWindow(weld::Widget& rWidget);
107
108 void FocusDeckTitle();
109 bool IsDeckTitleVisible() const;
110 bool IsPanelTitleVisible(const sal_Int32 nPanelIndex) const;
111
121 void FocusPanel(const sal_Int32 nPanelIndex,
122 const bool bFallbackToDeckTitle);
123
124 void FocusPanelContent(const sal_Int32 nPanelIndex);
125 void FocusButton(const sal_Int32 nButtonIndex);
126 void MoveFocusInsidePanel(const FocusLocation& rLocation,
127 const sal_Int32 nDirection);
128 bool MoveFocusInsideDeckTitle(const FocusLocation& rLocation,
129 const sal_Int32 nDirection);
130
131 bool HandleKeyEvent(const vcl::KeyCode& rKeyCode,
132 const FocusLocation& rLocation);
133
135
136};
137
138} // end of namespace sfx2::sidebar
139
140/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This is the parent window of the panels.
Definition: Deck.hxx:38
FocusLocation(const PanelComponent eComponent, const sal_Int32 nIndex)
Concentrate all focus handling in this class.
bool IsPanelTitleVisible(const sal_Int32 nPanelIndex) const
void SetButtons(const std::vector< weld::Widget * > &rButtons)
const std::function< void(const Panel &)> maShowPanelFunctor
void GrabFocus()
Transfer the focus into the sidebar tree of windows.
bool HandleKeyEvent(const vcl::KeyCode &rKeyCode, const FocusLocation &rLocation)
DECL_LINK(KeyInputHdl, const KeyEvent &, bool)
Listen for key events for panels and buttons.
void FocusButton(const sal_Int32 nButtonIndex)
bool MoveFocusInsideDeckTitle(const FocusLocation &rLocation, const sal_Int32 nDirection)
FocusLocation GetFocusLocation() const
void FocusPanel(const sal_Int32 nPanelIndex, const bool bFallbackToDeckTitle)
Set the focus to the title bar of the panel or, if the title bar is not visible, directly to the pane...
void SetPanels(const SharedPanelContainer &rPanels)
static void UnregisterWindow(weld::Widget &rWidget)
SharedPanelContainer maPanels
void Clear()
Forget all panels and buttons.
FocusManager(std::function< void(const Panel &)> aShowPanelFunctor)
void FocusPanelContent(const sal_Int32 nPanelIndex)
std::vector< weld::Widget * > maButtons
void MoveFocusInsidePanel(const FocusLocation &rLocation, const sal_Int32 nDirection)
void SetDeck(Deck *pDeck)
void RegisterWindow(weld::Widget &rWidget)
Let the focus manager listen for window events for the given window.
Multiple panels form a single deck.
Definition: Panel.hxx:54
std::vector< std::shared_ptr< Panel > > SharedPanelContainer
Definition: Panel.hxx:118