ReactOS 0.4.16-dev-570-g1868985
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 ShowButtonCaption (bool bShow)
 
void UpdateMaxButtonsWidth ()
 
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 (CStringW &szText)
 
- Public Member Functions inherited from CUiPrimitive
virtual ~CUiPrimitive ()
 
virtual CUiBoxAsBox ()
 
virtual VOID ComputeMinimalSize (SIZE *size)
 
virtual VOID ComputeContentBounds (RECT *rect)
 
virtual DWORD_PTR CountSizableChildren ()
 
virtual HDWP OnParentSize (RECT parentRect, HDWP hDwp)
 
- Public Member Functions inherited from CToolbar< TItemData >
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)
 
TItemData * GetItemData (int index)
 
DWORD SetItemData (int index, TItemData *data)
 

Private Member Functions

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

Private Attributes

const INT m_iToolbarHeight
 
DWORD m_dButtonsWidthMax
 

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 275 of file appview.h.

Constructor & Destructor Documentation

◆ CMainToolbar()

CMainToolbar::CMainToolbar ( )

Definition at line 104 of file appview.cpp.

105{
106}
DWORD m_dButtonsWidthMax
Definition: appview.h:278
const INT m_iToolbarHeight
Definition: appview.h:277

Member Function Documentation

◆ AddImageToImageList()

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

Definition at line 66 of file appview.cpp.

67{
68 HICON hImage;
69
70 if (!(hImage =
72 {
73 return;
74 }
75
76 ImageList_AddIcon(hImageList, hImage);
77 DeleteObject(hImage);
78}
HINSTANCE hInst
Definition: dxdiag.c:13
pKey DeleteObject()
static HICON
Definition: imagelist.c:80
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define IMAGE_ICON
Definition: winuser.h:212
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2289
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by InitImageList().

◆ Create()

HWND CMainToolbar::Create ( HWND  hwndParent)

Definition at line 146 of file appview.cpp.

147{
148 CStringW szInstallBtn;
149 CStringW szUninstallBtn;
150 CStringW szModifyBtn;
151 CStringW szSelectAllBtn;
152 CStringW szRefreshBtn;
153 CStringW szUpdateDbBtn;
154
155 /* Load tooltip strings */
156 szInstallBtn.LoadStringW(IDS_TOOLTIP_INSTALL);
157 szUninstallBtn.LoadStringW(IDS_TOOLTIP_UNINSTALL);
158 szModifyBtn.LoadStringW(IDS_TOOLTIP_MODIFY);
159 szSelectAllBtn.LoadStringW(IDS_TOOLTIP_SELECT_ALL);
160 szRefreshBtn.LoadStringW(IDS_TOOLTIP_REFRESH);
161 szUpdateDbBtn.LoadStringW(IDS_TOOLTIP_UPDATE_DB);
162
163 /* Create buttons */
164 TBBUTTON Buttons[] = {
165 /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
166 {0, ID_INSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szInstallBtn.GetString()},
167 {1, ID_UNINSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szUninstallBtn.GetString()},
168 {2, ID_MODIFY, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szModifyBtn.GetString()},
169 {3, ID_CHECK_ALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szSelectAllBtn.GetString()},
170 {-1, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
171 {4, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szRefreshBtn.GetString()},
172 {5, ID_RESETDB, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szUpdateDbBtn.GetString()}};
173
174 m_hWnd = CreateWindowExW(
176 hwndParent, 0, hInst, NULL);
177
178 if (!m_hWnd)
179 {
180 return FALSE;
181 }
182
185
186 /* Set image list */
187 HIMAGELIST hImageList = InitImageList();
188
189 if (hImageList)
190 {
191 ImageList_Destroy(SetImageList(hImageList));
192 }
193
195
196 /* Remember the ideal width to use as a max width of buttons */
198
199 return m_hWnd;
200}
#define IDS_TOOLTIP_REFRESH
Definition: resource.h:48
#define ID_REFRESH
Definition: resource.h:16
#define IDS_TOOLTIP_UPDATE_DB
Definition: resource.h:139
#define IDS_TOOLTIP_INSTALL
Definition: resource.h:132
#define ID_UNINSTALL
Definition: resource.h:74
#define ID_CHECK_ALL
Definition: resource.h:84
#define IDS_TOOLTIP_MODIFY
Definition: resource.h:134
#define ID_MODIFY
Definition: resource.h:77
#define IDS_TOOLTIP_UNINSTALL
Definition: resource.h:133
#define IDS_TOOLTIP_SELECT_ALL
Definition: resource.h:135
#define ID_RESETDB
Definition: resource.h:83
#define ID_INSTALL
Definition: resource.h:73
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
void UpdateMaxButtonsWidth()
Definition: appview.cpp:213
HIMAGELIST InitImageList()
Definition: appview.cpp:81
DWORD AddButtons(int count, TBBUTTON *buttons)
Definition: rosctrls.h:332
DWORD SetButtonStructSize()
Definition: rosctrls.h:286
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:424
static HWND hwndParent
Definition: cryptui.c:300
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
static const TBBUTTON Buttons[]
Definition: mplay32.c:41
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
#define BTNS_BUTTON
Definition: commctrl.h:998
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1190
#define BTNS_AUTOSIZE
Definition: commctrl.h:1004
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define BTNS_SEP
Definition: commctrl.h:999
#define TBSTYLE_LIST
Definition: commctrl.h:993
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:1013
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:943
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define _countof(array)
Definition: sndvol32.h:70
int32_t INT_PTR
Definition: typedefs.h:64
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)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by CApplicationView::CreateToolbar().

◆ GetMaxButtonsWidth()

DWORD CMainToolbar::GetMaxButtonsWidth ( ) const

Definition at line 221 of file appview.cpp.

222{
223 return m_dButtonsWidthMax;
224}

Referenced by CApplicationView::OnSize().

◆ InitImageList()

HIMAGELIST CMainToolbar::InitImageList ( )
private

Definition at line 81 of file appview.cpp.

82{
83 HIMAGELIST hImageList;
84
85 /* Create the toolbar icon image list */
87 if (!hImageList)
88 {
89 return NULL;
90 }
91
99 AddImageToImageList(hImageList, IDI_EXIT);
100
101 return hImageList;
102}
INT GetSystemColorDepth()
Definition: misc.cpp:328
#define IDI_UPDATE_DB
Definition: resource.h:14
#define IDI_EXIT
Definition: resource.h:5
#define IDI_MODIFY
Definition: resource.h:9
#define IDI_CHECK_ALL
Definition: resource.h:15
#define IDI_INSTALL
Definition: resource.h:6
#define IDI_SETTINGS
Definition: resource.h:8
#define IDI_UNINSTALL
Definition: resource.h:7
#define IDI_REFRESH
Definition: resource.h:10
VOID AddImageToImageList(HIMAGELIST hImageList, UINT ImageIndex)
Definition: appview.cpp:66
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define ILC_MASK
Definition: commctrl.h:351

Referenced by Create().

◆ OnGetDispInfo()

VOID CMainToolbar::OnGetDispInfo ( LPTOOLTIPTEXT  lpttt)

Definition at line 109 of file appview.cpp.

110{
111 UINT idButton = (UINT)lpttt->hdr.idFrom;
112
113 switch (idButton)
114 {
115 case ID_EXIT:
116 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_EXIT);
117 break;
118
119 case ID_INSTALL:
120 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_INSTALL);
121 break;
122
123 case ID_UNINSTALL:
124 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UNINSTALL);
125 break;
126
127 case ID_MODIFY:
128 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_MODIFY);
129 break;
130
131 case ID_SETTINGS:
132 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_SETTINGS);
133 break;
134
135 case ID_REFRESH:
136 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_REFRESH);
137 break;
138
139 case ID_RESETDB:
140 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UPDATE_DB);
141 break;
142 }
143}
#define ID_EXIT
Definition: resource.h:10
#define IDS_TOOLTIP_SETTINGS
Definition: resource.h:136
#define IDS_TOOLTIP_EXIT
Definition: resource.h:138
#define ID_SETTINGS
Definition: resource.h:80
switch(r->id)
Definition: btrfs.c:3046
unsigned int UINT
Definition: ndis.h:50
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by CApplicationView::ProcessWindowMessage().

