LibreOffice Module sfx2 (master) 1
|
Concentrate all focus handling in this class. More...
#include <FocusManager.hxx>
Classes | |
class | FocusLocation |
Public Member Functions | |
FocusManager (std::function< void(const Panel &)> aShowPanelFunctor) | |
~FocusManager () | |
void | Clear () |
Forget all panels and buttons. More... | |
void | GrabFocus () |
Transfer the focus into the sidebar tree of windows. More... | |
void | GrabFocusPanel () |
void | SetDeck (Deck *pDeck) |
void | SetPanels (const SharedPanelContainer &rPanels) |
void | SetButtons (const std::vector< weld::Widget * > &rButtons) |
Private Types | |
enum | PanelComponent { PC_DeckToolBox , PC_PanelTitle , PC_PanelToolBox , PC_PanelContent , PC_TabBar , PC_None } |
Private Member Functions | |
DECL_LINK (KeyInputHdl, const KeyEvent &, bool) | |
Listen for key events for panels and buttons. More... | |
void | ClearPanels () |
void | ClearButtons () |
void | RegisterWindow (weld::Widget &rWidget) |
Let the focus manager listen for window events for the given window. More... | |
void | FocusDeckTitle () |
bool | IsDeckTitleVisible () const |
bool | IsPanelTitleVisible (const sal_Int32 nPanelIndex) 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 panel. More... | |
void | FocusPanelContent (const sal_Int32 nPanelIndex) |
void | FocusButton (const sal_Int32 nButtonIndex) |
void | MoveFocusInsidePanel (const FocusLocation &rLocation, const sal_Int32 nDirection) |
bool | MoveFocusInsideDeckTitle (const FocusLocation &rLocation, const sal_Int32 nDirection) |
bool | HandleKeyEvent (const vcl::KeyCode &rKeyCode, const FocusLocation &rLocation) |
FocusLocation | GetFocusLocation () const |
Static Private Member Functions | |
static void | UnregisterWindow (weld::Widget &rWidget) |
Private Attributes | |
VclPtr< Deck > | mxDeck |
DeckTitleBar * | mpDeckTitleBar |
SharedPanelContainer | maPanels |
std::vector< weld::Widget * > | maButtons |
const std::function< void(const Panel &)> | maShowPanelFunctor |
Concentrate all focus handling in this class.
There is one ring of windows that accept the input focus which are cycled through with the arrow keys:
When the focus is in a panel title then focus travels over
Once the focus is in the panel content then focus cycles through all controls inside the panel but not back to the title bar of the panel. Escape places the focus back in the panel title.
Definition at line 50 of file FocusManager.hxx.
|
private |
Enumerator | |
---|---|
PC_DeckToolBox | |
PC_PanelTitle | |
PC_PanelToolBox | |
PC_PanelContent | |
PC_TabBar | |
PC_None |
Definition at line 78 of file FocusManager.hxx.
sfx2::sidebar::FocusManager::FocusManager | ( | std::function< void(const Panel &)> | aShowPanelFunctor | ) |
Definition at line 39 of file FocusManager.cxx.
sfx2::sidebar::FocusManager::~FocusManager | ( | ) |
Definition at line 45 of file FocusManager.cxx.
References Clear().
void sfx2::sidebar::FocusManager::Clear | ( | ) |
Forget all panels and buttons.
Remove all window listeners.
Definition at line 60 of file FocusManager.cxx.
References ClearButtons(), ClearPanels(), and SetDeck().
Referenced by sfx2::sidebar::SidebarController::disposeDecks(), sfx2::sidebar::SidebarController::disposing(), sfx2::sidebar::SidebarController::SwitchToDeck(), sfx2::sidebar::SidebarController::UpdateConfigurations(), and ~FocusManager().
|
private |
Definition at line 84 of file FocusManager.cxx.
References maButtons, and UnregisterWindow().
Referenced by Clear(), and SetButtons().
|
private |
Definition at line 67 of file FocusManager.cxx.
References maPanels, and UnregisterWindow().
Referenced by Clear(), and SetPanels().
|
private |
Listen for key events for panels and buttons.
|
private |
Definition at line 253 of file FocusManager.cxx.
References maButtons.
Referenced by HandleKeyEvent().
|
private |
Definition at line 175 of file FocusManager.cxx.
References FocusPanel(), weld::Toolbar::get_n_items(), sfx2::sidebar::TitleBar::GetToolBox(), weld::Widget::grab_focus(), and mpDeckTitleBar.
Referenced by FocusPanel(), GrabFocus(), and HandleKeyEvent().
|
private |
Set the focus to the title bar of the panel or, if the title bar is not visible, directly to the panel.
nPanelIndex | Index of the panel to focus. |
bFallbackToDeckTitle | When the panel title bar is not visible then The fallback bias defines whether to focus the deck (true) or the panel content (false) will be focused instead. |
Definition at line 207 of file FocusManager.cxx.
References FocusDeckTitle(), FocusPanelContent(), sfx2::sidebar::PanelTitleBar::GetExpander(), sfx2::sidebar::Panel::GetTitleBar(), sfx2::sidebar::TitleBar::GetVisible(), weld::Widget::grab_focus(), IsDeckTitleVisible(), o3tl::make_unsigned(), maPanels, maShowPanelFunctor, and sfx2::sidebar::Panel::SetExpanded().
Referenced by FocusDeckTitle(), GrabFocusPanel(), and HandleKeyEvent().
|
private |
Definition at line 244 of file FocusManager.cxx.
References weld::Container::child_grab_focus(), and maPanels.
Referenced by FocusPanel(), HandleKeyEvent(), MoveFocusInsideDeckTitle(), and MoveFocusInsidePanel().
|
private |
Definition at line 145 of file FocusManager.cxx.
References sfx2::sidebar::PanelTitleBar::GetExpander(), sfx2::sidebar::TitleBar::GetToolBox(), weld::Widget::has_child_focus(), weld::Widget::has_focus(), maButtons, maPanels, mpDeckTitleBar, nIndex, PC_DeckToolBox, PC_None, PC_PanelContent, PC_PanelTitle, PC_PanelToolBox, and PC_TabBar.
void sfx2::sidebar::FocusManager::GrabFocus | ( | ) |
Transfer the focus into the sidebar tree of windows.
This is typically called from the SidebarChildWindow as result of pressing the F6 key.
Definition at line 50 of file FocusManager.cxx.
References FocusDeckTitle().
void sfx2::sidebar::FocusManager::GrabFocusPanel | ( | ) |
Definition at line 55 of file FocusManager.cxx.
References FocusPanel().
Referenced by sfx2::sidebar::Sidebar::ShowDeck(), and sfx2::sidebar::Sidebar::ShowPanel().
|
private |
Definition at line 307 of file FocusManager.cxx.
References FocusButton(), FocusDeckTitle(), FocusPanel(), FocusPanelContent(), vcl::KeyCode::GetCode(), IsDeckTitleVisible(), IsPanelTitleVisible(), vcl::KeyCode::IsShift(), KEY_DOWN, KEY_ESCAPE, KEY_LEFT, KEY_RETURN, KEY_RIGHT, KEY_TAB, KEY_UP, maButtons, maPanels, sfx2::sidebar::FocusManager::FocusLocation::meComponent, sfx2::sidebar::FocusManager::FocusLocation::mnIndex, MoveFocusInsideDeckTitle(), MoveFocusInsidePanel(), mxDeck, nIndex, PC_DeckToolBox, PC_PanelContent, PC_PanelTitle, PC_PanelToolBox, and PC_TabBar.
|
private |
Definition at line 191 of file FocusManager.cxx.
References sfx2::sidebar::TitleBar::GetVisible(), and mpDeckTitleBar.
Referenced by FocusPanel(), and HandleKeyEvent().
|
private |
Definition at line 196 of file FocusManager.cxx.
References sfx2::sidebar::TitleBar::GetVisible(), o3tl::make_unsigned(), and maPanels.
Referenced by HandleKeyEvent(), and MoveFocusInsideDeckTitle().
|
private |
Definition at line 284 of file FocusManager.cxx.
References FocusPanelContent(), IsPanelTitleVisible(), sfx2::sidebar::FocusManager::FocusLocation::meComponent, and PC_DeckToolBox.
Referenced by HandleKeyEvent().
|
private |
Definition at line 258 of file FocusManager.cxx.
References FocusPanelContent(), maPanels, sfx2::sidebar::FocusManager::FocusLocation::meComponent, sfx2::sidebar::FocusManager::FocusLocation::mnIndex, PC_PanelTitle, and PC_PanelToolBox.
Referenced by HandleKeyEvent().
|
private |
Let the focus manager listen for window events for the given window.
Definition at line 134 of file FocusManager.cxx.
References weld::Widget::connect_key_press(), LINK, and UnregisterWindow().
Referenced by SetButtons(), SetDeck(), and SetPanels().
void sfx2::sidebar::FocusManager::SetButtons | ( | const std::vector< weld::Widget * > & | rButtons | ) |
Definition at line 124 of file FocusManager.cxx.
References ClearButtons(), maButtons, and RegisterWindow().
Referenced by sfx2::sidebar::TabBar::UpdateFocusManager().
void sfx2::sidebar::FocusManager::SetDeck | ( | Deck * | pDeck | ) |
Definition at line 94 of file FocusManager.cxx.
References sfx2::sidebar::Deck::GetTitleBar(), sfx2::sidebar::TitleBar::GetToolBox(), mpDeckTitleBar, mxDeck, RegisterWindow(), and UnregisterWindow().
Referenced by Clear(), sfx2::sidebar::SidebarController::notifyDeckTitle(), and sfx2::sidebar::SidebarController::SwitchToDeck().
void sfx2::sidebar::FocusManager::SetPanels | ( | const SharedPanelContainer & | rPanels | ) |
Definition at line 105 of file FocusManager.cxx.
References ClearPanels(), maPanels, and RegisterWindow().
Referenced by sfx2::sidebar::SidebarController::SwitchToDeck().
|
staticprivate |
Definition at line 140 of file FocusManager.cxx.
References weld::Widget::connect_key_press().
Referenced by ClearButtons(), ClearPanels(), RegisterWindow(), and SetDeck().
|
private |
Definition at line 75 of file FocusManager.hxx.
Referenced by ClearButtons(), FocusButton(), GetFocusLocation(), HandleKeyEvent(), and SetButtons().
|
private |
Definition at line 74 of file FocusManager.hxx.
Referenced by ClearPanels(), FocusPanel(), FocusPanelContent(), GetFocusLocation(), HandleKeyEvent(), IsPanelTitleVisible(), MoveFocusInsidePanel(), and SetPanels().
|
private |
Definition at line 76 of file FocusManager.hxx.
Referenced by FocusPanel().
|
private |
Definition at line 73 of file FocusManager.hxx.
Referenced by FocusDeckTitle(), GetFocusLocation(), IsDeckTitleVisible(), and SetDeck().
Definition at line 72 of file FocusManager.hxx.
Referenced by HandleKeyEvent(), and SetDeck().