ReactOS 0.4.15-dev-8434-g155a7c7
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 276 of file appview.h.

Constructor & Destructor Documentation

◆ CMainToolbar()

CMainToolbar::CMainToolbar ( )

Definition at line 60 of file appview.cpp.

61{
62}
DWORD m_dButtonsWidthMax
Definition: appview.h:279
const INT m_iToolbarHeight
Definition: appview.h:278

Member Function Documentation

◆ AddImageToImageList()

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

Definition at line 22 of file appview.cpp.

23{
24 HICON hImage;
25
26 if (!(hImage =
28 {
29 return;
30 }
31
32 ImageList_AddIcon(hImageList, hImage);
33 DeleteObject(hImage);
34}
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:2247
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by InitImageList().

◆ Create()

HWND CMainToolbar::Create ( HWND  hwndParent)

Definition at line 102 of file appview.cpp.

103{
104 CStringW szInstallBtn;
105 CStringW szUninstallBtn;
106 CStringW szModifyBtn;
107 CStringW szSelectAllBtn;
108 CStringW szRefreshBtn;
109 CStringW szUpdateDbBtn;
110
111 /* Load tooltip strings */
112 szInstallBtn.LoadStringW(IDS_TOOLTIP_INSTALL);
113 szUninstallBtn.LoadStringW(IDS_TOOLTIP_UNINSTALL);
114 szModifyBtn.LoadStringW(IDS_TOOLTIP_MODIFY);
115 szSelectAllBtn.LoadStringW(IDS_TOOLTIP_SELECT_ALL);
116 szRefreshBtn.LoadStringW(IDS_TOOLTIP_REFRESH);
117 szUpdateDbBtn.LoadStringW(IDS_TOOLTIP_UPDATE_DB);
118
119 /* Create buttons */
120 TBBUTTON Buttons[] = {
121 /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
122 {0, ID_INSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szInstallBtn.GetString()},
123 {1, ID_UNINSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szUninstallBtn.GetString()},
124 {2, ID_MODIFY, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szModifyBtn.GetString()},
125 {3, ID_CHECK_ALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szSelectAllBtn.GetString()},
126 {-1, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
127 {4, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szRefreshBtn.GetString()},
128 {5, ID_RESETDB, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szUpdateDbBtn.GetString()}};
129
130 m_hWnd = CreateWindowExW(
132 hwndParent, 0, hInst, NULL);
133
134 if (!m_hWnd)
135 {
136 return FALSE;
137 }
138
141
142 /* Set image list */
143 HIMAGELIST hImageList = InitImageList();
144
145 if (hImageList)
146 {
147 ImageList_Destroy(SetImageList(hImageList));
148 }
149
151
152 /* Remember ideal width to use as a max width of buttons */
153 SIZE size;
156
157 return m_hWnd;
158}
#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:37
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: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 175 of file appview.cpp.

176{
177 return m_dButtonsWidthMax;
178}

Referenced by CApplicationView::OnSize().

◆ HideButtonCaption()

VOID CMainToolbar::HideButtonCaption ( )

Definition at line 161 of file appview.cpp.

162{
163 DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
165}
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 37 of file appview.cpp.

38{
39 HIMAGELIST hImageList;
40
41 /* Create the toolbar icon image list */
43 if (!hImageList)
44 {
45 return NULL;
46 }
47
55 AddImageToImageList(hImageList, IDI_EXIT);
56
57 return hImageList;
58}
INT GetSystemColorDepth()
Definition: misc.cpp:300
#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:22
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 65 of file appview.cpp.

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

169{
170 DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
172}

Referenced by CApplicationView::OnSize().

Member Data Documentation

◆ m_dButtonsWidthMax

DWORD CMainToolbar::m_dButtonsWidthMax
private

Definition at line 279 of file appview.h.

Referenced by Create(), and GetMaxButtonsWidth().

◆ m_iToolbarHeight

const INT CMainToolbar::m_iToolbarHeight
private

Definition at line 278 of file appview.h.

Referenced by AddImageToImageList(), and InitImageList().


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