10fb3b8e927d99caa11a608cbab89e68ca9e2241
[platform/core/uifw/libds.git] / src / DSWindow / DSWindow.h
1 /*
2 * Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 #ifndef _DS_WINDOW_H_
25 #define _DS_WINDOW_H_
26
27 #include "DSCore.h"
28 #include "DSStruct.h"
29 #include "DSObject.h"
30 #include "DSSignal.h"
31 #include "IDSBuffer.h"
32 #include "DSWindowShell.h"
33
34 namespace display_server
35 {
36
37 class DSWindowPrivate;
38 class DSWaylandSurface;
39
40 class DSWindow : public DSObject
41 {
42         DS_PIMPL_USE_PRIVATE(DSWindow)
43
44 public:
45         explicit DSWindow();
46         DSWindow(std::shared_ptr<DSWaylandSurface> waylandSurface);
47         virtual ~DSWindow();
48
49         bool create(std::shared_ptr<DSWaylandSurface> waylandSurface);
50         void destroy(void);
51
52         bool show(void);
53         bool hide(bool autoFocus = true);
54         int  showState(void);
55
56         bool setTitle(const std::string &title);
57         const std::string getTitle(void);
58
59         bool setSkipFocus(bool set);
60         bool getSkipFocus(void);
61
62         bool setLayer(int layer);
63         bool raise(void);
64         bool lower(void);
65
66         bool setFocus(void);
67         bool hasFocus(void);
68
69         void setPosition(int x, int y);
70         stPosition getPosition(void);
71
72         stSize getSize(void);
73         void setSize(unsigned int w, unsigned int h);
74         void setSize(stSize size);
75
76         DSWaylandSurface *surface();
77
78         bool setWindowShell(DSWindowShell *winShell);
79         DSWindowShell *getWindowShell(void);
80
81         void registerCallbackSizeChanged(DSObject *slot, std::function<void(std::shared_ptr<stSize>)> func);
82         void registerCallbackBufferChanged(DSObject *slot, std::function<void(std::shared_ptr<IDSBuffer>)> func);
83
84 protected:
85         //virtual bool _onFocus(void);
86         //virtual bool _onShowStateChange(void);
87
88 private:
89         // signals
90         DSSignal<std::shared_ptr<stSize>> __sizeChangedSignal;
91         DSSignal<std::shared_ptr<IDSBuffer>> __bufferChangedSignal;
92 };
93
94 }
95
96 #endif // _DS_WINDOW_H_