-
Notifications
You must be signed in to change notification settings - Fork 12
/
xutil.h
90 lines (78 loc) · 2.93 KB
/
xutil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
* Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <qnamespace.h>
//#include "dtkwidget_global.h"
QT_BEGIN_NAMESPACE
class QWidget;
class QPoint;
class QMargins;
class QRect;
namespace XUtils
{
enum class CornerEdge
{
kInvalid = 0,
kTop = 1,
kRight = 2,
kBottom = 4,
kLeft = 8,
kTopLeft = 1 | 8,
kTopRight = 1 | 2,
kBottomLeft = 4 | 8,
kBottomRight = 4 | 2,
};
enum class XCursorType
{
kInvalid = -1,
kArrow = 2,
kTop = 138,
kTopRight = 136,
kRight = 96,
kBottomRight = 14,
kBottom = 16,
kBottomLeft = 12,
kLeft = 70,
kTopLeft = 134,
};
void SendButtonRelease(const QWidget *widget,
const QPoint &pos, const QPoint &globalPos);
void ChangeWindowMaximizedState(const QWidget *widget, int wm_state);
CornerEdge GetCornerEdge(const QWidget *widget, int x, int y, const QMargins &margins, int border_width);
bool UpdateCursorShape(const QWidget *widget, int x, int y, const QMargins &margins, int border_width);
bool IsCornerEdget(const QWidget *widget, int x, int y, const QMargins &margins, int border_width);
void MoveResizeWindow(const QWidget *widget, Qt::MouseButton qbutton, int x, int y, const QMargins &margins, int border_width);
void StartResizing(const QWidget *w, const QPoint &globalPoint, const CornerEdge &ce);
void SendMoveResizeMessage(const QWidget *widget, Qt::MouseButton qbutton, int action);
void MoveWindow(const QWidget *widget, Qt::MouseButton qbutton);
void CancelMoveWindow(const QWidget *widget, Qt::MouseButton qbutton);
void ResetCursorShape(const QWidget *widget);
bool SetCursorShape(const QWidget *widget, int cursor_id);
void ShowFullscreenWindow(const QWidget *widget, bool is_fullscreen);
void ShowMaximizedWindow(const QWidget *widget);
void ShowMinimizedWindow(const QWidget *widget, bool minimized);
void ShowNormalWindow(const QWidget *widget);
void ToggleMaximizedWindow(const QWidget *widget);
void SkipTaskbarPager(const QWidget *widget);
void SetStayOnTop(const QWidget *widget, bool on);
void SetMouseTransparent(const QWidget *widget, bool on);
void SetWindowExtents(const QWidget *widget, const QMargins &margins, const int resizeHandlSize);
void SetWindowExtents(uint wid, const QRect &windowRect, const QMargins &margins, const int resizeHandleSize);
void PropagateSizeHints(const QWidget *w);
void DisableResize(const QWidget *w);
}
QT_END_NAMESPACE