DestroyWindow(getHandle());
}
+bool ToolBar::create(int _tbID, HWND parentHwnd, DWORD dwStyle) {
+ dwStyle |= WS_CHILD;
+
+ // Create the ToolBar window
+ hwndToolBar = CreateWindowEx(0, TOOLBARCLASSNAME, 0, dwStyle,
+ 0, 0, 25, 25, parentHwnd, (HMENU)_tbID, GetModuleHandle(0), 0);
+
+ if (hwndToolBar) {
+ tbID = _tbID;
+
+ // It's required for backward compatibility
+ SendMessage(hwndToolBar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
+ }
+ return (hwndToolBar ? true : false);
+};
ToolBar();
virtual ~ToolBar();
+ // create() creates a windows toolbar. dwStyle is a combination of
+ // the toolbar control and button styles. It returns TRUE if successful,
+ // or FALSE otherwise.
+ bool create(int tbID, HWND parentHwnd, DWORD dwStyle = WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT);
+
// getHandle() returns handle to a toolbar window.
HWND getHandle() { return hwndToolBar; }
protected:
HWND hwndToolBar;
int tbID;
-
-};
\ No newline at end of file
+};