1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef GRAPHIC_LITE_INPUT_DEVICE_MANAGER_H 17 #define GRAPHIC_LITE_INPUT_DEVICE_MANAGER_H 18 19 #include "common/task.h" 20 #include "dock/input_device.h" 21 #include "gfx_utils/list.h" 22 23 namespace OHOS { 24 /** 25 * @brief Manage all input devices. 26 */ 27 class InputDeviceManager : public Task { 28 public: 29 /** 30 * @brief Get instance of InputDeviceManager. 31 * @returns Instance of InputDeviceManager 32 */ 33 static InputDeviceManager* GetInstance(); 34 35 void Init() override; 36 37 /** 38 * @brief Add an input device. 39 * 40 * @param [in] device Specific input device 41 */ 42 void Add(InputDevice* device); 43 44 /** 45 * @brief Remove an input device. 46 * 47 * @param [in] Device Specific device to remove 48 */ 49 void Remove(InputDevice* device); 50 51 /** 52 * Clear all display devices. 53 */ 54 void Clear(); 55 56 void Callback() override; 57 58 private: InputDeviceManager()59 InputDeviceManager() {} ~InputDeviceManager()60 ~InputDeviceManager() {} 61 62 InputDeviceManager(const InputDeviceManager&) = delete; 63 InputDeviceManager& operator=(const InputDeviceManager&) = delete; 64 InputDeviceManager(InputDeviceManager&&) = delete; 65 InputDeviceManager& operator=(InputDeviceManager&&) = delete; 66 67 static void OnViewLifeEvent(); 68 69 List<InputDevice*> deviceList_; 70 }; 71 } // namespace OHOS 72 #endif // GRAPHIC_LITE_INPUT_DEVICE_MANAGER_H 73