ReactOS 0.4.15-dev-7846-g8ba6c66
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 (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 273 of file appview.h.

Constructor & Destructor Documentation

◆ CMainToolbar()

CMainToolbar::CMainToolbar ( )

Definition at line 57 of file appview.cpp.

58{
59}
DWORD m_dButtonsWidthMax
Definition: appview.h:276
const INT m_iToolbarHeight
Definition: appview.h:275

Member Function Documentation

◆ AddImageToImageList()

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

Definition at line 19 of file appview.cpp.

20{
21 HICON hImage;
22
23 if (!(hImage =
25 {
26 return;
27 }
28
29 ImageList_AddIcon(hImageList, hImage);
30 DeleteObject(hImage);
31}
HINSTANCE hInst
Definition: dxdiag.c:13
pKey DeleteObject()
static HICON
Definition: imagelist.c:84
#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:2203
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by InitImageList().

◆ Create()

HWND CMainToolbar::Create ( HWND  hwndParent)

Definition at line 99 of file appview.cpp.

100{
101 CStringW szInstallBtn;
102 CStringW szUninstallBtn;
103 CStringW szModifyBtn;
104 CStringW szSelectAllBtn;
105 CStringW szRefreshBtn;
106 CStringW szUpdateDbBtn;
107
108 /* Load tooltip strings */
109 szInstallBtn.LoadStringW(IDS_TOOLTIP_INSTALL);
110 szUninstallBtn.LoadStringW(IDS_TOOLTIP_UNINSTALL);
111 szModifyBtn.LoadStringW(IDS_TOOLTIP_MODIFY);
112 szSelectAllBtn.LoadStringW(IDS_TOOLTIP_SELECT_ALL);
113 szRefreshBtn.LoadStringW(IDS_TOOLTIP_REFRESH);
114 szUpdateDbBtn.LoadStringW(IDS_TOOLTIP_UPDATE_DB);
115
116 /* Create buttons */
117 TBBUTTON Buttons[] = {
118 /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
119 {0, ID_INSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szInstallBtn.GetString()},
120 {1, ID_UNINSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szUninstallBtn.GetString()},
121 {2, ID_MODIFY, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szModifyBtn.GetString()},
122 {3, ID_CHECK_ALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szSelectAllBtn.GetString()},
123 {-1, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
124 {4, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szRefreshBtn.GetString()},
125 {5, ID_RESETDB, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szUpdateDbBtn.GetString()}};
126
127 m_hWnd = CreateWindowExW(
129 hwndParent, 0, hInst, NULL);
130
131 if (!m_hWnd)
132 {
133 return FALSE;
134 }
135
138
139 /* Set image list */
140 HIMAGELIST hImageList = InitImageList();
141
142 if (hImageList)
143 {
144 ImageList_Destroy(SetImageList(hImageList));
145 }
146
148
149 /* Remember ideal width to use as a max width of buttons */
150 SIZE size;
153
154 return m_hWnd;
155}
#define IDS_TOOLTIP_REFRESH
Definition: resource.h:48
#define ID_REFRESH
Definition: resource.h:16
#define IDS_TOOLTIP_UPDATE_DB
Definition: resource.h:134
#define IDS_TOOLTIP_INSTALL
Definition: resource.h:127
#define ID_UNINSTALL
Definition: resource.h:75
#define ID_CHECK_ALL
Definition: resource.h:85
#define IDS_TOOLTIP_MODIFY
Definition: resource.h:129
#define ID_MODIFY
Definition: resource.h:78
#define IDS_TOOLTIP_UNINSTALL
Definition: resource.h:128
#define IDS_TOOLTIP_SELECT_ALL
Definition: resource.h:130
#define ID_RESETDB
Definition: resource.h:84
#define ID_INSTALL
Definition: resource.h:74
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
HIMAGELIST InitImageList()
Definition: appview.cpp:34
DWORD AddButtons(int count, TBBUTTON *buttons)
Definition: rosctrls.h:332
DWORD SetButtonStructSize()
Definition: rosctrls.h:286
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:424
DWORD GetIdealSize(BOOL useHeight, LPSIZE size)
Definition: rosctrls.h:388
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
GLsizeiptr size
Definition: glext.h:5919
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:68
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 172 of file appview.cpp.

173{
174 return m_dButtonsWidthMax;
175}

Referenced by CApplicationView::OnSize().

◆ HideButtonCaption()

VOID CMainToolbar::HideButtonCaption ( )

Definition at line 158 of file appview.cpp.

159{
160 DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
162}
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().

◆ 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 */
40 if (!hImageList)
41 {
42 return NULL;
43 }
44
52 AddImageToImageList(hImageList, IDI_EXIT);
53
54 return hImageList;
55}
INT GetSystemColorDepth()
Definition: misc.cpp:321
#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:19
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 62 of file appview.cpp.

63{
64 UINT idButton = (UINT)lpttt->hdr.idFrom;
65
66 switch (idButton)
67 {
68 case ID_EXIT:
69 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_EXIT);
70 break;
71
72 case ID_INSTALL:
73 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_INSTALL);
74 break;
75
76 case ID_UNINSTALL:
77 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UNINSTALL);
78 break;
79
80 case ID_MODIFY:
81 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_MODIFY);
82 break;
83
84 case ID_SETTINGS:
85 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_SETTINGS);
86 break;
87
88 case ID_REFRESH:
89 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_REFRESH);
90 break;
91
92 case ID_RESETDB:
93 lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UPDATE_DB);
94 break;
95 }
96}
#define ID_EXIT
Definition: resource.h:10
#define IDS_TOOLTIP_SETTINGS
Definition: resource.h:131
#define IDS_TOOLTIP_EXIT
Definition: resource.h:133
#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 ( )

Definition at line 165 of file appview.cpp.

166{
167 DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
169}

Referenced by CApplicationView::OnSize().

Member Data Documentation

◆ m_dButtonsWidthMax

DWORD CMainToolbar::m_dButtonsWidthMax
private

Definition at line 276 of file appview.h.

Referenced by Create(), and GetMaxButtonsWidth().

◆ m_iToolbarHeight

const INT CMainToolbar::m_iToolbarHeight
private

Definition at line 275 of file appview.h.

Referenced by AddImageToImageList(), and InitImageList().


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