• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Windows/Control/ToolBar.h
2 
3 #ifndef __WINDOWS_CONTROL_TOOLBAR_H
4 #define __WINDOWS_CONTROL_TOOLBAR_H
5 
6 #include "../Window.h"
7 
8 namespace NWindows {
9 namespace NControl {
10 
11 class CToolBar: public NWindows::CWindow
12 {
13 public:
AutoSize()14   void AutoSize() { SendMessage(TB_AUTOSIZE, 0, 0); }
GetButtonSize()15   DWORD GetButtonSize() { return (DWORD)SendMessage(TB_GETBUTTONSIZE, 0, 0); }
16 
GetMaxSize(LPSIZE size)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(SendMessage(TB_GETMAXSIZE, 0, (LPARAM)size));
29   }
30   #endif
31 
EnableButton(UINT buttonID,bool enable)32   bool EnableButton(UINT buttonID, bool enable) { return LRESULTToBool(SendMessage(TB_ENABLEBUTTON, buttonID, MAKELONG(BoolToBOOL(enable), 0))); }
ButtonStructSize()33   void ButtonStructSize() { SendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON)); }
SetImageList(UINT listIndex,HIMAGELIST imageList)34   HIMAGELIST SetImageList(UINT listIndex, HIMAGELIST imageList) { return HIMAGELIST(SendMessage(TB_SETIMAGELIST, listIndex, (LPARAM)imageList)); }
AddButton(UINT numButtons,LPTBBUTTON buttons)35   bool AddButton(UINT numButtons, LPTBBUTTON buttons) { return LRESULTToBool(SendMessage(TB_ADDBUTTONS, numButtons, (LPARAM)buttons)); }
36   #ifndef _UNICODE
AddButtonW(UINT numButtons,LPTBBUTTON buttons)37   bool AddButtonW(UINT numButtons, LPTBBUTTON buttons) { return LRESULTToBool(SendMessage(TB_ADDBUTTONSW, numButtons, (LPARAM)buttons)); }
38   #endif
39 };
40 
41 }}
42 
43 #endif
44