MuldeR's Utilities for Qt MUtilities

GUI.h
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2022 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21
22 #pragma once
23
24 //MUtils
25 #include <MUtils/Global.h>
26
27 //Qt
28 #include <QColor>
29
30 //Forward Declaration
31 class QIcon;
32 class QWidget;
33
35
36 namespace MUtils
37 {
38 namespace GUI
39 {
40 typedef enum
41 {
42 USER_EVENT = 1000, /*QEvent::User*/
43 USER_EVENT_QUERYENDSESSION = USER_EVENT + 666,
44 USER_EVENT_ENDSESSION = USER_EVENT + 667
45 }
46 user_events_t;
47
48 typedef enum
49 {
50 SYSCOLOR_TEXT = 1,
51 SYSCOLOR_BACKGROUND = 2,
52 SYSCOLOR_CAPTION = 3
53 }
54 system_color_t;
55
56 //Broadcast message
57 MUTILS_API bool broadcast(int eventType, const bool &onlyToVisible);
58
59 //Window icon
60 MUTILS_API bool set_window_icon(QWidget *const window, const QIcon &icon, const bool bIsBigIcon);
61
62 //Theme support
63 MUTILS_API bool themes_enabled(void);
64
65 //DPI information
66 MUTILS_API double dpi_scale(void);
67 MUTILS_API bool scale_widget(QWidget *const widget, const bool recenter = true);
68 MUTILS_API bool center_widget(QWidget *const widget);
69
70 //System menu
71 MUTILS_API bool sysmenu_append(const QWidget *const win, const unsigned int identifier, const QString &text);
72 MUTILS_API bool sysmenu_update(const QWidget *const win, const unsigned int identifier, const QString &text);
73 MUTILS_API bool sysmenu_check_msg(void *const message, const unsigned int &identifier);
74
75 //Close button
76 MUTILS_API bool enable_close_button(const QWidget *const win, const bool &bEnable);
77
78 //Bring to front
79 MUTILS_API bool bring_to_front(const QWidget *const window);
80 MUTILS_API bool bring_to_front(const unsigned long pid);
81
82 //Sheet of glass
83 MUTILS_API bool sheet_of_glass(QWidget *const window);
84
85 //System colors
86 MUTILS_API QColor system_color(const int &color_id);
87
88 //Blink window
89 MUTILS_API void blink_window(QWidget *const poWindow, const unsigned int &count = 10, const unsigned int &delay = 150);
90
91 //Force quit application
92 MUTILS_API void force_quit(void);
93 }
94 }
95
Global.h
This file contains miscellaneous functions that are generally useful for Qt-based applications...
MUtils
Global MUtils namespace.
Definition: CPUFeatures.h:37