Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-taskbarbutton.h
1#ifndef QX_TASKBARBUTTON_H
2#define QX_TASKBARBUTTON_H
3
4// Shared Lib Support
5#include "qx/windows-gui/qx_windows-gui_export.h"
6
7// Qt Includes
8#include <QObject>
9#include <QWindow>
10
11// Windows Forward Declarations
12struct ITaskbarList4;
13
14namespace Qx
15{
16
17class QX_WINDOWS_GUI_EXPORT TaskbarButton : public QObject
18{
19//-QObject Macro (Required for all QObject Derived Classes)-----------------------------------------------------------
20 Q_OBJECT
21
22//-Class Enums------------------------------------------------------------------------------------------------------
23public:
32 Q_ENUM(ProgressState); // Register for Meta-Object system
35//-Instance Properties-------------------------------------------------------------------------------------------------------
36private:
37 // Overlay
38 Q_PROPERTY(QIcon overlayIcon READ overlayIcon WRITE setOverlayIcon RESET clearOverlayIcon);
39 Q_PROPERTY(QString overlayAccessibleDescription READ overlayAccessibleDescription WRITE setOverlayAccessibleDescription);
40
41 // Window
42 Q_PROPERTY(QWindow* window READ window WRITE setWindow);
43
44 // Progress
45 Q_PROPERTY(int progressValue READ progressValue WRITE setProgressValue NOTIFY progressValueChanged);
46 Q_PROPERTY(int progressMinimum READ progressMinimum WRITE setProgressMinimum NOTIFY progressMinimumChanged);
47 Q_PROPERTY(int progressMaximum READ progressMaximum WRITE setProgressMaximum NOTIFY progressMaximumChanged);
48 Q_PROPERTY(ProgressState progressState READ progressState WRITE setProgressState NOTIFY progressStateChanged);
49
50//-Instance Members-------------------------------------------------------------------------------------------------
51private:
52 // Overlay
53 QIcon mOverlayIcon;
54 QString mOverlayAccessibleDescription;
55
56 // Window
57 QWindow* mWindow;
58
59 // Progress
60 ITaskbarList4* mTaskbarInterface;
61 int mProgressValue;
62 int mProgressMinimum;
63 int mProgressMaximum;
64 ProgressState mProgressState;
65
66//-Constructor-------------------------------------------------------------------------------------------------------
67private:
68 Q_DISABLE_COPY(TaskbarButton);
69
70public:
71 explicit TaskbarButton(QObject *parent = nullptr);
72
73//-Destructor--------------------------------------------------------------------------------------------------------
74public:
76
77//-Instance Functions----------------------------------------------------------------------------------------------
78private:
79 int getNativeIconSize();
80 HWND getNativeWindowHandle();
81
82 void updateOverlay();
83 void updateProgressIndicator();
84
85public:
86 // General
88 bool eventFilter(QObject* object, QEvent* event) override;
91 // Overlay
92 QIcon overlayIcon() const;
93 QString overlayAccessibleDescription() const;
94
95 // Window
96 QWindow* window() const;
97 void setWindow(QWindow* window);
98
99 // Progress
100 int progressValue() const;
101 int progressMinimum() const;
102 int progressMaximum() const;
103 ProgressState progressState() const;
104
105//-Slots------------------------------------------------------------------------------------------------------------
106public slots:
107 // Overlay
108 void setOverlayIcon(const QIcon& icon);
109 void setOverlayAccessibleDescription(const QString& description);
110 void clearOverlayIcon();
111
112 // Progress
113 void setProgressValue(int progressValue);
114 void setProgressMinimum(int progressMinimum);
115 void setProgressMaximum(int progressMaximum);
116 void setProgressRange(int progressMinimum, int progressMaximum);
117 void setProgressState(TaskbarButton::ProgressState progressState);
118 void resetProgress();
119
120//-Signals------------------------------------------------------------------------------------------------------------
121signals:
122 void progressValueChanged(int progressValue);
123 void progressMinimumChanged(int progressMinimum);
124 void progressMaximumChanged(int progressMaximum);
126};
127
128#endif // QX_TASHBARBUTTON_H
129
130}
The TaskbarButton class represents the Windows taskbar button for a top-level window.
Definition qx-taskbarbutton.h:18
void progressStateChanged(TaskbarButton::ProgressState progressState)
ProgressState
Definition qx-taskbarbutton.h:24
@ Normal
Definition qx-taskbarbutton.h:27
@ Busy
Definition qx-taskbarbutton.h:26
@ Hidden
Definition qx-taskbarbutton.h:25
@ Stopped
Definition qx-taskbarbutton.h:28
void progressValueChanged(int progressValue)
void progressMaximumChanged(int progressMaximum)
void progressMinimumChanged(int progressMinimum)
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5