fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / toolpanel / TaskPaneFocusManager.hxx
blob4ae747ebe468fb132ac91fb39712e1ceddb7007b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SD_TOOLPANEL_FOCUS_MANAGER_HXX
21 #define SD_TOOLPANEL_FOCUS_MANAGER_HXX
23 #include <tools/link.hxx>
25 #include <memory>
27 class KeyCode;
28 class VclSimpleEvent;
29 class Window;
31 namespace sd { namespace toolpanel {
33 /** On certain key presses the focus is moved from one window to another.
34 For this to work every window that wants its focus managed has to
35 register or be registered and tell where to put the focus on what key
36 press.
38 class FocusManager
40 public:
41 /** Return an instance of the focus manager.
43 static FocusManager& Instance (void);
45 /** Register a link from one window to another so that any time the
46 specified key is pressed while the source window is focused, the
47 focus is transferred to the target window.
48 @param pSource
49 The window from which the focus will be transferred.
50 @param pTarget
51 The window to which the focus will be transferred.
52 @param rKey
53 The key for which the focus is transferred from the source
54 window to the target window.
56 void RegisterLink (
57 ::Window* pSource,
58 ::Window* pTarget,
59 const KeyCode& rKey);
61 /** Register a link that will move the focus from the source window to
62 the target window when the source window is focused and KEY_ESCAPE
63 is pressed.
64 @param pSource
65 The window from which the focus will be transferred.
66 @param pTarget
67 The window to which the focus will be transferred.
69 void RegisterUpLink (::Window* pSource, ::Window* pTarget);
71 /** Register a link that will move the focus from the source window to
72 the target window when the source window is focused and KEY_RETURN
73 is pressed.
74 @param pSource
75 The window from which the focus will be transferred.
76 @param pTarget
77 The window to which the focus will be transferred.
79 void RegisterDownLink (::Window* pSource, ::Window* pTarget);
81 /** Remove all links from the source window to the target window. When
82 there are links from the target window to the source window then
83 these are not touced.
85 void RemoveLinks (
86 ::Window* pSource,
87 ::Window* pTarget);
89 /** Let the focus manager transfer the focus from the specified source
90 window to a target window that is determined according the the
91 registered links and the given key code.
92 When there is no rule for this combination of source window and key
93 code then the focus stays where it is.
95 bool TransferFocus (::Window* pSource, const KeyCode& rCode);
97 private:
98 friend struct FocusManagerCreator;
100 class LinkMap;
101 ::std::auto_ptr<LinkMap> mpLinks;
103 FocusManager (void);
104 ~FocusManager (void);
106 /** Clear the list of focus transfer links. This removes all window
107 listeners.
109 void Clear (void);
111 /** Remove all links from or to the given window.
113 void RemoveLinks (::Window* pWindow);
115 /** Unregister as event listener from the given window when there are no
116 links from this window anymore.
118 void RemoveUnusedEventListener (::Window* pWindow);
120 /** Listen for key events and on KEY_RETURN go down and on
121 KEY_ESCAPE go up.
123 DECL_LINK(WindowEventListener, VclSimpleEvent*);
126 } } // end of namespace ::sd::toolpanel
128 #endif
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */