libnick 2024.9.2
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
taskbaritem.h
Go to the documentation of this file.
1
23#ifndef TASKBARITEM_H
24#define TASKBARITEM_H
25
26#include <memory>
27#include <mutex>
28#include <string>
29#include "progressstate.h"
30#ifdef _WIN32
31#include <windows.h>
32#include <atlbase.h>
33#include <gdiplus.h>
34#include <shlobj_core.h>
35#elif defined(__linux__)
36#include <gio/gio.h>
37#endif
38
39namespace Nickvision::Taskbar
40{
45 {
46 public:
69 double getProgress() const;
75 void setProgress(double progress);
80 bool getUrgent() const;
85 void setUrgent(bool urgent);
90 bool getCountVisible() const;
95 void setCountVisible(bool countVisible);
100 long getCount() const;
105 void setCount(long count);
106#ifdef _WIN32
112 bool connect(HWND hwnd);
113#elif defined(__linux__)
119 bool connect(const std::string& desktopFile);
120#endif
121
122 private:
123 mutable std::mutex m_mutex;
124 ProgressState m_progressState;
125 double m_progress;
126 bool m_urgent;
127 bool m_countVisible;
128 long m_count;
129#ifdef _WIN32
133 void drawCountIcon();
134 HWND m_hwnd;
135 CComPtr<ITaskbarList3> m_taskbar;
136 ULONG_PTR m_gdi;
137#elif defined(__linux__)
141 void sendDBusUpdate();
142 GDBusConnection* m_connection;
143 std::string m_objectPath;
144 std::string m_appUri;
145#endif
146 };
147}
148
149#endif //TASKBARITEM_H
An item on the taskbar.
Definition taskbaritem.h:45
TaskbarItem()
Constructs a TaskbarItem.
long getCount() const
Gets the count shown on the taskbar item.
void setCount(long count)
Sets the count shown on the taskbar item.
~TaskbarItem()
Destructs a TaskbarItem.
bool getUrgent() const
Gets whether or not the taskbar item is shown in an urgent state.
bool getCountVisible() const
Gets whether or not the count is visible on the taskbar item.
ProgressState getProgressState() const
Gets the state of the progress.
double getProgress() const
Gets the value of the progress.
void setCountVisible(bool countVisible)
Sets whether or not the count is visible on the taskbar item.
void setUrgent(bool urgent)
Sets whether or not the taskbar item is shown in an urgent state.
void setProgress(double progress)
Sets the value of the progress. Setting the progress value will set the progress state to Normal if p...
void setProgressState(ProgressState state)
Sets the state of the progress.
Definition progressstate.h:27
ProgressState
States of progress on a taskbar button.
Definition progressstate.h:32