1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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);
}
|