summaryrefslogtreecommitdiff
path: root/ui/tray_icon.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:26:50 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:26:50 +0200
commit669df123648aaa6aeccc70206b5417bc48b4e9ae (patch)
tree463c107a8d6405020bb304f7a7253e6b64afeee0 /ui/tray_icon.h
parent5.18 (diff)
downloadFreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.tar.gz
FreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.tar.bz2
FreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.zip
5.19
Diffstat (limited to 'ui/tray_icon.h')
-rw-r--r--ui/tray_icon.h38
1 files changed, 21 insertions, 17 deletions
diff --git a/ui/tray_icon.h b/ui/tray_icon.h
index 866d79d5..24c97eb0 100644
--- a/ui/tray_icon.h
+++ b/ui/tray_icon.h
@@ -4,38 +4,42 @@
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
-#ifndef TRAYICON_H_INCLUDED
-#define TRAYICON_H_INCLUDED
+#ifndef TRAYICON_H_84217830427534285
+#define TRAYICON_H_84217830427534285
-#include <wx/event.h>
+#include <functional>
#include <wx/image.h>
-//show tray icon with progress during lifetime of this instance
-//emits the following wxCommandEvent in case user double-clicks on tray icon or selects corresponding context menu item:
-extern const wxEventType FFS_REQUEST_RESUME_TRAY_EVENT;
+/*
+show tray icon with progress during lifetime of this instance
-class FfsTrayIcon : public wxEvtHandler
+ATTENTION: wxWidgets never assumes that an object indirectly destroys itself while processing an event!
+ this includes wxEvtHandler-derived objects!!!
+ it seems ProcessEvent() works (on Windows), but AddPendingEvent() will crash since it uses "this" after the event processing!
+
+=> don't derive from wxEvtHandler or any other wxWidgets object here!!!!!!
+=> use simple std::function as callback instead => instance may now be safely deleted in callback!
+*/
+
+class FfsTrayIcon
{
public:
- FfsTrayIcon();
+ FfsTrayIcon(const std::function<void()>& onRequestResume); //callback only held during lifetime of this instance
~FfsTrayIcon();
void setToolTip(const wxString& toolTip);
void setProgress(double fraction); //number between [0, 1], for small progress indicator
private:
- FfsTrayIcon(const FfsTrayIcon&);
- FfsTrayIcon& operator=(const FfsTrayIcon&);
-
- void OnContextMenuSelection(wxCommandEvent& event);
- void OnDoubleClick(wxCommandEvent& event);
+ FfsTrayIcon(const FfsTrayIcon&); //=delete
+ FfsTrayIcon& operator=(const FfsTrayIcon&); //=delete
class TaskBarImpl;
- TaskBarImpl* trayIcon; //actual tray icon (don't use inheritance to enable delayed deletion)
+ TaskBarImpl* trayIcon;
- wxString toolTipLast;
- double fractionLast;
+ wxString activeToolTip;
+ double activeFraction;
wxImage logo;
};
-#endif // TRAYICON_H_INCLUDED
+#endif //TRAYICON_H_84217830427534285
bgstack15