ReactOS  0.4.13-dev-651-g5dbc677
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 208 of file gui.cpp.

Constructor & Destructor Documentation

◆ CMainToolbar()

CMainToolbar::CMainToolbar ( )
inline

Definition at line 265 of file gui.cpp.

265  : m_iToolbarHeight(24)
266  {
267  }
const INT m_iToolbarHeight
Definition: gui.cpp:211

Member Function Documentation

◆ AddImageToImageList()

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

Definition at line 219 of file gui.cpp.

220  {
221  HICON hImage;
222 
223  if (!(hImage = (HICON) LoadImageW(hInst,
224  MAKEINTRESOURCE(ImageIndex),
225  IMAGE_ICON,
228  0)))
229  {
230  /* TODO: Error message */
231  }
232 
233  ImageList_AddIcon(hImageList, hImage);
234  DeleteObject(hImage);
235  }
#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:211
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:537
HINSTANCE hInst
Definition: dxdiag.c:13

Referenced by InitImageList().

◆ Create()

HWND CMainToolbar::Create ( HWND  hwndParent)
inline

Definition at line 305 of file gui.cpp.

306  {
307  /* Create buttons */
308  TBBUTTON Buttons[] =
309  { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
314  { -1, 0, TBSTATE_ENABLED, BTNS_SEP, { 0 }, 0, 0 },
315  { 4, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 },
316  { 5, ID_RESETDB, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 },
317  { -1, 0, TBSTATE_ENABLED, BTNS_SEP, { 0 }, 0, 0 },
318  { 6, ID_SETTINGS, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 },
319  { 7, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 },
320  };
321 
326 
329  0, 0, 0, 0,
330  hwndParent,
331  0, hInst, NULL);
332 
333  if (!m_hWnd)
334  {
335  /* TODO: Show error message */
336  return FALSE;
337  }
338 
341 
342  /* Set image list */
343  HIMAGELIST hImageList = InitImageList();
344 
345  if (!hImageList)
346  {
347  /* TODO: Show error message */
348  return FALSE;
349  }
350 
351  ImageList_Destroy(SetImageList(hImageList));
352 
354 
355  /* Remember ideal width to use as a max width of buttons */
356  SIZE size;
359 
360  return m_hWnd;
361  }
#define ID_REFRESH
Definition: resource.h:18
#define ID_SETTINGS
Definition: resource.h:78
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:985
#define IDS_SELECT_ALL
Definition: resource.h:111
#define _countof(array)
Definition: fontsub.cpp:30
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:915
#define BTNS_AUTOSIZE
Definition: commctrl.h:976
#define ID_RESETDB
Definition: resource.h:81
#define WS_CHILD
Definition: pedump.c:617
DWORD GetIdealSize(BOOL useHeight, LPSIZE size)
Definition: rosctrls.h:368
int32_t INT_PTR
Definition: typedefs.h:62
DWORD SetButtonStructSize()
Definition: rosctrls.h:271
#define ID_UNINSTALL
Definition: resource.h:72
DWORD m_dButtonsWidthMax
Definition: gui.cpp:212
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:925
#define IDS_INSTALL
Definition: resource.h:9
#define BTNS_BUTTON
Definition: commctrl.h:970
#define IDS_MODIFY
Definition: resource.h:90
DWORD AddButtons(int count, TBBUTTON *buttons)
Definition: rosctrls.h:312
#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:404
WCHAR szSelectAll[MAX_STR_LEN]
Definition: gui.cpp:217
WCHAR szModifyBtn[MAX_STR_LEN]
Definition: gui.cpp:216
static const TBBUTTON Buttons[]
Definition: mplay32.c:41
GLsizeiptr size
Definition: glext.h:5919
#define BTNS_SEP
Definition: commctrl.h:971
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:961
#define ID_CHECK_ALL
Definition: resource.h:82
WCHAR szInstallBtn[MAX_STR_LEN]
Definition: gui.cpp:214
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:237
#define ID_INSTALL
Definition: resource.h:71
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBSTATE_ENABLED
Definition: commctrl.h:946
WCHAR szUninstallBtn[MAX_STR_LEN]
Definition: gui.cpp:215
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_LIST
Definition: commctrl.h:965
#define ID_MODIFY
Definition: resource.h:75
#define TBSTYLE_FLAT
Definition: commctrl.h:964
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1162

Referenced by CMainWindow::CreateToolbar().

◆ GetMaxButtonsWidth()

DWORD CMainToolbar::GetMaxButtonsWidth ( ) const
inline

Definition at line 375 of file gui.cpp.

