• 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 FRAMEWORKS_INPUTMETHOD_CONTROLLER_SYS_PANEL_STATUS_H
17 #define FRAMEWORKS_INPUTMETHOD_CONTROLLER_SYS_PANEL_STATUS_H
18 
19 #include <cstdint>
20 
21 #include "parcel.h"
22 #include "panel_info.h"
23 
24 namespace OHOS {
25 namespace MiscServices {
26 struct SysPanelStatus : public Parcelable {
27     InputType inputType = InputType::NONE;
28     int32_t flag = FLG_FIXED;
29     uint32_t width = 0;
30     uint32_t height = 0;
31     bool isPanelRaised = true;
32     bool needFuncButton = true;
33 
SysPanelStatusSysPanelStatus34     SysPanelStatus(InputType sysType, int32_t sysFlag, uint32_t sysWidth, uint32_t sysHeight) : inputType(sysType),
35         flag(sysFlag), width(sysWidth), height(sysHeight) {}
36 
37     SysPanelStatus() = default;
38 
ReadFromParcelSysPanelStatus39     bool ReadFromParcel(Parcel &in)
40     {
41         int32_t inputTypeData = in.ReadInt32();
42         inputType = static_cast<InputType>(inputTypeData);
43         flag = in.ReadInt32();
44         width = in.ReadUint32();
45         height = in.ReadUint32();
46         isPanelRaised = in.ReadBool();
47         needFuncButton = in.ReadBool();
48         return true;
49     }
50 
MarshallingSysPanelStatus51     bool Marshalling(Parcel &out) const
52     {
53         if (!out.WriteInt32(static_cast<int32_t>(inputType))) {
54             return false;
55         }
56         if (!out.WriteInt32(flag)) {
57             return false;
58         }
59         if (!out.WriteUint32(width)) {
60             return false;
61         }
62         if (!out.WriteUint32(height)) {
63             return false;
64         }
65         if (!out.WriteBool(isPanelRaised)) {
66             return false;
67         }
68         if (!out.WriteBool(needFuncButton)) {
69             return false;
70         }
71         return true;
72     }
73 
UnmarshallingSysPanelStatus74     static SysPanelStatus *Unmarshalling(Parcel &in)
75     {
76         SysPanelStatus *data = new (std::nothrow) SysPanelStatus();
77         if (data && !data->ReadFromParcel(in)) {
78             delete data;
79             data = nullptr;
80         }
81         return data;
82     }
83 };
84 } // namespace MiscServices
85 } // namespace OHOS
86 
87 #endif // FRAMEWORKS_INPUTMETHOD_CONTROLLER_SYS_PANEL_STATUS_H
88