ReactOS  0.4.15-dev-1377-ga59cecd
CMainToolbar Class Reference

#include <appview.h>

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 VOID AppendTabOrderWindow (int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
 
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)
 
DWORD SetDrawTextFlags (DWORD useBits, DWORD bitState)
 
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 269 of file appview.h.

Constructor & Destructor Documentation

◆ CMainToolbar()

CMainToolbar::CMainToolbar ( )

Definition at line 61 of file appview.cpp.

62  : m_iToolbarHeight(24)
64 {
65  memset(szInstallBtn, 0, sizeof(szInstallBtn));
67  memset(szModifyBtn, 0, sizeof(szModifyBtn));
68  memset(szSelectAll, 0, sizeof(szSelectAll));
69 }
DWORD m_dButtonsWidthMax
Definition: appview.h:273
const INT m_iToolbarHeight
Definition: appview.h:272
WCHAR szSelectAll[MAX_STR_LEN]
Definition: appview.h:278
WCHAR szModifyBtn[MAX_STR_LEN]
Definition: appview.h:277
WCHAR szInstallBtn[MAX_STR_LEN]
Definition: appview.h:275
WCHAR szUninstallBtn[MAX_STR_LEN]
Definition: appview.h:276
#define memset(x, y, z)
Definition: compat.h:39

Member Function Documentation

◆ AddImageToImageList()

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

Definition at line 16 of file appview.cpp.

17 {
18  HICON hImage;
19 
20  if (!(hImage = (HICON)LoadImageW(hInst,
21  MAKEINTRESOURCE(ImageIndex),
22  IMAGE_ICON,
25  0)))
26  {
27  /* TODO: Error message */
28  }
29 
30  ImageList_AddIcon(hImageList, hImage);
31  DeleteObject(hImage);
32 }
#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: appview.h:272
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)

Definition at line 107 of file appview.cpp.

108 {
109  /* Create buttons */
110  TBBUTTON Buttons[] =
111  { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
116  { -1, 0, TBSTATE_ENABLED, BTNS_SEP, { 0 }, 0, 0 },
117  { 4, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 },
118  { 5, ID_RESETDB, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 }
119  };
120 
125 
128  0, 0, 0, 0,
129  hwndParent,
130  0, hInst, NULL);
131 
132  if (!m_hWnd)
133  {
134  /* TODO: Show error message */
135  return FALSE;
136  }
137 
140 
141  /* Set image list */
142  HIMAGELIST hImageList = InitImageList();
143 
144  if (!hImageList)
145  {
146  /* TODO: Show error message */
147  return FALSE;
148  }
149 
150  ImageList_Destroy(SetImageList(hImageList));
151 
153 
154  /* Remember ideal width to use as a max width of buttons */
155  SIZE size;
158 
159  return m_hWnd;
160 }
#define ID_REFRESH
Definition: resource.h:16
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:1009
#define IDS_SELECT_ALL
Definition: resource.h:116
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:939
#define BTNS_AUTOSIZE
Definition: commctrl.h:1000
#define ID_RESETDB
Definition: resource.h:84
#define WS_CHILD
Definition: pedump.c:617
DWORD GetIdealSize(BOOL useHeight, LPSIZE size)
Definition: rosctrls.h:386
int32_t INT_PTR
Definition: typedefs.h:64
#define ID_TOOLBAR_INSTALL
Definition: resource.h:87
DWORD SetButtonStructSize()
Definition: rosctrls.h:284
#define ID_UNINSTALL
Definition: resource.h:75
DWORD m_dButtonsWidthMax
Definition: appview.h:273
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:94
DWORD AddButtons(int count, TBBUTTON *buttons)
Definition: rosctrls.h:330
#define FALSE
Definition: types.h:117
#define IDS_UNINSTALL
Definition: resource.h:93
static HWND hwndParent
Definition: cryptui.c:300
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:422
WCHAR szSelectAll[MAX_STR_LEN]
Definition: appview.h:278
WCHAR szModifyBtn[MAX_STR_LEN]
Definition: appview.h:277
static const TBBUTTON Buttons[]
Definition: mplay32.c:41
GLsizeiptr size
Definition: glext.h:5919
#define BTNS_SEP
Definition: commctrl.h:995
#define _countof(array)
Definition: sndvol32.h:68
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:985
#define ID_CHECK_ALL
Definition: resource.h:85
WCHAR szInstallBtn[MAX_STR_LEN]
Definition: appview.h:275
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)
HINSTANCE hInst
Definition: dxdiag.c:13
HIMAGELIST InitImageList()
Definition: appview.cpp:34
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define TBSTATE_ENABLED
Definition: commctrl.h:970
WCHAR szUninstallBtn[MAX_STR_LEN]
Definition: appview.h:276
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_LIST
Definition: commctrl.h:989
#define ID_MODIFY
Definition: resource.h:78
#define TBSTYLE_FLAT
Definition: commctrl.h:988
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1186

Referenced by CApplicationView::CreateToolbar().

◆ GetMaxButtonsWidth()

DWORD CMainToolbar::GetMaxButtonsWidth ( ) const

Definition at line 174 of file appview.cpp.

