ReactOS  0.4.14-dev-608-gd495a4f
CMainToolbar Class Reference
Inheritance diagram for CMainToolbar:
Collaboration diagram for CMainToolbar:

Public Member Functions

 CMainToolbar ()
 
VOID OnGetDispInfo (LPTOOLTIPTEXT lpttt)
 
HWND Create (HWND hwndParent)
 
VOID HideButtonCaption ()
 
VOID ShowButtonCaption ()
 
DWORD GetMaxButtonsWidth () const
 
- Public Member Functions inherited from CUiWindow< CToolbar<> >
virtual CUiBoxAsBox ()
 
HWND GetWindow ()
 
virtual VOID ComputeMinimalSize (SIZE *size)
 
virtual VOID ComputeContentBounds (RECT *rect)
 
virtual DWORD_PTR CountSizableChildren ()
 
virtual HDWP OnParentSize (RECT parentRect, HDWP hDwp)
 
virtual ~CUiWindow ()
 
VOID GetWindowTextW (ATL::CStringW &szText)
 
- Public Member Functions inherited from CUiPrimitive
virtual ~CUiPrimitive ()
 
- Public Member Functions inherited from CToolbar<>
HWND Create (HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
 
DWORD SetButtonStructSize ()
 
HWND GetTooltip ()
 
DWORD SetTooltip (HWND hWndTooltip)
 
INT GetHotItem ()
 
DWORD SetHotItem (INT item)
 
int GetButtonCount ()
 
DWORD GetButton (int index, TBBUTTON *btn)
 
DWORD AddButton (TBBUTTON *btn)
 
DWORD AddButtons (int count, TBBUTTON *buttons)
 
DWORD InsertButton (int insertAt, TBBUTTON *btn)
 
DWORD MoveButton (int oldIndex, int newIndex)
 
DWORD DeleteButton (int index)
 
DWORD GetButtonInfo (int cmdId, TBBUTTONINFO *info)
 
DWORD SetButtonInfo (int cmdId, TBBUTTONINFO *info)
 
DWORD CheckButton (int cmdId, BOOL bCheck)
 
DWORD GetButtonSize ()
 
DWORD SetButtonSize (int w, int h)
 
DWORD AutoSize ()
 
DWORD GetMaxSize (LPSIZE size)
 
DWORD GetIdealSize (BOOL useHeight, LPSIZE size)
 
DWORD GetMetrics (TBMETRICS *tbm)
 
DWORD SetMetrics (TBMETRICS *tbm)
 
DWORD GetItemRect (int index, LPRECT prcItem)
 
DWORD SetRedraw (BOOL bEnable)
 
DWORD GetPadding ()
 
DWORD SetPadding (int x, int y)
 
HIMAGELIST SetImageList (HIMAGELIST himl)
 
INT HitTest (PPOINT ppt)
 
DWORD_PTRGetItemData (int index)
 
DWORD SetItemData (int index, DWORD_PTR *data)
 

Private Member Functions

VOID AddImageToImageList (HIMAGELIST hImageList, UINT ImageIndex)
 
HIMAGELIST InitImageList ()
 

Private Attributes

const INT m_iToolbarHeight
 
DWORD m_dButtonsWidthMax
 
WCHAR szInstallBtn [MAX_STR_LEN]
 
WCHAR szUninstallBtn [MAX_STR_LEN]
 
WCHAR szModifyBtn [MAX_STR_LEN]
 
WCHAR szSelectAll [MAX_STR_LEN]
 

Additional Inherited Members

- Public Attributes inherited from CUiBox
CUiMargin m_Margin
 
CUiAlignment m_HorizontalAlignment
 
CUiAlignment m_VerticalAlignment
 
- Protected Member Functions inherited from CUiBox
 CUiBox ()
 
virtual VOID ComputeRect (RECT parentRect, RECT currentRect, RECT *newRect)
 
- Protected Attributes inherited from CUiPrimitive
CUiPrimitivem_Parent
 

Detailed Description

Definition at line 260 of file gui.cpp.

Constructor & Destructor Documentation

◆ CMainToolbar()

CMainToolbar::CMainToolbar ( )
inline

Definition at line 317 of file gui.cpp.

317  : m_iToolbarHeight(24)
318  {
319  }
const INT m_iToolbarHeight
Definition: gui.cpp:263

Member Function Documentation

◆ AddImageToImageList()

VOID CMainToolbar::AddImageToImageList ( HIMAGELIST  hImageList,
UINT  ImageIndex 
)
inlineprivate

Definition at line 271 of file gui.cpp.

272  {
273  HICON hImage;
274 
275  if (!(hImage = (HICON) LoadImageW(hInst,
276  MAKEINTRESOURCE(ImageIndex),
277  IMAGE_ICON,
280  0)))
281  {
282  /* TODO: Error message */
283  }
284 
285  ImageList_AddIcon(hImageList, hImage);
286  DeleteObject(hImage);
287  }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
const INT m_iToolbarHeight
Definition: gui.cpp:263
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
HINSTANCE hInst
Definition: dxdiag.c:13

Referenced by InitImageList().

◆ Create()

HWND CMainToolbar::Create ( HWND  hwndParent)
inline

Definition at line 357 of file gui.cpp.

358  {
359  /* Create buttons */
360  TBBUTTON Buttons[] =
361  { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
366  { -1, 0, TBSTATE_ENABLED, BTNS_SEP, { 0 }, 0, 0 },
367  { 4, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 },
368  { 5, ID_RESETDB, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 },
369  { -1, 0, TBSTATE_ENABLED, BTNS_SEP, { 0 }, 0, 0 },
370  { 6, ID_SETTINGS, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 },
371  { 7, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 },
372  };
373 
378 
381  0, 0, 0, 0,
382  hwndParent,
383  0, hInst, NULL);
384 
385  if (!m_hWnd)
386  {
387  /* TODO: Show error message */
388  return FALSE;
389  }
390 
393 
394  /* Set image list */
395  HIMAGELIST hImageList = InitImageList();
396 
397  if (!hImageList)
398  {
399  /* TODO: Show error message */
400  return FALSE;
401  }
402 
403  ImageList_Destroy(SetImageList(hImageList));
404 
406 
407  /* Remember ideal width to use as a max width of buttons */
408  SIZE size;
411 
412  return m_hWnd;
413  }
#define ID_REFRESH
Definition: resource.h:18
#define ID_SETTINGS
Definition: resource.h:78
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:1009
#define IDS_SELECT_ALL
Definition: resource.h:111
#define _countof(array)
Definition: fontsub.cpp:30
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:939
#define BTNS_AUTOSIZE
Definition: commctrl.h:1000
#define ID_RESETDB
Definition: resource.h:81
#define WS_CHILD
Definition: pedump.c:617
DWORD GetIdealSize(BOOL useHeight, LPSIZE size)
Definition: rosctrls.h:381
int32_t INT_PTR
Definition: typedefs.h:62
DWORD SetButtonStructSize()
Definition: rosctrls.h:284
#define ID_UNINSTALL
Definition: resource.h:72
DWORD m_dButtonsWidthMax
Definition: gui.cpp:264
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define IDS_INSTALL
Definition: resource.h:9
#define BTNS_BUTTON
Definition: commctrl.h:994
#define IDS_MODIFY
Definition: resource.h:90
DWORD AddButtons(int count, TBBUTTON *buttons)
Definition: rosctrls.h:325
#define IDS_UNINSTALL
Definition: resource.h:89
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:417
WCHAR szSelectAll[MAX_STR_LEN]
Definition: gui.cpp:269
WCHAR szModifyBtn[MAX_STR_LEN]
Definition: gui.cpp:268
static const TBBUTTON Buttons[]
Definition: mplay32.c:41
GLsizeiptr size
Definition: glext.h:5919
#define BTNS_SEP
Definition: commctrl.h:995
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:985
#define ID_CHECK_ALL
Definition: resource.h:82
WCHAR szInstallBtn[MAX_STR_LEN]
Definition: gui.cpp:266
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define ID_EXIT
Definition: resource.h:10
HINSTANCE hInst
Definition: dxdiag.c:13
HIMAGELIST InitImageList()
Definition: gui.cpp:289
#define ID_INSTALL
Definition: resource.h:71
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBSTATE_ENABLED
Definition: commctrl.h:970
WCHAR szUninstallBtn[MAX_STR_LEN]
Definition: gui.cpp:267
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_LIST
Definition: commctrl.h:989
#define ID_MODIFY
Definition: resource.h:75
#define TBSTYLE_FLAT
Definition: commctrl.h:988
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1186

