Home | History | Annotate | Download | only in Control
      1 // Windows/Control/CommandBar.h
      2 
      3 #ifndef __WINDOWS_CONTROL_COMMANDBAR_H
      4 #define __WINDOWS_CONTROL_COMMANDBAR_H
      5 
      6 #ifdef UNDER_CE
      7 
      8 #include "../../Common/MyWindows.h"
      9 
     10 #include <commctrl.h>
     11 
     12 #include "../Window.h"
     13 
     14 namespace NWindows {
     15 namespace NControl {
     16 
     17 class CCommandBar: public NWindows::CWindow
     18 {
     19 public:
     20   bool Create(HINSTANCE hInst, HWND hwndParent, int idCmdBar)
     21   {
     22     _window = ::CommandBar_Create(hInst, hwndParent, idCmdBar);
     23     return (_window != NULL);
     24   }
     25 
     26   // Macros
     27   // void Destroy() { CommandBar_Destroy(_window); }
     28   // bool AddButtons(UINT numButtons, LPTBBUTTON buttons) { return BOOLToBool(SendMsg(TB_ADDBUTTONS, (WPARAM)numButtons, (LPARAM)buttons)); }
     29   bool InsertButton(int iButton, LPTBBUTTON button) { return BOOLToBool(SendMsg(TB_INSERTBUTTON, (WPARAM)iButton, (LPARAM)button)); }
     30   BOOL AddToolTips(UINT numToolTips, LPTSTR toolTips) { return BOOLToBool(SendMsg(TB_SETTOOLTIPS, (WPARAM)numToolTips, (LPARAM)toolTips)); }
     31   void AutoSize() { SendMsg(TB_AUTOSIZE, 0, 0); }
     32 
     33   bool AddAdornments(DWORD dwFlags) { return BOOLToBool(::CommandBar_AddAdornments(_window, dwFlags, 0)); }
     34   int AddBitmap(HINSTANCE hInst, int idBitmap, int iNumImages, int iImageWidth, int iImageHeight) { return ::CommandBar_AddBitmap(_window, hInst, idBitmap, iNumImages, iImageWidth, iImageHeight); }
     35   bool DrawMenuBar(WORD iButton) { return BOOLToBool(::CommandBar_DrawMenuBar(_window, iButton)); }
     36   HMENU GetMenu(WORD iButton) { return ::CommandBar_GetMenu(_window, iButton); }
     37   int Height() { return CommandBar_Height(_window); }
     38   HWND InsertComboBox(HINSTANCE hInst, int iWidth, UINT dwStyle, WORD idComboBox, WORD iButton) { return ::CommandBar_InsertComboBox(_window, hInst, iWidth, dwStyle, idComboBox, iButton); }
     39   bool InsertMenubar(HINSTANCE hInst, WORD idMenu, WORD iButton) { return BOOLToBool(::CommandBar_InsertMenubar(_window, hInst, idMenu, iButton)); }
     40   bool InsertMenubarEx(HINSTANCE hInst, LPTSTR pszMenu, WORD iButton) { return BOOLToBool(::CommandBar_InsertMenubarEx(_window, hInst, pszMenu, iButton)); }
     41   bool Show(bool cmdShow) { return BOOLToBool(::CommandBar_Show(_window, BoolToBOOL(cmdShow))); }
     42 
     43 
     44   // CE 4.0
     45   void AlignAdornments() { CommandBar_AlignAdornments(_window); }
     46 };
     47 
     48 }}
     49 
     50 #endif
     51 
     52 #endif
     53