• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 UNIVERSAL_DRAG_WRAPPER_H
17 #define UNIVERSAL_DRAG_WRAPPER_H
18 
19 #include "i_context.h"
20 
21 namespace OHOS {
22 namespace Msdp {
23 namespace DeviceStatus {
24 
25 typedef bool (*InitFunc)(IContext*);
26 typedef void (*RemoveUniversalDragFunc)(void);
27 typedef void (*SetDragableStateFunc)(bool);
28 typedef void (*SetDragSwitchStateFunc)(bool);
29 typedef void (*SetAppDragSwitchStateFunc)(const char *, bool);
30 typedef int32_t (*GetAppDragSwitchStateFunc)(const char *, bool &);
31 typedef void (*SetDraggableStateAsyncFunc)(bool, int64_t);
32 typedef void (*StopLongPressDragFunc)();
33 
34 class UniversalDragWrapper {
35 public:
UniversalDragWrapper(IContext * env)36     UniversalDragWrapper(IContext *env)  : env_(env) {}
37     ~UniversalDragWrapper();
38     bool InitUniversalDrag();
39     void RmoveUniversalDrag();
40     void SetDragableState(bool state);
41     void SetDragSwitchState(bool enable);
42     void SetAppDragSwitchState(const std::string &pkgName, bool enable);
43     int32_t GetAppDragSwitchState(const std::string &pkgName, bool &state);
44     void SetDraggableStateAsync(bool state, int64_t downTime);
45     void StopLongPressDrag();
46 
47 private:
48     IContext* env_ { nullptr };
49     void* universalDragHandle_ { nullptr };
50     InitFunc initUniversalDragHandle_ { nullptr };
51     RemoveUniversalDragFunc removeUniversalDragHandle_ { nullptr };
52     SetDragableStateFunc setDragableStateHandle_ { nullptr };
53     SetDragSwitchStateFunc setDragSwitchStateHandle_ { nullptr };
54     SetAppDragSwitchStateFunc setAppDragSwitchStateHandle_ { nullptr };
55     GetAppDragSwitchStateFunc getAppDragSwitchStateHandle_ { nullptr };
56     SetDraggableStateAsyncFunc setDraggableStateAsyncHandle_ { nullptr };
57     StopLongPressDragFunc StopLongPressDragHandle_ { nullptr };
58 };
59 } // namespace DeviceStatus
60 } // namespace Msdp
61 } // namespace OHOS
62 #endif // I_DRAG_ANIMATION_H