2014-09-10 14:49:33 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: include/taskbarbutton.h
|
|
|
|
// Purpose: Defines wxTaskBarButton class for manipulating buttons on the
|
|
|
|
// windows taskbar.
|
|
|
|
// Author: Chaobin Zhang <zhchbin@gmail.com>
|
|
|
|
// Created: 2014-04-30
|
|
|
|
// Copyright: (c) 2014 wxWidgets development team
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_TASKBARBUTTON_H_
|
|
|
|
#define _WX_TASKBARBUTTON_H_
|
|
|
|
|
2014-09-10 14:57:20 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2014-09-10 14:49:33 +00:00
|
|
|
#if wxUSE_TASKBARBUTTON
|
|
|
|
|
2014-09-10 14:57:20 +00:00
|
|
|
#include "wx/icon.h"
|
|
|
|
#include "wx/string.h"
|
2014-09-10 14:51:29 +00:00
|
|
|
|
2014-09-10 14:52:33 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxTaskBarButton;
|
2014-09-10 14:55:21 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListCategory;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpList;
|
2014-09-10 14:54:40 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListImpl;
|
2014-09-10 14:53:05 +00:00
|
|
|
|
2014-09-10 14:56:05 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxTaskBarButton: define wxTaskBarButton interface.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2014-09-10 14:49:55 +00:00
|
|
|
/**
|
|
|
|
State of the task bar button.
|
|
|
|
*/
|
2014-09-10 14:57:20 +00:00
|
|
|
enum wxTaskBarButtonState
|
2014-09-10 14:49:55 +00:00
|
|
|
{
|
|
|
|
wxTASKBAR_BUTTON_NO_PROGRESS = 0,
|
|
|
|
wxTASKBAR_BUTTON_INDETERMINATE = 1,
|
|
|
|
wxTASKBAR_BUTTON_NORMAL = 2,
|
|
|
|
wxTASKBAR_BUTTON_ERROR = 4,
|
|
|
|
wxTASKBAR_BUTTON_PAUSED = 8
|
|
|
|
};
|
|
|
|
|
2014-09-10 14:57:20 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxThumbBarButton : public wxObject
|
|
|
|
{
|
2014-09-10 14:50:08 +00:00
|
|
|
public:
|
2014-09-10 14:57:20 +00:00
|
|
|
wxThumbBarButton() : m_taskBarButtonParent(NULL)
|
|
|
|
{ }
|
|
|
|
|
2014-09-10 14:50:08 +00:00
|
|
|
wxThumbBarButton(int id,
|
|
|
|
const wxIcon& icon,
|
2014-09-10 14:51:29 +00:00
|
|
|
const wxString& tooltip = wxString(),
|
|
|
|
bool enable = true,
|
|
|
|
bool dismissOnClick = false,
|
|
|
|
bool hasBackground = true,
|
|
|
|
bool shown = true,
|
|
|
|
bool interactive = true);
|
2014-09-10 14:50:08 +00:00
|
|
|
|
2014-09-10 14:52:23 +00:00
|
|
|
bool Create(int id,
|
|
|
|
const wxIcon& icon,
|
|
|
|
const wxString& tooltip = wxString(),
|
|
|
|
bool enable = true,
|
|
|
|
bool dismissOnClick = false,
|
|
|
|
bool hasBackground = true,
|
|
|
|
bool shown = true,
|
|
|
|
bool interactive = true);
|
2014-09-10 14:50:08 +00:00
|
|
|
int GetID() const { return m_id; }
|
|
|
|
const wxIcon& GetIcon() const { return m_icon; }
|
|
|
|
const wxString& GetTooltip() const { return m_tooltip; }
|
2014-09-10 14:52:33 +00:00
|
|
|
|
2014-09-10 14:51:29 +00:00
|
|
|
bool IsEnable() const { return m_enable; }
|
2014-09-10 14:52:33 +00:00
|
|
|
void Enable(bool enable = true);
|
|
|
|
void Disable() { Enable(false); }
|
|
|
|
|
2014-09-10 14:51:29 +00:00
|
|
|
bool IsDismissOnClick() const { return m_dismissOnClick; }
|
2014-09-10 14:52:33 +00:00
|
|
|
void EnableDismissOnClick(bool enable = true);
|
|
|
|
void DisableDimissOnClick() { EnableDismissOnClick(false); }
|
|
|
|
|
2014-09-10 14:51:29 +00:00
|
|
|
bool HasBackground() const { return m_hasBackground; }
|
2014-09-10 14:52:33 +00:00
|
|
|
void SetHasBackground(bool has = true);
|
|
|
|
|
2014-09-10 14:51:29 +00:00
|
|
|
bool IsShown() const { return m_shown; }
|
2014-09-10 14:52:33 +00:00
|
|
|
void Show(bool shown = true);
|
|
|
|
void Hide() { Show(false); }
|
|
|
|
|
2014-09-10 14:51:29 +00:00
|
|
|
bool IsInteractive() const { return m_interactive; }
|
2014-09-10 14:52:43 +00:00
|
|
|
void SetInteractive(bool interactive = true);
|
2014-09-10 14:52:33 +00:00
|
|
|
|
|
|
|
void SetParent(wxTaskBarButton *parent) { m_taskBarButtonParent = parent; }
|
|
|
|
wxTaskBarButton* GetParent() const { return m_taskBarButtonParent; }
|
2014-09-10 14:50:08 +00:00
|
|
|
|
|
|
|
private:
|
2014-09-10 14:52:33 +00:00
|
|
|
bool UpdateParentTaskBarButton();
|
|
|
|
|
2014-09-10 14:50:08 +00:00
|
|
|
int m_id;
|
|
|
|
wxIcon m_icon;
|
|
|
|
wxString m_tooltip;
|
2014-09-10 14:51:29 +00:00
|
|
|
bool m_enable;
|
|
|
|
bool m_dismissOnClick;
|
|
|
|
bool m_hasBackground;
|
|
|
|
bool m_shown;
|
|
|
|
bool m_interactive;
|
2014-09-10 14:52:33 +00:00
|
|
|
wxTaskBarButton *m_taskBarButtonParent;
|
2014-09-10 14:52:23 +00:00
|
|
|
|
2014-09-10 14:57:20 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxThumbBarButton);
|
2014-09-10 14:50:08 +00:00
|
|
|
};
|
|
|
|
|
2014-09-10 14:51:51 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxTaskBarButton
|
2014-09-10 14:49:33 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-14 23:58:22 +00:00
|
|
|
// Factory function, may return NULL if task bar buttons are not supported
|
|
|
|
// by the current system.
|
|
|
|
static wxTaskBarButton* New(wxWindow* parent);
|
|
|
|
|
2014-09-10 14:49:33 +00:00
|
|
|
virtual ~wxTaskBarButton() { }
|
|
|
|
|
|
|
|
// Operations:
|
2014-09-10 14:51:09 +00:00
|
|
|
virtual void SetProgressRange(int range) = 0;
|
2014-09-10 14:49:33 +00:00
|
|
|
virtual void SetProgressValue(int value) = 0;
|
2014-09-10 14:51:09 +00:00
|
|
|
virtual void PulseProgress() = 0;
|
2014-09-10 14:50:58 +00:00
|
|
|
virtual void Show(bool show = true) = 0;
|
2014-09-10 14:49:55 +00:00
|
|
|
virtual void Hide() = 0;
|
|
|
|
virtual void SetThumbnailTooltip(const wxString& tooltip) = 0;
|
|
|
|
virtual void SetProgressState(wxTaskBarButtonState state) = 0;
|
2014-09-10 14:50:38 +00:00
|
|
|
virtual void SetOverlayIcon(const wxIcon& icon,
|
|
|
|
const wxString& description = wxString()) = 0;
|
2014-09-10 14:49:55 +00:00
|
|
|
virtual void SetThumbnailClip(const wxRect& rect) = 0;
|
2014-09-10 14:51:18 +00:00
|
|
|
virtual void SetThumbnailContents(const wxWindow *child) = 0;
|
2014-09-10 14:51:29 +00:00
|
|
|
virtual bool InsertThumbBarButton(size_t pos, wxThumbBarButton *button) = 0;
|
|
|
|
virtual bool AppendThumbBarButton(wxThumbBarButton *button) = 0;
|
2014-09-10 14:52:55 +00:00
|
|
|
virtual bool AppendSeparatorInThumbBar() = 0;
|
2014-09-10 14:52:11 +00:00
|
|
|
virtual wxThumbBarButton* RemoveThumbBarButton(wxThumbBarButton *button) = 0;
|
|
|
|
virtual wxThumbBarButton* RemoveThumbBarButton(int id) = 0;
|
2014-10-19 12:56:47 +00:00
|
|
|
virtual void Realize() = 0;
|
2014-09-10 14:50:08 +00:00
|
|
|
|
2014-09-14 23:58:22 +00:00
|
|
|
protected:
|
|
|
|
wxTaskBarButton() { }
|
|
|
|
|
2014-09-10 14:49:33 +00:00
|
|
|
private:
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxTaskBarButton);
|
|
|
|
};
|
|
|
|
|
2014-09-10 14:57:20 +00:00
|
|
|
enum wxTaskBarJumpListItemType
|
2014-09-10 14:54:30 +00:00
|
|
|
{
|
2014-09-10 14:54:40 +00:00
|
|
|
wxTASKBAR_JUMP_LIST_SEPARATOR,
|
|
|
|
wxTASKBAR_JUMP_LIST_TASK,
|
2017-06-21 18:48:08 +00:00
|
|
|
wxTASKBAR_JUMP_LIST_DESTINATION
|
2014-09-10 14:53:28 +00:00
|
|
|
};
|
|
|
|
|
2014-09-10 14:54:40 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxTaskBarJumpListItem
|
2014-09-10 14:53:05 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-10 14:55:21 +00:00
|
|
|
wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parentCategory = NULL,
|
|
|
|
wxTaskBarJumpListItemType type = wxTASKBAR_JUMP_LIST_SEPARATOR,
|
|
|
|
const wxString& title = wxEmptyString,
|
|
|
|
const wxString& filePath = wxEmptyString,
|
|
|
|
const wxString& arguments = wxEmptyString,
|
|
|
|
const wxString& tooltip = wxEmptyString,
|
|
|
|
const wxString& iconPath = wxEmptyString,
|
|
|
|
int iconIndex = 0);
|
2014-09-10 14:54:40 +00:00
|
|
|
|
|
|
|
wxTaskBarJumpListItemType GetType() const;
|
|
|
|
void SetType(wxTaskBarJumpListItemType type);
|
2014-09-10 14:53:05 +00:00
|
|
|
const wxString& GetTitle() const;
|
|
|
|
void SetTitle(const wxString& title);
|
|
|
|
const wxString& GetFilePath() const;
|
|
|
|
void SetFilePath(const wxString& filePath);
|
|
|
|
const wxString& GetArguments() const;
|
|
|
|
void SetArguments(const wxString& arguments);
|
|
|
|
const wxString& GetTooltip() const;
|
|
|
|
void SetTooltip(const wxString& tooltip);
|
|
|
|
const wxString& GetIconPath() const;
|
|
|
|
void SetIconPath(const wxString& iconPath);
|
|
|
|
int GetIconIndex() const;
|
|
|
|
void SetIconIndex(int iconIndex);
|
2014-09-10 14:55:21 +00:00
|
|
|
wxTaskBarJumpListCategory* GetCategory() const;
|
|
|
|
void SetCategory(wxTaskBarJumpListCategory *category);
|
2014-09-10 14:53:05 +00:00
|
|
|
|
|
|
|
private:
|
2014-09-10 14:55:21 +00:00
|
|
|
wxTaskBarJumpListCategory *m_parentCategory;
|
2014-09-10 14:54:40 +00:00
|
|
|
wxTaskBarJumpListItemType m_type;
|
2014-09-10 14:53:05 +00:00
|
|
|
wxString m_title;
|
|
|
|
wxString m_filePath;
|
|
|
|
wxString m_arguments;
|
|
|
|
wxString m_tooltip;
|
|
|
|
wxString m_iconPath;
|
|
|
|
int m_iconIndex;
|
2014-09-10 14:57:20 +00:00
|
|
|
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpListItem);
|
2014-09-10 14:53:05 +00:00
|
|
|
};
|
|
|
|
|
2014-09-10 14:54:40 +00:00
|
|
|
typedef wxVector<wxTaskBarJumpListItem*> wxTaskBarJumpListItems;
|
2014-09-10 14:53:57 +00:00
|
|
|
|
2014-09-10 14:54:40 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxTaskBarJumpListCategory
|
2014-09-10 14:53:57 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-10 14:55:21 +00:00
|
|
|
wxTaskBarJumpListCategory(wxTaskBarJumpList *parent = NULL,
|
|
|
|
const wxString& title = wxEmptyString);
|
2014-09-10 14:54:40 +00:00
|
|
|
virtual ~wxTaskBarJumpListCategory();
|
|
|
|
|
|
|
|
wxTaskBarJumpListItem* Append(wxTaskBarJumpListItem *item);
|
|
|
|
void Delete(wxTaskBarJumpListItem *item);
|
|
|
|
wxTaskBarJumpListItem* Remove(wxTaskBarJumpListItem *item);
|
|
|
|
wxTaskBarJumpListItem* FindItemByPosition(size_t pos) const;
|
|
|
|
wxTaskBarJumpListItem* Insert(size_t pos, wxTaskBarJumpListItem *item);
|
|
|
|
wxTaskBarJumpListItem* Prepend(wxTaskBarJumpListItem *item);
|
2014-09-10 14:53:57 +00:00
|
|
|
void SetTitle(const wxString& title);
|
|
|
|
const wxString& GetTitle() const;
|
2014-09-10 14:54:40 +00:00
|
|
|
const wxTaskBarJumpListItems& GetItems() const;
|
2014-09-10 14:53:57 +00:00
|
|
|
|
|
|
|
private:
|
2014-09-10 14:55:21 +00:00
|
|
|
friend class wxTaskBarJumpListItem;
|
|
|
|
|
|
|
|
void Update();
|
|
|
|
|
|
|
|
wxTaskBarJumpList *m_parent;
|
2014-09-10 14:54:40 +00:00
|
|
|
wxTaskBarJumpListItems m_items;
|
2014-09-10 14:53:57 +00:00
|
|
|
wxString m_title;
|
2014-09-10 14:57:20 +00:00
|
|
|
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpListCategory);
|
2014-09-10 14:53:57 +00:00
|
|
|
};
|
2014-09-10 14:53:05 +00:00
|
|
|
|
2014-09-10 14:54:40 +00:00
|
|
|
typedef wxVector<wxTaskBarJumpListCategory*> wxTaskBarJumpListCategories;
|
2014-09-10 14:54:08 +00:00
|
|
|
|
2014-09-10 14:54:40 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxTaskBarJumpList
|
2014-09-10 14:53:05 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-10 14:55:01 +00:00
|
|
|
wxTaskBarJumpList(const wxString& appID = wxEmptyString);
|
2014-09-10 14:54:40 +00:00
|
|
|
virtual ~wxTaskBarJumpList();
|
2014-09-10 14:53:57 +00:00
|
|
|
void ShowRecentCategory(bool shown = true);
|
|
|
|
void HideRecentCategory();
|
|
|
|
void ShowFrequentCategory(bool shown = true);
|
|
|
|
void HideFrequentCategory();
|
|
|
|
|
2014-09-10 14:54:40 +00:00
|
|
|
wxTaskBarJumpListCategory& GetTasks() const;
|
|
|
|
const wxTaskBarJumpListCategory& GetFrequentCategory() const;
|
|
|
|
const wxTaskBarJumpListCategory& GetRecentCategory() const;
|
|
|
|
const wxTaskBarJumpListCategories& GetCustomCategories() const;
|
2014-09-10 14:53:57 +00:00
|
|
|
|
2014-09-10 14:54:51 +00:00
|
|
|
void AddCustomCategory(wxTaskBarJumpListCategory* category);
|
|
|
|
wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title);
|
|
|
|
void DeleteCustomCategory(const wxString& title);
|
|
|
|
|
2014-09-10 14:53:05 +00:00
|
|
|
private:
|
2014-09-10 14:55:21 +00:00
|
|
|
friend class wxTaskBarJumpListCategory;
|
|
|
|
|
|
|
|
void Update();
|
2014-09-10 14:54:40 +00:00
|
|
|
wxTaskBarJumpListImpl *m_jumpListImpl;
|
2014-09-10 14:57:20 +00:00
|
|
|
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpList);
|
2014-09-10 14:53:05 +00:00
|
|
|
};
|
2014-09-10 14:49:33 +00:00
|
|
|
|
|
|
|
#endif // wxUSE_TASKBARBUTTON
|
|
|
|
|
|
|
|
#endif // _WX_TASKBARBUTTON_H_
|