ReactOS  0.4.12-dev-75-g00dd17e
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)
 

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 More...
 
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 ()
 

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 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
 

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 More...
 
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 }
#define SystemParametersInfo
Definition: winuser.h:5724
#define ID_TRAY_VOLUME
Definition: resource.h:215
OwnerDrawParent< Window > super
Definition: desktopbar.h:86
#define WINMSG_TASKBARCREATED
Definition: window.h:986
#define IDI_REACTOS
Definition: osk_res.h:22
#define RegisterWindowMessage
Definition: winuser.h:5706
void SetWindowIcon(HWND hwnd, UINT nid)
set big and small icons out of the resources for a window
Definition: explorer.cpp:689
RECT _work_area_org
Definition: desktopbar.h:95
const UINT WM_TASKBARCREATED
Definition: desktopbar.h:126

◆ ~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
60  PostQuitMessage(0);
61 }
#define SystemParametersInfo
Definition: winuser.h:5724
#define WM_SETTINGCHANGE
Definition: winuser.h:1611
#define PostMessage
Definition: winuser.h:5698
RECT _work_area_org
Definition: desktopbar.h:95
#define HWND_BROADCAST
Definition: winuser.h:1190
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

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 
433  case ID_ABOUT_EXPLORER:
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 
453  case ID_SWITCH_DESKTOP_1:
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 
459  g_Globals._desktops.SwitchToDesktop(desktop_idx);
460 
461  if (_hwndQuickLaunch)
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:
476  if (_hwndQuickLaunch)
478  else
479  return 1;
480  }
481 
482  return 0;
483 }
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters)
Definition: utility.cpp:189
void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
Definition: explorer.cpp:707
#define PM_UPDATE_DESKTOP
Definition: quicklaunch.h:34
void ExplorerPropertySheet(HWND hparent)
Definition: settings.cpp:37
#define ID_DESKTOPBAR_SETTINGS
Definition: resource.h:205
#define ID_VOLUME_PROPERTIES
Definition: resource.h:216
void ShowOrHideStartMenu()
Definition: desktopbar.cpp:486
#define ID_MINIMIZE_ALL
Definition: resource.h:212
void explorer_about(HWND hwndParent)
Definition: explorer.cpp:934
#define IDC_START
Definition: resource.h:137
WindowHandle _hwndQuickLaunch
Definition: desktopbar.h:112
#define ID_TRAY_VOLUME
Definition: resource.h:215
BOOL launch_cpanel(HWND hwnd, LPCTSTR applet)
Definition: utility.cpp:383
#define ID_TASKMGR
Definition: resource.h:214
#define PostMessage
Definition: winuser.h:5698
#define ID_EXPLORE
Definition: resource.h:213
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define WM_COMMAND
Definition: winuser.h:1716
void ToggleMinimize()
minimize/restore all windows on the desktop
Definition: desktop.cpp:229
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define TEXT(s)
Definition: k32.h:26
#define ID_ABOUT_EXPLORER
Definition: resource.h:204
#define SendMessage
Definition: winuser.h:5709
Desktops _desktops
Definition: globals.h:291
void SwitchToDesktop(int idx)
Definition: desktop.cpp:163
HWND _hwndDesktop
Definition: globals.h:289
#define ID_SWITCH_DESKTOP_1
Definition: resource.h:225

◆ 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 }
LONG top
Definition: windef.h:297
#define WMSZ_TOP
Definition: winuser.h:2420
#define SM_CYSCREEN
Definition: winuser.h:950
#define WMSZ_RIGHT
Definition: winuser.h:2419
int WINAPI GetSystemMetrics(_In_ int)
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#define WMSZ_BOTTOM
Definition: winuser.h:2423
#define DESKTOPBARBAR_HEIGHT
Definition: desktopbar.h:33
struct tagRECT * PRECT
#define WMSZ_LEFT
Definition: winuser.h:2418
UINT WPARAM wparam
Definition: msvc.h:92

◆ Create()

HWND DesktopBar::Create ( )
static

Definition at line 64 of file desktopbar.cpp.

Referenced by DesktopWindow::Init().

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 WINDOW_CREATOR(WND_CLASS)
Definition: window.h:202
#define WS_THICKFRAME
Definition: pedump.c:630
#define WS_EX_PALETTEWINDOW
Definition: winuser.h:399
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:298
& rect
Definition: startmenu.cpp:1413
#define SM_CXSCREEN
Definition: winuser.h:949
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 SM_CYSCREEN
Definition: winuser.h:950
window class with gray background color
Definition: window.h:248
int WINAPI GetSystemMetrics(_In_ int)
#define DESKTOPBARBAR_HEIGHT
Definition: desktopbar.h:33
#define CLASSNAME_EXPLORERBAR
Definition: desktopbar.h:29
desktop bar window, also known as "system tray"
Definition: desktopbar.h:74
#define WS_POPUP
Definition: pedump.c:616
LONG bottom
Definition: windef.h:299
#define WS_VISIBLE
Definition: pedump.c:620
#define TITLE_EXPLORERBAR
Definition: desktopbar.h:30

