Qx v0.7
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:
31
32 Q_ENUM(ProgressState); // Register for Meta-Object system
34
35//-Instance Properties-------------------------------------------------------------------------------------------------------
36private:
37 // Overlay
38 Q_PROPERTY(QIcon overlayIcon READ overlayIcon WRITE setOverlayIcon RESET clearOverlayIcon);
40
41 // Window
42 Q_PROPERTY(QWindow* window READ window WRITE setWindow);
43
44 // Progress
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;
90
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;
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
118 void resetProgress();
119
120//-Signals------------------------------------------------------------------------------------------------------------
121signals:
126};
127
128#endif // QX_TASHBARBUTTON_H
129
130}
void setProgressMaximum(int progressMaximum)
Definition qx-taskbarbutton.cpp:425
void progressStateChanged(TaskbarButton::ProgressState progressState)
int progressMinimum
The minimum value of the progress indicator.
Definition qx-taskbarbutton.h:46
QString overlayAccessibleDescription
The description of the overlay for accessibility purposes.
Definition qx-taskbarbutton.h:39
ProgressState
Definition qx-taskbarbutton.h:24
@ Stopped
Definition qx-taskbarbutton.h:28
@ Normal
Definition qx-taskbarbutton.h:27
@ Hidden
Definition qx-taskbarbutton.h:25
@ Paused
Definition qx-taskbarbutton.h:29
@ Busy
Definition qx-taskbarbutton.h:26
TaskbarButton(QObject *parent=nullptr)
Definition qx-taskbarbutton.cpp:193
void progressValueChanged(int progressValue)
void setProgressRange(int progressMinimum, int progressMaximum)
Definition qx-taskbarbutton.cpp:430
int progressMaximum
The maximum value of the progress indicator.
Definition qx-taskbarbutton.h:47
void clearOverlayIcon()
Definition qx-taskbarbutton.cpp:394
void setProgressValue(int progressValue)
Definition qx-taskbarbutton.cpp:403
QIcon overlayIcon
The overlay icon of the taskbar button.
Definition qx-taskbarbutton.h:38
void setWindow(QWindow *window)
Definition qx-taskbarbutton.cpp:330
int progressValue
The current value of the progress indicator.
Definition qx-taskbarbutton.h:45
void progressMaximumChanged(int progressMaximum)
void setProgressState(TaskbarButton::ProgressState progressState)
Definition qx-taskbarbutton.cpp:455
QWindow * window
The window whose taskbar button is manipulated.
Definition qx-taskbarbutton.h:42
void progressMinimumChanged(int progressMinimum)
void resetProgress()
Definition qx-taskbarbutton.cpp:468
ProgressState progressState
The display state of the progress indicator.
Definition qx-taskbarbutton.h:48
void setOverlayAccessibleDescription(const QString &description)
Definition qx-taskbarbutton.cpp:385
void setOverlayIcon(const QIcon &icon)
Definition qx-taskbarbutton.cpp:376
void setProgressMinimum(int progressMinimum)
Definition qx-taskbarbutton.cpp:420
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-abstracterror.cpp:13