summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2005-01-11 14:47:14 +0000
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2005-01-11 14:47:14 +0000
commitc7039163edebceea269027342555408808c94371 (patch)
tree50f5c37307df30cc3a13b45adf2a1c952e2787ba
parent199253ecd9feb8d96b21cc03557ffdadb0bee534 (diff)
downloadtigervnc-c7039163edebceea269027342555408808c94371.tar.gz
tigervnc-c7039163edebceea269027342555408808c94371.zip
Added button images operations to the ToolBar class:
addBitmap(), addSysBitmap(), setBitmapSize(). git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@92 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--rfbplayer/ToolBar.cxx21
-rw-r--r--rfbplayer/ToolBar.h18
2 files changed, 39 insertions, 0 deletions
diff --git a/rfbplayer/ToolBar.cxx b/rfbplayer/ToolBar.cxx
index b9cd7bb5..12c6aa01 100644
--- a/rfbplayer/ToolBar.cxx
+++ b/rfbplayer/ToolBar.cxx
@@ -48,3 +48,24 @@ bool ToolBar::create(int _tbID, HWND parentHwnd, DWORD dwStyle) {
}
return (hwndToolBar ? true : false);
};
+
+int ToolBar::addBitmap(int nButtons, UINT bitmapID) {
+ assert(nButtons > 0);
+ TBADDBITMAP resBitmap;
+ resBitmap.hInst = GetModuleHandle(0);
+ resBitmap.nID = bitmapID;
+ return SendMessage(getHandle(), TB_ADDBITMAP, nButtons, (LPARAM)&resBitmap);
+}
+
+int ToolBar::addSystemBitmap(UINT stdBitmapID) {
+ TBADDBITMAP resBitmap;
+ resBitmap.hInst = HINST_COMMCTRL;
+ resBitmap.nID = stdBitmapID;
+ return SendMessage(getHandle(), TB_ADDBITMAP, 0, (LPARAM)&resBitmap);
+}
+
+bool ToolBar::setBitmapSize(int width, int height) {
+ int result = SendMessage(getHandle(), TB_SETBITMAPSIZE,
+ 0, MAKELONG(width, height));
+ return (result ? true : false);
+}
diff --git a/rfbplayer/ToolBar.h b/rfbplayer/ToolBar.h
index e08bd0bc..aed4214a 100644
--- a/rfbplayer/ToolBar.h
+++ b/rfbplayer/ToolBar.h
@@ -20,6 +20,7 @@
#include <windows.h>
#include <commctrl.h>
+#include <assert.h>
class ToolBar {
public:
@@ -31,6 +32,23 @@ public:
// or FALSE otherwise.
bool create(int tbID, HWND parentHwnd, DWORD dwStyle = WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT);
+ // -=- Button images operations
+
+ // addBitmap() adds one or more images from resources to the list of button
+ // images available for a toolbar. Returns the index of the first new image
+ // if successful, or -1 otherwise.
+ int addBitmap(int nButtons, UINT bitmapID);
+
+ // addSystemBitmap() adds the system-defined button bitmaps to the list
+ // of the toolbar button specifying by stdBitmapID. Returns the index of
+ // the first new image if successful, or -1 otherwise.
+ int addSystemBitmap(UINT stdBitmapID);
+
+ // setBitmapSize() sets the size of the bitmapped images to be added
+ // to a toolbar. It returns TRUE if successful, or FALSE otherwise.
+ // You must call it before addBitmap().
+ bool setBitmapSize(int width, int height);
+
// getHandle() returns handle to a toolbar window.
HWND getHandle() { return hwndToolBar; }