376  {
377  return m_dButtonsWidthMax;
378  }
DWORD m_dButtonsWidthMax
Definition: gui.cpp:212

Referenced by CMainWindow::OnSize().

◆ HideButtonCaption()

VOID CMainToolbar::HideButtonCaption ( )
inline

Definition at line 363 of file gui.cpp.

364  {
365  DWORD dCurrentExStyle = (DWORD) SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
367  }
#define DWORD
Definition: nt_native.h:44
#define TB_GETEXTENDEDSTYLE
Definition: commctrl.h:1163
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:984
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1162

Referenced by CMainWindow::OnSize().

◆ InitImageList()

HIMAGELIST CMainToolbar::InitImageList ( )
inlineprivate

Definition at line 237 of file gui.cpp.

238  {
239  HIMAGELIST hImageList;
240 
241  /* Create the toolbar icon image list */
242  hImageList = ImageList_Create(m_iToolbarHeight,//GetSystemMetrics(SM_CXSMICON),
243  m_iToolbarHeight,//GetSystemMetrics(SM_CYSMICON),
245  1, 1);
246  if (!hImageList)
247  {
248  /* TODO: Error message */
249  return NULL;
250  }
251 
252  AddImageToImageList(hImageList, IDI_INSTALL);
253  AddImageToImageList(hImageList, IDI_UNINSTALL);
254  AddImageToImageList(hImageList, IDI_MODIFY);
255  AddImageToImageList(hImageList, IDI_CHECK_ALL);
256  AddImageToImageList(hImageList, IDI_REFRESH);
257  AddImageToImageList(hImageList, IDI_UPDATE_DB);
258  AddImageToImageList(hImageList, IDI_SETTINGS);
259  AddImageToImageList(hImageList, IDI_EXIT);
260 
261  return hImageList;
262  }
#define IDI_UNINSTALL
Definition: resource.h:7
INT GetSystemColorDepth()
Definition: gui.cpp:31
#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:801
const INT m_iToolbarHeight
Definition: gui.cpp:211
smooth NULL
Definition: ftsmooth.c:416
VOID AddImageToImageList(HIMAGELIST hImageList, UINT ImageIndex)
Definition: gui.cpp:219
#define IDI_MODIFY
Definition: resource.h:9
#define ILC_MASK
Definition: commctrl.h:336
#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 269 of file gui.cpp.

270  {
271  UINT idButton = (UINT) lpttt->hdr.idFrom;
272 
273  switch (idButton)
274  {
275  case ID_EXIT:
276  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_EXIT);
277  break;
278 
279  case ID_INSTALL:
280  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_INSTALL);
281  break;
282 
283  case ID_UNINSTALL:
284  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UNINSTALL);
285  break;
286 
287  case ID_MODIFY:
288  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_MODIFY);
289  break;
290 
291  case ID_SETTINGS:
292  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_SETTINGS);
293  break;
294 
295  case ID_REFRESH:
296  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_REFRESH);
297  break;
298 
299  case ID_RESETDB:
300  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UPDATE_DB);
301  break;
302  }
303  }
#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:2743
#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 369 of file gui.cpp.

370  {
371  DWORD dCurrentExStyle = (DWORD) SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
373  }
#define DWORD
Definition: nt_native.h:44
#define TB_GETEXTENDEDSTYLE
Definition: commctrl.h:1163
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:984
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1162

Referenced by CMainWindow::OnSize().

Member Data Documentation

◆ m_dButtonsWidthMax

DWORD CMainToolbar::m_dButtonsWidthMax
private

Definition at line 212 of file gui.cpp.

Referenced by Create(), and GetMaxButtonsWidth().

◆ m_iToolbarHeight

const INT CMainToolbar::m_iToolbarHeight
private

Definition at line 211 of file gui.cpp.

Referenced by AddImageToImageList(), and InitImageList().

◆ szInstallBtn

WCHAR CMainToolbar::szInstallBtn[MAX_STR_LEN]
private

Definition at line 214 of file gui.cpp.

Referenced by Create().

◆ szModifyBtn

WCHAR CMainToolbar::szModifyBtn[MAX_STR_LEN]
private

Definition at line 216 of file gui.cpp.

Referenced by Create().

◆ szSelectAll

WCHAR CMainToolbar::szSelectAll[MAX_STR_LEN]
private

Definition at line 217 of file gui.cpp.

Referenced by Create().

◆ szUninstallBtn

WCHAR CMainToolbar::szUninstallBtn[MAX_STR_LEN]
private

Definition at line 215 of file gui.cpp.

Referenced by Create().


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