ReactOS 0.4.16-dev-1093-g93e9710
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 105 of file appview.cpp.

106{
107}
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 67 of file appview.cpp.

68{
69 HICON hImage;
70
71 if (!(hImage =
73 {
74 return;
75 }
76
77 ImageList_AddIcon(hImageList, hImage);
78 DeleteObject(hImage);
79}
HINSTANCE hInst
Definition: dxdiag.c:13
pKey DeleteObject()
static HICON
Definition: imagelist.c:80
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#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:2540

Referenced by InitImageList().

◆ Create()

HWND CMainToolbar::Create ( HWND  hwndParent)

Definition at line 147 of file appview.cpp.

148{
149 CStringW szInstallBtn;
150 CStringW szUninstallBtn;
151 CStringW szModifyBtn;
152 CStringW szSelectAllBtn;
153 CStringW szRefreshBtn;
154 CStringW szUpdateDbBtn;
155
156 /* Load tooltip strings */
157 szInstallBtn.LoadStringW(IDS_TOOLTIP_INSTALL);
158 szUninstallBtn.LoadStringW(IDS_TOOLTIP_UNINSTALL);
159 szModifyBtn.LoadStringW(IDS_TOOLTIP_MODIFY);
160 szSelectAllBtn.LoadStringW(IDS_TOOLTIP_SELECT_ALL);
161 szRefreshBtn.LoadStringW(IDS_TOOLTIP_REFRESH);
162 szUpdateDbBtn.LoadStringW(IDS_TOOLTIP_UPDATE_DB);
163
164 /* Create buttons */
165 TBBUTTON Buttons[] = {
166 /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
167 {0, ID_INSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szInstallBtn.GetString()},
168 {1, ID_UNINSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szUninstallBtn.GetString()},
169 {2, ID_MODIFY, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szModifyBtn.GetString()},
170 {3, ID_CHECK_ALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szSelectAllBtn.GetString()},
171 {-1, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
172 {4, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szRefreshBtn.GetString()},
173 {5, ID_RESETDB, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szUpdateDbBtn.GetString()}};
174
175 m_hWnd = CreateWindowExW(
177 hwndParent, 0, hInst, NULL);
178
179 if (!m_hWnd)
180 {
181 return FALSE;
182 }
183
186
187 /* Set image list */
188 HIMAGELIST hImageList = InitImageList();
189
190 if (hImageList)
191 {
192 ImageList_Destroy(SetImageList(hImageList));
193 }
194
196
197 /* Remember the ideal width to use as a max width of buttons */
199
200 return m_hWnd;
201}
#define IDS_TOOLTIP_REFRESH
Definition: resource.h:48
#define ID_REFRESH
Definition: resource.h:16
#define IDS_TOOLTIP_UPDATE_DB
Definition: resource.h:144
#define IDS_TOOLTIP_INSTALL
Definition: resource.h:137
#define ID_UNINSTALL
Definition: resource.h:75
#define ID_CHECK_ALL
Definition: resource.h:85
#define IDS_TOOLTIP_MODIFY
Definition: resource.h:139
#define ID_MODIFY
Definition: resource.h:78
#define IDS_TOOLTIP_UNINSTALL
Definition: resource.h:138
#define IDS_TOOLTIP_SELECT_ALL
Definition: resource.h:140
#define ID_RESETDB
Definition: resource.h:84
#define ID_INSTALL
Definition: resource.h:74
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
void UpdateMaxButtonsWidth()
Definition: appview.cpp:214
HIMAGELIST InitImageList()
Definition: appview.cpp:82
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:941
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 222 of file appview.cpp.

223{
224 return m_dButtonsWidthMax;
225}

Referenced by CApplicationView::OnSize().

◆ InitImageList()

HIMAGELIST CMainToolbar::InitImageList ( )
private

Definition at line 82 of file appview.cpp.

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

Referenced by Create().

◆ OnGetDispInfo()

VOID CMainToolbar::OnGetDispInfo ( LPTOOLTIPTEXT  lpttt)

Definition at line 110 of file appview.cpp.

111{
112 UINT idButton = (UINT)lpttt->hdr.idFrom;
113
114 switch (idButton)
115 {
116 case ID_EXIT:
117 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_EXIT);
118 break;
119
120 case ID_INSTALL:
121 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_INSTALL);
122 break;
123
124 case ID_UNINSTALL:
125 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UNINSTALL);
126 break;
127
128 case ID_MODIFY:
129 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_MODIFY);
130 break;
131
132 case ID_SETTINGS:
133 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_SETTINGS);
134 break;
135
136 case ID_REFRESH:
137 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_REFRESH);
138 break;
139
140 case ID_RESETDB:
141 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UPDATE_DB);
142 break;
143 }
144}
#define ID_EXIT
Definition: resource.h:10
#define IDS_TOOLTIP_SETTINGS
Definition: resource.h:141
#define IDS_TOOLTIP_EXIT
Definition: resource.h:143
#define ID_SETTINGS
Definition: resource.h:81
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 204 of file appview.cpp.

205{
206 DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
207 if (bShow)
209 else
211}
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 214 of file appview.cpp.

215{
216 SIZE size;
219}
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: