ReactOS  0.4.12-dev-75-g00dd17e
QuickLaunchBar Struct Reference

quick launch bar window More...

#include <quicklaunch.h>

Inheritance diagram for QuickLaunchBar:
Collaboration diagram for QuickLaunchBar:

Public Types

typedef ExtContextMenuHandlerT< SubclassedWindowsuper
 
- Public Types inherited from ExtContextMenuHandlerT< SubclassedWindow >
typedef SubclassedWindow super
 
- Public Types inherited from SubclassedWindow
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

 QuickLaunchBar (HWND hwnd)
 
 ~QuickLaunchBar ()
 
- Public Member Functions inherited from ExtContextMenuHandlerT< SubclassedWindow >
 ExtContextMenuHandlerT (HWND hwnd)
 
 ExtContextMenuHandlerT (HWND hwnd, const PARA &info)
 
LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
- Public Member Functions inherited from SubclassedWindow
 SubclassedWindow (HWND)
 
- 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 (HWND hwndParent)
 
- 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 WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
int Command (int id, int code)
 
int Notify (int id, NMHDR *pnmh)
 
void AddShortcuts ()
 
void AddButton (int id, HBITMAP hbmp, LPCTSTR name, Entry *entry, int flags=TBSTATE_ENABLED)
 
void UpdateDesktopButtons (int desktop_idx)
 
- Protected Member Functions inherited from Window
virtual LRESULT Init (LPCREATESTRUCT pcs)
 

Protected Attributes

ShellDirectory_dir
 
int _next_id
 
QuickLaunchMap _entries
 
int _btn_dist
 
int _size
 
- Protected Attributes inherited from ExtContextMenuHandlerT< SubclassedWindow >
CtxMenuInterfaces _cm_ifs
 
- Protected Attributes inherited from SubclassedWindow
WNDPROC _orgWndProc
 

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 SubclassedWindow
static LRESULT CALLBACK SubclassedWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
- 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

quick launch bar window

Definition at line 60 of file quicklaunch.h.

Member Typedef Documentation

◆ super

Constructor & Destructor Documentation

◆ QuickLaunchBar()

QuickLaunchBar::QuickLaunchBar ( HWND  hwnd)

Definition at line 49 of file quicklaunch.cpp.

Referenced by Create().

50  : super(hwnd)
51 {
52  CONTEXT("QuickLaunchBar::QuickLaunchBar()");
53 
54  _dir = NULL;
56  _btn_dist = 20;
57  _size = 0;
58 
59  HWND hwndToolTip = (HWND) SendMessage(hwnd, TB_GETTOOLTIPS, 0, 0);
60 
61  SetWindowStyle(hwndToolTip, GetWindowStyle(hwndToolTip)|TTS_ALWAYSTIP);
62 
63  // delay refresh to some time later
64  PostMessage(hwnd, PM_REFRESH, 0, 0);
65 }
struct _CONTEXT CONTEXT
#define IDC_FIRST_QUICK_ID
Definition: quicklaunch.h:36
HANDLE HWND
Definition: compat.h:13
#define SetWindowStyle(hwnd, val)
Definition: utility.h:153
ShellDirectory * _dir
Definition: quicklaunch.h:74
#define GetWindowStyle(hwnd)
Definition: windowsx.h:290
#define TTS_ALWAYSTIP
Definition: commctrl.h:1727
smooth NULL
Definition: ftsmooth.c:416
#define PostMessage
Definition: winuser.h:5698
ExtContextMenuHandlerT< SubclassedWindow > super
Definition: quicklaunch.h:62
#define TB_GETTOOLTIPS
Definition: commctrl.h:1108
#define PM_REFRESH
Definition: explorer.h:69
#define SendMessage
Definition: winuser.h:5709

◆ ~QuickLaunchBar()

QuickLaunchBar::~QuickLaunchBar ( )

Definition at line 67 of file quicklaunch.cpp.

68 {
69  delete _dir;
70 }
ShellDirectory * _dir
Definition: quicklaunch.h:74

Member Function Documentation

◆ AddButton()