◆ 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
110  SetClassLongPtr(hwndStart, GCL_STYLE, GetClassLongPtr(hwndStart, GCL_STYLE) & ~CS_DBLCLKS);
111 
112  // create task bar
113  _hwndTaskBar = TaskBar::Create(_hwnd);
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 
163  RegisterHotkeys();
164 
165  // prepare Startmenu, but hide it for now
167  _startMenuRoot->_hwndStartButton = _hwndStartButton;
168 
169  return 0;
170 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define BS_OWNERDRAW
Definition: pedump.c:661
WindowHandle _hwndStartButton
Definition: desktopbar.h:115
#define RBBIM_CHILD
Definition: commctrl.h:1476
#define RBS_VARHEIGHT
Definition: commctrl.h:1441
#define GetStockFont(i)
Definition: windowsx.h:283
Definition: mk_font.cpp:20
WindowHandle _hwndrebar
Definition: desktopbar.h:113
virtual LRESULT Init(LPCREATESTRUCT pcs)
Definition: window.cpp:241
#define SetWindowFont(hwnd, hfont, fRedraw)
Definition: windowsx.h:503
#define RBBIM_ID
Definition: commctrl.h:1480
static HWND Create(HWND hwndParent)
Definition: taskbar.cpp:107
void RegisterHotkeys()
Definition: desktopbar.cpp:238
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define IDS_START
Definition: resource.h:98
LONG right
Definition: windef.h:298
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
struct StartMenuRoot * _startMenuRoot
Definition: desktopbar.h:117
& rect
Definition: startmenu.cpp:1413
#define DrawText
Definition: winuser.h:5637
UINT_PTR WPARAM
Definition: windef.h:207
#define IDC_START
Definition: resource.h:137
WindowHandle _hwndQuickLaunch
Definition: desktopbar.h:112
#define GCL_STYLE
Definition: winuser.h:665
#define RBBIM_STYLE
Definition: commctrl.h:1472
#define RBBIM_SIZE
Definition: commctrl.h:1478
static HWND Create(HWND hwndParent)
Definition: quicklaunch.cpp:72
#define CCS_NODIVIDER
Definition: commctrl.h:2218
special "Start" button with one click activation
Definition: desktopbar.h:132
#define DT_CALCRECT
Definition: winuser.h:526
LONG_PTR LPARAM
Definition: windef.h:208
#define CreateWindowEx
Definition: winuser.h:5621
#define RB_INSERTBAND
Definition: commctrl.h:1572
smooth NULL
Definition: ftsmooth.c:416
WindowHandle _hwndTaskBar
Definition: desktopbar.h:110
#define CCS_TOP
Definition: commctrl.h:2212
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2216
#define RBBS_HIDETITLE
#define SetClassLongPtr
Definition: winuser.h:5714
#define RBBS_VARIABLEHEIGHT
Definition: commctrl.h:1465
#define IDW_QUICKLAUNCHBAR
Definition: quicklaunch.h:32
#define PostMessage
Definition: winuser.h:5698
#define RBS_AUTOSIZE
Definition: commctrl.h:1445
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define REBARBANDINFO
Definition: commctrl.h:1539
#define RBBIM_TEXT
Definition: commctrl.h:1474
WindowHandle _hwndNotify
Definition: desktopbar.h:111
#define RBBIM_CHILDSIZE
Definition: commctrl.h:1477
#define IDW_TASKTOOLBAR
Definition: taskbar.h:43
HINSTANCE _hInstance
Definition: globals.h:270
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define CS_DBLCLKS
Definition: winuser.h:646
#define GetClassLongPtr
Definition: winuser.h:5648
#define REBARCLASSNAME
Definition: commctrl.h:1436
#define DT_SINGLELINE
Definition: winuser.h:540
static HWND Create(HWND hwndParent)
Definition: traynotify.cpp:367
#define GET_WINDOW(CLASS, hwnd)
Definition: window.h:88
#define ANSI_VAR_FONT
Definition: wingdi.h:905
#define REBARBAND_HEIGHT
Definition: desktopbar.h:34
int _taskbar_pos
Definition: desktopbar.h:96
#define STARTMENUROOT_ICON_SIZE
Definition: globals.h:173
#define RBBS_GRIPPERALWAYS
Definition: commctrl.h:1466
#define SendMessage
Definition: winuser.h:5709
static HWND Create(HWND hwndDesktopBar, int icon_size)
Definition: startmenu.cpp:1608
unsigned int ULONG
Definition: retypes.h:1
#define RBS_DBLCLKTOGGLE
Definition: commctrl.h:1447
const UINT WM_TASKBARCREATED
Definition: desktopbar.h:126
convenient loading of string resources
Definition: globals.h:303
#define WS_VISIBLE
Definition: pedump.c:620
#define HWND_BROADCAST
Definition: winuser.h:1190
DWORD WINAPI SHRestricted(RESTRICTIONS policy)
Definition: shpolicy.c:825
#define RBBIM_IDEALSIZE
Definition: commctrl.h:1481
Startmenu root window.
Definition: startmenu.h:364
Definition: window.h:572

◆ 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 }
LONG top
Definition: windef.h:297
UINT code
Definition: winuser.h:3112
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
#define RBN_CHILDSIZE
Definition: commctrl.h:1606
#define IDW_TASKTOOLBAR
Definition: taskbar.h:43
LONG bottom
Definition: windef.h:299

◆ 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 
518  NotifyArea* notify_area = GET_WINDOW(NotifyArea, _hwndNotify);
519 
520  if (notify_area)
521  return notify_area->ProcessTrayNotification(ptr->notify_code, &ptr->nicon_data);
522  }
523 
524  return FALSE;
525 }
ULONG_PTR dwData
Definition: winuser.h:2954
static PVOID ptr
Definition: dispmode.c:27
WindowHandle _hwndNotify
Definition: desktopbar.h:111
tray notification area aka "tray"
Definition: traynotify.h:130
#define GET_WINDOW(CLASS, hwnd)
Definition: window.h:88
NOTIFYICONDATA nicon_data
Definition: desktopbar.cpp:509
copy data structure for tray notifications
Definition: desktopbar.cpp:506

◆ 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_STARTMENU
Definition: desktopbar.h:71
void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
Definition: explorer.cpp:707
#define IDHK_DESKTOP
Definition: traywnd.cpp:55
void ShowOrHideStartMenu()
Definition: desktopbar.cpp:486
#define IDHK_RUN
Definition: traywnd.cpp:45
struct StartMenuRoot * _startMenuRoot
Definition: desktopbar.h:117
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define IDHK_LOGOFF
Definition: desktopbar.h:70
#define IDC_LOGOFF
Definition: desktopbar.h:38
void ToggleMinimize()
minimize/restore all windows on the desktop
Definition: desktop.cpp:229
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define IDC_LAUNCH
Definition: desktopbar.h:40
#define IDHK_EXPLORER
Definition: desktopbar.h:67
Desktops _desktops
Definition: globals.h:291

◆ RegisterHotkeys()

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

Definition at line 238 of file desktopbar.cpp.

Referenced by Init().

239 {
240  // register hotkey WIN+E opening explorer
241  RegisterHotKey(_hwnd, IDHK_EXPLORER, MOD_WIN, 'E');
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 IDHK_STARTMENU
Definition: desktopbar.h:71
#define IDHK_DESKTOP
Definition: traywnd.cpp:55
#define VK_ESCAPE
Definition: winuser.h:2168
#define IDHK_RUN
Definition: traywnd.cpp:45
#define IDHK_LOGOFF
Definition: desktopbar.h:70
#define MOD_CONTROL
Definition: imm.h:312
#define IDHK_EXPLORER
Definition: desktopbar.h:67
#define MOD_WIN
Definition: winuser.h:2598
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)

◆ 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 {
407  if (_hwndQuickLaunch)
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 }
HDWP WINAPI BeginDeferWindowPos(_In_ int)
WindowHandle _hwndrebar
Definition: desktopbar.h:113
#define SystemParametersInfo
Definition: winuser.h:5724
#define PM_GET_WIDTH
Definition: explorer.h:67
#define SWP_NOZORDER
Definition: winuser.h:1232
& rect
Definition: startmenu.cpp:1413
#define WM_SETTINGCHANGE
Definition: winuser.h:1611
WindowHandle _hwndQuickLaunch
Definition: desktopbar.h:112
#define SM_CXSCREEN
Definition: winuser.h:949
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
WindowHandle _hwndTaskBar
Definition: desktopbar.h:110
#define PostMessage
Definition: winuser.h:5698
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOACTIVATE
Definition: winuser.h:1227
WindowHandle _hwndNotify
Definition: desktopbar.h:111
int WINAPI GetSystemMetrics(_In_ int)
int _taskbar_pos
Definition: desktopbar.h:96
_Out_opt_ int * cx
Definition: commctrl.h:570
#define SendMessage
Definition: winuser.h:5709
#define HWND_BROADCAST
Definition: winuser.h:1190

◆ 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 }
WindowHandle _hwndStartButton
Definition: desktopbar.h:115
#define TRUE
Definition: types.h:120
#define Button_GetState(hwndCtl)
Definition: windowsx.h:7
struct StartMenuRoot * _startMenuRoot
Definition: desktopbar.h:117
#define Button_SetState(hwndCtl, state)
Definition: windowsx.h:11

◆ 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:
323  ShowExitWindowsDialog(_hwnd);
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 
342  case PM_GET_LAST_ACTIVE:
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 
358  case PM_GET_NOTIFYAREA:
359  return (LRESULT)(HWND)_hwndNotify;
360 
361  case WM_SYSCOLORCHANGE:
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 }
#define HTTOP
Definition: winuser.h:2444
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters)
Definition: utility.cpp:189
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_HOTKEY
Definition: winuser.h:1840
WindowHandle _hwndrebar
Definition: desktopbar.h:113
#define PM_REFRESH_CONFIG
Definition: explorer.h:70
void ProcessHotKey(int id_hotkey)
Definition: desktopbar.cpp:250
HANDLE HWND
Definition: compat.h:13
#define WM_NCHITTEST
Definition: winuser.h:1668
#define IDM_DESKTOPBAR
Definition: resource.h:95
void ShowOrHideStartMenu()
Definition: desktopbar.cpp:486
#define SC_TASKLIST
Definition: winuser.h:2553
WindowHandle _hwndQuickLaunch
Definition: desktopbar.h:112
#define ID_TRAY_VOLUME
Definition: resource.h:215
#define MF_BYPOSITION
Definition: winuser.h:203
#define WM_SIZING
Definition: winuser.h:1783
WindowHandle _hwndTaskBar
Definition: desktopbar.h:110
SHORT x
Definition: windef.h:332
#define HTSIZEFIRST
Definition: winuser.h:2442
#define PM_GET_NOTIFYAREA
Definition: traynotify.h:44
#define PM_RESIZE_CHILDREN
Definition: explorer.h:66
#define WM_COPYDATA
Definition: winuser.h:1646
GLsizeiptr size
Definition: glext.h:5919
#define WM_SIZE
Definition: winuser.h:1593
#define WM_TIMER
Definition: winuser.h:1718
#define WM_CLOSE
Definition: winuser.h:1603
WindowHandle _hwndNotify
Definition: desktopbar.h:111
#define HTBOTTOM
Definition: winuser.h:2447
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.h:631
void Resize(int cx, int cy)
Definition: desktopbar.cpp:396
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#define PM_GET_LAST_ACTIVE
Definition: taskbar.h:46
SHORT y
Definition: windef.h:333
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define TEXT(s)
Definition: k32.h:26
LRESULT ProcessCopyData(COPYDATASTRUCT *pcd)
Definition: desktopbar.cpp:512
#define SC_SIZE
Definition: winuser.h:2538
void ControlResize(WPARAM wparam, LPARAM lparam)
Definition: desktopbar.cpp:528
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SendMessage
Definition: winuser.h:5709
GLuint res
Definition: glext.h:9613
#define HIWORD(l)
Definition: typedefs.h:246
#define HTCLIENT
Definition: winuser.h:2429
GLfloat GLfloat p
Definition: glext.h:8902
LONG_PTR LRESULT
Definition: windef.h:209
#define WM_SYSCOMMAND
Definition: winuser.h:1717
#define LOWORD(l)
Definition: pedump.c:82
#define HTSIZELAST
Definition: winuser.h:2450
void ShowExitWindowsDialog(HWND hwndOwner)
Definition: startmenu.cpp:2128
UINT WPARAM wparam
Definition: msvc.h:92

Member Data Documentation

◆ _hwndNotify

WindowHandle DesktopBar::_hwndNotify
protected

Definition at line 111 of file desktopbar.h.

Referenced by Init().

◆ _hwndQuickLaunch

WindowHandle DesktopBar::_hwndQuickLaunch
protected

Definition at line 112 of file desktopbar.h.

Referenced by Init().

◆ _hwndrebar

WindowHandle DesktopBar::_hwndrebar
protected

Definition at line 113 of file desktopbar.h.

Referenced by Init().

◆ _hwndStartButton

WindowHandle DesktopBar::_hwndStartButton
protected

Definition at line 115 of file desktopbar.h.

Referenced by Init().

◆ _hwndTaskBar

WindowHandle DesktopBar::_hwndTaskBar
protected

Definition at line 110 of file desktopbar.h.

Referenced by Init().

◆ _startMenuRoot

struct StartMenuRoot* DesktopBar::_startMenuRoot
protected

Definition at line 117 of file desktopbar.h.

Referenced by Init().

◆ _taskbar_pos

int DesktopBar::_taskbar_pos
protected

Definition at line 96 of file desktopbar.h.

Referenced by Init().

◆ _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: