ReactOS  0.4.15-dev-499-g1f31905
CBalloonQueue Class Reference
Collaboration diagram for CBalloonQueue:

Classes

struct  Info
 

Public Member Functions

 CBalloonQueue ()
 
void Init (HWND hwndParent, CNotifyToolbar *toolbar, CTooltips *balloons)
 
void Deinit ()
 
bool OnTimer (int timerId)
 
void UpdateInfo (InternalIconData *notifyItem)
 
void RemoveInfo (InternalIconData *notifyItem)
 
void CloseCurrent ()
 

Static Public Attributes

static const int TimerInterval = 2000
 
static const int BalloonsTimerId = 1
 
static const int MinTimeout = 10000
 
static const int MaxTimeout = 30000
 
static const int CooldownBetweenBalloons = 2000
 

Private Member Functions

int IndexOf (InternalIconData *pdata)
 
void SetTimer (int length)
 
void Show (Info &info)
 
void Close (IN OUT InternalIconData *notifyItem, IN UINT uReason)
 

Private Attributes

HWND m_hwndParent
 
CTooltipsm_tooltips
 
CAtlList< Infom_queue
 
CNotifyToolbarm_toolbar
 
InternalIconDatam_current
 
bool m_currentClosed
 
int m_timer
 

Detailed Description

Definition at line 83 of file syspager.cpp.

Constructor & Destructor Documentation

◆ CBalloonQueue()

CBalloonQueue::CBalloonQueue ( )

Definition at line 500 of file syspager.cpp.

500  :
502  m_tooltips(NULL),
503  m_toolbar(NULL),
504  m_current(NULL),
505  m_currentClosed(false),
506  m_timer(-1)
507 {
508 }
CNotifyToolbar * m_toolbar
Definition: syspager.cpp:119
smooth NULL
Definition: ftsmooth.c:416
InternalIconData * m_current
Definition: syspager.cpp:121
HWND m_hwndParent
Definition: syspager.cpp:113
CTooltips * m_tooltips
Definition: syspager.cpp:115
bool m_currentClosed
Definition: syspager.cpp:122

Member Function Documentation

◆ Close()

void CBalloonQueue::Close ( IN OUT InternalIconData notifyItem,
IN UINT  uReason 
)
private

Definition at line 642 of file syspager.cpp.

643 {
644  TRACE("HideBalloonTip called\n");
645 
646  if (m_current == notifyItem && !m_currentClosed)
647  {
649 
650  // Prevent Re-entry
651  m_currentClosed = true;
654  }
655 }
CNotifyToolbar * m_toolbar
Definition: syspager.cpp:119
VOID TrackDeactivate()
Definition: rosctrls.h:721
bool SendNotifyCallback(InternalIconData *notifyItem, UINT uMsg)
Definition: syspager.cpp:1076
InternalIconData * m_current
Definition: syspager.cpp:121
#define TRACE(s)
Definition: solgame.cpp:4
CTooltips * m_tooltips
Definition: syspager.cpp:115
void SetTimer(int length)
Definition: syspager.cpp:609
bool m_currentClosed
Definition: syspager.cpp:122
static const int CooldownBetweenBalloons
Definition: syspager.cpp:90

Referenced by CloseCurrent(), OnTimer(), RemoveInfo(), and UpdateInfo().

◆ CloseCurrent()

void CBalloonQueue::CloseCurrent ( )

Definition at line 590 of file syspager.cpp.

591 {
592  if (m_current != NULL)
593  {
594  Close(m_current, NIN_BALLOONTIMEOUT);
595  }
596 }
smooth NULL
Definition: ftsmooth.c:416
InternalIconData * m_current
Definition: syspager.cpp:121
void Close(IN OUT InternalIconData *notifyItem, IN UINT uReason)
Definition: syspager.cpp:642

Referenced by CSysPagerWnd::OnBalloonPop().

◆ Deinit()

void CBalloonQueue::Deinit ( )

Definition at line 517 of file syspager.cpp.

518 {
519  if (m_timer >= 0)
520  {
522  }
523 }
HWND m_hwndParent
Definition: syspager.cpp:113
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by CSysPagerWnd::OnDestroy().

◆ IndexOf()

int CBalloonQueue::IndexOf ( InternalIconData pdata)
private

Definition at line 598 of file syspager.cpp.

599 {
600  int count = m_toolbar->GetButtonCount();
601  for (int i = 0; i < count; i++)
602  {
603  if (m_toolbar->GetItemData(i) == pdata)
604  return i;
605  }
606  return -1;
607 }
CNotifyToolbar * m_toolbar
Definition: syspager.cpp:119
GLuint GLuint GLsizei count
Definition: gl.h:1545
TItemData * GetItemData(int index)
Definition: rosctrls.h:434
int GetButtonCount()
Definition: rosctrls.h:315
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PROTOCOLDATA * pdata
Definition: protocol.c:158

Referenced by Show().

◆ Init()

void CBalloonQueue::Init ( HWND  hwndParent,
CNotifyToolbar toolbar,
CTooltips balloons 
)