Referenced by CMainWindow::CreateToolbar().

◆ GetMaxButtonsWidth()

DWORD CMainToolbar::GetMaxButtonsWidth ( ) const
inline

Definition at line 427 of file gui.cpp.

428  {
429  return m_dButtonsWidthMax;
430  }
DWORD m_dButtonsWidthMax
Definition: gui.cpp:264

Referenced by CMainWindow::OnSize().

◆ HideButtonCaption()

VOID CMainToolbar::HideButtonCaption ( )
inline

Definition at line 415 of file gui.cpp.

416  {
417  DWORD dCurrentExStyle = (DWORD) SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
419  }
#define DWORD
Definition: nt_native.h:44
#define TB_GETEXTENDEDSTYLE
Definition: commctrl.h:1187
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBSTYLE_EX_MIXEDBUTTONS
Definition: commctrl.h:1008
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1186

Referenced by CMainWindow::OnSize().

◆ InitImageList()

HIMAGELIST CMainToolbar::InitImageList ( )
inlineprivate

Definition at line 289 of file gui.cpp.

290  {
291  HIMAGELIST hImageList;
292 
293  /* Create the toolbar icon image list */
294  hImageList = ImageList_Create(m_iToolbarHeight,//GetSystemMetrics(SM_CXSMICON),
295  m_iToolbarHeight,//GetSystemMetrics(SM_CYSMICON),
297  1, 1);
298  if (!hImageList)
299  {
300  /* TODO: Error message */
301  return NULL;
302  }
303 
304  AddImageToImageList(hImageList, IDI_INSTALL);
305  AddImageToImageList(hImageList, IDI_UNINSTALL);
306  AddImageToImageList(hImageList, IDI_MODIFY);
307  AddImageToImageList(hImageList, IDI_CHECK_ALL);
308  AddImageToImageList(hImageList, IDI_REFRESH);
309  AddImageToImageList(hImageList, IDI_UPDATE_DB);
310  AddImageToImageList(hImageList, IDI_SETTINGS);
311  AddImageToImageList(hImageList, IDI_EXIT);
312 
313  return hImageList;
314  }
#define IDI_UNINSTALL
Definition: resource.h:7
INT GetSystemColorDepth()
Definition: gui.cpp:29
#define IDI_UPDATE_DB
Definition: resource.h:14
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
const INT m_iToolbarHeight
Definition: gui.cpp:263
smooth NULL
Definition: ftsmooth.c:416
VOID AddImageToImageList(HIMAGELIST hImageList, UINT ImageIndex)
Definition: gui.cpp:271
#define IDI_MODIFY
Definition: resource.h:9
#define ILC_MASK
Definition: commctrl.h:347
#define IDI_EXIT
Definition: resource.h:5
#define IDI_INSTALL
Definition: resource.h:6
#define IDI_CHECK_ALL
Definition: resource.h:15
#define IDI_REFRESH
Definition: resource.h:10
#define IDI_SETTINGS
Definition: resource.h:8

