summaryrefslogtreecommitdiffstats
path: root/win/vncviewer/ViewerToolBar.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'win/vncviewer/ViewerToolBar.cxx')
-rw-r--r--win/vncviewer/ViewerToolBar.cxx117
1 files changed, 117 insertions, 0 deletions
diff --git a/win/vncviewer/ViewerToolBar.cxx b/win/vncviewer/ViewerToolBar.cxx
new file mode 100644
index 00000000..29b80301
--- /dev/null
+++ b/win/vncviewer/ViewerToolBar.cxx
@@ -0,0 +1,117 @@
+/* Copyright (C) 2005 TightVNC Team. All Rights Reserved.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+
+// -=- ViewerToolBar.cxx
+
+#include <vncviewer/ViewerToolBar.h>
+#include <vncviewer/resource.h>
+
+void ViewerToolBar::create(HWND parentHwnd) {
+ // Create the toolbar panel
+ ToolBar::create(ID_TOOLBAR, parentHwnd, WS_CHILD |
+ TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NORESIZE);
+ addBitmap(4, IDB_TOOLBAR);
+
+ // Create the control buttons
+ addButton(0, ID_OPTIONS);
+ addButton(1, ID_INFO);
+ addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
+ addButton(2, ID_FULLSCREEN);
+ addButton(3, ID_REQUEST_REFRESH);
+ addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
+ addButton(4, ID_SEND_CAD);
+ addButton(5, ID_SEND_CTLESC);
+ addButton(6, ID_CTRL_KEY);
+ addButton(7, ID_ALT_KEY);
+ addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
+ addButton(8, ID_FILE_TRANSFER);
+ addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
+ addButton(9, ID_NEW_CONNECTION);
+ addButton(10, ID_CONN_SAVE_AS);
+ addButton(11, ID_CLOSE);
+
+ // Resize the toolbar window
+ autoSize();
+}
+
+LRESULT ViewerToolBar::processWM_NOTIFY(WPARAM wParam, LPARAM lParam) {
+ switch (((LPNMHDR)lParam)->code) {
+ // Process tooltips text
+ case TTN_NEEDTEXT:
+ {
+ LPTOOLTIPTEXT TTStr = (LPTOOLTIPTEXT)lParam;
+ if (TTStr->hdr.code != TTN_NEEDTEXT)
+ return 0;
+
+ switch (TTStr->hdr.idFrom) {
+ case ID_OPTIONS:
+ TTStr->lpszText = "Connection options...";
+ break;
+ case ID_INFO:
+ TTStr->lpszText = "Connection info";
+ break;
+ case ID_FULLSCREEN:
+ TTStr->lpszText = "Full screen";
+ break;
+ case ID_REQUEST_REFRESH:
+ TTStr->lpszText = "Request screen refresh";
+ break;
+ case ID_SEND_CAD:
+ TTStr->lpszText = "Send Ctrl-Alt-Del";
+ break;
+ case ID_SEND_CTLESC:
+ TTStr->lpszText = "Send Ctrl-Esc";
+ break;
+ case ID_CTRL_KEY:
+ TTStr->lpszText = "Send Ctrl key press/release";
+ break;
+ case ID_ALT_KEY:
+ TTStr->lpszText = "Send Alt key press/release";
+ break;
+ case ID_FILE_TRANSFER:
+ TTStr->lpszText = "Transfer files...";
+ break;
+ case ID_NEW_CONNECTION:
+ TTStr->lpszText = "New connection...";
+ break;
+ case ID_CONN_SAVE_AS:
+ TTStr->lpszText = "Save connection info as...";
+ break;
+ case ID_CLOSE:
+ TTStr->lpszText = "Disconnect";
+ break;
+ default:
+ break;
+ }
+ }
+
+ default:
+ break;
+ }
+ return 0;
+}
+
+void ViewerToolBar::show() {
+ ShowWindow(getHandle(), SW_SHOW);
+ SendMessage(parentHwnd, WM_SIZE, 0, 0);
+}
+
+void ViewerToolBar::hide() {
+ ShowWindow(getHandle(), SW_HIDE);
+ SendMessage(parentHwnd, WM_SIZE, 0, 0);
+}