blob: adc6f07e96ba053a15836557adc7432cc2d1f6df [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);
george821d3cc612006-09-09 14:42:20 +000037 addButton(4, ID_ZOOM_IN);
38 addButton(5, ID_ZOOM_OUT);
39 addButton(6, ID_ACTUAL_SIZE);
40 addButton(7, ID_AUTO_SIZE);
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000041 addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
george821d3cc612006-09-09 14:42:20 +000042 addButton(8, ID_SEND_CAD);
43 addButton(9, ID_SEND_CTLESC);
44 addButton(10, ID_CTRL_KEY);
45 addButton(11, ID_ALT_KEY);
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000046 addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
george821d3cc612006-09-09 14:42:20 +000047 addButton(12, ID_FILE_TRANSFER);
48 addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
49 addButton(13, ID_NEW_CONNECTION);
50 addButton(14, ID_CONN_SAVE_AS);
51 addButton(15, ID_CLOSE);
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000052
53 // Resize the toolbar window
54 autoSize();
55}
56
57LRESULT ViewerToolBar::processWM_NOTIFY(WPARAM wParam, LPARAM lParam) {
58 switch (((LPNMHDR)lParam)->code) {
59 // Process tooltips text
60 case TTN_NEEDTEXT:
61 {
62 LPTOOLTIPTEXT TTStr = (LPTOOLTIPTEXT)lParam;
63 if (TTStr->hdr.code != TTN_NEEDTEXT)
64 return 0;
65
66 switch (TTStr->hdr.idFrom) {
67 case ID_OPTIONS:
68 TTStr->lpszText = "Connection options...";
69 break;
70 case ID_INFO:
71 TTStr->lpszText = "Connection info";
72 break;
73 case ID_FULLSCREEN:
74 TTStr->lpszText = "Full screen";
75 break;
76 case ID_REQUEST_REFRESH:
77 TTStr->lpszText = "Request screen refresh";
78 break;
79 case ID_SEND_CAD:
80 TTStr->lpszText = "Send Ctrl-Alt-Del";
81 break;
82 case ID_SEND_CTLESC:
83 TTStr->lpszText = "Send Ctrl-Esc";
84 break;
85 case ID_CTRL_KEY:
86 TTStr->lpszText = "Send Ctrl key press/release";
87 break;
88 case ID_ALT_KEY:
89 TTStr->lpszText = "Send Alt key press/release";
90 break;
91 case ID_FILE_TRANSFER:
92 TTStr->lpszText = "Transfer files...";
93 break;
94 case ID_NEW_CONNECTION:
95 TTStr->lpszText = "New connection...";
96 break;
97 case ID_CONN_SAVE_AS:
98 TTStr->lpszText = "Save connection info as...";
99 break;
100 case ID_CLOSE:
101 TTStr->lpszText = "Disconnect";
102 break;
103 default:
104 break;
105 }
106 }
107
108 default:
109 break;
110 }
111 return 0;
112}