Added ToolBar::autoSize, ToolBar::getButtonRect().
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@103 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfbplayer/ToolBar.cxx b/rfbplayer/ToolBar.cxx
index bd7d4a9..c4808cc 100644
--- a/rfbplayer/ToolBar.cxx
+++ b/rfbplayer/ToolBar.cxx
@@ -153,6 +153,12 @@
return (result ? true : false);
}
+bool ToolBar::getButtonRect(int nIndex, LPRECT buttonRect) {
+ int result = SendMessage(getHandle(), TB_GETITEMRECT,
+ nIndex, (LPARAM)buttonRect);
+ return (result ? true : false);
+}
+
bool ToolBar::setButtonSize(int width, int height) {
assert(width > 0);
assert(height > 0);
@@ -164,3 +170,7 @@
}
return false;
}
+
+void ToolBar::autoSize() {
+ SendMessage(getHandle(), TB_AUTOSIZE, 0, 0);
+}
diff --git a/rfbplayer/ToolBar.h b/rfbplayer/ToolBar.h
index 03d58a8..1806173 100644
--- a/rfbplayer/ToolBar.h
+++ b/rfbplayer/ToolBar.h
@@ -79,10 +79,17 @@
// pressButton() presses or releases the specified button in the toolbar.
bool pressButton(int idButton, bool press);
+ // getButtonRect() gets the bounding rectangle of a button in a toolbar.
+ bool getButtonRect(int nIndex, LPRECT buttonRect);
+
// setButtonSize() sets the size of the buttons to be added to a toolbar.
// Button size must be largen the button bitmap.
bool setButtonSize(int width, int height);
+
+
+ // autoSize() resizes the toolbar window.
+ void autoSize();
// getHandle() returns handle to a toolbar window.
HWND getHandle() { return hwndToolBar; }