• 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 SWITCH_EVENT_H
17 #define SWITCH_EVENT_H
18 
19 #include "nocopyable.h"
20 
21 #include "input_event.h"
22 
23 namespace OHOS {
24 namespace MMI {
25 class SwitchEvent : public InputEvent {
26 public:
27     static constexpr int32_t SWITCH_ON = 0;
28     static constexpr int32_t SWITCH_OFF = 1;
29 
30 public:
GetSwitchValue()31     int GetSwitchValue() const
32     {
33         return switchValue_;
34     }
35 
GetSwitchMask()36     int GetSwitchMask() const
37     {
38         return updateSwitchMask_;
39     }
40 
SetSwitchValue(int32_t value)41     void SetSwitchValue(int32_t value)
42     {
43         switchValue_ = value;
44     }
45 
SetSwitchMask(int32_t switchMask)46     void SetSwitchMask(int32_t switchMask)
47     {
48         updateSwitchMask_ = switchMask;
49     }
50 
SwitchEvent(int32_t value)51     explicit SwitchEvent(int32_t value)
52         : InputEvent(value),
53         switchValue_(value),
54         updateSwitchMask_(0) {}
55 private:
56         int32_t switchValue_ { 0 };
57         int32_t updateSwitchMask_ { 0 };
58 };
59 } // namespace MMI
60 } // namespace OHOS
61 #endif // SWITCH_EVENT_H