• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 INPUTMETHOD_IMF_PANEL_INFO_H
17 #define INPUTMETHOD_IMF_PANEL_INFO_H
18 #include <sstream>
19 
20 #include "parcel.h"
21 
22 namespace OHOS {
23 namespace MiscServices {
24 enum PanelType {
25     SOFT_KEYBOARD = 0,
26     STATUS_BAR,
27 };
28 
29 enum PanelFlag {
30     FLG_FIXED = 0,
31     FLG_FLOATING,
32     FLG_CANDIDATE_COLUMN,
33 };
34 
35 struct PanelInfo : public Parcelable {
36     PanelType panelType = SOFT_KEYBOARD;
37     PanelFlag panelFlag = FLG_FIXED;
38 
ReadFromParcelPanelInfo39     bool ReadFromParcel(Parcel &in)
40     {
41         int32_t panelTypeData = in.ReadInt32();
42         int32_t panelFlagData = in.ReadInt32();
43         panelType = static_cast<PanelType>(panelTypeData);
44         panelFlag = static_cast<PanelFlag>(panelFlagData);
45         return true;
46     }
MarshallingPanelInfo47     bool Marshalling(Parcel &out) const
48     {
49         if (!out.WriteInt32(static_cast<int32_t>(panelType))) {
50             return false;
51         }
52         if (!out.WriteInt32(static_cast<int32_t>(panelFlag))) {
53             return false;
54         }
55         return true;
56     }
UnmarshallingPanelInfo57     static PanelInfo *Unmarshalling(Parcel &in)
58     {
59         PanelInfo *data = new (std::nothrow) PanelInfo();
60         if (data && !data->ReadFromParcel(in)) {
61             delete data;
62             data = nullptr;
63         }
64         return data;
65     }
66 };
67 
68 enum class ImmersiveMode : int32_t {
69     NONE_IMMERSIVE = 0,
70     IMMERSIVE = 1,
71     LIGHT_IMMERSIVE = 2,
72     DARK_IMMERSIVE = 3,
73     END,
74 };
75 
76 enum class GradientMode : int32_t {
77     NONE,
78     LINEAR_GRADIENT,
79     END,
80 };
81 
82 enum class FluidLightMode : int32_t {
83     NONE,
84     BACKGROUND_FLUID_LIGHT,
85     END,
86 };
87 
88 struct ImmersiveEffect {
89     uint32_t gradientHeight;
90     GradientMode gradientMode;
91     FluidLightMode fluidLightMode;
ToStringImmersiveEffect92     inline std::string ToString() const
93     {
94         std::stringstream ss;
95         ss << "[ImmersiveEffect: "
96            << "gradientHeight=" << gradientHeight << ", "
97            << "gradientMode=" << static_cast<int32_t>(gradientMode) << ", "
98            << "fluidLightMode=" << static_cast<int32_t>(fluidLightMode) << "]";
99         return ss.str();
100     }
101 };
102 } // namespace MiscServices
103 } // namespace OHOS
104 
105 #endif // INPUTMETHOD_IMF_PANEL_INFO_H