• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 STYLUS_EVENT_H
17 #define STYLUS_EVENT_H
18 
19 #include "manipulation_event.h"
20 
21 namespace OHOS {
22 struct StylusProperty {
23     int action;
24     int buttons;
25 };
26 
27 class StylusEvent : public ManipulationEvent {
28 public:
29     void Initialize(MultimodalProperty &multiProperty,
30         ManipulationProperty &manipulationProperty, StylusProperty stylusProperty);
31 
~StylusEvent()32     virtual ~StylusEvent() { }
33 
34     virtual int GetAction();
35 
36     virtual int GetButtons();
37 
38     bool Marshalling(Parcel &parcel) const override;
39     static StylusEvent *Unmarshalling(Parcel &parcel);
40 
41     static constexpr int NONE = 0;
42 
43     static constexpr int BUTTON_PRESS = 1;
44 
45     static constexpr int BUTTON_RELEASE = 2;
46 
47     static constexpr int STYLUS_DOWN = 3;
48 
49     static constexpr int STYLUS_MOVE = 4;
50 
51     static constexpr int STYLUS_UP = 5;
52 
53     static constexpr int NONE_BUTTON = 0;
54 
55     static constexpr int FIRST_BUTTON = 1;
56 protected:
57     StylusProperty stylusProperty_;
58 };
59 }  // namespace OHOS
60 #endif  // STYLUS_EVENT_H