Definition at line 510 of file syspager.cpp.

511 {
513  m_toolbar = toolbar;
514  m_tooltips = balloons;
515 }
CNotifyToolbar * m_toolbar
Definition: syspager.cpp:119
static HWND hwndParent
Definition: cryptui.c:300
HWND m_hwndParent
Definition: syspager.cpp:113
CTooltips * m_tooltips
Definition: syspager.cpp:115

Referenced by CSysPagerWnd::OnCreate().

◆ OnTimer()

bool CBalloonQueue::OnTimer ( int  timerId)

Definition at line 525 of file syspager.cpp.

526 {
527  if (timerId != m_timer)
528  return false;
529 
531  m_timer = -1;
532 
533  if (m_current && !m_currentClosed)
534  {
535  Close(m_current, NIN_BALLOONTIMEOUT);
536  }
537  else
538  {
539  m_current = NULL;
540  m_currentClosed = false;
541  if (!m_queue.IsEmpty())
542  {
543  Info info = m_queue.RemoveHead();
544  Show(info);
545  }
546  }
547 
548  return true;
549 }
void Show(Info &info)
Definition: syspager.cpp:614
struct TraceInfo Info
smooth NULL
Definition: ftsmooth.c:416
InternalIconData * m_current
Definition: syspager.cpp:121
HWND m_hwndParent
Definition: syspager.cpp:113
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
CAtlList< Info > m_queue
Definition: syspager.cpp:117
bool m_currentClosed
Definition: syspager.cpp:122
void Close(IN OUT InternalIconData *notifyItem, IN UINT uReason)
Definition: syspager.cpp:642

Referenced by CSysPagerWnd::OnTimer().

◆ RemoveInfo()

void CBalloonQueue::RemoveInfo ( InternalIconData notifyItem)

Definition at line 575 of file syspager.cpp.

576 {
577  Close(notifyItem, NIN_BALLOONHIDE);
578 
579  POSITION position = m_queue.GetHeadPosition();
580  while(position != NULL)
581  {
582  Info& info = m_queue.GetNext(position);
583  if (info.pSource == notifyItem)
584  {
585  m_queue.RemoveAt(position);
586  }
587  }
588 }
struct TraceInfo Info
smooth NULL
Definition: ftsmooth.c:416
CAtlList< Info > m_queue
Definition: syspager.cpp:117
void Close(IN OUT InternalIconData *notifyItem, IN UINT uReason)
Definition: syspager.cpp:642

Referenced by CNotifyToolbar::RemoveButton().

◆ SetTimer()

void CBalloonQueue::SetTimer ( int  length)
private

Definition at line 609 of file syspager.cpp.

610 {
612 }
smooth NULL
Definition: ftsmooth.c:416
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
HWND m_hwndParent
Definition: syspager.cpp:113
void SetTimer(int length)
Definition: syspager.cpp:609
static const int BalloonsTimerId
Definition: syspager.cpp:87

Referenced by Close(), and Show().

◆ Show()

void CBalloonQueue::Show ( Info info)
private

Definition at line 614 of file syspager.cpp.

615 {
616  TRACE("ShowBalloonTip called for flags=%x text=%ws; title=%ws\n", info.uIcon, info.szInfo, info.szInfoTitle);
617 
618  // TODO: NIF_REALTIME, NIIF_NOSOUND, other Vista+ flags
619 
620  const int index = IndexOf(info.pSource);
621  RECT rc;
622  m_toolbar->GetItemRect(index, &rc);
623  m_toolbar->ClientToScreen(&rc);
624  const WORD x = (rc.left + rc.right) / 2;
625  const WORD y = (rc.top + rc.bottom) / 2;
626 
627  m_tooltips->SetTitle(info.szInfoTitle, info.uIcon);
629  m_tooltips->UpdateTipText(m_hwndParent, reinterpret_cast<LPARAM>(m_toolbar->m_hWnd), info.szInfo);
630  m_tooltips->TrackActivate(m_hwndParent, reinterpret_cast<LPARAM>(m_toolbar->m_hWnd));
631 
632  m_current = info.pSource;
633  int timeout = info.uTimeout;
636 
637  SetTimer(timeout);
638 
639  m_toolbar->SendNotifyCallback(m_current, NIN_BALLOONSHOW);
640 }
VOID TrackActivate(IN HWND hwndToolOwner, IN UINT uId)
Definition: rosctrls.h:713
static const int MaxTimeout
Definition: syspager.cpp:89
CNotifyToolbar * m_toolbar
Definition: syspager.cpp:119
VOID TrackPosition(IN WORD x, IN WORD y)
Definition: rosctrls.h:726
LONG top
Definition: windef.h:307
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
Definition: dhcpd.h:245
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
VOID UpdateTipText(IN HWND hwndToolOwner, IN UINT uId, IN PCWSTR szText, IN HINSTANCE hinstResourceOwner=NULL)
Definition: rosctrls.h:683
BOOL SetTitle(PCWSTR szTitleText, WPARAM icon=0)
Definition: rosctrls.h:708
bool SendNotifyCallback(InternalIconData *notifyItem, UINT uMsg)
Definition: syspager.cpp:1076
InternalIconData * m_current
Definition: syspager.cpp:121
GLuint index
Definition: glext.h:6031
DWORD GetItemRect(int index, LPRECT prcItem)
Definition: rosctrls.h:401
#define TRACE(s)
Definition: solgame.cpp:4
HWND m_hwndParent
Definition: syspager.cpp:113
unsigned short WORD
Definition: ntddk_ex.h:93
CTooltips * m_tooltips
Definition: syspager.cpp:115
static const int MinTimeout
Definition: syspager.cpp:88
int IndexOf(InternalIconData *pdata)
Definition: syspager.cpp:598
void SetTimer(int length)
Definition: syspager.cpp:609
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
LONG bottom
Definition: windef.h:309