◆ ShowButtonCaption()

void CMainToolbar::ShowButtonCaption ( bool  bShow)

Definition at line 203 of file appview.cpp.

204{
205 DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
206 if (bShow)
208 else
210}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DWORD
Definition: nt_native.h:44
#define TBSTYLE_EX_MIXEDBUTTONS
Definition: commctrl.h:1012
#define TB_GETEXTENDEDSTYLE
Definition: commctrl.h:1191

Referenced by CApplicationView::OnSize().

◆ UpdateMaxButtonsWidth()

void CMainToolbar::UpdateMaxButtonsWidth ( )

Definition at line 213 of file appview.cpp.

214{
215 SIZE size;
218}
DWORD GetIdealSize(BOOL useHeight, LPSIZE size)
Definition: rosctrls.h:388
GLsizeiptr size
Definition: glext.h:5919

Referenced by Create(), and CApplicationView::ProcessWindowMessage().

Member Data Documentation

◆ m_dButtonsWidthMax

DWORD CMainToolbar::m_dButtonsWidthMax
private

Definition at line 278 of file appview.h.

Referenced by GetMaxButtonsWidth(), and UpdateMaxButtonsWidth().

◆ m_iToolbarHeight

const INT CMainToolbar::m_iToolbarHeight
private

Definition at line 277 of file appview.h.

Referenced by AddImageToImageList(), and InitImageList().


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