]> source.dussan.org Git - tigervnc.git/commitdiff
Added ToolBar:create() function. It creats a windows toolbar.
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Mon, 10 Jan 2005 12:20:01 +0000 (12:20 +0000)
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Mon, 10 Jan 2005 12:20:01 +0000 (12:20 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@90 3789f03b-4d11-0410-bbf8-ca57d06f2519

rfbplayer/ToolBar.cxx
rfbplayer/ToolBar.h

index a1b20d374b36e2dd30c0f8bc9e63c371d4aebe5f..b9cd7bb575a548544fc286e748c8c2e405bd8ac2 100644 (file)
@@ -33,3 +33,18 @@ ToolBar::~ToolBar() {
   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);
+};
index aa59533afb880cdaec1977c0869e4693fc8b117b..e08bd0bcee9f602092f1959454f4a24568598c38 100644 (file)
@@ -26,11 +26,15 @@ public:
   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
+};