Referenced by OnTimer(), and UpdateInfo().

◆ UpdateInfo()

void CBalloonQueue::UpdateInfo ( InternalIconData notifyItem)

Definition at line 551 of file syspager.cpp.

552 {
553  size_t len = 0;
554  HRESULT hr = StringCchLength(notifyItem->szInfo, _countof(notifyItem->szInfo), &len);
555  if (SUCCEEDED(hr) && len > 0)
556  {
557  Info info(notifyItem);
558 
559  // If m_current == notifyItem, we want to replace the previous balloon even if there is a queue.
560  if (m_current != notifyItem && (m_current != NULL || !m_queue.IsEmpty()))
561  {
562  m_queue.AddTail(info);
563  }
564  else
565  {
566  Show(info);
567  }
568  }
569  else
570  {
571  Close(notifyItem, NIN_BALLOONHIDE);
572  }
573 }
#define StringCchLength
Definition: strsafe.h:829
void Show(Info &info)
Definition: syspager.cpp:614
HRESULT hr
Definition: shlfolder.c:183
struct TraceInfo Info
struct _test_info info[]
Definition: SetCursorPos.c:19
smooth NULL
Definition: ftsmooth.c:416
InternalIconData * m_current
Definition: syspager.cpp:121
LONG HRESULT
Definition: typedefs.h:78
#define _countof(array)
Definition: sndvol32.h:68
GLenum GLsizei len
Definition: glext.h:6722
CAtlList< Info > m_queue
Definition: syspager.cpp:117
CHAR szInfo[256]
Definition: shellapi.h:238
#define SUCCEEDED(hr)
Definition: intsafe.h:57
void Close(IN OUT InternalIconData *notifyItem, IN UINT uReason)
Definition: syspager.cpp:642

Referenced by CNotifyToolbar::AddButton(), and CNotifyToolbar::UpdateButton().

Member Data Documentation

◆ BalloonsTimerId

const int CBalloonQueue::BalloonsTimerId = 1
static

Definition at line 87 of file syspager.cpp.

Referenced by SetTimer().

◆ CooldownBetweenBalloons

const int CBalloonQueue::CooldownBetweenBalloons = 2000
static

Definition at line 90 of file syspager.cpp.

Referenced by Close().

◆ m_current

InternalIconData* CBalloonQueue::m_current
private

Definition at line 121 of file syspager.cpp.

Referenced by Close(), CloseCurrent(), OnTimer(), Show(), and UpdateInfo().

◆ m_currentClosed

bool CBalloonQueue::m_currentClosed
private

Definition at line 122 of file syspager.cpp.

Referenced by Close(), and OnTimer().

◆ m_hwndParent

HWND CBalloonQueue::m_hwndParent
private

Definition at line 113 of file syspager.cpp.

Referenced by Deinit(), Init(), OnTimer(), SetTimer(), and Show().

◆ m_queue

CAtlList<Info> CBalloonQueue::m_queue
private

Definition at line 117 of file syspager.cpp.

Referenced by OnTimer(), RemoveInfo(), and UpdateInfo().

◆ m_timer

int CBalloonQueue::m_timer
private

Definition at line 124 of file syspager.cpp.

Referenced by Deinit(), OnTimer(), and SetTimer().

◆ m_toolbar

CNotifyToolbar* CBalloonQueue::m_toolbar
private

Definition at line 119 of file syspager.cpp.

Referenced by Close(), IndexOf(), Init(), and Show().

◆ m_tooltips

CTooltips* CBalloonQueue::m_tooltips
private

Definition at line 115 of file syspager.cpp.

Referenced by Close(), Init(), and Show().

◆ MaxTimeout

const int CBalloonQueue::MaxTimeout = 30000
static

Definition at line 89 of file syspager.cpp.

Referenced by Show().

◆ MinTimeout

const int CBalloonQueue::MinTimeout = 10000
static

Definition at line 88 of file syspager.cpp.

Referenced by Show().

◆ TimerInterval

const int CBalloonQueue::TimerInterval = 2000
static

Definition at line 86 of file syspager.cpp.


The documentation for this class was generated from the following file: