ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

desktopbar.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2003, 2004 Martin Fuchs
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00017  */
00018 
00019 
00020  //
00021  // Explorer clone
00022  //
00023  // desktopbar.cpp
00024  //
00025  // Martin Fuchs, 22.08.2003
00026  //
00027 
00028 
00029 #include <precomp.h>
00030 
00031 #include "../resource.h"
00032 
00033 #include "desktopbar.h"
00034 #include "taskbar.h"
00035 #include "startmenu.h"
00036 #include "traynotify.h"
00037 #include "quicklaunch.h"
00038 
00039 #include "../dialogs/settings.h"
00040 
00041 
00042 DesktopBar::DesktopBar(HWND hwnd)
00043  :  super(hwnd),
00044 #ifdef __REACTOS__
00045     _trayIcon(hwnd, ID_TRAY_VOLUME)
00046 #else
00047     WM_TASKBARCREATED(RegisterWindowMessage(WINMSG_TASKBARCREATED))
00048 #endif
00049 {
00050     SetWindowIcon(hwnd, IDI_REACTOS);
00051 
00052     SystemParametersInfo(SPI_GETWORKAREA, 0, &_work_area_org, 0);
00053 }
00054 
00055 DesktopBar::~DesktopBar()
00056 {
00057      // restore work area to the previous size
00058     SystemParametersInfo(SPI_SETWORKAREA, 0, &_work_area_org, 0);
00059     PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETWORKAREA, 0);
00060 
00061      // exit application after destroying desktop window
00062     PostQuitMessage(0);
00063 }
00064 
00065 
00066 HWND DesktopBar::Create()
00067 {
00068     static BtnWindowClass wcDesktopBar(CLASSNAME_EXPLORERBAR);
00069 
00070     RECT rect;
00071 
00072     rect.left = -2; // hide left border
00073 #ifdef TASKBAR_AT_TOP
00074     rect.top = -2;  // hide top border
00075 #else
00076     rect.top = GetSystemMetrics(SM_CYSCREEN) - DESKTOPBARBAR_HEIGHT;
00077 #endif
00078     rect.right = GetSystemMetrics(SM_CXSCREEN) + 2;
00079     rect.bottom = rect.top + DESKTOPBARBAR_HEIGHT + 2;
00080 
00081     return Window::Create(WINDOW_CREATOR(DesktopBar), WS_EX_PALETTEWINDOW,
00082                             wcDesktopBar, TITLE_EXPLORERBAR,
00083                             WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE,
00084                             rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, 0);
00085 }
00086 
00087 
00088 LRESULT DesktopBar::Init(LPCREATESTRUCT pcs)
00089 {
00090     if (super::Init(pcs))
00091         return 1;
00092 
00093      // create start button
00094     ResString start_str(IDS_START);
00095     WindowCanvas canvas(_hwnd);
00096     FontSelection font(canvas, GetStockFont(ANSI_VAR_FONT));
00097     RECT rect = {0, 0};
00098     DrawText(canvas, start_str, -1, &rect, DT_SINGLELINE|DT_CALCRECT);
00099     int start_btn_width = rect.right+16+8;
00100 
00101     _taskbar_pos = start_btn_width + 6;
00102 
00103      // create "Start" button
00104     HWND hwndStart = Button(_hwnd, start_str, 1, 1, start_btn_width, REBARBAND_HEIGHT, IDC_START, WS_VISIBLE|WS_CHILD|BS_OWNERDRAW);
00105     SetWindowFont(hwndStart, GetStockFont(ANSI_VAR_FONT), FALSE);
00106     new StartButton(hwndStart);
00107 
00108     /* Save the handle to the window, needed for push-state handling */
00109     _hwndStartButton = hwndStart;
00110 
00111      // disable double clicks
00112     SetClassLongPtr(hwndStart, GCL_STYLE, GetClassLongPtr(hwndStart, GCL_STYLE) & ~CS_DBLCLKS);
00113 
00114      // create task bar
00115     _hwndTaskBar = TaskBar::Create(_hwnd);
00116 
00117 #ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
00118     if (!g_Globals._SHRestricted || !SHRestricted(REST_NOTRAYITEMSDISPLAY))
00119 #endif
00120          // create tray notification area
00121         _hwndNotify = NotifyArea::Create(_hwnd);
00122 
00123 
00124      // notify all top level windows about the successfully created desktop bar
00125      //@@ Use SendMessage() instead of PostMessage() to avoid problems with delayed created shell service objects?
00126     PostMessage(HWND_BROADCAST, WM_TASKBARCREATED, 0, 0);
00127 
00128 
00129     _hwndQuickLaunch = QuickLaunchBar::Create(_hwnd);
00130 
00131      // create rebar window to manage task and quick launch bar
00132 #ifndef _NO_REBAR
00133     _hwndrebar = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL,
00134                     WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|
00135                     RBS_VARHEIGHT|RBS_AUTOSIZE|RBS_DBLCLKTOGGLE|    //|RBS_REGISTERDROP
00136                     CCS_NODIVIDER|CCS_NOPARENTALIGN|CCS_TOP,
00137                     0, 0, 0, 0, _hwnd, 0, g_Globals._hInstance, 0);
00138 
00139     REBARBANDINFO rbBand;
00140 
00141     rbBand.cbSize = sizeof(REBARBANDINFO);
00142     rbBand.fMask  = RBBIM_TEXT|RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE|RBBIM_ID|RBBIM_IDEALSIZE;
00143     rbBand.cyChild = REBARBAND_HEIGHT;
00144     rbBand.cyMaxChild = (ULONG)-1;
00145     rbBand.cyMinChild = REBARBAND_HEIGHT;
00146     rbBand.cyIntegral = REBARBAND_HEIGHT + 3;   //@@ OK?
00147     rbBand.fStyle = RBBS_VARIABLEHEIGHT|RBBS_GRIPPERALWAYS|RBBS_HIDETITLE;
00148 
00149     TCHAR QuickLaunchBand[] = _T("Quicklaunch");
00150     rbBand.lpText = QuickLaunchBand;
00151     rbBand.hwndChild = _hwndQuickLaunch;
00152     rbBand.cx = 100;
00153     rbBand.cxMinChild = 100;
00154     rbBand.wID = IDW_QUICKLAUNCHBAR;
00155     SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
00156 
00157     TCHAR TaskbarBand[] = _T("Taskbar");
00158     rbBand.lpText = TaskbarBand;
00159     rbBand.hwndChild = _hwndTaskBar;
00160     rbBand.cx = 200;    //pcs->cx-_taskbar_pos-quicklaunch_width-(notifyarea_width+1);
00161     rbBand.cxMinChild = 50;
00162     rbBand.wID = IDW_TASKTOOLBAR;
00163     SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
00164 #endif
00165 
00166 
00167     RegisterHotkeys();
00168 
00169      // prepare Startmenu, but hide it for now
00170     _startMenuRoot = GET_WINDOW(StartMenuRoot, StartMenuRoot::Create(_hwndStartButton, STARTMENUROOT_ICON_SIZE));
00171     _startMenuRoot->_hwndStartButton = _hwndStartButton;
00172 
00173     return 0;
00174 }
00175 
00176 
00177 StartButton::StartButton(HWND hwnd)
00178  :  PictureButton(hwnd, SmallIcon(IDI_STARTMENU), GetSysColorBrush(COLOR_BTNFACE))
00179 {
00180 }
00181 
00182 LRESULT StartButton::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
00183 {
00184     switch(nmsg) {
00185        // one click activation: handle button-down message, don't wait for button-up
00186       case WM_LBUTTONDOWN:
00187         if (!Button_GetState(_hwnd)) {
00188             Button_SetState(_hwnd, TRUE);
00189 
00190             SetCapture(_hwnd);
00191 
00192             SendMessage(GetParent(_hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(_hwnd),0), 0);
00193         }
00194 
00195         Button_SetState(_hwnd, FALSE);
00196         break;
00197 
00198        // re-target mouse move messages while moving the mouse cursor through the start menu
00199       case WM_MOUSEMOVE:
00200         if (GetCapture() == _hwnd) {
00201             POINT pt = {GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)};
00202 
00203             ClientToScreen(_hwnd, &pt);
00204             HWND hwnd = WindowFromPoint(pt);
00205 
00206             if (hwnd && hwnd!=_hwnd) {
00207                 ScreenToClient(hwnd, &pt);
00208                 SendMessage(hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(pt.x, pt.y));
00209             }
00210         }
00211         break;
00212 
00213       case WM_LBUTTONUP:
00214         if (GetCapture() == _hwnd) {
00215             ReleaseCapture();
00216 
00217             POINT pt = {GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)};
00218 
00219             ClientToScreen(_hwnd, &pt);
00220             HWND hwnd = WindowFromPoint(pt);
00221 
00222             if (hwnd && hwnd!=_hwnd) {
00223                 ScreenToClient(hwnd, &pt);
00224                 PostMessage(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y));
00225                 PostMessage(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(pt.x, pt.y));
00226             }
00227         }
00228         break;
00229 
00230       case WM_CANCELMODE:
00231         ReleaseCapture();
00232         break;
00233 
00234       default:
00235         return super::WndProc(nmsg, wparam, lparam);
00236     }
00237 
00238     return 0;
00239 }
00240 
00241 
00242 void DesktopBar::RegisterHotkeys()
00243 {
00244      // register hotkey WIN+E opening explorer
00245     RegisterHotKey(_hwnd, IDHK_EXPLORER, MOD_WIN, 'E');
00246     RegisterHotKey(_hwnd, IDHK_RUN, MOD_WIN, 'R');
00247     RegisterHotKey(_hwnd, IDHK_DESKTOP, MOD_WIN, 'D');
00248     RegisterHotKey(_hwnd, IDHK_LOGOFF, MOD_WIN, 'L');
00249     RegisterHotKey(_hwnd, IDHK_STARTMENU, MOD_CONTROL, VK_ESCAPE);
00250 
00252 }
00253 
00254 void DesktopBar::ProcessHotKey(int id_hotkey)
00255 {
00256     switch(id_hotkey) {
00257         case IDHK_EXPLORER:
00258             explorer_show_frame(SW_SHOWNORMAL);
00259             break;
00260 
00261         case IDHK_RUN:
00262             _startMenuRoot->Command(IDC_LAUNCH, 0);
00263             break;
00264 
00265         case IDHK_LOGOFF:
00266             _startMenuRoot->Command(IDC_LOGOFF, 0);
00267             break;
00268 
00269         case IDHK_DESKTOP:
00270             g_Globals._desktops.ToggleMinimize();
00271             break;
00272 
00273         case IDHK_STARTMENU:
00274             ShowOrHideStartMenu();
00275             break;
00277     }
00278 }
00279 
00280 
00281 LRESULT DesktopBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
00282 {
00283     switch(nmsg) {
00284       case WM_NCHITTEST: {
00285         LRESULT res = super::WndProc(nmsg, wparam, lparam);
00286 
00287         if (res>=HTSIZEFIRST && res<=HTSIZELAST) {
00288 #ifdef TASKBAR_AT_TOP
00289             if (res == HTBOTTOM)    // enable vertical resizing at the lower border
00290 #else
00291             if (res == HTTOP)       // enable vertical resizing at the upper border
00292 #endif
00293                 return res;
00294             else
00295                 return HTCLIENT;    // disable any other resizing
00296         }
00297         return res;}
00298 
00299       case WM_SYSCOMMAND:
00300         if ((wparam&0xFFF0) == SC_SIZE) {
00301 #ifdef TASKBAR_AT_TOP
00302             if (wparam == SC_SIZE+6)// enable vertical resizing at the lower border
00303 #else
00304             if (wparam == SC_SIZE+3)// enable vertical resizing at the upper border
00305 #endif
00306                 goto def;
00307             else
00308                 return 0;           // disable any other resizing
00309         } else if (wparam == SC_TASKLIST)
00310             ShowOrHideStartMenu();
00311         goto def;
00312 
00313       case WM_SIZE:
00314         Resize(LOWORD(lparam), HIWORD(lparam));
00315         break;
00316 
00317       case WM_SIZING:
00318         ControlResize(wparam, lparam);
00319         break;
00320 
00321       case PM_RESIZE_CHILDREN: {
00322         ClientRect size(_hwnd);
00323         Resize(size.right, size.bottom);
00324         break;}
00325 
00326       case WM_CLOSE:
00327         ShowExitWindowsDialog(_hwnd);
00328         break;
00329 
00330       case WM_HOTKEY:
00331         ProcessHotKey(wparam);
00332         break;
00333 
00334       case WM_COPYDATA:
00335         return ProcessCopyData((COPYDATASTRUCT*)lparam);
00336 
00337       case WM_CONTEXTMENU: {
00338         POINTS p;
00339         p.x = LOWORD(lparam);
00340         p.y = HIWORD(lparam);
00341         PopupMenu menu(IDM_DESKTOPBAR);
00342         SetMenuDefaultItem(menu, 0, MF_BYPOSITION);
00343         menu.TrackPopupMenu(_hwnd, p);
00344         break;}
00345 
00346       case PM_GET_LAST_ACTIVE:
00347         if (_hwndTaskBar)
00348             return SendMessage(_hwndTaskBar, nmsg, wparam, lparam);
00349         break;
00350 
00351       case PM_REFRESH_CONFIG:   
00352         SendMessage(_hwndNotify, PM_REFRESH_CONFIG, 0, 0);
00353         break;
00354 
00355       case WM_TIMER:
00356         if (wparam == ID_TRAY_VOLUME) {
00357             KillTimer(_hwnd, wparam);
00358             launch_file(_hwnd, TEXT("sndvol32.exe"), SW_SHOWNORMAL, TEXT("-t"));    // launch volume control in small mode
00359         }
00360         break;
00361 
00362       case PM_GET_NOTIFYAREA:
00363         return (LRESULT)(HWND)_hwndNotify;
00364 
00365       case WM_SYSCOLORCHANGE:
00366         /* Forward WM_SYSCOLORCHANGE to common controls */
00367 #ifndef _NO_REBAR
00368         SendMessage(_hwndrebar, WM_SYSCOLORCHANGE, 0, 0);
00369 #endif
00370         SendMessage(_hwndQuickLaunch, WM_SYSCOLORCHANGE, 0, 0);
00371         SendMessage(_hwndTaskBar, WM_SYSCOLORCHANGE, 0, 0);
00372         break;
00373 
00374       default: def:
00375         return super::WndProc(nmsg, wparam, lparam);
00376     }
00377 
00378     return 0;
00379 }
00380 
00381 int DesktopBar::Notify(int id, NMHDR* pnmh)
00382 {
00383     if (pnmh->code == RBN_CHILDSIZE) {
00384         /* align the task bands to the top, so it's in row with the Start button */
00385         NMREBARCHILDSIZE* childSize = (NMREBARCHILDSIZE*)pnmh;
00386 
00387         if (childSize->wID == IDW_TASKTOOLBAR) {
00388             int cy = childSize->rcChild.top - childSize->rcBand.top;
00389 
00390             if (cy) {
00391                 childSize->rcChild.bottom -= cy;
00392                 childSize->rcChild.top -= cy;
00393             }
00394         }
00395     }
00396 
00397     return 0;
00398 }
00399 
00400 void DesktopBar::Resize(int cx, int cy)
00401 {
00403     int quicklaunch_width = SendMessage(_hwndQuickLaunch, PM_GET_WIDTH, 0, 0);
00404     int notifyarea_width = SendMessage(_hwndNotify, PM_GET_WIDTH, 0, 0);
00405 
00406     HDWP hdwp = BeginDeferWindowPos(3);
00407 
00408     if (_hwndrebar)
00409         DeferWindowPos(hdwp, _hwndrebar, 0, _taskbar_pos, 1, cx-_taskbar_pos-(notifyarea_width+1), cy-2, SWP_NOZORDER|SWP_NOACTIVATE);
00410     else {
00411         if (_hwndQuickLaunch)
00412             DeferWindowPos(hdwp, _hwndQuickLaunch, 0, _taskbar_pos, 1, quicklaunch_width, cy-2, SWP_NOZORDER|SWP_NOACTIVATE);
00413 
00414         if (_hwndTaskBar)
00415             DeferWindowPos(hdwp, _hwndTaskBar, 0, _taskbar_pos+quicklaunch_width, 0, cx-_taskbar_pos-quicklaunch_width-(notifyarea_width+1), cy, SWP_NOZORDER|SWP_NOACTIVATE);
00416     }
00417 
00418     if (_hwndNotify)
00419         DeferWindowPos(hdwp, _hwndNotify, 0, cx-(notifyarea_width+1), 1, notifyarea_width, cy-2, SWP_NOZORDER|SWP_NOACTIVATE);
00420 
00421     EndDeferWindowPos(hdwp);
00422 
00423     WindowRect rect(_hwnd);
00424     RECT work_area = {0, 0, GetSystemMetrics(SM_CXSCREEN), rect.top};
00425     SystemParametersInfo(SPI_SETWORKAREA, 0, &work_area, 0);    // don't use SPIF_SENDCHANGE because then we have to wait for any message being delivered
00426     PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETWORKAREA, 0);
00427 }
00428 
00429 
00430 int DesktopBar::Command(int id, int code)
00431 {
00432     switch(id) {
00433       case IDC_START:
00434         ShowOrHideStartMenu();
00435         break;
00436 
00437       case ID_ABOUT_EXPLORER:
00438         explorer_about(g_Globals._hwndDesktop);
00439         break;
00440 
00441       case ID_DESKTOPBAR_SETTINGS:
00442         ExplorerPropertySheet(g_Globals._hwndDesktop);
00443         break;
00444 
00445       case ID_MINIMIZE_ALL:
00446         g_Globals._desktops.ToggleMinimize();
00447         break;
00448 
00449       case ID_EXPLORE:
00450         explorer_show_frame(SW_SHOWNORMAL);
00451         break;
00452 
00453       case ID_TASKMGR:
00454         launch_file(_hwnd, TEXT("taskmgr.exe"), SW_SHOWNORMAL);
00455         break;
00456 
00457       case ID_SWITCH_DESKTOP_1:
00458       case ID_SWITCH_DESKTOP_1+1: {
00459         int desktop_idx = id - ID_SWITCH_DESKTOP_1;
00460 
00461         g_Globals._desktops.SwitchToDesktop(desktop_idx);
00462 
00463         if (_hwndQuickLaunch)
00464             PostMessage(_hwndQuickLaunch, PM_UPDATE_DESKTOP, desktop_idx, 0);
00465         break;}
00466 
00467 #ifdef __REACTOS__
00468       case ID_TRAY_VOLUME:
00469         launch_file(_hwnd, TEXT("sndvol32.exe"), SW_SHOWNORMAL);    // launch volume control application
00470         break;
00471 
00472       case ID_VOLUME_PROPERTIES:
00473         launch_cpanel(_hwnd, TEXT("mmsys.cpl"));
00474         break;
00475 #endif
00476 
00477       default:
00478         if (_hwndQuickLaunch)
00479             return SendMessage(_hwndQuickLaunch, WM_COMMAND, MAKEWPARAM(id,code), 0);
00480         else
00481             return 1;
00482     }
00483 
00484     return 0;
00485 }
00486 
00487 
00488 void DesktopBar::ShowOrHideStartMenu()
00489 {
00490     if (_startMenuRoot)
00491     {
00492         // set the Button, if not set
00493         if (!Button_GetState(_hwndStartButton))
00494             Button_SetState(_hwndStartButton, TRUE);
00495 
00496         if (_startMenuRoot->IsStartMenuVisible())
00497             _startMenuRoot->CloseStartMenu();
00498         else
00499             _startMenuRoot->TrackStartmenu();
00500 
00501         // StartMenu was closed, release button state
00502         Button_SetState(_hwndStartButton, false);
00503     }
00504 }
00505 
00506 
00508 struct TrayNotifyCDS {
00509     DWORD   cookie;
00510     DWORD   notify_code;
00511     NOTIFYICONDATA nicon_data;
00512 };
00513 
00514 LRESULT DesktopBar::ProcessCopyData(COPYDATASTRUCT* pcd)
00515 {
00516      // Is this a tray notification message?
00517     if (pcd->dwData == 1) {
00518         TrayNotifyCDS* ptr = (TrayNotifyCDS*) pcd->lpData;
00519 
00520         NotifyArea* notify_area = GET_WINDOW(NotifyArea, _hwndNotify);
00521 
00522         if (notify_area)
00523             return notify_area->ProcessTrayNotification(ptr->notify_code, &ptr->nicon_data);
00524     }
00525 
00526     return FALSE;
00527 }
00528 
00529 
00530 void DesktopBar::ControlResize(WPARAM wparam, LPARAM lparam)
00531 {
00532     PRECT dragRect = (PRECT) lparam;
00533     //int screenWidth = GetSystemMetrics(SM_CXSCREEN);
00534     int screenHeight = GetSystemMetrics(SM_CYSCREEN);
00535 
00537 
00538     switch(wparam) {
00539       case WMSZ_BOTTOM: 
00540         break;
00541 
00542       case WMSZ_TOP:    // Taskbar is at the bottom of the screen
00543         dragRect->top = screenHeight - (((screenHeight - dragRect->top) + DESKTOPBARBAR_HEIGHT/2) / DESKTOPBARBAR_HEIGHT) * DESKTOPBARBAR_HEIGHT;
00544         if (dragRect->top < screenHeight / 2)
00545             dragRect->top = screenHeight - (screenHeight/2 / DESKTOPBARBAR_HEIGHT * DESKTOPBARBAR_HEIGHT);
00546         else if (dragRect->top > screenHeight - 5)
00547             dragRect->top = screenHeight - 5;
00548         break;
00549 
00550       case WMSZ_RIGHT:  
00551         break;
00552 
00553       case WMSZ_LEFT:   
00554         break;
00555     }
00556 }
00557 
00558 
00559 #ifdef __REACTOS__
00560 
00561 void DesktopBar::AddTrayIcons()
00562 {
00563     _trayIcon.Add(SmallIcon(IDI_SPEAKER), ResString(IDS_VOLUME));
00564 }
00565 
00566 void DesktopBar::TrayClick(UINT id, int btn)
00567 {
00568     switch(id) {
00569       case ID_TRAY_VOLUME:
00570         if (btn == TRAYBUTTON_LEFT)
00571             SetTimer(_hwnd, ID_TRAY_VOLUME, 500, NULL); // wait a bit to correctly handle double clicks
00572         else {
00573             PopupMenu menu(IDM_VOLUME);
00574             SetMenuDefaultItem(menu, 0, MF_BYPOSITION);
00575             menu.TrackPopupMenuAtPos(_hwnd, GetMessagePos());
00576         }
00577         break;
00578     }
00579 }
00580 
00581 void DesktopBar::TrayDblClick(UINT id, int btn)
00582 {
00583     switch(id) {
00584       case ID_TRAY_VOLUME:
00585         KillTimer(_hwnd, ID_TRAY_VOLUME);   // finish one-click timer
00586         launch_file(_hwnd, TEXT("sndvol32.exe"), SW_SHOWNORMAL);    // launch volume control application
00587         break;
00588     }
00589 }
00590 
00591 #endif

Generated on Sun May 27 2012 04:18:36 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.