aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/Control/ToolBar.h
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Windows/Control/ToolBar.h')
-rw-r--r--CPP/Windows/Control/ToolBar.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/CPP/Windows/Control/ToolBar.h b/CPP/Windows/Control/ToolBar.h
new file mode 100644
index 0000000..7bc93a2
--- /dev/null
+++ b/CPP/Windows/Control/ToolBar.h
@@ -0,0 +1,43 @@
1// Windows/Control/ToolBar.h
2
3#ifndef __WINDOWS_CONTROL_TOOLBAR_H
4#define __WINDOWS_CONTROL_TOOLBAR_H
5
6#include "../Window.h"
7
8namespace NWindows {
9namespace NControl {
10
11class CToolBar: public NWindows::CWindow
12{
13public:
14 void AutoSize() { SendMsg(TB_AUTOSIZE, 0, 0); }
15 DWORD GetButtonSize() { return (DWORD)SendMsg(TB_GETBUTTONSIZE, 0, 0); }
16
17 bool GetMaxSize(LPSIZE size)
18 #ifdef UNDER_CE
19 {
20 // maybe it must be fixed for more than 1 buttons
21 DWORD val = GetButtonSize();
22 size->cx = LOWORD(val);
23 size->cy = HIWORD(val);
24 return true;
25 }
26 #else
27 {
28 return LRESULTToBool(SendMsg(TB_GETMAXSIZE, 0, (LPARAM)size));
29 }
30 #endif
31
32 bool EnableButton(UINT buttonID, bool enable) { return LRESULTToBool(SendMsg(TB_ENABLEBUTTON, buttonID, MAKELONG(BoolToBOOL(enable), 0))); }
33 void ButtonStructSize() { SendMsg(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON)); }
34 HIMAGELIST SetImageList(UINT listIndex, HIMAGELIST imageList) { return HIMAGELIST(SendMsg(TB_SETIMAGELIST, listIndex, (LPARAM)imageList)); }
35 bool AddButton(UINT numButtons, LPTBBUTTON buttons) { return LRESULTToBool(SendMsg(TB_ADDBUTTONS, numButtons, (LPARAM)buttons)); }
36 #ifndef _UNICODE
37 bool AddButtonW(UINT numButtons, LPTBBUTTON buttons) { return LRESULTToBool(SendMsg(TB_ADDBUTTONSW, numButtons, (LPARAM)buttons)); }
38 #endif
39};
40
41}}
42
43#endif