aboutsummaryrefslogtreecommitdiffstats
path: root/rfbplayer/ToolBar.cxx
diff options
context:
space:
mode:
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2005-01-11 15:51:36 +0000
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2005-01-11 15:51:36 +0000
commit2818450b1f3d03ce2284b929a5865133e93b386a (patch)
treec1ce25e79844b5c6a7c93df1027086b338e677f0 /rfbplayer/ToolBar.cxx
parentc7039163edebceea269027342555408808c94371 (diff)
downloadtigervnc-2818450b1f3d03ce2284b929a5865133e93b386a.tar.gz
tigervnc-2818450b1f3d03ce2284b929a5865133e93b386a.zip
Added button operations to the ToolBar class.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@93 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'rfbplayer/ToolBar.cxx')
-rw-r--r--rfbplayer/ToolBar.cxx95
1 files changed, 95 insertions, 0 deletions
diff --git a/rfbplayer/ToolBar.cxx b/rfbplayer/ToolBar.cxx
index 12c6aa01..bd7d4a9b 100644
--- a/rfbplayer/ToolBar.cxx
+++ b/rfbplayer/ToolBar.cxx
@@ -69,3 +69,98 @@ bool ToolBar::setBitmapSize(int width, int height) {
0, MAKELONG(width, height));
return (result ? true : false);
}
+
+bool ToolBar::addButton(int iBitmap, int idCommand, BYTE state, BYTE style, UINT dwData, int iString) {
+ TBBUTTON tbb;
+ tbb.iBitmap = iBitmap;
+ tbb.idCommand = idCommand;
+ tbb.fsState = state;
+ tbb.fsStyle = style;
+ tbb.dwData = dwData;
+ tbb.iString = iString;
+
+ int result = SendMessage(getHandle(), TB_ADDBUTTONS, 1, (LPARAM)&tbb);
+ if (result) {
+ SendMessage(getHandle(), TB_AUTOSIZE, 0, 0);
+ }
+ return (result ? true : false);
+}
+
+bool ToolBar::addNButton(int nButtons, LPTBBUTTON tbb) {
+ assert(nButtons > 0);
+ assert(tbb > 0);
+ int result = SendMessage(getHandle(), TB_ADDBUTTONS, nButtons, (LPARAM)tbb);
+ if (result) {
+ SendMessage(getHandle(), TB_AUTOSIZE, 0, 0);
+ }
+ return (result ? true : false);
+}
+
+bool ToolBar::deleteButton(int indexButton) {
+ assert(indexButton >= 0);
+ int result = SendMessage(getHandle(), TB_DELETEBUTTON, indexButton, 0);
+
+ if (result) {
+ SendMessage(getHandle(), TB_AUTOSIZE, 0, 0);
+ }
+ return (result ? true : false);
+}
+
+bool ToolBar::insertButton(int indexButton, LPTBBUTTON tbb) {
+ assert(indexButton >= 0);
+ assert(tbb > 0);
+ int result = SendMessage(getHandle(), TB_INSERTBUTTON,
+ indexButton, (LPARAM)tbb);
+
+ if (result) {
+ SendMessage(getHandle(), TB_AUTOSIZE, 0, 0);
+ }
+ return (result ? true : false);
+}
+
+int ToolBar::getButtonInfo(int idButton, TBBUTTONINFO *btnInfo) {
+ assert(idButton >= 0);
+ assert(btnInfo > 0);
+ return SendMessage(getHandle(), TB_GETBUTTONINFO, idButton, (LPARAM)btnInfo);
+}
+
+bool ToolBar::setButtonInfo(int idButton, TBBUTTONINFO* btnInfo) {
+ assert(idButton >= 0);
+ assert(btnInfo > 0);
+ int result = SendMessage(getHandle(), TB_SETBUTTONINFO,
+ idButton, (LPARAM)(LPTBBUTTONINFO)btnInfo);
+ return (result ? true : false);
+}
+
+bool ToolBar::checkButton(int idButton, bool check) {
+ assert(idButton >= 0);
+ int result = SendMessage(getHandle(), TB_CHECKBUTTON,
+ idButton, MAKELONG(check, 0));
+ return (result ? true : false);
+}
+
+bool ToolBar::enableButton(int idButton, bool enable) {
+ assert(idButton >= 0);
+ int result = SendMessage(getHandle(), TB_ENABLEBUTTON,
+ idButton, MAKELONG(enable, 0));
+ return (result ? true : false);
+}
+
+bool ToolBar::pressButton(int idButton, bool press) {
+ assert(idButton >= 0);
+ int result = SendMessage(getHandle(), TB_PRESSBUTTON,
+ idButton, MAKELONG(press, 0));
+ return (result ? true : false);
+}
+
+bool ToolBar::setButtonSize(int width, int height) {
+ assert(width > 0);
+ assert(height > 0);
+ int result = SendMessage(getHandle(), TB_SETBUTTONSIZE,
+ 0, MAKELONG(width, height));
+ if (result) {
+ SendMessage(getHandle(), TB_AUTOSIZE, 0, 0);
+ return true;
+ }
+ return false;
+}