tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ToolBar.h (1379B)


      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:
     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