175 {
176  return m_dButtonsWidthMax;
177 }
DWORD m_dButtonsWidthMax
Definition: appview.h:273

Referenced by CApplicationView::OnSize().

◆ HideButtonCaption()

VOID CMainToolbar::HideButtonCaption ( )

Definition at line 162 of file appview.cpp.

163 {
164  DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
166 }
#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 CApplicationView::OnSize().

◆ InitImageList()

HIMAGELIST CMainToolbar::InitImageList ( )
private

Definition at line 34 of file appview.cpp.

35 {
36  HIMAGELIST hImageList;
37 
38  /* Create the toolbar icon image list */
39  hImageList = ImageList_Create(m_iToolbarHeight,//GetSystemMetrics(SM_CXSMICON),
40  m_iToolbarHeight,//GetSystemMetrics(SM_CYSMICON),
42  1, 1);
43  if (!hImageList)
44  {
45  /* TODO: Error message */
46  return NULL;
47  }
48 
49  AddImageToImageList(hImageList, IDI_INSTALL);
51  AddImageToImageList(hImageList, IDI_MODIFY);
53  AddImageToImageList(hImageList, IDI_REFRESH);
55  AddImageToImageList(hImageList, IDI_SETTINGS);
56  AddImageToImageList(hImageList, IDI_EXIT);
57 
58  return hImageList;
59 }
#define IDI_UNINSTALL
Definition: resource.h:7
#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: appview.h:272
VOID AddImageToImageList(HIMAGELIST hImageList, UINT ImageIndex)
Definition: appview.cpp:16
INT GetSystemColorDepth()
Definition: misc.cpp:489
#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 NULL
Definition: types.h:112
#define IDI_REFRESH
Definition: resource.h:10
#define IDI_SETTINGS
Definition: resource.h:8

Referenced by Create().

◆ OnGetDispInfo()

VOID CMainToolbar::OnGetDispInfo ( LPTOOLTIPTEXT  lpttt)

Definition at line 71 of file appview.cpp.

72 {
73  UINT idButton = (UINT)lpttt->hdr.idFrom;
74 
75  switch (idButton)
76  {
77  case ID_EXIT:
78  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_EXIT);
79  break;
80 
81  case ID_INSTALL:
82  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_INSTALL);
83  break;
84 
85  case ID_UNINSTALL:
86  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UNINSTALL);
87  break;
88 
89  case ID_MODIFY:
90  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_MODIFY);
91  break;
92 
93  case ID_SETTINGS:
94  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_SETTINGS);
95  break;
96 
97  case ID_REFRESH:
98  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_REFRESH);
99  break;
100 
101  case ID_RESETDB:
102  lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UPDATE_DB);
103  break;
104  }
105 }
#define ID_REFRESH
Definition: resource.h:16
#define ID_SETTINGS
Definition: resource.h:81
#define IDS_TOOLTIP_EXIT
Definition: resource.h:133
#define ID_RESETDB
Definition: resource.h:84
#define ID_UNINSTALL
Definition: resource.h:75
switch(r->id)
Definition: btrfs.c:2980
#define IDS_TOOLTIP_MODIFY
Definition: resource.h:130
#define IDS_TOOLTIP_REFRESH
Definition: resource.h:48
#define IDS_TOOLTIP_UNINSTALL
Definition: resource.h:129
#define ID_EXIT
Definition: resource.h:10
#define ID_INSTALL
Definition: resource.h:74
#define IDS_TOOLTIP_UPDATE_DB
Definition: resource.h:134
#define IDS_TOOLTIP_SETTINGS
Definition: resource.h:131
unsigned int UINT
Definition: ndis.h:50
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ID_MODIFY
Definition: resource.h:78
#define IDS_TOOLTIP_INSTALL
Definition: resource.h:128

Referenced by CApplicationView::ProcessWindowMessage().

◆ ShowButtonCaption()

VOID CMainToolbar::ShowButtonCaption ( )

Definition at line 168 of file appview.cpp.

169 {
170  DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
172 }
#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 CApplicationView::OnSize().

Member Data Documentation

◆ m_dButtonsWidthMax

DWORD CMainToolbar::m_dButtonsWidthMax
private

Definition at line 273 of file appview.h.

Referenced by Create(), and GetMaxButtonsWidth().

◆ m_iToolbarHeight

const INT CMainToolbar::m_iToolbarHeight
private

Definition at line 272 of file appview.h.

Referenced by AddImageToImageList(), and InitImageList().

◆ szInstallBtn

WCHAR CMainToolbar::szInstallBtn[MAX_STR_LEN]
private

Definition at line 275 of file appview.h.

Referenced by CMainToolbar(), and Create().

◆ szModifyBtn

WCHAR CMainToolbar::szModifyBtn[MAX_STR_LEN]
private

Definition at line 277 of file appview.h.

Referenced by CMainToolbar(), and Create().

◆ szSelectAll

WCHAR CMainToolbar::szSelectAll[MAX_STR_LEN]
private

Definition at line 278 of file appview.h.

Referenced by CMainToolbar(), and Create().

◆ szUninstallBtn

WCHAR CMainToolbar::szUninstallBtn[MAX_STR_LEN]
private

Definition at line 276 of file appview.h.

Referenced by CMainToolbar(), and Create().


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