Fcitx
tempmodemanager.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2026-2026 CSSlayer <wengxt@gmail.com>
3  *
4  * SPDX-License-Identifier: LGPL-2.1-or-later
5  *
6  */
7 
8 #ifndef _FCITX_TEMPMODEMANAGER_H_
9 #define _FCITX_TEMPMODEMANAGER_H_
10 
11 #include <memory>
12 #include <fcitx-utils/handlertable.h>
13 #include <fcitx-utils/macros.h>
14 #include <fcitx/fcitxcore_export.h>
15 #include <fcitx/instance.h>
16 #include <fcitx/tempmode.h>
17 
18 /// \addtogroup FcitxCore
19 /// \{
20 /// \file
21 /// \brief Registration and dispatch for temporary input modes.
22 
23 namespace fcitx {
24 
25 class TempModeManagerPrivate;
26 
27 /**
28  * Manage registered TempMode objects for an Instance.
29  *
30  * The manager watches key events, activates temp modes on their trigger keys,
31  * and routes subsequent key events to the active mode before normal input
32  * method handling.
33  */
34 class FCITXCORE_EXPORT TempModeManager {
35 public:
36  /**
37  * Create a temp mode manager for an instance.
38  *
39  * @param instance instance that owns the event pipeline
40  */
41  TempModeManager(Instance *instance);
42  ~TempModeManager();
43 
44  /**
45  * Register a temp mode with this manager.
46  *
47  * Registering the same temp mode multiple times has no effect.
48  *
49  * @param tempMode temp mode to register
50  */
51  void registerTempMode(TempMode &tempMode);
52 
53 private:
54  std::unique_ptr<TempModeManagerPrivate> d_ptr;
55  FCITX_DECLARE_PRIVATE(TempModeManager);
56 };
57 
58 } // namespace fcitx
59 
60 /// \}
61 
62 #endif // _FCITX_TEMPMODEMANAGER_H_
Temporary input modes for Fcitx.
An instance represents a standalone Fcitx instance.
Definition: instance.h:92
Manage registered TempMode objects for an Instance.
Definition: action.cpp:17
A temporary mode that can take over key handling for a short period.
Definition: tempmode.h:45