blob: 29b8030117a9ffe6047af25c78fc89e5d74f8fba [file] [log] [blame]
Constantin Kaplinsky729598c2006-05-25 05:12:25 +00001/* Copyright (C) 2005 TightVNC Team. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19// -=- ViewerToolBar.cxx
20
21#include <vncviewer/ViewerToolBar.h>
22#include <vncviewer/resource.h>
23
24void ViewerToolBar::create(HWND parentHwnd) {
25 // Create the toolbar panel
26 ToolBar::create(ID_TOOLBAR, parentHwnd, WS_CHILD |
27 TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NORESIZE);
28 addBitmap(4, IDB_TOOLBAR);
29
30 // Create the control buttons
31 addButton(0, ID_OPTIONS);
32 addButton(1, ID_INFO);
33 addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
34 addButton(2, ID_FULLSCREEN);
35 addButton(3, ID_REQUEST_REFRESH);
36 addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
37 addButton(4, ID_SEND_CAD);
38 addButton(5, ID_SEND_CTLESC);
39 addButton(6, ID_CTRL_KEY);
40 addButton(7, ID_ALT_KEY);
41 addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
42 addButton(8, ID_FILE_TRANSFER);
43 addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
44 addButton(9, ID_NEW_CONNECTION);
45 addButton(10, ID_CONN_SAVE_AS);
46 addButton(11, ID_CLOSE);
47
48 // Resize the toolbar window
49 autoSize();
50}
51
52LRESULT ViewerToolBar::processWM_NOTIFY(WPARAM wParam, LPARAM lParam) {
53 switch (((LPNMHDR)lParam)->code) {
54 // Process tooltips text
55 case TTN_NEEDTEXT:
56 {
57 LPTOOLTIPTEXT TTStr = (LPTOOLTIPTEXT)lParam;
58 if (TTStr->hdr.code != TTN_NEEDTEXT)
59 return 0;
60
61 switch (TTStr->hdr.idFrom) {
62 case ID_OPTIONS:
63 TTStr->lpszText = "Connection options...";
64 break;
65 case ID_INFO:
66 TTStr->lpszText = "Connection info";
67 break;
68 case ID_FULLSCREEN:
69 TTStr->lpszText = "Full screen";
70 break;
71 case ID_REQUEST_REFRESH:
72 TTStr->lpszText = "Request screen refresh";
73 break;
74 case ID_SEND_CAD:
75 TTStr->lpszText = "Send Ctrl-Alt-Del";
76 break;
77 case ID_SEND_CTLESC:
78 TTStr->lpszText = "Send Ctrl-Esc";
79 break;
80 case ID_CTRL_KEY:
81 TTStr->lpszText = "Send Ctrl key press/release";
82 break;
83 case ID_ALT_KEY:
84 TTStr->lpszText = "Send Alt key press/release";
85 break;
86 case ID_FILE_TRANSFER:
87 TTStr->lpszText = "Transfer files...";
88 break;
89 case ID_NEW_CONNECTION:
90 TTStr->lpszText = "New connection...";
91 break;
92 case ID_CONN_SAVE_AS:
93 TTStr->lpszText = "Save connection info as...";
94 break;
95 case ID_CLOSE:
96 TTStr->lpszText = "Disconnect";
97 break;
98 default:
99 break;
100 }
101 }
102
103 default:
104 break;
105 }
106 return 0;
107}
108
109void ViewerToolBar::show() {
110 ShowWindow(getHandle(), SW_SHOW);
111 SendMessage(parentHwnd, WM_SIZE, 0, 0);
112}
113
114void ViewerToolBar::hide() {
115 ShowWindow(getHandle(), SW_HIDE);
116 SendMessage(parentHwnd, WM_SIZE, 0, 0);
117}