blob: 38e84c45c719112d044d1cd28f06694ea01e7b1e [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(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
48 addButton(13, ID_NEW_CONNECTION);
49 addButton(14, ID_CONN_SAVE_AS);
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000050
51 // Resize the toolbar window
52 autoSize();
53}
54
55LRESULT ViewerToolBar::processWM_NOTIFY(WPARAM wParam, LPARAM lParam) {
56 switch (((LPNMHDR)lParam)->code) {
57 // Process tooltips text
58 case TTN_NEEDTEXT:
59 {
60 LPTOOLTIPTEXT TTStr = (LPTOOLTIPTEXT)lParam;
61 if (TTStr->hdr.code != TTN_NEEDTEXT)
62 return 0;
63
64 switch (TTStr->hdr.idFrom) {
65 case ID_OPTIONS:
66 TTStr->lpszText = "Connection options...";
67 break;
68 case ID_INFO:
69 TTStr->lpszText = "Connection info";
70 break;
71 case ID_FULLSCREEN:
72 TTStr->lpszText = "Full screen";
73 break;
74 case ID_REQUEST_REFRESH:
75 TTStr->lpszText = "Request screen refresh";
76 break;
77 case ID_SEND_CAD:
78 TTStr->lpszText = "Send Ctrl-Alt-Del";
79 break;
80 case ID_SEND_CTLESC:
81 TTStr->lpszText = "Send Ctrl-Esc";
82 break;
83 case ID_CTRL_KEY:
84 TTStr->lpszText = "Send Ctrl key press/release";
85 break;
86 case ID_ALT_KEY:
87 TTStr->lpszText = "Send Alt key press/release";
88 break;
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000089 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;
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000095 default:
96 break;
97 }
98 }
99
100 default:
101 break;
102 }
103 return 0;
104}