Referenced by Create().

◆ OnGetDispInfo()

VOID CMainToolbar::OnGetDispInfo ( LPTOOLTIPTEXT  lpttt)
inline

Definition at line 321 of file gui.cpp.

322  {
323  UINT idButton = (UINT) lpttt->hdr.idFrom;
324 
325  switch (idButton)
326  {
327  case ID_EXIT:
328  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_EXIT);
329  break;
330 
331  case ID_INSTALL:
332  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_INSTALL);
333  break;
334 
335  case ID_UNINSTALL:
336  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UNINSTALL);
337  break;
338 
339  case ID_MODIFY:
340  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_MODIFY);
341  break;
342 
343  case ID_SETTINGS:
344  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_SETTINGS);
345  break;
346 
347  case ID_REFRESH:
348  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_REFRESH);
349  break;
350 
351  case ID_RESETDB:
352  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UPDATE_DB);
353  break;
354  }
355  }
#define ID_REFRESH
Definition: resource.h:18
#define ID_SETTINGS
Definition: resource.h:78
#define IDS_TOOLTIP_EXIT
Definition: resource.h:123
#define ID_RESETDB
Definition: resource.h:81
#define ID_UNINSTALL
Definition: resource.h:72
switch(r->id)
Definition: btrfs.c:2904
#define IDS_TOOLTIP_MODIFY
Definition: resource.h:120
#define IDS_TOOLTIP_REFRESH
Definition: resource.h:50
#define IDS_TOOLTIP_UNINSTALL
Definition: resource.h:119
#define ID_EXIT
Definition: resource.h:10
#define ID_INSTALL
Definition: resource.h:71
#define IDS_TOOLTIP_UPDATE_DB
Definition: resource.h:124
#define IDS_TOOLTIP_SETTINGS
Definition: resource.h:121
unsigned int UINT
Definition: ndis.h:50
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ID_MODIFY
Definition: resource.h:75
#define IDS_TOOLTIP_INSTALL
Definition: resource.h:118

Referenced by CMainWindow::ProcessWindowMessage().

◆ ShowButtonCaption()

VOID CMainToolbar::ShowButtonCaption ( )
inline

Definition at line 421 of file gui.cpp.

422  {
423  DWORD dCurrentExStyle = (DWORD) SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
425  }
#define DWORD
Definition: nt_native.h:44
#define TB_GETEXTENDEDSTYLE
Definition: commctrl.h:1187
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBSTYLE_EX_MIXEDBUTTONS
Definition: commctrl.h:1008
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1186

Referenced by CMainWindow::OnSize().

Member Data Documentation

◆ m_dButtonsWidthMax

DWORD CMainToolbar::m_dButtonsWidthMax
private

Definition at line 264 of file gui.cpp.

Referenced by Create(), and GetMaxButtonsWidth().

◆ m_iToolbarHeight

const INT CMainToolbar::m_iToolbarHeight
private

Definition at line 263 of file gui.cpp.

Referenced by AddImageToImageList(), and InitImageList().

◆ szInstallBtn

WCHAR CMainToolbar::szInstallBtn[MAX_STR_LEN]
private

Definition at line 266 of file gui.cpp.

Referenced by Create().

◆ szModifyBtn

WCHAR CMainToolbar::szModifyBtn[MAX_STR_LEN]
private

Definition at line 268 of file gui.cpp.

Referenced by Create().

◆ szSelectAll

WCHAR CMainToolbar::szSelectAll[MAX_STR_LEN]
private

Definition at line 269 of file gui.cpp.

Referenced by Create().

◆ szUninstallBtn

WCHAR CMainToolbar::szUninstallBtn[MAX_STR_LEN]
private

Definition at line 267 of file gui.cpp.

Referenced by Create().


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