[91ef65]: SystemTray.h Maximize Restore History

Download this file

SystemTray.h    138 lines (118 with data), 4.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* Copyright (c) 2003-2007 Rony Shapiro <ronys@users.sourceforge.net>.
* All rights reserved. Use of the code is allowed under the
* Artistic License terms, as specified in the LICENSE file
* distributed with this code, or available from
* http://www.opensource.org/licenses/artistic-license.php
*/
#pragma once
/////////////////////////////////////////////////////////////////////////////
// SystemTray.h : header file
//
// Written by Chris Maunder (chrismaunder@codeguru.com)
// Copyright (c) 1998.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name is included. If
// the source code in this file is used in any commercial application
// then acknowledgement must be made to the author of this file
// (in whatever form you wish).
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability if it causes any damage to your
// computer, causes your pet cat to fall ill, increases baldness or
// makes you car start emitting strange noises when you start it up.
//
// Expect bugs.
//
// Please use and enjoy. Please let me know of any bugs/mods/improvements
// that you have found/implemented and I will fix/incorporate them into this
// file.
#include "RUEList.h"
#include "corelib/MyString.h"
#include <afxdisp.h>
/////////////////////////////////////////////////////////////////////////////
// CSystemTray window
class CSystemTray : public CWnd
{
// Construction/destruction
public:
// CSystemTray();
CSystemTray(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szTip, HICON icon,
CRUEList &RUEList,
UINT uID, UINT menuID);
virtual ~CSystemTray();
DECLARE_DYNAMIC(CSystemTray)
// Operations
public:
void SetTarget(CWnd *tgt) { m_pTarget = tgt;} // ronys
BOOL Enabled() const { return m_bEnabled; }
BOOL Visible() const { return !m_bHidden; }
// Create the tray icon
BOOL Create(CWnd* pParent, UINT uCallbackMessage, LPCTSTR szTip, HICON icon,
UINT uID, UINT menuID);
// Change or retrieve the Tooltip text
BOOL SetTooltipText(LPCTSTR pszTooltipText);
BOOL SetTooltipText(UINT nID);
CString GetTooltipText() const;
// Change or retrieve the icon displayed
BOOL SetIcon(HICON hIcon);
BOOL SetIcon(LPCTSTR lpszIconName);
BOOL SetIcon(UINT nIDResource);
BOOL SetStandardIcon(LPCTSTR lpIconName);
BOOL SetStandardIcon(UINT nIDResource);
HICON GetIcon() const;
void HideIcon();
void ShowIcon();
void RemoveIcon();
void MoveToRight();
// For icon animation
BOOL SetIconList(UINT uFirstIconID, UINT uLastIconID);
BOOL SetIconList(HICON* pHIconList, UINT nNumIcons);
BOOL Animate(UINT nDelayMilliSeconds, int nNumSeconds = -1);
BOOL StepAnimation();
BOOL StopAnimation();
// Change menu default item
void GetMenuDefaultItem(UINT& uItem, BOOL& bByPos) const;
BOOL SetMenuDefaultItem(UINT uItem, BOOL bByPos);
// Change or retrieve the window to send notification messages to
BOOL SetNotificationWnd(CWnd* pNotifyWnd);
CWnd* GetNotificationWnd() const;
// Default handler for tray notification message
virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSystemTray)
protected:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
protected:
void Initialise();
BOOL m_bEnabled; // does O/S support tray icon?
BOOL m_bHidden; // Has the icon been hidden?
NOTIFYICONDATA m_tnd;
CArray<HICON, HICON> m_IconList;
static UINT m_nIDEvent;
UINT_PTR m_uIDTimer;
int m_nCurrentIcon;
UINT m_menuID;
COleDateTime m_StartTime;
int m_nAnimationPeriod;
HICON m_hSavedIcon;
UINT m_DefaultMenuItemID;
BOOL m_DefaultMenuItemByPos;
CWnd * m_pTarget; // ronys
static const UINT m_nTaskbarCreatedMsg; //thedavecollins
const CRUEList &m_RUEList; // reference set to dboxmain's
CList<CMyString, CMyString&> m_menulist;
// Generated message map functions
protected:
//{{AFX_MSG(CSystemTray)
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
LRESULT OnTaskbarCreated(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
};