1 /*
2  * Copyright (c) 2022 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 WINDOW_OPERATOR_H
17 #define WINDOW_OPERATOR_H
18 
19 #include "ui_driver.h"
20 
21 namespace OHOS::uitest {
22     class WindowOperator {
23     public:
24        WindowOperator(UiDriver &driver, const Window &window, UiOpArgs &options);
25 
26        /**Focus the window.*/
27        void Focus(ApiReplyInfo &out);
28 
29        /**Move this Window to the specified points.*/
30        void MoveTo(uint32_t endX, uint32_t endY, ApiReplyInfo &out);
31 
32        /**Resize this Window to the specified size for the specified direction.*/
33        void Resize(int32_t width, int32_t highth, ResizeDirection direction, ApiReplyInfo &out);
34 
35        /**Change this Window into split screen mode*/
36        void Split(ApiReplyInfo &out);
37 
38        /**Maximize this window.*/
39        void Maximize(ApiReplyInfo &out);
40 
41        /**Resume this window.*/
42        void Resume(ApiReplyInfo &out);
43 
44        /**Minimize this window.*/
45        void Minimize(ApiReplyInfo &out);
46 
47        /**Close this window.*/
48        void Close(ApiReplyInfo &out);
49 
50     private:
51         UiDriver &driver_;
52         const Window &window_;
53         UiOpArgs &options_;
54 
55         /**Exhale the decoration bar of the current window.*/
56         void CallBar(ApiReplyInfo &out);
57 
58         /**Click on the decoration bar of this window.*/
59         void BarAction(string_view buttonId, ApiReplyInfo &out);
60     };
61 } // namespace OHOS::uitest
62 
63 #endif