ReactOS 0.4.15-dev-7998-gdb93cb1
DesktopBar Struct Reference

desktop bar window, also known as "system tray" More...

#include <desktopbar.h>

Inheritance diagram for DesktopBar:
Collaboration diagram for DesktopBar:

Public Types

typedef OwnerDrawParent< Windowsuper
 
- Public Types inherited from OwnerDrawParent< Window >
typedef Window super
 
- Public Types inherited from Window
typedef map< HWND, Window * > WindowMap
 
typedef Window *(* CREATORFUNC) (HWND)
 
typedef Window *(* CREATORFUNC_INFO) (HWND, const void *)
 

Public Member Functions

 DesktopBar (HWND hwnd)
 
 ~DesktopBar ()
 
- Public Member Functions inherited from OwnerDrawParent< Window >
 OwnerDrawParent (HWND hwnd)
 
LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
- Public Member Functions inherited from Window
 Window (HWND hwnd)
 
virtual ~Window ()
 
LRESULT SendParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 
LRESULT PostParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 
 Window (INT cx, INT cy, BOOL fAutoHide=FALSE)
 
virtual ~Window ()
 
virtual LRESULT CALLBACK WindowProcDx (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void DoAction ()
 

Static Public Member Functions

static HWND Create ()
 
- Static Public Member Functions inherited from Window
static HWND Create (CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
 
static HWND Create (CREATORFUNC_INFO creator, const void *info, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
 
static Windowcreate_mdi_child (const ChildWndInfo &info, const MDICREATESTRUCT &mcs, CREATORFUNC_INFO creator)
 
static LRESULT CALLBACK WindowWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK DialogProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static Windowget_window (HWND hwnd)
 get window controller from window handle
 
template<typename CLASS >
static CLASS * get_window (HWND hwnd)
 
static void register_pretranslate (HWND hwnd)
 
static void unregister_pretranslate (HWND hwnd)
 
static BOOL pretranslate_msg (LPMSG pmsg)
 
static void register_dialog (HWND hwnd)
 
static void unregister_dialog (HWND hwnd)
 
static BOOL dispatch_dialog_msg (LPMSG pmsg)
 
static int MessageLoop ()
 
static void CancelModes ()
 
static BOOL DoRegisterClass (HINSTANCE hInstance)
 
static HWND DoCreateMainWnd (HINSTANCE hInstance, LPCTSTR pszText, INT cx, INT cy, DWORD style=WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN, DWORD exstyle=WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_TOPMOST, BOOL fAutoHide=FALSE)
 
static INT DoMainLoop ()
 
static WindowGetAppbarData (HWND hwnd)
 
static LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static DWORD WINAPI ActionThreadFunc (LPVOID args)
 

Protected Member Functions

LRESULT Init (LPCREATESTRUCT pcs)
 
LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
int Notify (int id, NMHDR *pnmh)
 
int Command (int id, int code)
 
void Resize (int cx, int cy)
 
void ControlResize (WPARAM wparam, LPARAM lparam)
 
void RegisterHotkeys ()
 
void ProcessHotKey (int id_hotkey)
 
void ShowOrHideStartMenu ()
 
LRESULT ProcessCopyData (COPYDATASTRUCT *pcd)
 
- Protected Member Functions inherited from Window
virtual LRESULT Init (LPCREATESTRUCT pcs)
 
virtual LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
virtual int Command (int id, int code)
 
virtual int Notify (int id, NMHDR *pnmh)
 
void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
void OnPaint (HWND hwnd)
 
void OnRButtonDown (HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
 
void OnKey (HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags)
 
void OnAppBarCallback (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL AppBar_Register (HWND hwnd)
 
BOOL AppBar_UnRegister (HWND hwnd)
 
BOOL AppBar_SetAutoHide (HWND hwnd, BOOL fHide)
 
BOOL AppBar_AutoHide (HWND hwnd)
 
BOOL AppBar_NoAutoHide (HWND hwnd)
 
BOOL AppBar_SetSide (HWND hwnd, UINT uSide)
 
void AppBar_SetAlwaysOnTop (HWND hwnd, BOOL fOnTop)
 
void AppBar_Hide (HWND hwnd)
 
void AppBar_UnHide (HWND hwnd)
 
void AppBar_SetAutoHideTimer (HWND hwnd)
 
void AppBar_SetAutoUnhideTimer (HWND hwnd)
 
void AppBar_Size (HWND hwnd)
 
void AppBar_QueryPos (HWND hwnd, LPRECT lprc)
 
void AppBar_QuerySetPos (UINT uEdge, LPRECT lprc, PAPPBARDATA pabd, BOOL fMove)
 
void AppBar_PosChanged (PAPPBARDATA pabd)
 
BOOL OnCreate (HWND hwnd, LPCREATESTRUCT lpCreateStruct)
 
void OnActivate (HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized)
 
void OnWindowPosChanged (HWND hwnd, const LPWINDOWPOS lpwpos)
 
void OnSize (HWND hwnd, UINT state, int cx, int cy)
 
void OnMove (HWND hwnd, int x, int y)
 
void OnNCDestroy (HWND hwnd)
 
void OnTimer (HWND hwnd, UINT id)
 
UINT OnNCHitTest (HWND hwnd, int x, int y)
 
void OnLButtonDown (HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
 
void OnMouseMove (HWND hwnd, int x, int y, UINT keyFlags)
 
void OnLButtonUp (HWND hwnd, int x, int y, UINT keyFlags)
 
void GetWorkArea (LPRECT prc) const
 

Protected Attributes

RECT _work_area_org
 
int _taskbar_pos
 
WindowHandle _hwndTaskBar
 
WindowHandle _hwndNotify
 
WindowHandle _hwndQuickLaunch
 
WindowHandle _hwndrebar
 
WindowHandle _hwndStartButton
 
struct StartMenuRoot_startMenuRoot
 
const UINT WM_TASKBARCREATED
 
- Protected Attributes inherited from Window
HWND m_hwnd
 
BOOL m_fAutoHide
 
BOOL m_fOnTop
 
BOOL m_fHiding
 
UINT m_uSide
 
LONG m_cxWidth
 
LONG m_cyHeight
 
LONG m_cxSave
 
LONG m_cySave
 
BOOL m_fAppBarRegd
 
BOOL m_fMoving
 
BOOL m_bDragged
 
POINT m_ptDragOn
 
RECT m_rcAppBar
 
RECT m_rcDrag
 

Additional Inherited Members

- Public Attributes inherited from Window
IAccessible IAccessible_iface
 
IOleWindow IOleWindow_iface
 
IEnumVARIANT IEnumVARIANT_iface
 
LONG ref
 
- Static Protected Member Functions inherited from Window
static Windowcreate_controller (HWND hwnd)
 create controller for a new window
 
static StaticWindowDataGetStaticWindowData ()
 
static LRESULT CALLBACK MDICBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK PropSheetCBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 
- Static Protected Attributes inherited from Window
static WindowMap s_wnd_map
 
static const voids_new_info = NULL
 
static CREATORFUNC s_window_creator = NULL
 
static HHOOK s_hcbtHook = 0
 
static WindowSet s_pretranslate_windows
 
static WindowSet s_dialogs
 

Detailed Description

desktop bar window, also known as "system tray"

Definition at line 74 of file desktopbar.h.

Member Typedef Documentation

◆ super

Definition at line 86 of file desktopbar.h.

Constructor & Destructor Documentation

◆ DesktopBar()

DesktopBar::DesktopBar ( HWND  hwnd)

Definition at line 40 of file desktopbar.cpp.

41 : super(hwnd),
42#ifdef __REACTOS__
43 _trayIcon(hwnd, ID_TRAY_VOLUME)
44#else
46#endif
47{
49
50 SystemParametersInfo(SPI_GETWORKAREA, 0, &_work_area_org, 0);
51}
void SetWindowIcon(HWND hwnd, UINT nid)
set big and small icons out of the resources for a window
Definition: explorer.cpp:689
#define ID_TRAY_VOLUME
Definition: resource.h:215
#define WINMSG_TASKBARCREATED
Definition: window.h:986
#define IDI_REACTOS
Definition: osk_res.h:21
const UINT WM_TASKBARCREATED
Definition: desktopbar.h:126
OwnerDrawParent< Window > super
Definition: desktopbar.h:86
RECT _work_area_org
Definition: desktopbar.h:95
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define RegisterWindowMessage
Definition: winuser.h:5840
#define SystemParametersInfo
Definition: winuser.h:5858

◆ ~DesktopBar()

DesktopBar::~DesktopBar ( )

Definition at line 53 of file desktopbar.cpp.

54{
55 // restore work area to the previous size
56 SystemParametersInfo(SPI_SETWORKAREA, 0, &_work_area_org, 0);
57 PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETWORKAREA, 0);
58
59 // exit application after destroying desktop window
61}
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define HWND_BROADCAST
Definition: winuser.h:1204
#define WM_SETTINGCHANGE
Definition: winuser.h:1629
#define PostMessage
Definition: winuser.h:5832

Member Function Documentation

◆ Command()

int DesktopBar::Command ( int  id,
int  code 
)
protectedvirtual

Reimplemented from Window.

Definition at line 426 of file desktopbar.cpp.

427{
428 switch(id) {
429 case IDC_START:
431 break;
432
435 break;
436
439 break;
440
441 case ID_MINIMIZE_ALL:
443 break;
444
445 case ID_EXPLORE:
447 break;
448
449 case ID_TASKMGR:
450 launch_file(_hwnd, TEXT("taskmgr.exe"), SW_SHOWNORMAL);
451 break;
452
454 case ID_SWITCH_DESKTOP_1+1:
455 case ID_SWITCH_DESKTOP_1+2:
456 case ID_SWITCH_DESKTOP_1+3: {
457 int desktop_idx = id - ID_SWITCH_DESKTOP_1;
458
460
463 break;}
464
465#ifdef __REACTOS__
466 case ID_TRAY_VOLUME:
467 launch_file(_hwnd, TEXT("sndvol32.exe"), SW_SHOWNORMAL); // launch volume control application
468 break;
469
471 launch_cpanel(_hwnd, TEXT("mmsys.cpl"));
472 break;
473#endif
474
475 default:
478 else
479 return 1;
480 }
481
482 return 0;
483}
#define IDC_START
Definition: desktopbar.h:37
#define TEXT(s)
Definition: k32.h:26
void ExplorerPropertySheet(HWND hparent)
Definition: settings.cpp:37
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
Definition: explorer.cpp:707
void explorer_about(HWND hwndParent)
Definition: explorer.cpp:934
#define ID_ABOUT_EXPLORER
Definition: resource.h:204
#define ID_TASKMGR
Definition: resource.h:214
#define ID_DESKTOPBAR_SETTINGS
Definition: resource.h:205
#define ID_MINIMIZE_ALL
Definition: resource.h:212
#define ID_EXPLORE
Definition: resource.h:213
#define ID_SWITCH_DESKTOP_1
Definition: resource.h:225
#define ID_VOLUME_PROPERTIES
Definition: resource.h:216
BOOL launch_cpanel(HWND hwnd, LPCTSTR applet)
Definition: utility.cpp:383
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters)
Definition: utility.cpp:189
#define PM_UPDATE_DESKTOP
Definition: quicklaunch.h:34
WindowHandle _hwndQuickLaunch
Definition: desktopbar.h:112
void ShowOrHideStartMenu()
Definition: desktopbar.cpp:486
void SwitchToDesktop(int idx)
Definition: desktop.cpp:163
void ToggleMinimize()
minimize/restore all windows on the desktop
Definition: desktop.cpp:229
Desktops _desktops
Definition: globals.h:291
HWND _hwndDesktop
Definition: globals.h:289
Definition: inflate.c:139
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
#define WM_COMMAND
Definition: winuser.h:1740
#define SendMessage
Definition: winuser.h:5843

◆ ControlResize()

void DesktopBar::ControlResize ( WPARAM  wparam,
LPARAM  lparam 
)
protected
Todo:
write code for taskbar being at sides or top.
Todo:
Taskbar is at the top of the screen
Todo:
Taskbar is at the left of the screen
Todo:
Taskbar is at the right of the screen

Definition at line 528 of file desktopbar.cpp.

529{
530 PRECT dragRect = (PRECT) lparam;
531 //int screenWidth = GetSystemMetrics(SM_CXSCREEN);
532 int screenHeight = GetSystemMetrics(SM_CYSCREEN);
533
535
536 switch(wparam) {
537 case WMSZ_BOTTOM:
538 break;
539
540 case WMSZ_TOP: // Taskbar is at the bottom of the screen
541 dragRect->top = screenHeight - (((screenHeight - dragRect->top) + DESKTOPBARBAR_HEIGHT/2) / DESKTOPBARBAR_HEIGHT) * DESKTOPBARBAR_HEIGHT;
542 if (dragRect->top < screenHeight / 2)
543 dragRect->top = screenHeight - (screenHeight/2 / DESKTOPBARBAR_HEIGHT * DESKTOPBARBAR_HEIGHT);
544 else if (dragRect->top > screenHeight - 5)
545 dragRect->top = screenHeight - 5;
546 break;
547
548 case WMSZ_RIGHT:
549 break;
550
551 case WMSZ_LEFT:
552 break;
553 }
554}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define DESKTOPBARBAR_HEIGHT
Definition: desktopbar.h:33
LONG top
Definition: windef.h:307
#define PRECT
Definition: precomp.h:27
#define SM_CYSCREEN
Definition: winuser.h:960
#define WMSZ_TOP
Definition: winuser.h:2466
#define WMSZ_LEFT
Definition: winuser.h:2464
#define WMSZ_BOTTOM
Definition: winuser.h:2469
#define WMSZ_RIGHT
Definition: winuser.h:2465
int WINAPI GetSystemMetrics(_In_ int)

Referenced by WndProc().

◆ Create()

HWND DesktopBar::Create ( )
static

Definition at line 64 of file desktopbar.cpp.

65{
66 static BtnWindowClass wcDesktopBar(CLASSNAME_EXPLORERBAR);
67
68 RECT rect;
69
70 rect.left = -2; // hide left border
71#ifdef TASKBAR_AT_TOP
72 rect.top = -2; // hide top border
73#else
75#endif
77 rect.bottom = rect.top + DESKTOPBARBAR_HEIGHT + 2;
78
80 wcDesktopBar, TITLE_EXPLORERBAR,
82 rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, 0);
83}
#define TITLE_EXPLORERBAR
Definition: desktopbar.h:30
#define CLASSNAME_EXPLORERBAR
Definition: desktopbar.h:29
#define WINDOW_CREATOR(WND_CLASS)
Definition: window.h:202
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define WS_THICKFRAME
Definition: pedump.c:630
& rect
Definition: startmenu.cpp:1413
window class with gray background color
Definition: window.h:249
desktop bar window, also known as "system tray"
Definition: desktopbar.h:81
static HWND Create(CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
Definition: window.cpp:87
#define WS_EX_PALETTEWINDOW
Definition: winuser.h:399
#define SM_CXSCREEN
Definition: winuser.h:959

Referenced by DesktopWindow::Init().

◆ Init()

LRESULT DesktopBar::Init ( LPCREATESTRUCT  pcs)
protectedvirtual

Reimplemented from Window.

Definition at line 86 of file desktopbar.cpp.

87{
88 if (super::Init(pcs))
89 return 1;
90
91 // create start button
92 ResString start_str(IDS_START);
93 WindowCanvas canvas(_hwnd);
94 FontSelection font(canvas, GetStockFont(ANSI_VAR_FONT));
95 RECT rect = {0, 0};
96 DrawText(canvas, start_str, -1, &rect, DT_SINGLELINE|DT_CALCRECT);
97 int start_btn_width = rect.right+16+8;
98
99 _taskbar_pos = start_btn_width + 6;
100
101 // create "Start" button
102 HWND hwndStart = Button(_hwnd, start_str, 1, 1, start_btn_width, REBARBAND_HEIGHT, IDC_START, WS_VISIBLE|WS_CHILD|BS_OWNERDRAW);
104 new StartButton(hwndStart);
105
106 /* Save the handle to the window, needed for push-state handling */
107 _hwndStartButton = hwndStart;
108
109 // disable double clicks
111
112 // create task bar
114
115 if (!g_Globals._SHRestricted || !SHRestricted(REST_NOTRAYITEMSDISPLAY))
116 // create tray notification area
118
119
120 // notify all top level windows about the successfully created desktop bar
121 //@@ Use SendMessage() instead of PostMessage() to avoid problems with delayed created shell service objects?
123
124
126
127 // create rebar window to manage task and quick launch bar
128#ifndef _NO_REBAR
131 RBS_VARHEIGHT|RBS_AUTOSIZE|RBS_DBLCLKTOGGLE| //|RBS_REGISTERDROP
133 0, 0, 0, 0, _hwnd, 0, g_Globals._hInstance, 0);
134
135 REBARBANDINFO rbBand;
136
137 rbBand.cbSize = sizeof(REBARBANDINFO);
139 rbBand.cyChild = REBARBAND_HEIGHT;
140 rbBand.cyMaxChild = (ULONG)-1;
141 rbBand.cyMinChild = REBARBAND_HEIGHT;
142 rbBand.cyIntegral = REBARBAND_HEIGHT + 3; //@@ OK?
144
145 TCHAR QuickLaunchBand[] = _T("Quicklaunch");
146 rbBand.lpText = QuickLaunchBand;
147 rbBand.hwndChild = _hwndQuickLaunch;
148 rbBand.cx = 150;
149 rbBand.cxMinChild = 150;
150 rbBand.wID = IDW_QUICKLAUNCHBAR;
152
153 TCHAR TaskbarBand[] = _T("Taskbar");
154 rbBand.lpText = TaskbarBand;
155 rbBand.hwndChild = _hwndTaskBar;
156 rbBand.cx = 200; //pcs->cx-_taskbar_pos-quicklaunch_width-(notifyarea_width+1);
157 rbBand.cxMinChild = 50;
158 rbBand.wID = IDW_TASKTOOLBAR;
160#endif
161
162
164
165 // prepare Startmenu, but hide it for now
167 _startMenuRoot->_hwndStartButton = _hwndStartButton;
168
169 return 0;
170}
#define IDS_START
Definition: resource.h:23
#define REBARBAND_HEIGHT
Definition: desktopbar.h:34
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define RBBS_HIDETITLE
#define STARTMENUROOT_ICON_SIZE
Definition: globals.h:173
#define GET_WINDOW(CLASS, hwnd)
Definition: window.h:88
Definition: mk_font.cpp:20
#define WS_CHILD
Definition: pedump.c:617
#define BS_OWNERDRAW
Definition: pedump.c:661
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define RB_INSERTBAND
Definition: commctrl.h:1602
#define RBBIM_CHILDSIZE
Definition: commctrl.h:1507
#define REBARBANDINFO
Definition: commctrl.h:1569
#define RBBIM_CHILD
Definition: commctrl.h:1506
#define RBS_AUTOSIZE
Definition: commctrl.h:1475
#define REBARCLASSNAME
Definition: commctrl.h:1466
#define CCS_NODIVIDER
Definition: commctrl.h:2248
#define CCS_TOP
Definition: commctrl.h:2242
#define RBBIM_ID
Definition: commctrl.h:1510
#define RBS_VARHEIGHT
Definition: commctrl.h:1471
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2246
#define RBBIM_STYLE
Definition: commctrl.h:1502
#define RBBIM_SIZE
Definition: commctrl.h:1508
#define RBBIM_TEXT
Definition: commctrl.h:1504
#define RBS_DBLCLKTOGGLE
Definition: commctrl.h:1477
#define RBBS_GRIPPERALWAYS
Definition: commctrl.h:1496
#define RBBS_VARIABLEHEIGHT
Definition: commctrl.h:1495
#define RBBIM_IDEALSIZE
Definition: commctrl.h:1511
#define IDW_QUICKLAUNCHBAR
Definition: quicklaunch.h:32
@ REST_NOTRAYITEMSDISPLAY
Definition: shlobj.h:1777
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:146
Definition: window.h:573
WindowHandle _hwndrebar
Definition: desktopbar.h:113
WindowHandle _hwndNotify
Definition: desktopbar.h:111
void RegisterHotkeys()
Definition: desktopbar.cpp:238
WindowHandle _hwndTaskBar
Definition: desktopbar.h:110
WindowHandle _hwndStartButton
Definition: desktopbar.h:115
struct StartMenuRoot * _startMenuRoot
Definition: desktopbar.h:117
int _taskbar_pos
Definition: desktopbar.h:96
HINSTANCE _hInstance
Definition: globals.h:270
static HWND Create(HWND hwndParent)
Definition: traynotify.cpp:367
static HWND Create(HWND hwndParent)
Definition: quicklaunch.cpp:72
convenient loading of string resources
Definition: globals.h:304
special "Start" button with one click activation
Definition: desktopbar.h:133
Startmenu root window.
Definition: startmenu.h:365
static HWND Create(HWND hwndDesktopBar, int icon_size)
Definition: startmenu.cpp:1608
static HWND Create(HWND hwndParent)
Definition: taskbar.cpp:107
virtual LRESULT Init(LPCREATESTRUCT pcs)
Definition: window.cpp:241
#define IDW_TASKTOOLBAR
Definition: taskbar.h:43
uint32_t ULONG
Definition: typedefs.h:59
#define _T(x)
Definition: vfdio.h:22
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define SetWindowFont(hwnd, hfont, fRedraw)
Definition: windowsx.h:533
#define GetStockFont(i)
Definition: windowsx.h:308
#define ANSI_VAR_FONT
Definition: wingdi.h:907
#define CreateWindowEx
Definition: winuser.h:5755
#define DT_SINGLELINE
Definition: winuser.h:540
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define GetClassLongPtr
Definition: winuser.h:5782
#define CS_DBLCLKS
Definition: winuser.h:651
#define DrawText
Definition: winuser.h:5771
#define SetClassLongPtr
Definition: winuser.h:5848
#define DT_CALCRECT
Definition: winuser.h:526
#define GCL_STYLE
Definition: winuser.h:670
char TCHAR
Definition: xmlstorage.h:189

◆ Notify()

int DesktopBar::Notify ( int  id,
NMHDR pnmh 
)
protectedvirtual

Reimplemented from Window.

Definition at line 377 of file desktopbar.cpp.

378{
379 if (pnmh->code == RBN_CHILDSIZE) {
380 /* align the task bands to the top, so it's in row with the Start button */
381 NMREBARCHILDSIZE* childSize = (NMREBARCHILDSIZE*)pnmh;
382
383 if (childSize->wID == IDW_TASKTOOLBAR) {
384 int cy = childSize->rcChild.top - childSize->rcBand.top;
385
386 if (cy) {
387 childSize->rcChild.bottom -= cy;
388 childSize->rcChild.top -= cy;
389 }
390 }
391 }
392
393 return 0;
394}
#define RBN_CHILDSIZE
Definition: commctrl.h:1636
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
UINT code
Definition: winuser.h:3159
LONG bottom
Definition: windef.h:309

◆ ProcessCopyData()

LRESULT DesktopBar::ProcessCopyData ( COPYDATASTRUCT pcd)
protected

Definition at line 512 of file desktopbar.cpp.

513{
514 // Is this a tray notification message?
515 if (pcd->dwData == 1) {
516 TrayNotifyCDS* ptr = (TrayNotifyCDS*) pcd->lpData;
517
519
520 if (notify_area)
521 return notify_area->ProcessTrayNotification(ptr->notify_code, &ptr->nicon_data);
522 }
523
524 return FALSE;
525}
static PVOID ptr
Definition: dispmode.c:27
tray notification area aka "tray"
Definition: traynotify.h:131
copy data structure for tray notifications
Definition: desktopbar.cpp:506
ULONG_PTR dwData
Definition: winuser.h:3001

Referenced by WndProc().

◆ ProcessHotKey()

void DesktopBar::ProcessHotKey ( int  id_hotkey)
protected
Todo:
implement all common hotkeys

Definition at line 250 of file desktopbar.cpp.

251{
252 switch(id_hotkey) {
253 case IDHK_EXPLORER:
255 break;
256
257 case IDHK_RUN:
258 _startMenuRoot->Command(IDC_LAUNCH, 0);
259 break;
260
261 case IDHK_LOGOFF:
262 _startMenuRoot->Command(IDC_LOGOFF, 0);
263 break;
264
265 case IDHK_DESKTOP:
267 break;
268
269 case IDHK_STARTMENU:
271 break;
273 }
274}
#define IDHK_RUN
Definition: desktopbar.h:68
#define IDHK_STARTMENU
Definition: desktopbar.h:71
#define IDC_LAUNCH
Definition: desktopbar.h:40
#define IDHK_DESKTOP
Definition: desktopbar.h:69
#define IDHK_EXPLORER
Definition: desktopbar.h:67
#define IDC_LOGOFF
Definition: desktopbar.h:38
#define IDHK_LOGOFF
Definition: desktopbar.h:70

Referenced by WndProc().

◆ RegisterHotkeys()

void DesktopBar::RegisterHotkeys ( )
protected
Todo:
register all common hotkeys

Definition at line 238 of file desktopbar.cpp.

239{
240 // register hotkey WIN+E opening explorer
242 RegisterHotKey(_hwnd, IDHK_RUN, MOD_WIN, 'R');
243 RegisterHotKey(_hwnd, IDHK_DESKTOP, MOD_WIN, 'D');
244 RegisterHotKey(_hwnd, IDHK_LOGOFF, MOD_WIN, 'L');
246
248}
#define MOD_CONTROL
Definition: imm.h:185
#define MOD_WIN
Definition: winuser.h:2644
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
#define VK_ESCAPE
Definition: winuser.h:2214

Referenced by Init().

◆ Resize()

void DesktopBar::Resize ( int  cx,
int  cy 
)
protected
Todo:
general children resizing algorithm

Definition at line 396 of file desktopbar.cpp.

397{
399 int quicklaunch_width = SendMessage(_hwndQuickLaunch, PM_GET_WIDTH, 0, 0);
400 int notifyarea_width = SendMessage(_hwndNotify, PM_GET_WIDTH, 0, 0);
401
402 HDWP hdwp = BeginDeferWindowPos(3);
403
404 if (_hwndrebar)
405 DeferWindowPos(hdwp, _hwndrebar, 0, _taskbar_pos, 1, cx-_taskbar_pos-(notifyarea_width+1), cy-2, SWP_NOZORDER|SWP_NOACTIVATE);
406 else {
408 DeferWindowPos(hdwp, _hwndQuickLaunch, 0, _taskbar_pos, 1, quicklaunch_width, cy-2, SWP_NOZORDER|SWP_NOACTIVATE);
409
410 if (_hwndTaskBar)
411 DeferWindowPos(hdwp, _hwndTaskBar, 0, _taskbar_pos+quicklaunch_width, 0, cx-_taskbar_pos-quicklaunch_width-(notifyarea_width+1), cy, SWP_NOZORDER|SWP_NOACTIVATE);
412 }
413
414 if (_hwndNotify)
415 DeferWindowPos(hdwp, _hwndNotify, 0, cx-(notifyarea_width+1), 1, notifyarea_width, cy-2, SWP_NOZORDER|SWP_NOACTIVATE);
416
417 EndDeferWindowPos(hdwp);
418
419 WindowRect rect(_hwnd);
420 RECT work_area = {0, 0, GetSystemMetrics(SM_CXSCREEN), rect.top};
421 SystemParametersInfo(SPI_SETWORKAREA, 0, &work_area, 0); // don't use SPIF_SENDCHANGE because then we have to wait for any message being delivered
422 PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETWORKAREA, 0);
423}
#define PM_GET_WIDTH
Definition: explorer.h:67
_Out_opt_ int * cx
Definition: commctrl.h:585
#define SWP_NOACTIVATE
Definition: winuser.h:1242
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOZORDER
Definition: winuser.h:1247
HDWP WINAPI BeginDeferWindowPos(_In_ int)

Referenced by WndProc().

◆ ShowOrHideStartMenu()

void DesktopBar::ShowOrHideStartMenu ( )
protected

Definition at line 486 of file desktopbar.cpp.

487{
488 if (_startMenuRoot)
489 {
490 // set the Button, if not set
493
494 if (_startMenuRoot->IsStartMenuVisible())
495 _startMenuRoot->CloseStartMenu();
496 else
497 _startMenuRoot->TrackStartmenu();
498
499 // StartMenu was closed, release button state
501 }
502}
#define TRUE
Definition: types.h:120
#define Button_GetState(hwndCtl)
Definition: windowsx.h:32
#define Button_SetState(hwndCtl, state)
Definition: windowsx.h:36

Referenced by Command(), ProcessHotKey(), and WndProc().

◆ WndProc()

LRESULT DesktopBar::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
protectedvirtual
Todo:
read desktop bar settings

Reimplemented from Window.

Definition at line 277 of file desktopbar.cpp.

278{
279 switch(nmsg) {
280 case WM_NCHITTEST: {
282
283 if (res>=HTSIZEFIRST && res<=HTSIZELAST) {
284#ifdef TASKBAR_AT_TOP
285 if (res == HTBOTTOM) // enable vertical resizing at the lower border
286#else
287 if (res == HTTOP) // enable vertical resizing at the upper border
288#endif
289 return res;
290 else
291 return HTCLIENT; // disable any other resizing
292 }
293 return res;}
294
295 case WM_SYSCOMMAND:
296 if ((wparam&0xFFF0) == SC_SIZE) {
297#ifdef TASKBAR_AT_TOP
298 if (wparam == SC_SIZE+6)// enable vertical resizing at the lower border
299#else
300 if (wparam == SC_SIZE+3)// enable vertical resizing at the upper border
301#endif
302 goto def;
303 else
304 return 0; // disable any other resizing
305 } else if (wparam == SC_TASKLIST)
307 goto def;
308
309 case WM_SIZE:
311 break;
312
313 case WM_SIZING:
315 break;
316
317 case PM_RESIZE_CHILDREN: {
318 ClientRect size(_hwnd);
319 Resize(size.right, size.bottom);
320 break;}
321
322 case WM_CLOSE:
324 break;
325
326 case WM_HOTKEY:
328 break;
329
330 case WM_COPYDATA:
332
333 case WM_CONTEXTMENU: {
334 POINTS p;
335 p.x = LOWORD(lparam);
336 p.y = HIWORD(lparam);
337 PopupMenu menu(IDM_DESKTOPBAR);
339 menu.TrackPopupMenu(_hwnd, p);
340 break;}
341
343 if (_hwndTaskBar)
344 return SendMessage(_hwndTaskBar, nmsg, wparam, lparam);
345 break;
346
347 case PM_REFRESH_CONFIG:
349 break;
350
351 case WM_TIMER:
352 if (wparam == ID_TRAY_VOLUME) {
353 KillTimer(_hwnd, wparam);
354 launch_file(_hwnd, TEXT("sndvol32.exe"), SW_SHOWNORMAL, TEXT("-t")); // launch volume control in small mode
355 }
356 break;
357
359 return (LRESULT)(HWND)_hwndNotify;
360
362 /* Forward WM_SYSCOLORCHANGE to common controls */
363#ifndef _NO_REBAR
365#endif
368 break;
369
370 default: def:
371 return super::WndProc(nmsg, wparam, lparam);
372 }
373
374 return 0;
375}
HANDLE HWND
Definition: compat.h:19
#define PM_REFRESH_CONFIG
Definition: explorer.h:70
#define PM_RESIZE_CHILDREN
Definition: explorer.h:66
void ShowExitWindowsDialog(HWND hwndOwner)
Definition: startmenu.cpp:2128
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
GLfloat GLfloat p
Definition: glext.h:8902
#define IDM_DESKTOPBAR
Definition: resource.h:95
#define LOWORD(l)
Definition: pedump.c:82
#define WM_CONTEXTMENU
Definition: richedit.h:64
void Resize(int cx, int cy)
Definition: desktopbar.cpp:396
void ControlResize(WPARAM wparam, LPARAM lparam)
Definition: desktopbar.cpp:528
void ProcessHotKey(int id_hotkey)
Definition: desktopbar.cpp:250
LRESULT ProcessCopyData(COPYDATASTRUCT *pcd)
Definition: desktopbar.cpp:512
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.h:631
#define PM_GET_LAST_ACTIVE
Definition: taskbar.h:46
#define PM_GET_NOTIFYAREA
Definition: traynotify.h:44
#define HIWORD(l)
Definition: typedefs.h:247
LONG_PTR LRESULT
Definition: windef.h:209
#define HTSIZELAST
Definition: winuser.h:2496
#define WM_CLOSE
Definition: winuser.h:1621
#define WM_SYSCOMMAND
Definition: winuser.h:1741
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define HTBOTTOM
Definition: winuser.h:2493
#define WM_SIZE
Definition: winuser.h:1611
#define WM_NCHITTEST
Definition: winuser.h:1686
#define SC_TASKLIST
Definition: winuser.h:2599
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626
#define SC_SIZE
Definition: winuser.h:2584
#define WM_TIMER
Definition: winuser.h:1742
#define MF_BYPOSITION
Definition: winuser.h:203
#define HTCLIENT
Definition: winuser.h:2475
#define WM_COPYDATA
Definition: winuser.h:1664
#define HTSIZEFIRST
Definition: winuser.h:2488
#define WM_SIZING
Definition: winuser.h:1807
#define HTTOP
Definition: winuser.h:2490
#define WM_HOTKEY
Definition: winuser.h:1879
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Member Data Documentation

◆ _hwndNotify

WindowHandle DesktopBar::_hwndNotify
protected

Definition at line 111 of file desktopbar.h.

Referenced by Init(), ProcessCopyData(), Resize(), and WndProc().

◆ _hwndQuickLaunch

WindowHandle DesktopBar::_hwndQuickLaunch
protected

Definition at line 112 of file desktopbar.h.

Referenced by Command(), Init(), Resize(), and WndProc().

◆ _hwndrebar

WindowHandle DesktopBar::_hwndrebar
protected

Definition at line 113 of file desktopbar.h.

Referenced by Init(), Resize(), and WndProc().

◆ _hwndStartButton

WindowHandle DesktopBar::_hwndStartButton
protected

Definition at line 115 of file desktopbar.h.

Referenced by Init(), and ShowOrHideStartMenu().

◆ _hwndTaskBar

WindowHandle DesktopBar::_hwndTaskBar
protected

Definition at line 110 of file desktopbar.h.

Referenced by Init(), Resize(), and WndProc().

◆ _startMenuRoot

struct StartMenuRoot* DesktopBar::_startMenuRoot
protected

Definition at line 117 of file desktopbar.h.

Referenced by Init(), ProcessHotKey(), and ShowOrHideStartMenu().

◆ _taskbar_pos

int DesktopBar::_taskbar_pos
protected

Definition at line 96 of file desktopbar.h.

Referenced by Init(), and Resize().

◆ _work_area_org

RECT DesktopBar::_work_area_org
protected

Definition at line 95 of file desktopbar.h.

Referenced by DesktopBar(), and ~DesktopBar().

◆ WM_TASKBARCREATED

const UINT DesktopBar::WM_TASKBARCREATED
protected

Definition at line 126 of file desktopbar.h.

Referenced by Init().


The documentation for this struct was generated from the following files: