ReactOS  0.4.15-dev-3165-gdf6fff7
CTaskSwitchWnd Class Reference
Inheritance diagram for CTaskSwitchWnd:
Collaboration diagram for CTaskSwitchWnd:

Public Member Functions

 CTaskSwitchWnd ()
 
virtual ~CTaskSwitchWnd ()
 
INT GetWndTextFromTaskItem (IN PTASK_ITEM TaskItem, LPWSTR szBuf, DWORD cchBuf)
 
VOID UpdateIndexesAfter (IN INT iIndex, BOOL bInserted)
 
INT UpdateTaskGroupButton (IN PTASK_GROUP TaskGroup)
 
VOID ExpandTaskGroup (IN PTASK_GROUP TaskGroup)
 
HICON GetWndIcon (HWND hwnd)
 
INT UpdateTaskItemButton (IN PTASK_ITEM TaskItem)
 
VOID RemoveIcon (IN PTASK_ITEM TaskItem)
 
PTASK_ITEM FindLastTaskItemOfGroup (IN PTASK_GROUP TaskGroup OPTIONAL, IN PTASK_ITEM NewTaskItem OPTIONAL)
 
INT CalculateTaskItemNewButtonIndex (IN PTASK_ITEM TaskItem)
 
INT AddTaskItemButton (IN OUT PTASK_ITEM TaskItem)
 
BOOL DeleteTaskItemButton (IN OUT PTASK_ITEM TaskItem)
 
PTASK_GROUP AddToTaskGroup (IN HWND hWnd)
 
VOID RemoveTaskFromTaskGroup (IN OUT PTASK_ITEM TaskItem)
 
PTASK_ITEM FindTaskItem (IN HWND hWnd)
 
PTASK_ITEM FindOtherTaskItem (IN HWND hWnd)
 
PTASK_ITEM AllocTaskItem ()
 
VOID FreeTaskItem (IN OUT PTASK_ITEM TaskItem)
 
VOID DeleteTaskItem (IN OUT PTASK_ITEM TaskItem)
 
VOID CheckActivateTaskItem (IN OUT PTASK_ITEM TaskItem)
 
PTASK_ITEM FindTaskItemByIndex (IN INT Index)
 
PTASK_GROUP FindTaskGroupByIndex (IN INT Index)
 
BOOL AddTask (IN HWND hWnd)
 
BOOL ActivateTaskItem (IN OUT PTASK_ITEM TaskItem OPTIONAL)
 
BOOL ActivateTask (IN HWND hWnd)
 
BOOL DeleteTask (IN HWND hWnd)
 
VOID DeleteAllTasks ()
 
VOID FlashTaskItem (IN OUT PTASK_ITEM TaskItem)
 
BOOL FlashTask (IN HWND hWnd)
 
VOID RedrawTaskItem (IN OUT PTASK_ITEM TaskItem)
 
BOOL RedrawTask (IN HWND hWnd)
 
VOID UpdateButtonsSize (IN BOOL bRedrawDisabled)
 
BOOL CALLBACK EnumWindowsProc (IN HWND hWnd)
 
BOOL RefreshWindowList ()
 
LRESULT OnThemeChanged (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
BOOL HandleAppCommand (IN WPARAM wParam, IN LPARAM lParam)
 
LRESULT OnShellHook (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
VOID HandleTaskItemClick (IN OUT PTASK_ITEM TaskItem)
 
VOID HandleTaskGroupClick (IN OUT PTASK_GROUP TaskGroup)
 
BOOL HandleButtonClick (IN WORD wIndex)
 
VOID HandleTaskItemRightClick (IN OUT PTASK_ITEM TaskItem)
 
VOID HandleTaskGroupRightClick (IN OUT PTASK_GROUP TaskGroup)
 
BOOL HandleButtonRightClick (IN WORD wIndex)
 
LRESULT HandleItemPaint (IN OUT NMTBCUSTOMDRAW *nmtbcd)
 
LRESULT HandleToolbarNotification (IN const NMHDR *nmh)
 
LRESULT OnEraseBackground (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnNcHitTest (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCommand (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnNotify (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnUpdateTaskbarPos (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnTaskbarSettingsChanged (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnContextMenu (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnKludgeItemRect (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMouseActivate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnTimer (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSetFont (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSettingChanged (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCopyData (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
HRESULT Initialize (IN HWND hWndParent, IN OUT ITrayWindow *tray)
 
HRESULT WINAPI GetWindow (HWND *phwnd)
 
HRESULT WINAPI ContextSensitiveHelp (BOOL fEnterMode)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from ATL::CWindowImpl< CTaskSwitchWnd, CWindow, CControlWinTraits >
HWND Create (HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
- Public Member Functions inherited from ATL::CWindowImplBaseT< CWindow, CControlWinTraits >
 CWindowImplBaseT ()
 
virtual void OnFinalMessage (HWND)
 
BOOL SubclassWindow (HWND hWnd)
 
HWND UnsubclassWindow (BOOL bForce=FALSE)
 
virtual WNDPROC GetWindowProc ()
 
LRESULT DefWindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HWND Create (HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, _U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam)
 
- Public Member Functions inherited from ATL::CWindowImplRoot< CWindow >
 CWindowImplRoot ()
 
virtual ~CWindowImplRoot ()
 
- Public Member Functions inherited from ATL::CWindow
 CWindow (HWND hWnd=NULL)
 
 operator HWND () const
 
UINT ArrangeIconicWindows ()
 
void Attach (HWND hWndNew)
 
HDC BeginPaint (LPPAINTSTRUCT lpPaint)
 
BOOL BringWindowToTop ()
 
BOOL CenterWindow (HWND hWndCenter=NULL)
 
BOOL ChangeClipboardChain (HWND hWndNewNext)
 
BOOL CheckDlgButton (int nIDButton, UINT nCheck)
 
BOOL CheckRadioButton (int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
 
HWND ChildWindowFromPoint (POINT point) const
 
HWND ChildWindowFromPointEx (POINT point, UINT uFlags) const
 
BOOL ClientToScreen (LPPOINT lpPoint) const
 
BOOL ClientToScreen (LPRECT lpRect) const
 
HWND Create (LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
BOOL CreateCaret (HBITMAP pBitmap)
 
BOOL CreateGrayCaret (int nWidth, int nHeight)
 
BOOL CreateSolidCaret (int nWidth, int nHeight)
 
HDWP DeferWindowPos (HDWP hWinPosInfo, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
 
BOOL DestroyWindow ()
 
HWND Detach ()
 
int DlgDirList (LPTSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT nFileType)
 
int DlgDirListComboBox (LPTSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT nFileType)
 
BOOL DlgDirSelect (LPTSTR lpString, int nCount, int nIDListBox)
 
BOOL DlgDirSelectComboBox (LPTSTR lpString, int nCount, int nIDComboBox)
 
void DragAcceptFiles (BOOL bAccept=TRUE)
 
BOOL DrawMenuBar ()
 
BOOL EnableScrollBar (UINT uSBFlags, UINT uArrowFlags=ESB_ENABLE_BOTH)
 
BOOL EnableWindow (BOOL bEnable=TRUE)
 
void EndPaint (LPPAINTSTRUCT lpPaint)
 
BOOL FlashWindow (BOOL bInvert)
 
BOOL GetClientRect (LPRECT lpRect) const
 
HDC GetDC ()
 
HDC GetDCEx (HRGN hRgnClip, DWORD flags)
 
HWND GetDescendantWindow (int nID) const
 
HRESULT GetDlgControl (int nID, REFIID iid, void **ppCtrl)
 
int GetDlgCtrlID () const
 
HRESULT GetDlgHost (int nID, REFIID iid, void **ppHost)
 
HWND GetDlgItem (int nID)
 
UINT GetDlgItemInt (int nID, BOOL *lpTrans=NULL, BOOL bSigned=TRUE) const
 
UINT GetDlgItemText (int nID, LPTSTR lpStr, int nMaxCount) const
 
BOOL GetDlgItemText (int nID, BSTR &bstrText) const
 
DWORD GetExStyle () const
 
HFONT GetFont () const
 
DWORD GetHotKey () const
 
HICON GetIcon (BOOL bBigIcon=TRUE) const
 
HWND GetLastActivePopup () const
 
HMENU GetMenu () const
 
HWND GetNextDlgGroupItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
HWND GetNextDlgTabItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
CWindow GetParent () const
 
BOOL GetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo)
 
BOOL GetScrollPos (int nBar)
 
BOOL GetScrollRange (int nBar, LPINT lpMinPos, LPINT lpMaxPos) const
 
DWORD GetStyle () const
 
HMENU GetSystemMenu (BOOL bRevert)
 
HWND GetTopLevelParent () const
 
HWND GetTopLevelWindow () const
 
HWND GetTopWindow () const
 
BOOL GetUpdateRect (LPRECT lpRect, BOOL bErase=FALSE)
 
int GetUpdateRgn (HRGN hRgn, BOOL bErase=FALSE)
 
HWND GetWindow (UINT nCmd) const
 
DWORD GetWindowContextHelpId () const
 
HDC GetWindowDC ()
 
LONG GetWindowLong (int nIndex) const
 
LONG_PTR GetWindowLongPtr (int nIndex) const
 
BOOL GetWindowPlacement (WINDOWPLACEMENT *lpwndpl) const
 
DWORD GetWindowProcessID ()
 
BOOL GetWindowRect (LPRECT lpRect) const
 
int GetWindowRgn (HRGN hRgn)
 
int GetWindowText (LPTSTR lpszStringBuf, int nMaxCount) const
 
BOOL GetWindowText (BSTR &bstrText)
 
int GetWindowTextLength () const
 
DWORD GetWindowThreadID ()
 
WORD GetWindowWord (int nIndex) const
 
void GotoDlgCtrl (HWND hWndCtrl) const
 
BOOL HideCaret ()
 
BOOL HiliteMenuItem (HMENU hMenu, UINT uHiliteItem, UINT uHilite)
 
BOOL Invalidate (BOOL bErase=TRUE)
 
BOOL InvalidateRect (LPCRECT lpRect, BOOL bErase=TRUE)
 
void InvalidateRgn (HRGN hRgn, BOOL bErase=TRUE)
 
BOOL IsChild (const HWND hWnd) const
 
BOOL IsDialogMessage (LPMSG lpMsg)
 
UINT IsDlgButtonChecked (int nIDButton) const
 
BOOL IsIconic () const
 
BOOL IsParentDialog ()
 
BOOL IsWindow () const
 
BOOL IsWindowEnabled () const
 
BOOL IsWindowVisible () const
 
BOOL IsWindowUnicode ()
 
BOOL IsZoomed () const
 
BOOL KillTimer (UINT_PTR nIDEvent)
 
BOOL LockWindowUpdate (BOOL bLock=TRUE)
 
int MapWindowPoints (HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
 
int MapWindowPoints (HWND hWndTo, LPRECT lpRect) const
 
int MessageBox (LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
 
BOOL ModifyStyle (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL ModifyStyleEx (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL MoveWindow (int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
 
void NextDlgCtrl () const
 
BOOL OpenClipboard ()
 
BOOL PostMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void PrevDlgCtrl () const
 
void Print (HDC hDC, DWORD dwFlags) const
 
void PrintClient (HDC hDC, DWORD dwFlags) const
 
BOOL RedrawWindow (LPCRECT lpRectUpdate=NULL, HRGN hRgnUpdate=NULL, UINT flags=RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE)
 
int ReleaseDC (HDC hDC)
 
BOOL ResizeClient (int nWidth, int nHeight, BOOL bRedraw=FALSE)
 
BOOL ScreenToClient (LPPOINT lpPoint) const
 
BOOL ScrollWindow (int xAmount, int yAmount, LPCRECT lpRect=NULL, LPCRECT lpClipRect=NULL)
 
int ScrollWindowEx (int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate, UINT flags)
 
LRESULT SendDlgItemMessage (int nID, UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
LRESULT SendMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void SendMessageToDescendants (UINT message, WPARAM wParam=0, LPARAM lParam=0, BOOL bDeep=TRUE)
 
BOOL SendNotifyMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
HWND SetActiveWindow ()
 
HWND SetCapture ()
 
HWND SetClipboardViewer ()
 
int SetDlgCtrlID (int nID)
 
BOOL SetDlgItemInt (int nID, UINT nValue, BOOL bSigned=TRUE)
 
BOOL SetDlgItemText (int nID, LPCTSTR lpszString)
 
HWND SetFocus ()
 
void SetFont (HFONT hFont, BOOL bRedraw=TRUE)
 
int SetHotKey (WORD wVirtualKeyCode, WORD wModifiers)
 
HICON SetIcon (HICON hIcon, BOOL bBigIcon=TRUE)
 
BOOL SetMenu (HMENU hMenu)
 
HWND SetParent (HWND hWndNewParent)
 
void SetRedraw (BOOL bRedraw=TRUE)
 
int SetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw=TRUE)
 
int SetScrollPos (int nBar, int nPos, BOOL bRedraw=TRUE)
 
BOOL SetScrollRange (int nBar, int nMinPos, int nMaxPos, BOOL bRedraw=TRUE)
 
UINT_PTR SetTimer (UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
 
BOOL SetWindowContextHelpId (DWORD dwContextHelpId)
 
LONG SetWindowLong (int nIndex, LONG dwNewLong)
 
LONG_PTR SetWindowLongPtr (int nIndex, LONG_PTR dwNewLong)
 
BOOL SetWindowPlacement (const WINDOWPLACEMENT *lpwndpl)
 
BOOL SetWindowPos (HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
 
int SetWindowRgn (HRGN hRgn, BOOL bRedraw=FALSE)
 
BOOL SetWindowText (LPCTSTR lpszString)
 
WORD SetWindowWord (int nIndex, WORD wNewWord)
 
BOOL ShowCaret ()
 
BOOL ShowOwnedPopups (BOOL bShow=TRUE)
 
BOOL ShowScrollBar (UINT nBar, BOOL bShow=TRUE)
 
BOOL ShowWindow (int nCmdShow)
 
BOOL ShowWindowAsync (int nCmdShow)
 
BOOL UpdateWindow ()
 
BOOL ValidateRect (LPCRECT lpRect)
 
BOOL ValidateRgn (HRGN hRgn)
 
BOOL WinHelp (LPCTSTR lpszHelp, UINT nCmd=HELP_CONTEXT, DWORD dwData=0)
 
- Public Member Functions inherited from ATL::CMessageMap
virtual BOOL ProcessWindowMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID)=0
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Static Public Member Functions

static BOOL CALLBACK s_EnumWindowsProc (IN HWND hWnd, IN LPARAM lParam)
 
- Static Public Member Functions inherited from ATL::CComCoClass< CTaskSwitchWnd >
static LPCTSTR WINAPI GetObjectDescription ()
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Static Public Member Functions inherited from ATL::CWindowImpl< CTaskSwitchWnd, CWindow, CControlWinTraits >
static LPCTSTR GetWndCaption ()
 
- Static Public Member Functions inherited from ATL::CWindowImplBaseT< CWindow, CControlWinTraits >
static DWORD GetWndStyle (DWORD dwStyle)
 
static DWORD GetWndExStyle (DWORD dwExStyle)
 
static LRESULT CALLBACK StartWindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- Static Public Member Functions inherited from ATL::CWindow
static LPCTSTR GetWndClassName ()
 
static LRESULT SendMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 

Private Attributes

CTaskToolbar m_TaskBar
 
CComPtr< ITrayWindow > m_Tray
 
UINT m_ShellHookMsg
 
WORD m_TaskItemCount
 
WORD m_AllocatedTaskItems
 
PTASK_GROUP m_TaskGroups
 
PTASK_ITEM m_TaskItems
 
PTASK_ITEM m_ActiveTaskItem
 
HTHEME m_Theme
 
UINT m_ButtonsPerLine
 
WORD m_ButtonCount
 
HIMAGELIST m_ImageList
 
BOOL m_IsGroupingEnabled
 
BOOL m_IsDestroying
 
SIZE m_ButtonSize
 
UINT m_uHardErrorMsg
 
CHardErrorThread m_HardErrorThread
 

Additional Inherited Members

- Public Types inherited from ATL::CWindowImplRoot< CWindow >
enum  
 
- Public Types inherited from IOleWindow
typedef IOleWindowLPOLEWINDOW
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from ATL::CWindowImplBaseT< CWindow, CControlWinTraits >
WNDPROC m_pfnSuperWindowProc
 
- Public Attributes inherited from ATL::CWindowImplRoot< CWindow >
CWndProcThunk m_thunk
 
const _ATL_MSGm_pCurrentMsg
 
DWORD m_dwState
 
- Public Attributes inherited from ATL::CWindow
HWND m_hWnd
 
- Static Public Attributes inherited from ATL::CWindow
static RECT rcDefault
 

Detailed Description

Definition at line 295 of file taskswnd.cpp.

Constructor & Destructor Documentation

◆ CTaskSwitchWnd()

CTaskSwitchWnd::CTaskSwitchWnd ( )
inline

Definition at line 329 of file taskswnd.cpp.

329  :
331  m_TaskItemCount(0),
334  m_TaskItems(NULL),
336  m_Theme(NULL),
337  m_ButtonsPerLine(0),
338  m_ButtonCount(0),
339  m_ImageList(NULL),
342  {
345  }
WORD m_AllocatedTaskItems
Definition: taskswnd.cpp:308
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
PTASK_ITEM m_ActiveTaskItem
Definition: taskswnd.cpp:312
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
#define ZeroMemory
Definition: winbase.h:1664
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
WORD m_ButtonCount
Definition: taskswnd.cpp:316
#define FALSE
Definition: types.h:117
UINT m_ButtonsPerLine
Definition: taskswnd.cpp:315
HTHEME m_Theme
Definition: taskswnd.cpp:314
UINT m_uHardErrorMsg
Definition: taskswnd.cpp:325
PTASK_GROUP m_TaskGroups
Definition: taskswnd.cpp:310
static const WCHAR L[]
Definition: oid.c:1250
HIMAGELIST m_ImageList
Definition: taskswnd.cpp:318
BOOL m_IsDestroying
Definition: taskswnd.cpp:321
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
UINT m_ShellHookMsg
Definition: taskswnd.cpp:305
#define NULL
Definition: types.h:112

◆ ~CTaskSwitchWnd()

virtual CTaskSwitchWnd::~CTaskSwitchWnd ( )
inlinevirtual

Definition at line 346 of file taskswnd.cpp.

346 { }

Member Function Documentation

◆ ActivateTask()

BOOL CTaskSwitchWnd::ActivateTask ( IN HWND  hWnd)
inline

Definition at line 1130 of file taskswnd.cpp.

1131  {
1132  PTASK_ITEM TaskItem;
1133 
1134  if (!hWnd)
1135  {
1136  return ActivateTaskItem(NULL);
1137  }
1138 
1139  TaskItem = FindTaskItem(hWnd);
1140  if (TaskItem == NULL)
1141  {
1142  TaskItem = FindOtherTaskItem(hWnd);
1143  }
1144 
1145  if (TaskItem == NULL)
1146  {
1147  WARN("Activate window 0x%p, could not find task\n", hWnd);
1149  }
1150 
1151  return ActivateTaskItem(TaskItem);
1152  }
#define WARN(fmt,...)
Definition: debug.h:112
HWND hWnd
Definition: settings.c:17
PTASK_ITEM FindTaskItem(IN HWND hWnd)
Definition: taskswnd.cpp:855
BOOL ActivateTaskItem(IN OUT PTASK_ITEM TaskItem OPTIONAL)
Definition: taskswnd.cpp:1118
BOOL RefreshWindowList()
Definition: taskswnd.cpp:1405
PTASK_ITEM FindOtherTaskItem(IN HWND hWnd)
Definition: taskswnd.cpp:872
#define NULL
Definition: types.h:112

Referenced by HandleTaskItemRightClick(), and OnShellHook().

◆ ActivateTaskItem()

BOOL CTaskSwitchWnd::ActivateTaskItem ( IN OUT PTASK_ITEM TaskItem  OPTIONAL)
inline

Definition at line 1118 of file taskswnd.cpp.

1119  {
1120  if (TaskItem != NULL)
1121  {
1122  TRACE("Activate window 0x%p on button %d\n", TaskItem->hWnd, TaskItem->Index);
1123  }
1124 
1125  CheckActivateTaskItem(TaskItem);
1126 
1127  return FALSE;
1128  }
VOID CheckActivateTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:998
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112

Referenced by ActivateTask().

◆ AddTask()

BOOL CTaskSwitchWnd::AddTask ( IN HWND  hWnd)
inline

Definition at line 1089 of file taskswnd.cpp.

1090  {
1091  PTASK_ITEM TaskItem;
1092 
1093  if (!::IsWindow(hWnd) || m_Tray->IsSpecialHWND(hWnd))
1094  return FALSE;
1095 
1096  TaskItem = FindTaskItem(hWnd);
1097  if (TaskItem == NULL)
1098  {
1099  TRACE("Add window 0x%p\n", hWnd);
1100  TaskItem = AllocTaskItem();
1101  if (TaskItem != NULL)
1102  {
1103  ZeroMemory(TaskItem, sizeof(*TaskItem));
1104  TaskItem->hWnd = hWnd;
1105  TaskItem->Index = -1;
1106  TaskItem->Group = AddToTaskGroup(hWnd);
1107 
1108  if (!m_IsDestroying)
1109  {
1110  AddTaskItemButton(TaskItem);
1111  }
1112  }
1113  }
1114 
1115  return TaskItem != NULL;
1116  }
BOOL IsWindow() const
Definition: atlwin.h:882
HWND hWnd
Definition: settings.c:17
#define ZeroMemory
Definition: winbase.h:1664
PTASK_ITEM FindTaskItem(IN HWND hWnd)
Definition: taskswnd.cpp:855
PTASK_ITEM AllocTaskItem()
Definition: taskswnd.cpp:913
#define FALSE
Definition: types.h:117
PTASK_GROUP Group
Definition: taskswnd.cpp:82
#define TRACE(s)
Definition: solgame.cpp:4
INT AddTaskItemButton(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:670
BOOL m_IsDestroying
Definition: taskswnd.cpp:321
#define NULL
Definition: types.h:112
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:303
PTASK_GROUP AddToTaskGroup(IN HWND hWnd)
Definition: taskswnd.cpp:765
HWND hWnd
Definition: taskswnd.cpp:81

Referenced by EnumWindowsProc(), and OnShellHook().

◆ AddTaskItemButton()

INT CTaskSwitchWnd::AddTaskItemButton ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 670 of file taskswnd.cpp.

671  {
672  WCHAR windowText[255];
673  TBBUTTON tbBtn = { 0 };
674  INT iIndex;
675  HICON icon;
676 
677  if (TaskItem->Index >= 0)
678  {
679  return UpdateTaskItemButton(TaskItem);
680  }
681 
682  if (TaskItem->Group != NULL &&
683  TaskItem->Group->IsCollapsed)
684  {
685  /* The task group is collapsed, we only need to update the group button */
686  return UpdateTaskGroupButton(TaskItem->Group);
687  }
688 
689  icon = GetWndIcon(TaskItem->hWnd);
690  if (!icon)
691  icon = static_cast<HICON>(LoadImageW(NULL, MAKEINTRESOURCEW(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
692  TaskItem->IconIndex = ImageList_ReplaceIcon(m_ImageList, -1, icon);
693 
694  tbBtn.iBitmap = TaskItem->IconIndex;
697  tbBtn.dwData = TaskItem->Index;
698 
700  {
701  tbBtn.iString = (DWORD_PTR) windowText;
702  }
703 
704  /* Find out where to insert the new button */
705  iIndex = CalculateTaskItemNewButtonIndex(TaskItem);
706  ASSERT(iIndex >= 0);
707  tbBtn.idCommand = iIndex;
708 
710 
711  if (m_TaskBar.InsertButton(iIndex, &tbBtn))
712  {
713  UpdateIndexesAfter(iIndex, TRUE);
714 
715  TRACE("Added button %d for hwnd 0x%p\n", iIndex, TaskItem->hWnd);
716 
717  TaskItem->Index = iIndex;
718  m_ButtonCount++;
719 
720  /* Update button sizes and fix the button wrapping */
722  return iIndex;
723  }
724 
726 
727  return -1;
728  }
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2779
#define BTNS_NOPREFIX
Definition: commctrl.h:1005
static HICON
Definition: imagelist.c:84
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
#define DWORD_PTR
Definition: treelist.c:76
#define TRUE
Definition: types.h:120
BYTE fsStyle
Definition: commctrl.h:952
int32_t INT
Definition: typedefs.h:58
INT UpdateTaskItemButton(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:514
WORD m_ButtonCount
Definition: taskswnd.cpp:316
VOID UpdateIndexesAfter(IN INT iIndex, BOOL bInserted)
Definition: taskswnd.cpp:408
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define BTNS_CHECK
Definition: commctrl.h:1000
#define BTNS_SHOWTEXT
Definition: commctrl.h:1006
INT_PTR iString
Definition: commctrl.h:959
DWORD_PTR dwData
Definition: commctrl.h:958
int iBitmap
Definition: commctrl.h:949
#define TRACE(s)
Definition: solgame.cpp:4
#define ASSERT(a)
Definition: mode.c:44
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
HICON GetWndIcon(HWND hwnd)
Definition: taskswnd.cpp:489
VOID BeginUpdate()
Definition: taskswnd.cpp:235
int idCommand
Definition: commctrl.h:950
HIMAGELIST m_ImageList
Definition: taskswnd.cpp:318
INT CalculateTaskItemNewButtonIndex(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:626
DWORD InsertButton(int insertAt, TBBUTTON *btn)
Definition: rosctrls.h:337
INT UpdateTaskGroupButton(IN PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:471
#define NULL
Definition: types.h:112
WCHAR windowText[1024]
Definition: appswitch.c:49
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
VOID EndUpdate()
Definition: taskswnd.cpp:240
BYTE fsState
Definition: commctrl.h:951
#define OIC_SAMPLE
Definition: winuser.h:1148
#define TBSTATE_ELLIPSES
Definition: commctrl.h:978
INT GetWndTextFromTaskItem(IN PTASK_ITEM TaskItem, LPWSTR szBuf, DWORD cchBuf)
Definition: taskswnd.cpp:348
VOID UpdateButtonsSize(IN BOOL bRedrawDisabled)
Definition: taskswnd.cpp:1245

Referenced by AddTask().

◆ AddToTaskGroup()

PTASK_GROUP CTaskSwitchWnd::AddToTaskGroup ( IN HWND  hWnd)
inline

Definition at line 765 of file taskswnd.cpp.

766  {
767  DWORD dwProcessId;
768  PTASK_GROUP TaskGroup, *PrevLink;
769 
771  &dwProcessId))
772  {
773  TRACE("Cannot get process id of hwnd 0x%p\n", hWnd);
774  return NULL;
775  }
776 
777  /* Try to find an existing task group */
778  TaskGroup = m_TaskGroups;
779  PrevLink = &m_TaskGroups;
780  while (TaskGroup != NULL)
781  {
782  if (TaskGroup->dwProcessId == dwProcessId)
783  {
784  TaskGroup->dwTaskCount++;
785  return TaskGroup;
786  }
787 
788  PrevLink = &TaskGroup->Next;
789  TaskGroup = TaskGroup->Next;
790  }
791 
792  /* Allocate a new task group */
793  TaskGroup = (PTASK_GROUP) HeapAlloc(hProcessHeap,
795  sizeof(*TaskGroup));
796  if (TaskGroup != NULL)
797  {
798  TaskGroup->dwTaskCount = 1;
799  TaskGroup->dwProcessId = dwProcessId;
800  TaskGroup->Index = -1;
801 
802  /* Add the task group to the list */
803  *PrevLink = TaskGroup;
804  }
805 
806  return TaskGroup;
807  }
HWND hWnd
Definition: settings.c:17
struct _TASK_GROUP * PTASK_GROUP
struct _TASK_GROUP * Next
Definition: taskswnd.cpp:63
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
DWORD dwTaskCount
Definition: taskswnd.cpp:65
#define TRACE(s)
Definition: solgame.cpp:4
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
PTASK_GROUP m_TaskGroups
Definition: taskswnd.cpp:310
DWORD dwProcessId
Definition: taskswnd.cpp:66
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
HANDLE hProcessHeap
Definition: kbswitch.c:25

Referenced by AddTask().

◆ AllocTaskItem()

PTASK_ITEM CTaskSwitchWnd::AllocTaskItem ( )
inline

Definition at line 913 of file taskswnd.cpp.

914  {
916  {
917  /* We need the most significant bit in 16 bit command IDs to indicate whether it
918  is a task group or task item. WM_COMMAND limits command IDs to 16 bits! */
919  return NULL;
920  }
921 
923 
924  if (m_TaskItemCount == 0)
925  {
927  0,
929  if (m_TaskItems != NULL)
930  {
932  }
933  else
934  return NULL;
935  }
937  {
938  PTASK_ITEM NewArray;
939  SIZE_T NewArrayLength, ActiveTaskItemIndex;
940 
941  NewArrayLength = m_AllocatedTaskItems + TASK_ITEM_ARRAY_ALLOC;
942 
943  NewArray = (PTASK_ITEM) HeapReAlloc(hProcessHeap,
944  0,
945  m_TaskItems,
946  NewArrayLength * sizeof(*m_TaskItems));
947  if (NewArray != NULL)
948  {
949  if (m_ActiveTaskItem != NULL)
950  {
951  /* Fixup the ActiveTaskItem pointer */
952  ActiveTaskItemIndex = m_ActiveTaskItem - m_TaskItems;
953  m_ActiveTaskItem = NewArray + ActiveTaskItemIndex;
954  }
955  m_AllocatedTaskItems = (WORD) NewArrayLength;
956  m_TaskItems = NewArray;
957  }
958  else
959  return NULL;
960  }
961 
962  return m_TaskItems + m_TaskItemCount++;
963  }
WORD m_AllocatedTaskItems
Definition: taskswnd.cpp:308
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
#define MAX_TASKS_COUNT
Definition: taskswnd.cpp:29
PTASK_ITEM m_ActiveTaskItem
Definition: taskswnd.cpp:312
#define TASK_ITEM_ARRAY_ALLOC
Definition: taskswnd.cpp:30
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
struct _TASK_ITEM * PTASK_ITEM
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ASSERT(a)
Definition: mode.c:44
unsigned short WORD
Definition: ntddk_ex.h:93
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define HeapReAlloc
Definition: compat.h:593
#define NULL
Definition: types.h:112
HANDLE hProcessHeap
Definition: kbswitch.c:25

Referenced by AddTask().

◆ CalculateTaskItemNewButtonIndex()

INT CTaskSwitchWnd::CalculateTaskItemNewButtonIndex ( IN PTASK_ITEM  TaskItem)
inline

Definition at line 626 of file taskswnd.cpp.

627  {
628  PTASK_GROUP TaskGroup;
629  PTASK_ITEM LastTaskItem;
630 
631  /* NOTE: This routine assumes that the group is *not* collapsed! */
632 
633  TaskGroup = TaskItem->Group;
635  {
636  if (TaskGroup != NULL)
637  {
638  ASSERT(TaskGroup->Index < 0);
639  ASSERT(!TaskGroup->IsCollapsed);
640 
641  if (TaskGroup->dwTaskCount > 1)
642  {
643  LastTaskItem = FindLastTaskItemOfGroup(TaskGroup, TaskItem);
644  if (LastTaskItem != NULL)
645  {
646  /* Since the group is expanded the task items must have an index */
647  ASSERT(LastTaskItem->Index >= 0);
648 
649  return LastTaskItem->Index + 1;
650  }
651  }
652  }
653  else
654  {
655  /* Find the last NULL group button. NULL groups are added at the end of the
656  task item list when grouping is enabled */
657  LastTaskItem = FindLastTaskItemOfGroup(NULL, TaskItem);
658  if (LastTaskItem != NULL)
659  {
660  ASSERT(LastTaskItem->Index >= 0);
661 
662  return LastTaskItem->Index + 1;
663  }
664  }
665  }
666 
667  return m_ButtonCount;
668  }
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
WORD m_ButtonCount
Definition: taskswnd.cpp:316
PTASK_ITEM FindLastTaskItemOfGroup(IN PTASK_GROUP TaskGroup OPTIONAL, IN PTASK_ITEM NewTaskItem OPTIONAL)
Definition: taskswnd.cpp:588
DWORD dwTaskCount
Definition: taskswnd.cpp:65
#define ASSERT(a)
Definition: mode.c:44
DWORD IsCollapsed
Definition: taskswnd.cpp:74
#define NULL
Definition: types.h:112

Referenced by AddTaskItemButton().

◆ CheckActivateTaskItem()

VOID CTaskSwitchWnd::CheckActivateTaskItem ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 998 of file taskswnd.cpp.

999  {
1000  PTASK_ITEM CurrentTaskItem;
1001  PTASK_GROUP TaskGroup = NULL;
1002 
1003  CurrentTaskItem = m_ActiveTaskItem;
1004 
1005  if (TaskItem != NULL)
1006  TaskGroup = TaskItem->Group;
1007 
1008  if (m_IsGroupingEnabled &&
1009  TaskGroup != NULL &&
1010  TaskGroup->IsCollapsed)
1011  {
1012  /* FIXME */
1013  return;
1014  }
1015 
1016  if (CurrentTaskItem != NULL)
1017  {
1018  PTASK_GROUP CurrentTaskGroup;
1019 
1020  if (CurrentTaskItem == TaskItem)
1021  return;
1022 
1023  CurrentTaskGroup = CurrentTaskItem->Group;
1024 
1025  if (m_IsGroupingEnabled &&
1026  CurrentTaskGroup != NULL &&
1027  CurrentTaskGroup->IsCollapsed)
1028  {
1029  if (CurrentTaskGroup == TaskGroup)
1030  return;
1031 
1032  /* FIXME */
1033  }
1034  else
1035  {
1037  if (CurrentTaskItem->Index >= 0)
1038  {
1039  UpdateTaskItemButton(CurrentTaskItem);
1040  }
1041  }
1042  }
1043 
1044  m_ActiveTaskItem = TaskItem;
1045 
1046  if (TaskItem != NULL && TaskItem->Index >= 0)
1047  {
1048  UpdateTaskItemButton(TaskItem);
1049  }
1050  else if (TaskItem == NULL)
1051  {
1052  TRACE("Active TaskItem now NULL\n");
1053  }
1054  }
PTASK_ITEM m_ActiveTaskItem
Definition: taskswnd.cpp:312
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
INT UpdateTaskItemButton(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:514
PTASK_GROUP Group
Definition: taskswnd.cpp:82
#define TRACE(s)
Definition: solgame.cpp:4
DWORD IsCollapsed
Definition: taskswnd.cpp:74
#define NULL
Definition: types.h:112

Referenced by ActivateTaskItem().

◆ ContextSensitiveHelp()

HRESULT WINAPI CTaskSwitchWnd::ContextSensitiveHelp ( BOOL  fEnterMode)
inline

Implements IOleWindow.

Definition at line 1961 of file taskswnd.cpp.

1962  {
1963  return E_NOTIMPL;
1964  }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DeleteAllTasks()

VOID CTaskSwitchWnd::DeleteAllTasks ( )
inline

Definition at line 1171 of file taskswnd.cpp.

1172  {
1173  PTASK_ITEM CurrentTask;
1174 
1175  if (m_TaskItemCount > 0)
1176  {
1177  CurrentTask = m_TaskItems + m_TaskItemCount;
1178  do
1179  {
1180  DeleteTaskItem(--CurrentTask);
1181  } while (CurrentTask != m_TaskItems);
1182  }
1183  }
VOID DeleteTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:983
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311

Referenced by OnDestroy().

◆ DeleteTask()

BOOL CTaskSwitchWnd::DeleteTask ( IN HWND  hWnd)
inline

Definition at line 1154 of file taskswnd.cpp.

1155  {
1156  PTASK_ITEM TaskItem;
1157 
1158  TaskItem = FindTaskItem(hWnd);
1159  if (TaskItem != NULL)
1160  {
1161  TRACE("Delete window 0x%p on button %d\n", hWnd, TaskItem->Index);
1162  DeleteTaskItem(TaskItem);
1163  return TRUE;
1164  }
1165  //else
1166  //TRACE("Failed to delete window 0x%p\n", hWnd);
1167 
1168  return FALSE;
1169  }
VOID DeleteTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:983
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
PTASK_ITEM FindTaskItem(IN HWND hWnd)
Definition: taskswnd.cpp:855
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112

Referenced by OnShellHook().

◆ DeleteTaskItem()

VOID CTaskSwitchWnd::DeleteTaskItem ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 983 of file taskswnd.cpp.

984  {
985  if (!m_IsDestroying)
986  {
987  /* Delete the task button from the toolbar */
988  DeleteTaskItemButton(TaskItem);
989  }
990 
991  /* Remove the task from it's group */
992  RemoveTaskFromTaskGroup(TaskItem);
993 
994  /* Free the task item */
995  FreeTaskItem(TaskItem);
996  }
BOOL DeleteTaskItemButton(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:730
VOID RemoveTaskFromTaskGroup(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:809
BOOL m_IsDestroying
Definition: taskswnd.cpp:321
VOID FreeTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:965

Referenced by DeleteAllTasks(), and DeleteTask().

◆ DeleteTaskItemButton()

BOOL CTaskSwitchWnd::DeleteTaskItemButton ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 730 of file taskswnd.cpp.

731  {
732  PTASK_GROUP TaskGroup;
733  INT iIndex;
734 
735  TaskGroup = TaskItem->Group;
736 
737  if (TaskItem->Index >= 0)
738  {
739  if ((TaskGroup != NULL && !TaskGroup->IsCollapsed) ||
740  TaskGroup == NULL)
741  {
743 
744  RemoveIcon(TaskItem);
745  iIndex = TaskItem->Index;
746  if (m_TaskBar.DeleteButton(iIndex))
747  {
748  TaskItem->Index = -1;
749  m_ButtonCount--;
750 
751  UpdateIndexesAfter(iIndex, FALSE);
752 
753  /* Update button sizes and fix the button wrapping */
755  return TRUE;
756  }
757 
759  }
760  }
761 
762  return FALSE;
763  }
#define TRUE
Definition: types.h:120
DWORD DeleteButton(int index)
Definition: rosctrls.h:347
VOID RemoveIcon(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:560
int32_t INT
Definition: typedefs.h:58
WORD m_ButtonCount
Definition: taskswnd.cpp:316
#define FALSE
Definition: types.h:117
VOID UpdateIndexesAfter(IN INT iIndex, BOOL bInserted)
Definition: taskswnd.cpp:408
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
VOID BeginUpdate()
Definition: taskswnd.cpp:235
DWORD IsCollapsed
Definition: taskswnd.cpp:74
#define NULL
Definition: types.h:112
VOID EndUpdate()
Definition: taskswnd.cpp:240
VOID UpdateButtonsSize(IN BOOL bRedrawDisabled)
Definition: taskswnd.cpp:1245

Referenced by DeleteTaskItem().

◆ EnumWindowsProc()

BOOL CALLBACK CTaskSwitchWnd::EnumWindowsProc ( IN HWND  hWnd)
inline

Definition at line 1377 of file taskswnd.cpp.

1378  {
1379  /* Only show windows that still exist and are visible and none of explorer's
1380  special windows (such as the desktop or the tray window) */
1381  if (::IsWindow(hWnd) && ::IsWindowVisible(hWnd) &&
1382  !m_Tray->IsSpecialHWND(hWnd))
1383  {
1384  DWORD exStyle = ::GetWindowLong(hWnd, GWL_EXSTYLE);
1385  /* Don't list popup windows and also no tool windows */
1386  if ((::GetWindow(hWnd, GW_OWNER) == NULL || exStyle & WS_EX_APPWINDOW) &&
1387  !(exStyle & WS_EX_TOOLWINDOW))
1388  {
1389  TRACE("Adding task for %p...\n", hWnd);
1390  AddTask(hWnd);
1391  }
1392 
1393  }
1394 
1395  return TRUE;
1396  }
#define TRUE
Definition: types.h:120
HRESULT WINAPI GetWindow(HWND *phwnd)
Definition: taskswnd.cpp:1953
BOOL IsWindow() const
Definition: atlwin.h:882
HWND hWnd
Definition: settings.c:17
#define GWL_EXSTYLE
Definition: winuser.h:845
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG GetWindowLong(int nIndex) const
Definition: atlwin.h:738
BOOL AddTask(IN HWND hWnd)
Definition: taskswnd.cpp:1089
#define NULL
Definition: types.h:112
#define GW_OWNER
Definition: winuser.h:761
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:303
#define WS_EX_APPWINDOW
Definition: winuser.h:383
BOOL IsWindowVisible() const
Definition: atlwin.h:893

◆ ExpandTaskGroup()

VOID CTaskSwitchWnd::ExpandTaskGroup ( IN PTASK_GROUP  TaskGroup)
inline

Definition at line 480 of file taskswnd.cpp.

481  {
482  ASSERT(TaskGroup->dwTaskCount > 0);
483  ASSERT(TaskGroup->IsCollapsed);
484  ASSERT(TaskGroup->Index >= 0);
485 
486  /* FIXME: Implement */
487  }
#define ASSERT(a)
Definition: mode.c:44

Referenced by RemoveTaskFromTaskGroup().

◆ FindLastTaskItemOfGroup()

PTASK_ITEM CTaskSwitchWnd::FindLastTaskItemOfGroup ( IN PTASK_GROUP TaskGroup  OPTIONAL,
IN PTASK_ITEM NewTaskItem  OPTIONAL 
)
inline

Definition at line 588 of file taskswnd.cpp.

591  {
592  PTASK_ITEM TaskItem, LastTaskItem, FoundTaskItem = NULL;
593  DWORD dwTaskCount;
594 
596 
597  TaskItem = m_TaskItems;
598  LastTaskItem = TaskItem + m_TaskItemCount;
599 
600  dwTaskCount = (TaskGroup != NULL ? TaskGroup->dwTaskCount : MAX_TASKS_COUNT);
601 
602  ASSERT(dwTaskCount > 0);
603 
604  while (TaskItem != LastTaskItem)
605  {
606  if (TaskItem->Group == TaskGroup)
607  {
608  if ((NewTaskItem != NULL && TaskItem != NewTaskItem) || NewTaskItem == NULL)
609  {
610  FoundTaskItem = TaskItem;
611  }
612 
613  if (--dwTaskCount == 0)
614  {
615  /* We found the last task item in the group! */
616  break;
617  }
618  }
619 
620  TaskItem++;
621  }
622 
623  return FoundTaskItem;
624  }
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
#define MAX_TASKS_COUNT
Definition: taskswnd.cpp:29
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
PTASK_GROUP Group
Definition: taskswnd.cpp:82
#define ASSERT(a)
Definition: mode.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112

Referenced by CalculateTaskItemNewButtonIndex().

◆ FindOtherTaskItem()

PTASK_ITEM CTaskSwitchWnd::FindOtherTaskItem ( IN HWND  hWnd)
inline

Definition at line 872 of file taskswnd.cpp.

873  {
874  PTASK_ITEM LastItem, TaskItem;
875  PTASK_GROUP TaskGroup;
876  DWORD dwProcessId;
877 
878  if (!GetWindowThreadProcessId(hWnd, &dwProcessId))
879  {
880  return NULL;
881  }
882 
883  /* Try to find another task that belongs to the same
884  process as the given window */
885  TaskItem = m_TaskItems;
886  LastItem = TaskItem + m_TaskItemCount;
887  while (TaskItem != LastItem)
888  {
889  TaskGroup = TaskItem->Group;
890  if (TaskGroup != NULL)
891  {
892  if (TaskGroup->dwProcessId == dwProcessId)
893  return TaskItem;
894  }
895  else
896  {
897  DWORD dwProcessIdTask;
898 
899  if (GetWindowThreadProcessId(TaskItem->hWnd,
900  &dwProcessIdTask) &&
901  dwProcessIdTask == dwProcessId)
902  {
903  return TaskItem;
904  }
905  }
906 
907  TaskItem++;
908  }
909 
910  return NULL;
911  }
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
HWND hWnd
Definition: settings.c:17
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
PTASK_GROUP Group
Definition: taskswnd.cpp:82
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwProcessId
Definition: taskswnd.cpp:66
#define NULL
Definition: types.h:112
HWND hWnd
Definition: taskswnd.cpp:81

Referenced by ActivateTask().

◆ FindTaskGroupByIndex()

PTASK_GROUP CTaskSwitchWnd::FindTaskGroupByIndex ( IN INT  Index)
inline

Definition at line 1073 of file taskswnd.cpp.

1074  {
1075  PTASK_GROUP CurrentGroup;
1076 
1077  CurrentGroup = m_TaskGroups;
1078  while (CurrentGroup != NULL)
1079  {
1080  if (CurrentGroup->Index == Index)
1081  break;
1082 
1083  CurrentGroup = CurrentGroup->Next;
1084  }
1085 
1086  return CurrentGroup;
1087  }
struct _TASK_GROUP * Next
Definition: taskswnd.cpp:63
_In_ WDFCOLLECTION _In_ ULONG Index
PTASK_GROUP m_TaskGroups
Definition: taskswnd.cpp:310
#define NULL
Definition: types.h:112

Referenced by HandleButtonClick(), HandleButtonRightClick(), and HandleItemPaint().

◆ FindTaskItem()

PTASK_ITEM CTaskSwitchWnd::FindTaskItem ( IN HWND  hWnd)
inline

Definition at line 855 of file taskswnd.cpp.

856  {
857  PTASK_ITEM TaskItem, LastItem;
858 
859  TaskItem = m_TaskItems;
860  LastItem = TaskItem + m_TaskItemCount;
861  while (TaskItem != LastItem)
862  {
863  if (TaskItem->hWnd == hWnd)
864  return TaskItem;
865 
866  TaskItem++;
867  }
868 
869  return NULL;
870  }
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
HWND hWnd
Definition: settings.c:17
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
#define NULL
Definition: types.h:112
HWND hWnd
Definition: taskswnd.cpp:81

Referenced by ActivateTask(), AddTask(), DeleteTask(), FlashTask(), OnKludgeItemRect(), and RedrawTask().

◆ FindTaskItemByIndex()

PTASK_ITEM CTaskSwitchWnd::FindTaskItemByIndex ( IN INT  Index)
inline

Definition at line 1056 of file taskswnd.cpp.

1057  {
1058  PTASK_ITEM TaskItem, LastItem;
1059 
1060  TaskItem = m_TaskItems;
1061  LastItem = TaskItem + m_TaskItemCount;
1062  while (TaskItem != LastItem)
1063  {
1064  if (TaskItem->Index == Index)
1065  return TaskItem;
1066 
1067  TaskItem++;
1068  }
1069 
1070  return NULL;
1071  }
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
_In_ WDFCOLLECTION _In_ ULONG Index
#define NULL
Definition: types.h:112

Referenced by HandleButtonClick(), HandleButtonRightClick(), and HandleItemPaint().

◆ FlashTask()

BOOL CTaskSwitchWnd::FlashTask ( IN HWND  hWnd)
inline

Definition at line 1191 of file taskswnd.cpp.

1192  {
1193  PTASK_ITEM TaskItem;
1194 
1195  TaskItem = FindTaskItem(hWnd);
1196  if (TaskItem != NULL)
1197  {
1198  TRACE("Flashing window 0x%p on button %d\n", hWnd, TaskItem->Index);
1199  FlashTaskItem(TaskItem);
1200  return TRUE;
1201  }
1202 
1203  return FALSE;
1204  }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
PTASK_ITEM FindTaskItem(IN HWND hWnd)
Definition: taskswnd.cpp:855
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112
VOID FlashTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:1185

Referenced by OnShellHook().

◆ FlashTaskItem()

VOID CTaskSwitchWnd::FlashTaskItem ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 1185 of file taskswnd.cpp.

1186  {
1187  TaskItem->RenderFlashed = 1;
1188  UpdateTaskItemButton(TaskItem);
1189  }
INT UpdateTaskItemButton(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:514

Referenced by FlashTask().

◆ FreeTaskItem()

VOID CTaskSwitchWnd::FreeTaskItem ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 965 of file taskswnd.cpp.

966  {
967  WORD wIndex;
968 
969  if (TaskItem == m_ActiveTaskItem)
971 
972  wIndex = (WORD) (TaskItem - m_TaskItems);
973  if (wIndex + 1 < m_TaskItemCount)
974  {
975  MoveMemory(TaskItem,
976  TaskItem + 1,
977  (m_TaskItemCount - wIndex - 1) * sizeof(*TaskItem));
978  }
979 
980  m_TaskItemCount--;
981  }
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
PTASK_ITEM m_ActiveTaskItem
Definition: taskswnd.cpp:312
#define MoveMemory
Definition: winbase.h:1661
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
unsigned short WORD
Definition: ntddk_ex.h:93
#define NULL
Definition: types.h:112

Referenced by DeleteTaskItem().

◆ GetWindow()

HRESULT WINAPI CTaskSwitchWnd::GetWindow ( HWND phwnd)
inline

Implements IOleWindow.

Definition at line 1953 of file taskswnd.cpp.

1954  {
1955  if (!phwnd)
1956  return E_INVALIDARG;
1957  *phwnd = m_hWnd;
1958  return S_OK;
1959  }
#define E_INVALIDARG
Definition: ddrawi.h:101
HWND m_hWnd
Definition: atlwin.h:268
#define S_OK
Definition: intsafe.h:52

Referenced by EnumWindowsProc().

◆ GetWndIcon()

HICON CTaskSwitchWnd::GetWndIcon ( HWND  hwnd)
inline

Definition at line 489 of file taskswnd.cpp.

490  {
491  HICON hIcon = 0;
492 
493  SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon);
494  if (hIcon)
495  return hIcon;
496 
498  if (hIcon)
499  return hIcon;
500 
501  SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon);
502  if (hIcon)
503  return hIcon;
504 
506  if (hIcon)
507  return hIcon;
508 
510 
511  return hIcon;
512  }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HICON
Definition: imagelist.c:84
#define GCL_HICONSM
Definition: winuser.h:662
#define SMTO_ABORTIFHUNG
Definition: winuser.h:1209
#define ICON_SMALL
Definition: tnclass.cpp:48
#define SendMessageTimeout
Definition: winuser.h:5821
ULONG_PTR * PDWORD_PTR
Definition: basetsd.h:184
#define GetClassLongPtr
Definition: winuser.h:5758
#define GCL_HICON
Definition: winuser.h:661
HICON hIcon
Definition: msconfig.c:44
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by AddTaskItemButton(), and UpdateTaskItemButton().

◆ GetWndTextFromTaskItem()

INT CTaskSwitchWnd::GetWndTextFromTaskItem ( IN PTASK_ITEM  TaskItem,
LPWSTR  szBuf,
DWORD  cchBuf 
)
inline

Definition at line 348 of file taskswnd.cpp.

349  {
350  /* Get the window text without sending a message so we don't hang if an
351  application isn't responding! */
352  return InternalGetWindowText(TaskItem->hWnd, szBuf, cchBuf);
353  }
INT WINAPI InternalGetWindowText(_In_ HWND hWnd, _Out_writes_to_(cchMaxCount, return+1) LPWSTR pString, _In_ int cchMaxCount)

Referenced by AddTaskItemButton(), and UpdateTaskItemButton().

◆ HandleAppCommand()

BOOL CTaskSwitchWnd::HandleAppCommand ( IN WPARAM  wParam,
IN LPARAM  lParam 
)
inline

Definition at line 1470 of file taskswnd.cpp.

1471  {
1472  BOOL Ret = FALSE;
1473 
1474  switch (GET_APPCOMMAND_LPARAM(lParam))
1475  {
1476  case APPCOMMAND_BROWSER_SEARCH:
1477  Ret = SHFindFiles(NULL,
1478  NULL);
1479  break;
1480 
1481  case APPCOMMAND_BROWSER_HOME:
1482  case APPCOMMAND_LAUNCH_MAIL:
1483  default:
1484  TRACE("Shell app command %d unhandled!\n", (INT) GET_APPCOMMAND_LPARAM(lParam));
1485  break;
1486  }
1487 
1488  return Ret;
1489  }
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI SHFindFiles(PCIDLIST_ABSOLUTE pidlFolder, PCIDLIST_ABSOLUTE pidlSaveFile)
Definition: shellord.c:2234
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112
LPARAM lParam
Definition: combotst.c:139

Referenced by OnShellHook().

◆ HandleButtonClick()

BOOL CTaskSwitchWnd::HandleButtonClick ( IN WORD  wIndex)
inline

Definition at line 1608 of file taskswnd.cpp.

1609  {
1610  PTASK_ITEM TaskItem;
1611  PTASK_GROUP TaskGroup;
1612 
1613  if (m_IsGroupingEnabled)
1614  {
1615  TaskGroup = FindTaskGroupByIndex((INT) wIndex);
1616  if (TaskGroup != NULL && TaskGroup->IsCollapsed)
1617  {
1618  HandleTaskGroupClick(TaskGroup);
1619  return TRUE;
1620  }
1621  }
1622 
1623  TaskItem = FindTaskItemByIndex((INT) wIndex);
1624  if (TaskItem != NULL)
1625  {
1626  HandleTaskItemClick(TaskItem);
1627  return TRUE;
1628  }
1629 
1630  return FALSE;
1631  }
VOID HandleTaskItemClick(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:1573
PTASK_GROUP FindTaskGroupByIndex(IN INT Index)
Definition: taskswnd.cpp:1073
#define TRUE
Definition: types.h:120
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
VOID HandleTaskGroupClick(IN OUT PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:1603
DWORD IsCollapsed
Definition: taskswnd.cpp:74
#define NULL
Definition: types.h:112
PTASK_ITEM FindTaskItemByIndex(IN INT Index)
Definition: taskswnd.cpp:1056

Referenced by OnCommand().

◆ HandleButtonRightClick()

BOOL CTaskSwitchWnd::HandleButtonRightClick ( IN WORD  wIndex)
inline

Definition at line 1658 of file taskswnd.cpp.

1659  {
1660  PTASK_ITEM TaskItem;
1661  PTASK_GROUP TaskGroup;
1662  if (m_IsGroupingEnabled)
1663  {
1664  TaskGroup = FindTaskGroupByIndex((INT) wIndex);
1665  if (TaskGroup != NULL && TaskGroup->IsCollapsed)
1666  {
1667  HandleTaskGroupRightClick(TaskGroup);
1668  return TRUE;
1669  }
1670  }
1671 
1672  TaskItem = FindTaskItemByIndex((INT) wIndex);
1673 
1674  if (TaskItem != NULL)
1675  {
1676  HandleTaskItemRightClick(TaskItem);
1677  return TRUE;
1678  }
1679 
1680  return FALSE;
1681  }
VOID HandleTaskGroupRightClick(IN OUT PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:1653
PTASK_GROUP FindTaskGroupByIndex(IN INT Index)
Definition: taskswnd.cpp:1073
#define TRUE
Definition: types.h:120
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
DWORD IsCollapsed
Definition: taskswnd.cpp:74
VOID HandleTaskItemRightClick(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:1634
#define NULL
Definition: types.h:112
PTASK_ITEM FindTaskItemByIndex(IN INT Index)
Definition: taskswnd.cpp:1056

Referenced by OnContextMenu().

◆ HandleItemPaint()

LRESULT CTaskSwitchWnd::HandleItemPaint ( IN OUT NMTBCUSTOMDRAW nmtbcd)
inline

Definition at line 1684 of file taskswnd.cpp.

1685  {
1686  LRESULT Ret = CDRF_DODEFAULT;
1687  PTASK_GROUP TaskGroup;
1688  PTASK_ITEM TaskItem;
1689 
1690  TaskItem = FindTaskItemByIndex((INT) nmtbcd->nmcd.dwItemSpec);
1691  TaskGroup = FindTaskGroupByIndex((INT) nmtbcd->nmcd.dwItemSpec);
1692  if (TaskGroup == NULL && TaskItem != NULL)
1693  {
1694  ASSERT(TaskItem != NULL);
1695 
1696  if (TaskItem != NULL && ::IsWindow(TaskItem->hWnd))
1697  {
1698  /* Make the entire button flashing if necessary */
1699  if (nmtbcd->nmcd.uItemState & CDIS_MARKED)
1700  {
1701  Ret = TBCDRF_NOBACKGROUND;
1702  if (!m_Theme)
1703  {
1704  SelectObject(nmtbcd->nmcd.hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
1705  Rectangle(nmtbcd->nmcd.hdc,
1706  nmtbcd->nmcd.rc.left,
1707  nmtbcd->nmcd.rc.top,
1708  nmtbcd->nmcd.rc.right,
1709  nmtbcd->nmcd.rc.bottom);
1710  }
1711  else
1712  {
1713  DrawThemeBackground(m_Theme, nmtbcd->nmcd.hdc, TDP_FLASHBUTTON, 0, &nmtbcd->nmcd.rc, 0);
1714  }
1715  nmtbcd->clrText = GetSysColor(COLOR_HIGHLIGHTTEXT);
1716  return Ret;
1717  }
1718  }
1719  }
1720  else if (TaskGroup != NULL)
1721  {
1722  /* FIXME: Implement painting for task groups */
1723  }
1724  return Ret;
1725  }
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
PTASK_GROUP FindTaskGroupByIndex(IN INT Index)
Definition: taskswnd.cpp:1073
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL IsWindow() const
Definition: atlwin.h:882
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetSysColor(_In_ int)
#define CDIS_MARKED
Definition: commctrl.h:298
HTHEME m_Theme
Definition: taskswnd.cpp:314
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
#define ASSERT(a)
Definition: mode.c:44
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define TBCDRF_NOBACKGROUND
Definition: commctrl.h:1040
#define NULL
Definition: types.h:112
PTASK_ITEM FindTaskItemByIndex(IN INT Index)
Definition: taskswnd.cpp:1056
LONG_PTR LRESULT
Definition: windef.h:209
HBRUSH WINAPI GetSysColorBrush(_In_ int)
HWND hWnd
Definition: taskswnd.cpp:81

Referenced by HandleToolbarNotification().

◆ HandleTaskGroupClick()

VOID CTaskSwitchWnd::HandleTaskGroupClick ( IN OUT PTASK_GROUP  TaskGroup)
inline

Definition at line 1603 of file taskswnd.cpp.

1604  {
1605  /* TODO: Show task group menu */
1606  }

Referenced by HandleButtonClick().

◆ HandleTaskGroupRightClick()

VOID CTaskSwitchWnd::HandleTaskGroupRightClick ( IN OUT PTASK_GROUP  TaskGroup)
inline

Definition at line 1653 of file taskswnd.cpp.

1654  {
1655  /* TODO: Show task group right click menu */
1656  }

Referenced by HandleButtonRightClick().

◆ HandleTaskItemClick()

VOID CTaskSwitchWnd::HandleTaskItemClick ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 1573 of file taskswnd.cpp.

1574  {
1575  BOOL bIsMinimized;
1576  BOOL bIsActive;
1577 
1578  if (::IsWindow(TaskItem->hWnd))
1579  {
1580  bIsMinimized = ::IsIconic(TaskItem->hWnd);
1581  bIsActive = (TaskItem == m_ActiveTaskItem);
1582 
1583  TRACE("Active TaskItem %p, selected TaskItem %p\n", m_ActiveTaskItem, TaskItem);
1584  if (m_ActiveTaskItem)
1585  TRACE("Active TaskItem hWnd=%p, TaskItem hWnd %p\n", m_ActiveTaskItem->hWnd, TaskItem->hWnd);
1586 
1587  TRACE("Valid button clicked. HWND=%p, IsMinimized=%s, IsActive=%s...\n",
1588  TaskItem->hWnd, bIsMinimized ? "Yes" : "No", bIsActive ? "Yes" : "No");
1589 
1590  if (!bIsMinimized && bIsActive)
1591  {
1592  ::ShowWindowAsync(TaskItem->hWnd, SW_MINIMIZE);
1593  TRACE("Valid button clicked. App window Minimized.\n");
1594  }
1595  else
1596  {
1597  ::SwitchToThisWindow(TaskItem->hWnd, TRUE);
1598  TRACE("Valid button clicked. App window Restored.\n");
1599  }
1600  }
1601  }
#define TRUE
Definition: types.h:120
BOOL ShowWindowAsync(int nCmdShow)
Definition: atlwin.h:1274
PTASK_ITEM m_ActiveTaskItem
Definition: taskswnd.cpp:312
BOOL IsWindow() const
Definition: atlwin.h:882
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define SW_MINIMIZE
Definition: winuser.h:770
BOOL IsIconic() const
Definition: atlwin.h:867
VOID WINAPI SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
Definition: window.c:82
HWND hWnd
Definition: taskswnd.cpp:81

Referenced by HandleButtonClick().

◆ HandleTaskItemRightClick()

VOID CTaskSwitchWnd::HandleTaskItemRightClick ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 1634 of file taskswnd.cpp.

1635  {
1636  POINT pt;
1637  GetCursorPos(&pt);
1638 
1639  SetForegroundWindow(TaskItem->hWnd);
1640 
1641  ActivateTask(TaskItem->hWnd);
1642 
1643  /* Wait up to 2 seconds for the window to process the foreground notification. */
1644  DWORD_PTR resultDummy;
1645  if (!SendMessageTimeout(TaskItem->hWnd, WM_NULL, 0, 0, 0, 2000, &resultDummy))
1646  ERR("HandleTaskItemRightClick detected the window was unresponsive for 2 seconds, or was destroyed\n");
1647  if (GetForegroundWindow() != TaskItem->hWnd)
1648  ERR("HandleTaskItemRightClick detected the window did not become foreground\n");
1649 
1650  ::SendMessageW(TaskItem->hWnd, WM_POPUPSYSTEMMENU, 0, MAKELPARAM(pt.x, pt.y));
1651  }
#define WM_NULL
Definition: winuser.h:1590
#define pt(x, y)
Definition: drawing.c:79
#define MAKELPARAM(l, h)
Definition: winuser.h:3984
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
BOOL ActivateTask(IN HWND hWnd)
Definition: taskswnd.cpp:1130
#define WM_POPUPSYSTEMMENU
Definition: undocuser.h:60
#define SendMessageTimeout
Definition: winuser.h:5821
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define ERR(fmt,...)
Definition: debug.h:110
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
BOOL WINAPI SetForegroundWindow(_In_ HWND)

Referenced by HandleButtonRightClick().

◆ HandleToolbarNotification()

LRESULT CTaskSwitchWnd::HandleToolbarNotification ( IN const NMHDR nmh)
inline

Definition at line 1727 of file taskswnd.cpp.

1728  {
1729  LRESULT Ret = 0;
1730 
1731  switch (nmh->code)
1732  {
1733  case NM_CUSTOMDRAW:
1734  {
1735  LPNMTBCUSTOMDRAW nmtbcd = (LPNMTBCUSTOMDRAW) nmh;
1736 
1737  switch (nmtbcd->nmcd.dwDrawStage)
1738  {
1739 
1740  case CDDS_ITEMPREPAINT:
1741  Ret = HandleItemPaint(nmtbcd);
1742  break;
1743 
1744  case CDDS_PREPAINT:
1745  Ret = CDRF_NOTIFYITEMDRAW;
1746  break;
1747 
1748  default:
1749  Ret = CDRF_DODEFAULT;
1750  break;
1751  }
1752  break;
1753  }
1754  }
1755 
1756  return Ret;
1757  }
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
NMCUSTOMDRAW nmcd
Definition: commctrl.h:1017
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define CDDS_PREPAINT
Definition: commctrl.h:280
struct _NMTBCUSTOMDRAW * LPNMTBCUSTOMDRAW
LRESULT HandleItemPaint(IN OUT NMTBCUSTOMDRAW *nmtbcd)
Definition: taskswnd.cpp:1684
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by OnNotify().

◆ Initialize()

HRESULT CTaskSwitchWnd::Initialize ( IN HWND  hWndParent,
IN OUT ITrayWindow *  tray 
)
inline

Definition at line 1943 of file taskswnd.cpp.

1944  {
1945  m_Tray = tray;
1948  if (!m_hWnd)
1949  return E_FAIL;
1950  return S_OK;
1951  }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1666
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define E_FAIL
Definition: ddrawi.h:102
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
BOOL bGroupButtons
Definition: precomp.h:206
const WCHAR szRunningApps[]
Definition: taskswnd.cpp:33
HWND m_hWnd
Definition: atlwin.h:268
#define WS_TABSTOP
Definition: pedump.c:634
#define S_OK
Definition: intsafe.h:52
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:303
#define WS_VISIBLE
Definition: pedump.c:620

◆ OnCommand()

LRESULT CTaskSwitchWnd::OnCommand ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1802 of file taskswnd.cpp.

1803  {
1804  LRESULT Ret = TRUE;
1805  if (lParam != 0 && (HWND) lParam == m_TaskBar.m_hWnd)
1806  {
1808  }
1809  return Ret;
1810  }
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138
BOOL HandleButtonClick(IN WORD wIndex)
Definition: taskswnd.cpp:1608
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ OnContextMenu()

LRESULT CTaskSwitchWnd::OnContextMenu ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1847 of file taskswnd.cpp.

1848  {
1849  LRESULT Ret = 0;
1850  INT_PTR iBtn = -1;
1851 
1852  if (m_TaskBar.m_hWnd != NULL)
1853  {
1854  POINT pt;
1855 
1856  pt.x = GET_X_LPARAM(lParam);
1857  pt.y = GET_Y_LPARAM(lParam);
1858 
1859  ::ScreenToClient(m_TaskBar.m_hWnd, &pt);
1860 
1861  iBtn = m_TaskBar.HitTest(&pt);
1862  if (iBtn >= 0)
1863  {
1864  HandleButtonRightClick(iBtn);
1865  }
1866  }
1867  if (iBtn < 0)
1868  {
1869  /* Not on a taskbar button, so forward message to tray */
1870  Ret = SendMessage(m_Tray->GetHWND(), uMsg, wParam, lParam);
1871  }
1872  return Ret;
1873  }
INT HitTest(PPOINT ppt)
Definition: rosctrls.h:430
#define pt(x, y)
Definition: drawing.c:79
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
int32_t INT_PTR
Definition: typedefs.h:64
WPARAM wParam
Definition: combotst.c:138
BOOL HandleButtonRightClick(IN WORD wIndex)
Definition: taskswnd.cpp:1658
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
BOOL ScreenToClient(LPPOINT lpPoint) const
Definition: atlwin.h:1027
#define NULL
Definition: types.h:112
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:303
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1051
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

◆ OnCopyData()

LRESULT CTaskSwitchWnd::OnCopyData ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1927 of file taskswnd.cpp.

1928  {
1930  if (cpData->dwData == m_uHardErrorMsg)
1931  {
1932  /* A hard error balloon message */
1934  ERR("Got balloon data 0x%x, 0x%x, '%S', '%S'\n", pData->Status, pData->dwType, (WCHAR*)((ULONG_PTR)pData + pData->TitleOffset), (WCHAR*)((ULONG_PTR)pData + pData->MessageOffset));
1935  if (pData->cbHeaderSize == sizeof(BALLOON_HARD_ERROR_DATA))
1937  return TRUE;
1938  }
1939 
1940  return FALSE;
1941  }
#define TRUE
Definition: types.h:120
void StartThread(PBALLOON_HARD_ERROR_DATA pData)
Definition: taskswnd.cpp:178
uint32_t ULONG_PTR
Definition: typedefs.h:65
ULONG_PTR dwData
Definition: winuser.h:2977
#define FALSE
Definition: types.h:117
struct _BALLOON_HARD_ERROR_DATA * PBALLOON_HARD_ERROR_DATA
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT m_uHardErrorMsg
Definition: taskswnd.cpp:325
struct tagCOPYDATASTRUCT * PCOPYDATASTRUCT
#define ERR(fmt,...)
Definition: debug.h:110
#define ULONG_PTR
Definition: config.h:101
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
LPARAM lParam
Definition: combotst.c:139
CHardErrorThread m_HardErrorThread
Definition: taskswnd.cpp:326

◆ OnCreate()

LRESULT CTaskSwitchWnd::OnCreate ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1427 of file taskswnd.cpp.

1428  {
1429  if (!m_TaskBar.Initialize(m_hWnd))
1430  return FALSE;
1431 
1432  SetWindowTheme(m_TaskBar.m_hWnd, L"TaskBand", NULL);
1433 
1436 
1437  /* Set proper spacing between buttons */
1438  m_TaskBar.UpdateTbButtonSpacing(m_Tray->IsHorizontal(), m_Theme != NULL);
1439 
1440  /* Register the shell hook */
1441  m_ShellHookMsg = RegisterWindowMessageW(L"SHELLHOOK");
1442 
1443  TRACE("ShellHookMsg got assigned number %d\n", m_ShellHookMsg);
1444 
1445  RegisterShellHook(m_hWnd, 3); /* 1 if no NT! We're targeting NT so we don't care! */
1446 
1448 
1449  /* Recalculate the button size */
1451 
1452 #if DUMP_TASKS != 0
1453  SetTimer(hwnd, 1, 5000, NULL);
1454 #endif
1455  return TRUE;
1456  }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI RegisterShellHook(HWND hWnd, DWORD dwType)
Definition: shellord.c:311
#define TRUE
Definition: types.h:120
BOOL Initialize(HWND hWndParent)
Definition: taskswnd.cpp:282
#define SM_CYSMICON
Definition: winuser.h:1003
#define ILC_COLOR32
Definition: commctrl.h:358
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define FALSE
Definition: types.h:117
UINT_PTR SetTimer(UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
Definition: atlwin.h:1193
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:424
HTHEME m_Theme
Definition: taskswnd.cpp:314
BOOL RefreshWindowList()
Definition: taskswnd.cpp:1405
#define TRACE(s)
Definition: solgame.cpp:4
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
static const WCHAR L[]
Definition: oid.c:1250
#define ILC_MASK
Definition: commctrl.h:351
HWND m_hWnd
Definition: atlwin.h:268
HIMAGELIST m_ImageList
Definition: taskswnd.cpp:318
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
UINT m_ShellHookMsg
Definition: taskswnd.cpp:305
#define NULL
Definition: types.h:112
INT UpdateTbButtonSpacing(IN BOOL bHorizontal, IN BOOL bThemed, IN UINT uiRows=0, IN UINT uiBtnsPerLine=0)
Definition: taskswnd.cpp:203
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:303
VOID UpdateButtonsSize(IN BOOL bRedrawDisabled)
Definition: taskswnd.cpp:1245

◆ OnDestroy()

LRESULT CTaskSwitchWnd::OnDestroy ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1458 of file taskswnd.cpp.

1459  {
1460  m_IsDestroying = TRUE;
1461 
1462  /* Unregister the shell hook */
1464 
1466  DeleteAllTasks();
1467  return TRUE;
1468  }
BOOL WINAPI RegisterShellHook(HWND hWnd, DWORD dwType)
Definition: shellord.c:311
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
VOID DeleteAllTasks()
Definition: taskswnd.cpp:1171
HTHEME m_Theme
Definition: taskswnd.cpp:314
HWND m_hWnd
Definition: atlwin.h:268
BOOL m_IsDestroying
Definition: taskswnd.cpp:321
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950

◆ OnEraseBackground()

LRESULT CTaskSwitchWnd::OnEraseBackground ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1759 of file taskswnd.cpp.

1760  {
1761  HDC hdc = (HDC) wParam;
1762 
1763  if (!IsAppThemed())
1764  {
1765  bHandled = FALSE;
1766  return 0;
1767  }
1768 
1769  RECT rect;
1770  GetClientRect(&rect);
1772 
1773  return TRUE;
1774  }
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
HDC hdc
Definition: main.c:9
HWND m_hWnd
Definition: atlwin.h:268

◆ OnKludgeItemRect()

LRESULT CTaskSwitchWnd::OnKludgeItemRect ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1875 of file taskswnd.cpp.

1876  {
1877  PTASK_ITEM TaskItem = FindTaskItem((HWND) wParam);
1878  if (TaskItem)
1879  {
1880  RECT* prcMinRect = (RECT*) lParam;
1881  RECT rcItem, rcToolbar;
1882  m_TaskBar.GetItemRect(TaskItem->Index, &rcItem);
1883  m_TaskBar.GetWindowRect(&rcToolbar);
1884 
1885  OffsetRect(&rcItem, rcToolbar.left, rcToolbar.top);
1886 
1887  *prcMinRect = rcItem;
1888  return TRUE;
1889  }
1890  return FALSE;
1891  }
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
PTASK_ITEM FindTaskItem(IN HWND hWnd)
Definition: taskswnd.cpp:855
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
DWORD GetItemRect(int index, LPRECT prcItem)
Definition: rosctrls.h:403
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
LPARAM lParam
Definition: combotst.c:139

◆ OnMouseActivate()

LRESULT CTaskSwitchWnd::OnMouseActivate ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1893 of file taskswnd.cpp.

1894  {
1895  return MA_NOACTIVATE;
1896  }
#define MA_NOACTIVATE
Definition: winuser.h:2479

◆ OnNcHitTest()

LRESULT CTaskSwitchWnd::OnNcHitTest ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1791 of file taskswnd.cpp.

1792  {
1793  LRESULT Ret = TRUE;
1794  /* We want the tray window to be draggable everywhere, so make the control
1795  appear transparent */
1796  Ret = DefWindowProc(uMsg, wParam, lParam);
1797  if (Ret != HTVSCROLL && Ret != HTHSCROLL)
1798  Ret = HTTRANSPARENT;
1799  return Ret;
1800  }
#define HTHSCROLL
Definition: winuser.h:2457
#define HTTRANSPARENT
Definition: winuser.h:2449
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1546
#define HTVSCROLL
Definition: winuser.h:2458
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

◆ OnNotify()

LRESULT CTaskSwitchWnd::OnNotify ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1812 of file taskswnd.cpp.

1813  {
1814  LRESULT Ret = TRUE;
1815  const NMHDR *nmh = (const NMHDR *) lParam;
1816 
1817  if (nmh->hwndFrom == m_TaskBar.m_hWnd)
1818  {
1819  Ret = HandleToolbarNotification(nmh);
1820  }
1821  return Ret;
1822  }
#define TRUE
Definition: types.h:120
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
LRESULT HandleToolbarNotification(IN const NMHDR *nmh)
Definition: taskswnd.cpp:1727
HWND hwndFrom
Definition: winuser.h:3133
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

◆ OnSetFont()

LRESULT CTaskSwitchWnd::OnSetFont ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1911 of file taskswnd.cpp.

1912  {
1913  return m_TaskBar.SendMessageW(uMsg, wParam, lParam);
1914  }
WPARAM wParam
Definition: combotst.c:138
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
LPARAM lParam
Definition: combotst.c:139

◆ OnSettingChanged()

LRESULT CTaskSwitchWnd::OnSettingChanged ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1916 of file taskswnd.cpp.

1917  {
1918  if (wParam == SPI_SETNONCLIENTMETRICS)
1919  {
1920  /* Don't update the font, this will be done when we get a WM_SETFONT from our parent */
1922  }
1923 
1924  return 0;
1925  }
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
VOID UpdateButtonsSize(IN BOOL bRedrawDisabled)
Definition: taskswnd.cpp:1245

◆ OnShellHook()

LRESULT CTaskSwitchWnd::OnShellHook ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1491 of file taskswnd.cpp.

1492  {
1493  BOOL Ret = FALSE;
1494 
1495  /* In case the shell hook wasn't registered properly, ignore WM_NULLs*/
1496  if (uMsg == 0)
1497  {
1498  bHandled = FALSE;
1499  return 0;
1500  }
1501 
1502  TRACE("Received shell hook message: wParam=%08lx, lParam=%08lx\n", wParam, lParam);
1503 
1504  switch ((INT) wParam)
1505  {
1506  case HSHELL_APPCOMMAND:
1507  Ret = HandleAppCommand(wParam, lParam);
1508  break;
1509 
1510  case HSHELL_WINDOWCREATED:
1511  AddTask((HWND) lParam);
1512  break;
1513 
1515  /* The window still exists! Delay destroying it a bit */
1516  DeleteTask((HWND) lParam);
1517  break;
1518 
1520  case HSHELL_WINDOWACTIVATED:
1522  break;
1523 
1524  case HSHELL_FLASH:
1525  FlashTask((HWND) lParam);
1526  break;
1527 
1528  case HSHELL_REDRAW:
1529  RedrawTask((HWND) lParam);
1530  break;
1531 
1532  case HSHELL_TASKMAN:
1533  ::PostMessage(m_Tray->GetHWND(), TWM_OPENSTARTMENU, 0, 0);
1534  break;
1535 
1537  ::SwitchToThisWindow(m_Tray->GetHWND(), TRUE);
1538  ::SetForegroundWindow(m_Tray->GetHWND());
1539  break;
1540 
1541  case HSHELL_LANGUAGE:
1542  case HSHELL_SYSMENU:
1543  case HSHELL_ENDTASK:
1544  case HSHELL_ACCESSIBILITYSTATE:
1545  case HSHELL_WINDOWREPLACED:
1546  case HSHELL_WINDOWREPLACING:
1547 
1548  case HSHELL_GETMINRECT:
1549  default:
1550  {
1551 #if DEBUG_SHELL_HOOK
1552  int i, found;
1553  for (i = 0, found = 0; i != _countof(hshell_msg); i++)
1554  {
1555  if (hshell_msg[i].msg == (INT) wParam)
1556  {
1557  TRACE("Shell message %ws unhandled (lParam = 0x%p)!\n", hshell_msg[i].msg_name, lParam);
1558  found = 1;
1559  break;
1560  }
1561  }
1562  if (found)
1563  break;
1564 #endif
1565  TRACE("Shell message %d unhandled (lParam = 0x%p)!\n", (INT) wParam, lParam);
1566  break;
1567  }
1568  }
1569 
1570  return Ret;
1571  }
#define TRUE
Definition: types.h:120
#define HSHELL_FLASH
Definition: winuser.h:1263
#define HSHELL_WINDOWCREATED
Definition: winuser.h:1241
BOOL HandleAppCommand(IN WPARAM wParam, IN LPARAM lParam)
Definition: taskswnd.cpp:1470
BOOL FlashTask(IN HWND hWnd)
Definition: taskswnd.cpp:1191
int32_t INT
Definition: typedefs.h:58
WPARAM wParam
Definition: combotst.c:138
BOOL ActivateTask(IN HWND hWnd)
Definition: taskswnd.cpp:1130
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL RedrawTask(IN HWND hWnd)
Definition: taskswnd.cpp:1231
#define TWM_OPENSTARTMENU
Definition: precomp.h:131
BOOL DeleteTask(IN HWND hWnd)
Definition: taskswnd.cpp:1154
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
BOOL AddTask(IN HWND hWnd)
Definition: taskswnd.cpp:1089
#define HSHELL_WINDOWDESTROYED
Definition: winuser.h:1242
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
BOOL PostMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:979
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:303
#define HSHELL_RUDEAPPACTIVATED
Definition: winuser.h:1264
#define msg(x)
Definition: auth_time.c:54
#define HSHELL_ACTIVATESHELLWINDOW
Definition: winuser.h:1243
BOOL WINAPI SetForegroundWindow(_In_ HWND)
LPARAM lParam
Definition: combotst.c:139
VOID WINAPI SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
Definition: window.c:82

◆ OnSize()

LRESULT CTaskSwitchWnd::OnSize ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1776 of file taskswnd.cpp.

1777  {
1778  SIZE szClient;
1779 
1780  szClient.cx = LOWORD(lParam);
1781  szClient.cy = HIWORD(lParam);
1782  if (m_TaskBar.m_hWnd != NULL)
1783  {
1784  m_TaskBar.SetWindowPos(NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER);
1785 
1787  }
1788  return TRUE;
1789  }
#define TRUE
Definition: types.h:120
#define SWP_NOZORDER
Definition: winuser.h:1233
#define FALSE
Definition: types.h:117
LONG cx
Definition: windef.h:334
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
#define NULL
Definition: types.h:112
#define HIWORD(l)
Definition: typedefs.h:247
LONG cy
Definition: windef.h:335
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
VOID UpdateButtonsSize(IN BOOL bRedrawDisabled)
Definition: taskswnd.cpp:1245

◆ OnTaskbarSettingsChanged()

LRESULT CTaskSwitchWnd::OnTaskbarSettingsChanged ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1831 of file taskswnd.cpp.

1832  {
1833  TaskbarSettings* newSettings = (TaskbarSettings*)lParam;
1834  if (newSettings->bGroupButtons != g_TaskbarSettings.bGroupButtons)
1835  {
1838 
1839  /* Collapse or expand groups if necessary */
1842  }
1843 
1844  return 0;
1845  }
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
#define FALSE
Definition: types.h:117
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
BOOL RefreshWindowList()
Definition: taskswnd.cpp:1405
BOOL bGroupButtons
Definition: precomp.h:206
LPARAM lParam
Definition: combotst.c:139
VOID UpdateButtonsSize(IN BOOL bRedrawDisabled)
Definition: taskswnd.cpp:1245

◆ OnThemeChanged()

LRESULT CTaskSwitchWnd::OnThemeChanged ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1412 of file taskswnd.cpp.

1413  {
1414  TRACE("OmThemeChanged\n");
1415 
1416  if (m_Theme)
1418 
1419  if (IsThemeActive())
1420  m_Theme = OpenThemeData(m_hWnd, L"TaskBand");
1421  else
1422  m_Theme = NULL;
1423 
1424  return TRUE;
1425  }
#define TRUE
Definition: types.h:120
HTHEME m_Theme
Definition: taskswnd.cpp:314
#define TRACE(s)
Definition: solgame.cpp:4
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
static const WCHAR L[]
Definition: oid.c:1250
HWND m_hWnd
Definition: atlwin.h:268
#define NULL
Definition: types.h:112
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950

◆ OnTimer()

LRESULT CTaskSwitchWnd::OnTimer ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1898 of file taskswnd.cpp.

1899  {
1900 #if DUMP_TASKS != 0
1901  switch (wParam)
1902  {
1903  case 1:
1904  DumpTasks();
1905  break;
1906  }
1907 #endif
1908  return TRUE;
1909  }
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138

◆ OnUpdateTaskbarPos()

LRESULT CTaskSwitchWnd::OnUpdateTaskbarPos ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
inline

Definition at line 1824 of file taskswnd.cpp.

1825  {
1826  /* Update the button spacing */
1827  m_TaskBar.UpdateTbButtonSpacing(m_Tray->IsHorizontal(), m_Theme != NULL);
1828  return TRUE;
1829  }
#define TRUE
Definition: types.h:120
HTHEME m_Theme
Definition: taskswnd.cpp:314
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
#define NULL
Definition: types.h:112
INT UpdateTbButtonSpacing(IN BOOL bHorizontal, IN BOOL bThemed, IN UINT uiRows=0, IN UINT uiBtnsPerLine=0)
Definition: taskswnd.cpp:203
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:303

◆ RedrawTask()

BOOL CTaskSwitchWnd::RedrawTask ( IN HWND  hWnd)
inline

Definition at line 1231 of file taskswnd.cpp.

1232  {
1233  PTASK_ITEM TaskItem;
1234 
1235  TaskItem = FindTaskItem(hWnd);
1236  if (TaskItem != NULL)
1237  {
1238  RedrawTaskItem(TaskItem);
1239  return TRUE;
1240  }
1241 
1242  return FALSE;
1243  }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
VOID RedrawTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:1206
PTASK_ITEM FindTaskItem(IN HWND hWnd)
Definition: taskswnd.cpp:855
#define FALSE
Definition: types.h:117
#define NULL
Definition: types.h:112

Referenced by OnShellHook().

◆ RedrawTaskItem()

VOID CTaskSwitchWnd::RedrawTaskItem ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 1206 of file taskswnd.cpp.

1207  {
1208  PTASK_GROUP TaskGroup;
1209 
1210  TaskGroup = TaskItem->Group;
1211  if (m_IsGroupingEnabled && TaskGroup != NULL)
1212  {
1213  if (TaskGroup->IsCollapsed && TaskGroup->Index >= 0)
1214  {
1215  UpdateTaskGroupButton(TaskGroup);
1216  }
1217  else if (TaskItem->Index >= 0)
1218  {
1219  goto UpdateTaskItem;
1220  }
1221  }
1222  else if (TaskItem->Index >= 0)
1223  {
1224  UpdateTaskItem:
1225  TaskItem->RenderFlashed = 0;
1226  UpdateTaskItemButton(TaskItem);
1227  }
1228  }
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
INT UpdateTaskItemButton(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:514
DWORD IsCollapsed
Definition: taskswnd.cpp:74
INT UpdateTaskGroupButton(IN PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:471
#define NULL
Definition: types.h:112

Referenced by RedrawTask().

◆ RefreshWindowList()

BOOL CTaskSwitchWnd::RefreshWindowList ( )
inline

Definition at line 1405 of file taskswnd.cpp.

1406  {
1407  TRACE("Refreshing window list...\n");
1408  /* Add all windows to the toolbar */
1409  return EnumWindows(s_EnumWindowsProc, (LPARAM)this);
1410  }
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC, _In_ LPARAM)
static BOOL CALLBACK s_EnumWindowsProc(IN HWND hWnd, IN LPARAM lParam)
Definition: taskswnd.cpp:1398

Referenced by ActivateTask(), OnCreate(), and OnTaskbarSettingsChanged().

◆ RemoveIcon()

VOID CTaskSwitchWnd::RemoveIcon ( IN PTASK_ITEM  TaskItem)
inline

Definition at line 560 of file taskswnd.cpp.

561  {
562  TBBUTTONINFO tbbi;
563  PTASK_ITEM currentTaskItem, LastItem;
564 
565  if (TaskItem->IconIndex == -1)
566  return;
567 
568  tbbi.cbSize = sizeof(tbbi);
569  tbbi.dwMask = TBIF_IMAGE;
570 
571  currentTaskItem = m_TaskItems;
572  LastItem = currentTaskItem + m_TaskItemCount;
573  while (currentTaskItem != LastItem)
574  {
575  if (currentTaskItem->IconIndex > TaskItem->IconIndex)
576  {
577  currentTaskItem->IconIndex--;
578  tbbi.iImage = currentTaskItem->IconIndex;
579 
580  m_TaskBar.SetButtonInfo(currentTaskItem->Index, &tbbi);
581  }
582  currentTaskItem++;
583  }
584 
585  ImageList_Remove(m_ImageList, TaskItem->IconIndex);
586  }
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
#define TBIF_IMAGE
Definition: commctrl.h:1219
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
INT IconIndex
Definition: taskswnd.cpp:84
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
BOOL WINAPI ImageList_Remove(HIMAGELIST himl, INT i)
Definition: imagelist.c:2568
HIMAGELIST m_ImageList
Definition: taskswnd.cpp:318
DWORD SetButtonInfo(int cmdId, TBBUTTONINFO *info)
Definition: rosctrls.h:357
#define TBBUTTONINFO
Definition: commctrl.h:1254

Referenced by DeleteTaskItemButton().

◆ RemoveTaskFromTaskGroup()

VOID CTaskSwitchWnd::RemoveTaskFromTaskGroup ( IN OUT PTASK_ITEM  TaskItem)
inline

Definition at line 809 of file taskswnd.cpp.

810  {
811  PTASK_GROUP TaskGroup, CurrentGroup, *PrevLink;
812 
813  TaskGroup = TaskItem->Group;
814  if (TaskGroup != NULL)
815  {
816  DWORD dwNewTaskCount = --TaskGroup->dwTaskCount;
817  if (dwNewTaskCount == 0)
818  {
819  /* Find the previous pointer in the chain */
820  CurrentGroup = m_TaskGroups;
821  PrevLink = &m_TaskGroups;
822  while (CurrentGroup != TaskGroup)
823  {
824  PrevLink = &CurrentGroup->Next;
825  CurrentGroup = CurrentGroup->Next;
826  }
827 
828  /* Remove the group from the list */
829  ASSERT(TaskGroup == CurrentGroup);
830  *PrevLink = TaskGroup->Next;
831 
832  /* Free the task group */
834  0,
835  TaskGroup);
836  }
837  else if (TaskGroup->IsCollapsed &&
838  TaskGroup->Index >= 0)
839  {
840  if (dwNewTaskCount > 1)
841  {
842  /* FIXME: Check if we should expand the group */
843  /* Update the task group button */
844  UpdateTaskGroupButton(TaskGroup);
845  }
846  else
847  {
848  /* Expand the group of one task button to a task button */
849  ExpandTaskGroup(TaskGroup);
850  }
851  }
852  }
853  }
struct _TASK_GROUP * Next
Definition: taskswnd.cpp:63
DWORD dwTaskCount
Definition: taskswnd.cpp:65
#define ASSERT(a)
Definition: mode.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
PTASK_GROUP m_TaskGroups
Definition: taskswnd.cpp:310
DWORD IsCollapsed
Definition: taskswnd.cpp:74
INT UpdateTaskGroupButton(IN PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:471
#define NULL
Definition: types.h:112
VOID ExpandTaskGroup(IN PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:480
#define HeapFree(x, y, z)
Definition: compat.h:594
HANDLE hProcessHeap
Definition: kbswitch.c:25

Referenced by DeleteTaskItem().

◆ s_EnumWindowsProc()

static BOOL CALLBACK CTaskSwitchWnd::s_EnumWindowsProc ( IN HWND  hWnd,
IN LPARAM  lParam 
)
inlinestatic

Definition at line 1398 of file taskswnd.cpp.

1399  {
1401 
1402  return This->EnumWindowsProc(hWnd);
1403  }
HWND hWnd
Definition: settings.c:17
LPARAM lParam
Definition: combotst.c:139

Referenced by RefreshWindowList().

◆ UpdateButtonsSize()

VOID CTaskSwitchWnd::UpdateButtonsSize ( IN BOOL  bRedrawDisabled)
inline

Definition at line 1245 of file taskswnd.cpp.

1246  {
1247  RECT rcClient;
1248  UINT uiRows, uiMax, uiMin, uiBtnsPerLine, ui;
1249  LONG NewBtnSize;
1250  BOOL Horizontal;
1251 
1252  /* Update the size of the image list if needed */
1253  int cx, cy;
1256  {
1258 
1259  /* SetIconSize removes all icons so we have to reinsert them */
1260  PTASK_ITEM TaskItem = m_TaskItems;
1261  PTASK_ITEM LastTaskItem = m_TaskItems + m_TaskItemCount;
1262  while (TaskItem != LastTaskItem)
1263  {
1264  TaskItem->IconIndex = -1;
1265  UpdateTaskItemButton(TaskItem);
1266 
1267  TaskItem++;
1268  }
1270  }
1271 
1272  if (GetClientRect(&rcClient) && !IsRectEmpty(&rcClient))
1273  {
1274  if (m_ButtonCount > 0)
1275  {
1276  Horizontal = m_Tray->IsHorizontal();
1277 
1278  if (Horizontal)
1279  {
1280  TBMETRICS tbm = { 0 };
1281  tbm.cbSize = sizeof(tbm);
1282  tbm.dwMask = TBMF_BUTTONSPACING;
1283  m_TaskBar.GetMetrics(&tbm);
1284 
1285  if (m_ButtonSize.cy + tbm.cyButtonSpacing != 0)
1286  uiRows = (rcClient.bottom + tbm.cyButtonSpacing) / (m_ButtonSize.cy + tbm.cyButtonSpacing);
1287  else
1288  uiRows = 1;
1289 
1290  if (uiRows == 0)
1291  uiRows = 1;
1292 
1293  uiBtnsPerLine = (m_ButtonCount + uiRows - 1) / uiRows;
1294  }
1295  else
1296  {
1297  uiBtnsPerLine = 1;
1298  uiRows = m_ButtonCount;
1299  }
1300 
1301  if (!bRedrawDisabled)
1303 
1304  /* We might need to update the button spacing */
1305  int cxButtonSpacing = m_TaskBar.UpdateTbButtonSpacing(
1306  Horizontal, m_Theme != NULL,
1307  uiRows, uiBtnsPerLine);
1308 
1309  /* Determine the minimum and maximum width of a button */
1311  if (Horizontal)
1312  {
1314 
1315  /* Calculate the ideal width and make sure it's within the allowed range */
1316  NewBtnSize = (rcClient.right - (uiBtnsPerLine * cxButtonSpacing)) / uiBtnsPerLine;
1317 
1318  if (NewBtnSize < (LONG) uiMin)
1319  NewBtnSize = uiMin;
1320  if (NewBtnSize >(LONG)uiMax)
1321  NewBtnSize = uiMax;
1322 
1323  /* Recalculate how many buttons actually fit into one line */
1324  uiBtnsPerLine = rcClient.right / (NewBtnSize + cxButtonSpacing);
1325  if (uiBtnsPerLine == 0)
1326  uiBtnsPerLine++;
1327  }
1328  else
1329  {
1330  NewBtnSize = uiMax = rcClient.right;
1331  }
1332 
1333  m_ButtonSize.cx = NewBtnSize;
1334 
1335  m_ButtonsPerLine = uiBtnsPerLine;
1336 
1337  for (ui = 0; ui != m_ButtonCount; ui++)
1338  {
1339  TBBUTTONINFOW tbbi = { 0 };
1340  tbbi.cbSize = sizeof(tbbi);
1342  tbbi.cx = (INT) NewBtnSize;
1343  tbbi.fsState = TBSTATE_ENABLED;
1344 
1345  /* Check if we're updating a button that is the last one in the
1346  line. If so, we need to set the TBSTATE_WRAP flag! */
1347  if (Horizontal)
1348  {
1349  if ((ui + 1) % uiBtnsPerLine == 0)
1350  tbbi.fsState |= TBSTATE_WRAP;
1351  }
1352  else
1353  {
1354  tbbi.fsState |= TBSTATE_WRAP;
1355  }
1356 
1357  if (m_ActiveTaskItem != NULL &&
1359  {
1360  tbbi.fsState |= TBSTATE_CHECKED;
1361  }
1362 
1363  m_TaskBar.SetButtonInfo(ui, &tbbi);
1364  }
1365  }
1366  else
1367  {
1368  m_ButtonsPerLine = 0;
1369  m_ButtonSize.cx = 0;
1370  }
1371  }
1372 
1373  // FIXME: This seems to be enabling redraws prematurely, but moving it to its right place doesn't work!
1374  m_TaskBar.EndUpdate();
1375  }
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
#define SM_CXMINIMIZED
Definition: winuser.h:1010
#define TBIF_BYINDEX
Definition: commctrl.h:1226
PTASK_ITEM m_ActiveTaskItem
Definition: taskswnd.cpp:312
UINT ui
Definition: oleauto.h:49
#define INT
Definition: polytest.cpp:20
DWORD dwMask
Definition: commctrl.h:1243
#define SM_CXEDGE
Definition: winuser.h:998
#define SM_CYSMICON
Definition: winuser.h:1003
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
INT UpdateTaskItemButton(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:514
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
WORD m_ButtonCount
Definition: taskswnd.cpp:316
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
UINT m_ButtonsPerLine
Definition: taskswnd.cpp:315
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
#define TBMF_BUTTONSPACING
Definition: commctrl.h:1289
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
DWORD GetMetrics(TBMETRICS *tbm)
Definition: rosctrls.h:393
LONG cx
Definition: windef.h:334
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:424
HTHEME m_Theme
Definition: taskswnd.cpp:314
INT IconIndex
Definition: taskswnd.cpp:84
#define TBIF_STATE
Definition: commctrl.h:1221
int cyButtonSpacing
Definition: commctrl.h:1299
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
VOID BeginUpdate()
Definition: taskswnd.cpp:235
UINT cbSize
Definition: commctrl.h:1292
HIMAGELIST m_ImageList
Definition: taskswnd.cpp:318
#define TBSTATE_CHECKED
Definition: commctrl.h:972
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
INT UpdateTbButtonSpacing(IN BOOL bHorizontal, IN BOOL bThemed, IN UINT uiRows=0, IN UINT uiBtnsPerLine=0)
Definition: taskswnd.cpp:203
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:303
_Out_opt_ int * cx
Definition: commctrl.h:585
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define SM_CXSIZE
Definition: winuser.h:981
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
DWORD dwMask
Definition: commctrl.h:1293
#define TBSTATE_WRAP
Definition: commctrl.h:977
DWORD SetButtonInfo(int cmdId, TBBUTTONINFO *info)
Definition: rosctrls.h:357
LONG bottom
Definition: windef.h:309
#define TBIF_SIZE
Definition: commctrl.h:1225
VOID EndUpdate()
Definition: taskswnd.cpp:240
BOOL WINAPI ImageList_SetIconSize(HIMAGELIST himl, INT cx, INT cy)
Definition: imagelist.c:3038
LONG cy
Definition: windef.h:335

Referenced by AddTaskItemButton(), DeleteTaskItemButton(), OnCreate(), OnSettingChanged(), OnSize(), and OnTaskbarSettingsChanged().

◆ UpdateIndexesAfter()

VOID CTaskSwitchWnd::UpdateIndexesAfter ( IN INT  iIndex,
BOOL  bInserted 
)
inline

Definition at line 408 of file taskswnd.cpp.

409  {
410  PTASK_GROUP CurrentGroup;
411  PTASK_ITEM CurrentTaskItem, LastTaskItem;
412  INT NewIndex;
413 
414  int offset = bInserted ? +1 : -1;
415 
417  {
418  /* Update all affected groups */
419  CurrentGroup = m_TaskGroups;
420  while (CurrentGroup != NULL)
421  {
422  if (CurrentGroup->IsCollapsed &&
423  CurrentGroup->Index >= iIndex)
424  {
425  /* Update the toolbar buttons */
426  NewIndex = CurrentGroup->Index + offset;
427  if (m_TaskBar.SetButtonCommandId(CurrentGroup->Index + offset, NewIndex))
428  {
429  CurrentGroup->Index = NewIndex;
430  }
431  else
432  CurrentGroup->Index = -1;
433  }
434 
435  CurrentGroup = CurrentGroup->Next;
436  }
437  }
438 
439  /* Update all affected task items */
440  CurrentTaskItem = m_TaskItems;
441  LastTaskItem = CurrentTaskItem + m_TaskItemCount;
442  while (CurrentTaskItem != LastTaskItem)
443  {
444  CurrentGroup = CurrentTaskItem->Group;
445  if (CurrentGroup != NULL)
446  {
447  if (!CurrentGroup->IsCollapsed &&
448  CurrentTaskItem->Index >= iIndex)
449  {
450  goto UpdateTaskItemBtn;
451  }
452  }
453  else if (CurrentTaskItem->Index >= iIndex)
454  {
455  UpdateTaskItemBtn:
456  /* Update the toolbar buttons */
457  NewIndex = CurrentTaskItem->Index + offset;
458  if (m_TaskBar.SetButtonCommandId(CurrentTaskItem->Index + offset, NewIndex))
459  {
460  CurrentTaskItem->Index = NewIndex;
461  }
462  else
463  CurrentTaskItem->Index = -1;
464  }
465 
466  CurrentTaskItem++;
467  }
468  }
WORD m_TaskItemCount
Definition: taskswnd.cpp:307
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:320
int32_t INT
Definition: typedefs.h:58
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:311
struct _TASK_GROUP * Next
Definition: taskswnd.cpp:63
PTASK_GROUP Group
Definition: taskswnd.cpp:82
GLintptr offset
Definition: glext.h:5920
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
BOOL SetButtonCommandId(IN INT iButtonIndex, IN INT iCommandId)
Definition: taskswnd.cpp:246
PTASK_GROUP m_TaskGroups
Definition: taskswnd.cpp:310
DWORD IsCollapsed
Definition: taskswnd.cpp:74
#define NULL
Definition: types.h:112

Referenced by AddTaskItemButton(), and DeleteTaskItemButton().

◆ UpdateTaskGroupButton()

INT CTaskSwitchWnd::UpdateTaskGroupButton ( IN PTASK_GROUP  TaskGroup)
inline

Definition at line 471 of file taskswnd.cpp.

472  {
473  ASSERT(TaskGroup->Index >= 0);
474 
475  /* FIXME: Implement */
476 
477  return TaskGroup->Index;
478  }
#define ASSERT(a)
Definition: mode.c:44

Referenced by AddTaskItemButton(), RedrawTaskItem(), and RemoveTaskFromTaskGroup().

◆ UpdateTaskItemButton()

INT CTaskSwitchWnd::UpdateTaskItemButton ( IN PTASK_ITEM  TaskItem)
inline

Definition at line 514 of file taskswnd.cpp.

515  {
516  TBBUTTONINFO tbbi = { 0 };
517  HICON icon;
518  WCHAR windowText[255];
519 
520  ASSERT(TaskItem->Index >= 0);
521 
522  tbbi.cbSize = sizeof(tbbi);
523  tbbi.dwMask = TBIF_BYINDEX | TBIF_STATE | TBIF_TEXT | TBIF_IMAGE;
524  tbbi.fsState = TBSTATE_ENABLED;
525  if (m_ActiveTaskItem == TaskItem)
526  tbbi.fsState |= TBSTATE_CHECKED;
527 
528  if (TaskItem->RenderFlashed)
529  tbbi.fsState |= TBSTATE_MARKED;
530 
531  /* Check if we're updating a button that is the last one in the
532  line. If so, we need to set the TBSTATE_WRAP flag! */
533  if (!m_Tray->IsHorizontal() || (m_ButtonsPerLine != 0 &&
534  (TaskItem->Index + 1) % m_ButtonsPerLine == 0))
535  {
536  tbbi.fsState |= TBSTATE_WRAP;
537  }
538 
540  {
541  tbbi.pszText = windowText;
542  }
543 
544  icon = GetWndIcon(TaskItem->hWnd);
545  if (!icon)
546  icon = static_cast<HICON>(LoadImageW(NULL, MAKEINTRESOURCEW(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
547  TaskItem->IconIndex = ImageList_ReplaceIcon(m_ImageList, TaskItem->IconIndex, icon);
548  tbbi.iImage = TaskItem->IconIndex;
549 
550  if (!m_TaskBar.SetButtonInfo(TaskItem->Index, &tbbi))
551  {
552  TaskItem->Index = -1;
553  return -1;
554  }
555 
556  TRACE("Updated button %d for hwnd 0x%p\n", TaskItem->Index, TaskItem->hWnd);
557  return TaskItem->Index;
558  }
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2779
static HICON
Definition: imagelist.c:84
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
#define TBIF_BYINDEX
Definition: commctrl.h:1226
PTASK_ITEM m_ActiveTaskItem
Definition: taskswnd.cpp:312
#define TBIF_IMAGE
Definition: commctrl.h:1219
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
UINT m_ButtonsPerLine
Definition: taskswnd.cpp:315
#define TBIF_STATE
Definition: commctrl.h:1221
#define TRACE(s)
Definition: solgame.cpp:4
#define ASSERT(a)
Definition: mode.c:44
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:301
HICON GetWndIcon(HWND hwnd)
Definition: taskswnd.cpp:489
#define TBSTATE_MARKED
Definition: commctrl.h:979
HIMAGELIST m_ImageList
Definition: taskswnd.cpp:318
#define TBSTATE_CHECKED
Definition: commctrl.h:972
#define TBIF_TEXT
Definition: commctrl.h:1220
#define NULL
Definition: types.h:112
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:303
WCHAR windowText[1024]
Definition: appswitch.c:49
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define TBSTATE_WRAP
Definition: commctrl.h:977
DWORD SetButtonInfo(int cmdId, TBBUTTONINFO *info)
Definition: rosctrls.h:357
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define OIC_SAMPLE
Definition: winuser.h:1148
INT GetWndTextFromTaskItem(IN PTASK_ITEM TaskItem, LPWSTR szBuf, DWORD cchBuf)
Definition: taskswnd.cpp:348
#define TBBUTTONINFO
Definition: commctrl.h:1254

Referenced by AddTaskItemButton(), CheckActivateTaskItem(), FlashTaskItem(), RedrawTaskItem(), and UpdateButtonsSize().

Member Data Documentation

◆ m_ActiveTaskItem

PTASK_ITEM CTaskSwitchWnd::m_ActiveTaskItem
private

◆ m_AllocatedTaskItems

WORD CTaskSwitchWnd::m_AllocatedTaskItems
private

Definition at line 308 of file taskswnd.cpp.

Referenced by AllocTaskItem().

◆ m_ButtonCount

WORD CTaskSwitchWnd::m_ButtonCount
private

◆ m_ButtonSize

SIZE CTaskSwitchWnd::m_ButtonSize
private

Definition at line 323 of file taskswnd.cpp.

Referenced by CTaskSwitchWnd(), and UpdateButtonsSize().

◆ m_ButtonsPerLine

UINT CTaskSwitchWnd::m_ButtonsPerLine
private

Definition at line 315 of file taskswnd.cpp.

Referenced by UpdateButtonsSize(), and UpdateTaskItemButton().

◆ m_HardErrorThread

CHardErrorThread CTaskSwitchWnd::m_HardErrorThread
private

Definition at line 326 of file taskswnd.cpp.

Referenced by OnCopyData().

◆ m_ImageList

HIMAGELIST CTaskSwitchWnd::m_ImageList
private

◆ m_IsDestroying

BOOL CTaskSwitchWnd::m_IsDestroying
private

Definition at line 321 of file taskswnd.cpp.

Referenced by AddTask(), DeleteTaskItem(), and OnDestroy().

◆ m_IsGroupingEnabled

◆ m_ShellHookMsg

UINT CTaskSwitchWnd::m_ShellHookMsg
private

Definition at line 305 of file taskswnd.cpp.

Referenced by OnCreate().

◆ m_TaskBar

◆ m_TaskGroups

PTASK_GROUP CTaskSwitchWnd::m_TaskGroups
private

◆ m_TaskItemCount

◆ m_TaskItems

◆ m_Theme

HTHEME CTaskSwitchWnd::m_Theme
private

◆ m_Tray

CComPtr<ITrayWindow> CTaskSwitchWnd::m_Tray
private

◆ m_uHardErrorMsg

UINT CTaskSwitchWnd::m_uHardErrorMsg
private

Definition at line 325 of file taskswnd.cpp.

Referenced by CTaskSwitchWnd(), and OnCopyData().


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