void QuickLaunchBar::AddButton ( int  id,
HBITMAP  hbmp,
LPCTSTR  name,
Entry entry,
int  flags = TBSTATE_ENABLED 
)
protected

Definition at line 174 of file quicklaunch.cpp.

Referenced by AddShortcuts().

175 {
176  TBADDBITMAP ab = {0, (UINT_PTR)hbmp};
177  int bmp_idx = SendMessage(_hwnd, TB_ADDBITMAP, 1, (LPARAM)&ab);
178 
179  QuickLaunchEntry qle;
180 
181  qle._hbmp = hbmp;
182  qle._title = name;
183  qle._entry = entry;
184 
185  _entries[id] = qle;
186 
187  TBBUTTON btn = {0, 0, (BYTE)flags, BTNS_BUTTON|BTNS_NOPREFIX, {0, 0}, 0, 0};
188 
189  btn.idCommand = id;
190  btn.iBitmap = bmp_idx;
191 
192  SendMessage(_hwnd, TB_INSERTBUTTON, INT_MAX, (LPARAM)&btn);
193 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
#define BTNS_NOPREFIX
Definition: commctrl.h:975
#define INT_MAX
Definition: limits.h:40
uint8_t entry
Definition: isohybrid.c:63
#define TB_INSERTBUTTON
Definition: commctrl.h:1240
#define BTNS_BUTTON
Definition: commctrl.h:968
LONG_PTR LPARAM
Definition: windef.h:208
UCHAR ab[sizeof("Hello World!") -1]
Definition: fdi.c:114
int iBitmap
Definition: commctrl.h:919
QuickLaunchMap _entries
Definition: quicklaunch.h:77
#define TB_ADDBITMAP
Definition: commctrl.h:1026
GLbitfield flags
Definition: glext.h:7161
int idCommand
Definition: commctrl.h:920
unsigned char BYTE
Definition: ntddk_ex.h:96
#define SendMessage
Definition: winuser.h:5709
GLenum GLuint id
Definition: glext.h:5579
HBITMAP hbmp
Definition: msvc.h:60
quick launch bar shortcut
Definition: quicklaunch.h:43
GLuint const GLchar * name
Definition: glext.h:6031

◆ AddShortcuts()

void QuickLaunchBar::AddShortcuts ( )
protected
Todo:
perhaps also look into CSIDL_COMMON_APPDATA ?

Definition at line 90 of file quicklaunch.cpp.

Referenced by WndProc().

91 {
92  CONTEXT("QuickLaunchBar::AddShortcuts()");
93 
94  WaitCursor wait;
95 
96  try {
98 
99  SpecialFolderFSPath app_data(CSIDL_APPDATA, _hwnd);
100 
101  _stprintf(path, TEXT("%s\\")QUICKLAUNCH_FOLDER, (LPCTSTR)app_data);
102 
104  _dir = new ShellDirectory(GetDesktopFolder(), path, _hwnd);
105 
107 
108  // immediatelly extract the shortcut icons
109  for(Entry*entry=_dir->_down; entry; entry=entry->_next)
110  entry->_icon_id = entry->safe_extract_icon(ICF_NORMAL);
111  } catch(COMException&) {
112  return;
113  }
114 
115 
116  ShellFolder desktop_folder;
117  WindowCanvas canvas(_hwnd);
118 
121 
124 
125  TBBUTTON sep = {0, -1, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0};
126  SendMessage(_hwnd, TB_INSERTBUTTON, INT_MAX, (LPARAM)&sep);
127 
128  int cur_desktop = g_Globals._desktops._current_desktop;
129  ResString desktop_fmt(IDS_DESKTOP_NUM);
130 
131  HDC hdc = CreateCompatibleDC(canvas);
132  DWORD size = SendMessage(_hwnd, TB_GETBUTTONSIZE, 0, 0);
133  int cx = LOWORD(size);
134  int cy = HIWORD(size);
135  RECT rect = {0, 0, cx, cy};
136  RECT textRect = {0, 0, cx-7, cy-7};
137 
138  for(int i=0; i<DESKTOP_COUNT; ++i) {
139  HBITMAP hbmp = CreateCompatibleBitmap(canvas, cx, cy);
140  HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
141 
142  FontSelection font(hdc, GetStockFont(ANSI_VAR_FONT));
143  FmtString num_txt(TEXT("%d"), i+1);
144  TextColor color(hdc, RGB(64,64,64));
145  BkMode mode(hdc, TRANSPARENT);
147  DrawText(hdc, num_txt, num_txt.length(), &textRect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
148 
149  SelectBitmap(hdc, hbmp_old);
150 
151  AddButton(ID_SWITCH_DESKTOP_1+i, hbmp, FmtString(desktop_fmt, i+1), NULL, cur_desktop==i?TBSTATE_ENABLED|TBSTATE_PRESSED:TBSTATE_ENABLED);
152  }
153  DeleteDC(hdc);
154 
155  for(Entry*entry=_dir->_down; entry; entry=entry->_next) {
156  // hide files like "desktop.ini"
157  if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
158  continue;
159 
160  // hide subfolders
161  if (!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
162  HBITMAP hbmp = g_Globals._icon_cache.get_icon(entry->_icon_id).create_bitmap(bk_color, bk_brush, canvas);
163 
164  AddButton(_next_id++, hbmp, entry->_display_name, entry); //entry->_etype==ET_SHELL? desktop_folder.get_name(static_cast<ShellEntry*>(entry)->_pidl): entry->_display_name);
165  }
166  }
167 
168  _btn_dist = LOWORD(SendMessage(_hwnd, TB_GETBUTTONSIZE, 0, 0));
170 
172 }
#define HDC
Definition: msvc.h:22
struct _CONTEXT CONTEXT
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
file system path of special folder
#define HBITMAP
Definition: msvc.h:28
#define INT_MAX
Definition: limits.h:40
#define GetStockFont(i)
Definition: windowsx.h:283
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
Definition: mk_font.cpp:20
void AddButton(int id, HBITMAP hbmp, LPCTSTR name, Entry *entry, int flags=TBSTATE_ENABLED)
uint8_t entry
Definition: isohybrid.c:63
shell folder entry
Definition: shellfs.h:53
IShellFolder smart pointer.
Definition: shellclasses.h:593
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define TB_INSERTBUTTON
Definition: commctrl.h:1240
#define ID_MINIMIZE_ALL
Definition: resource.h:212
DWORD WINAPI GetSysColor(_In_ int)
& rect
Definition: startmenu.cpp:1413
#define DrawText
Definition: winuser.h:5637
size_type size() const
Definition: _map.h:172
ShellDirectory * _dir
Definition: quicklaunch.h:74
Exception with context information.
Definition: shellclasses.h:113
#define QUICKLAUNCH_FOLDER
Definition: quicklaunch.h:39
GLenum GLclampf GLint i
Definition: glfuncs.h:14
COLORREF bk_color
Definition: startmenu.cpp:1409
int _current_desktop
Definition: globals.h:253
GLuint color
Definition: glext.h:6243
LONG_PTR LPARAM
Definition: windef.h:208
#define TRANSPARENT
Definition: wingdi.h:948
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
HDC hdc
Definition: msvc.h:53
RECT textRect
Definition: startmenu.cpp:1392
smooth NULL
Definition: ftsmooth.c:416
#define DESKTOP_COUNT
Definition: globals.h:238
#define DT_VCENTER
Definition: winuser.h:543
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define IDS_MINIMIZE_ALL
Definition: resource.h:37
#define TB_GETBUTTONSIZE
Definition: commctrl.h:1130
#define PM_RESIZE_CHILDREN
Definition: explorer.h:66
char TCHAR
Definition: xmlstorage.h:189
#define TBSTATE_PRESSED
Definition: commctrl.h:943
#define IDS_TITLE
Definition: resource.h:30
GLsizeiptr size
Definition: glext.h:5919
QuickLaunchMap _entries
Definition: quicklaunch.h:77
#define BTNS_SEP
Definition: commctrl.h:969
void smart_scan(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:353
Entry * _down
Definition: entries.h:93
#define CSIDL_APPDATA
Definition: shlobj.h:2013
#define RGB(r, g, b)
Definition: wingdi.h:2917
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SORT_NAME
Definition: xpath.c:441
#define ID_EXPLORE
Definition: resource.h:213
#define COLOR_BTNFACE
Definition: winuser.h:918
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
const Icon & get_icon(int icon_id)
Definition: explorer.cpp:625
GLenum mode
Definition: glext.h:6217
ShellFolder & GetDesktopFolder()
BOOL RecursiveCreateDirectory(LPCTSTR path_in)
Definition: utility.cpp:394
#define _stprintf
Definition: utility.h:124
HBITMAP create_bitmap(COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) const
Definition: explorer.cpp:285
#define DT_SINGLELINE
Definition: winuser.h:540
HWND WINAPI GetParent(_In_ HWND)
#define TEXT(s)
Definition: k32.h:26
#define ANSI_VAR_FONT
Definition: wingdi.h:905
BOOL WINAPI DeleteDC(_In_ HDC)
Definition: services.c:325
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define SelectBitmap(hdc, hbm)
Definition: windowsx.h:484
_Out_opt_ int * cx
Definition: commctrl.h:570
#define SendMessage
Definition: winuser.h:5709
#define TBSTATE_ENABLED
Definition: commctrl.h:944
#define HIWORD(l)
Definition: typedefs.h:246
Desktops _desktops
Definition: globals.h:291
#define DT_CENTER
Definition: winuser.h:527
HBRUSH bk_brush
Definition: startmenu.cpp:1410
convenient loading of string resources
Definition: globals.h:303
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
DWORD COLORREF
Definition: windef.h:290
HBITMAP hbmp
Definition: msvc.h:60
#define IDS_DESKTOP_NUM
Definition: resource.h:38
#define LOWORD(l)
Definition: pedump.c:82
base of all file and directory entries
Definition: entries.h:82
#define ID_SWITCH_DESKTOP_1
Definition: resource.h:225
IconCache _icon_cache
Definition: globals.h:285

◆ Command()

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

Reimplemented from SubclassedWindow.

Definition at line 266 of file quicklaunch.cpp.

267 {
268  CONTEXT("QuickLaunchBar::Command()");
269 
270  if ((id&~0xFF) == IDC_FIRST_QUICK_ID) {
271  QuickLaunchEntry& qle = _entries[id];
272 
273  if (qle._entry) {
274  qle._entry->launch_entry(_hwnd);
275  return 0;
276  }
277  }
278 
279  return 0; // Don't return 1 to avoid recursion with DesktopBar::Command()
280 }
struct _CONTEXT CONTEXT
#define IDC_FIRST_QUICK_ID
Definition: quicklaunch.h:36
QuickLaunchMap _entries
Definition: quicklaunch.h:77
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL)
Definition: entries.cpp:443
GLenum GLuint id
Definition: glext.h:5579
quick launch bar shortcut
Definition: quicklaunch.h:43

◆ Create()

HWND QuickLaunchBar::Create ( HWND  hwndParent)
static

Definition at line 72 of file quicklaunch.cpp.

Referenced by DesktopBar::Init().

73 {
74  CONTEXT("QuickLaunchBar::Create()");
75 
76  ClientRect clnt(hwndParent);
77 
78  HWND hwnd = CreateToolbarEx(hwndParent,
82  IDW_QUICKLAUNCHBAR, 0, 0, 0, NULL, 0, 0, 0, 16, 16, sizeof(TBBUTTON));
83 
84  if (hwnd)
85  new QuickLaunchBar(hwnd);
86 
87  return hwnd;
88 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
QuickLaunchBar(HWND hwnd)
Definition: quicklaunch.cpp:49
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
struct _CONTEXT CONTEXT
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD style, UINT wID, INT nBitmaps, HINSTANCE hBMInst, UINT_PTR wBMID, LPCTBBUTTON lpButtons, INT iNumButtons, INT dxButton, INT dyButton, INT dxBitmap, INT dyBitmap, UINT uStructSize)
Definition: commctrl.c:929
#define CCS_NODIVIDER
Definition: commctrl.h:2218
smooth NULL
Definition: ftsmooth.c:416
#define CCS_TOP
Definition: commctrl.h:2212
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2216
#define IDW_QUICKLAUNCHBAR
Definition: quicklaunch.h:32
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:959
#define CCS_NORESIZE
Definition: commctrl.h:2215
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:960
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_FLAT
Definition: commctrl.h:962

◆ Notify()

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

Reimplemented from SubclassedWindow.

Definition at line 282 of file quicklaunch.cpp.

283 {
284  switch(pnmh->code) {
285  case TTN_GETDISPINFO: {
286  NMTTDISPINFO* ttdi = (NMTTDISPINFO*) pnmh;
287 
288  int id = ttdi->hdr.idFrom;
289  ttdi->lpszText = _entries[id]._title.str();
290 #ifdef TTF_DI_SETITEM
291  ttdi->uFlags |= TTF_DI_SETITEM;
292 #endif
293 
294  // enable multiline tooltips (break at CR/LF and for very long one-line strings)
295  SendMessage(pnmh->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 400);
296 
297  break;}
298 
299  return super::Notify(id, pnmh);
300  }
301 
302  return 0;
303 }
UINT code
Definition: winuser.h:3112
#define NMTTDISPINFO
Definition: commctrl.h:1884
UINT_PTR idFrom
Definition: winuser.h:3111
#define TTN_GETDISPINFO
Definition: commctrl.h:1848
#define TTF_DI_SETITEM
Definition: commctrl.h:1742
QuickLaunchMap _entries
Definition: quicklaunch.h:77
#define TTM_SETMAXTIPWIDTH
Definition: commctrl.h:1789
HWND hwndFrom
Definition: winuser.h:3110
#define SendMessage
Definition: winuser.h:5709
GLenum GLuint id
Definition: glext.h:5579
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:353

◆ UpdateDesktopButtons()

void QuickLaunchBar::UpdateDesktopButtons ( int  desktop_idx)
protected

Definition at line 195 of file quicklaunch.cpp.

Referenced by WndProc().

196 {
197  for(int i=0; i<DESKTOP_COUNT; ++i) {
198  TBBUTTONINFO tbi = {sizeof(TBBUTTONINFO), TBIF_STATE, 0, 0, (BYTE)(desktop_idx==i? TBSTATE_ENABLED|TBSTATE_PRESSED: TBSTATE_ENABLED)};
199 
201  }
202 }
#define TB_SETBUTTONINFO
Definition: commctrl.h:1233
GLenum GLclampf GLint i
Definition: glfuncs.h:14
LONG_PTR LPARAM
Definition: windef.h:208
#define DESKTOP_COUNT
Definition: globals.h:238
#define TBSTATE_PRESSED
Definition: commctrl.h:943
#define TBIF_STATE
Definition: commctrl.h:1191
unsigned char BYTE
Definition: ntddk_ex.h:96
#define SendMessage
Definition: winuser.h:5709
#define TBSTATE_ENABLED
Definition: commctrl.h:944
#define ID_SWITCH_DESKTOP_1
Definition: resource.h:225
#define TBBUTTONINFO
Definition: commctrl.h:1224

◆ WndProc()

LRESULT QuickLaunchBar::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
protectedvirtual

Reimplemented from SubclassedWindow.

Definition at line 204 of file quicklaunch.cpp.

205 {
206  switch(nmsg) {
207  case PM_REFRESH:
208  AddShortcuts();
209  break;
210 
211  case PM_GET_WIDTH: {
212  // take line wrapping into account
213  int btns = SendMessage(_hwnd, TB_BUTTONCOUNT, 0, 0);
214  int rows = SendMessage(_hwnd, TB_GETROWS, 0, 0);
215 
216  if (rows<2 || rows==btns)
217  return _size;
218 
219  RECT rect;
220  int max_cx = 0;
221 
222  for(QuickLaunchMap::const_iterator it=_entries.begin(); it!=_entries.end(); ++it) {
223  SendMessage(_hwnd, TB_GETRECT, it->first, (LPARAM)&rect);
224 
225  if (rect.right > max_cx)
226  max_cx = rect.right;
227  }
228 
229  return max_cx;}
230 
231  case PM_UPDATE_DESKTOP:
233  break;
234 
235  case WM_CONTEXTMENU: {
236  TBBUTTON btn;
238  Point screen_pt(lparam), clnt_pt=screen_pt;
239  ScreenToClient(_hwnd, &clnt_pt);
240 
241  Entry* entry = NULL;
242  int idx = SendMessage(_hwnd, TB_HITTEST, 0, (LPARAM)&clnt_pt);
243 
244  if (idx>=0 &&
245  SendMessage(_hwnd, TB_GETBUTTON, idx, (LPARAM)&btn)!=-1 &&
246  (it=_entries.find(btn.idCommand))!=_entries.end()) {
247  entry = it->second._entry;
248  }
249 
250  if (entry) { // entry is NULL for desktop switch buttons
251  HRESULT hr = entry->do_context_menu(_hwnd, screen_pt, _cm_ifs);
252 
253  if (!SUCCEEDED(hr))
254  CHECKERROR(hr);
255  } else
256  goto def;
257  break;}
258 
259  default: def:
260  return super::WndProc(nmsg, wparam, lparam);
261  }
262 
263  return 0;
264 }
#define TB_HITTEST
Definition: commctrl.h:1238
#define TB_BUTTONCOUNT
Definition: commctrl.h:1080
#define PM_UPDATE_DESKTOP
Definition: quicklaunch.h:34
#define TB_GETROWS
Definition: commctrl.h:1112
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define TB_GETBUTTON
Definition: commctrl.h:1079
void AddShortcuts()
Definition: quicklaunch.cpp:90
uint8_t entry
Definition: isohybrid.c:63
#define PM_GET_WIDTH
Definition: explorer.h:67
#define TB_GETRECT
Definition: commctrl.h:1123
virtual HRESULT do_context_menu(HWND hwnd, const POINT &pos, CtxMenuInterfaces &cm_ifs)
Definition: entries.cpp:519
LONG right
Definition: windef.h:298
_Rep_type::const_iterator const_iterator
Definition: _map.h:86
& rect
Definition: startmenu.cpp:1413
LONG_PTR LPARAM
Definition: windef.h:208
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define CHECKERROR(hr)
Definition: shellclasses.h:162
QuickLaunchMap _entries
Definition: quicklaunch.h:77
LONG HRESULT
Definition: typedefs.h:77
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
_STLP_TEMPLATE_FOR_CONT_EXT iterator find(const _KT &__x)
Definition: _map.h:210
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#define PM_REFRESH
Definition: explorer.h:69
#define SendMessage
Definition: winuser.h:5709
void UpdateDesktopButtons(int desktop_idx)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
iterator begin()
Definition: _map.h:163
base of all file and directory entries
Definition: entries.h:82
_Rep_type::iterator iterator
Definition: _map.h:85
#define SUCCEEDED(hr)
Definition: intsafe.h:57
UINT WPARAM wparam
Definition: msvc.h:92
iterator end()
Definition: _map.h:165

Member Data Documentation

◆ _btn_dist

int QuickLaunchBar::_btn_dist
protected

Definition at line 78 of file quicklaunch.h.

Referenced by AddShortcuts(), and QuickLaunchBar().

◆ _dir

ShellDirectory* QuickLaunchBar::_dir
protected

Definition at line 74 of file quicklaunch.h.

Referenced by AddShortcuts(), QuickLaunchBar(), and ~QuickLaunchBar().

◆ _entries

QuickLaunchMap QuickLaunchBar::_entries
protected

Definition at line 77 of file quicklaunch.h.

Referenced by AddButton(), AddShortcuts(), Command(), Notify(), and WndProc().

◆ _next_id

int QuickLaunchBar::_next_id
protected

Definition at line 76 of file quicklaunch.h.

Referenced by AddShortcuts(), and QuickLaunchBar().

◆ _size

int QuickLaunchBar::_size
protected

Definition at line 79 of file quicklaunch.h.

Referenced by AddShortcuts(), QuickLaunchBar(), and WndProc().


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