aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2005-11-27 17:02:36 +0000
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2005-11-27 17:02:36 +0000
commite3555590ec6595e6e3c383f02d0e6883bbde0edc (patch)
treeaf2eba63892f38bb3222275be93c62fe0acc5c53 /vncviewer
parent2a54ed6060da38f00a348159ddc98942e00f1da7 (diff)
downloadtigervnc-e3555590ec6595e6e3c383f02d0e6883bbde0edc.tar.gz
tigervnc-e3555590ec6595e6e3c383f02d0e6883bbde0edc.zip
Added possibility to show/hide the toolbar over the system menu.
Added the system menu point "Show toolbar". git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@417 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/ViewerToolBar.cxx2
-rw-r--r--vncviewer/cview.cxx23
-rw-r--r--vncviewer/cview.h1
-rw-r--r--vncviewer/resource.h3
4 files changed, 24 insertions, 5 deletions
diff --git a/vncviewer/ViewerToolBar.cxx b/vncviewer/ViewerToolBar.cxx
index 9846262b..543acea6 100644
--- a/vncviewer/ViewerToolBar.cxx
+++ b/vncviewer/ViewerToolBar.cxx
@@ -23,7 +23,7 @@
void ViewerToolBar::create(HWND parentHwnd) {
// Create the toolbar panel
- ToolBar::create(ID_TOOLBAR, parentHwnd, WS_CHILD | WS_VISIBLE |
+ ToolBar::create(ID_TOOLBAR, parentHwnd, WS_CHILD |
TBSTYLE_FLAT | CCS_NORESIZE);
addBitmap(4, IDB_TOOLBAR);
diff --git a/vncviewer/cview.cxx b/vncviewer/cview.cxx
index 66dd501f..413d1a7b 100644
--- a/vncviewer/cview.cxx
+++ b/vncviewer/cview.cxx
@@ -222,7 +222,7 @@ CView::CView()
hwnd(0), frameHwnd(0), requestUpdate(false), has_focus(false),
palette_changed(false), sameMachine(false), encodingChange(false),
formatChange(false), lastUsedEncoding_(encodingRaw), fullScreenActive(false),
- bumpScroll(false), manager(0) {
+ bumpScroll(false), manager(0), toolbar(true) {
// Create the main window
const TCHAR* name = _T("VNC Viewer 4.0b");
@@ -263,6 +263,9 @@ CView::CView()
// Create the backing buffer
buffer = new win32::DIBSectionBuffer(getFrameHandle());
+
+ // Show the toolbar if needed
+ if (toolbar) tb.show();
}
CView::~CView() {
@@ -282,6 +285,8 @@ bool CView::initialise(network::Socket* s) {
HMENU wndmenu = GetSystemMenu(hwnd, FALSE);
AppendMenu(wndmenu, MF_SEPARATOR, 0, 0);
AppendMenu(wndmenu, MF_STRING, IDM_FULLSCREEN, _T("&Full screen"));
+ AppendMenu(wndmenu, (toolbar ? MF_STRING | MF_CHECKED : MF_STRING),
+ IDM_SHOW_TOOLBAR, _T("Show tool&bar"));
AppendMenu(wndmenu, MF_SEPARATOR, 0, 0);
AppendMenu(wndmenu, MF_STRING, IDM_CTRL_KEY, _T("Ctr&l"));
AppendMenu(wndmenu, MF_STRING, IDM_ALT_KEY, _T("Al&t"));
@@ -400,6 +405,11 @@ CView::setFullscreen(bool fs) {
CheckMenuItem(GetSystemMenu(getHandle(), FALSE), IDM_FULLSCREEN,
(options.fullScreen ? MF_CHECKED : 0) | MF_BYCOMMAND);
+ // If the fullscreen mode is active then disable the menu point
+ // "Show toolbar", otherwise enable the menu point.
+ EnableMenuItem(GetSystemMenu(getHandle(), FALSE), IDM_SHOW_TOOLBAR,
+ (options.fullScreen ? MF_GRAYED : MF_ENABLED) | MF_BYCOMMAND);
+
// If the window is not visible then we ignore the request.
// setVisible() will call us to correct the full-screen state when
// the window is visible, to keep things consistent.
@@ -427,7 +437,7 @@ CView::setFullscreen(bool fs) {
flags = flags & ~(WS_CAPTION | WS_THICKFRAME | WS_MAXIMIZE | WS_MINIMIZE);
vlog.debug("flags=%x", flags);
- tb.hide();
+ if (toolbar) tb.hide();
SetWindowLong(getFrameHandle(), GWL_EXSTYLE, 0);
SetWindowLong(getHandle(), GWL_STYLE, flags);
SetWindowPos(getHandle(), HWND_TOP, mi.rcMonitor.left, mi.rcMonitor.top,
@@ -438,7 +448,7 @@ CView::setFullscreen(bool fs) {
fullScreenActive = bumpScroll = false;
// Set the window non-fullscreen
- tb.show();
+ if (toolbar) tb.show();
SetWindowLong(getFrameHandle(), GWL_EXSTYLE, WS_EX_CLIENTEDGE);
SetWindowLong(getHandle(), GWL_STYLE, fullScreenOldFlags);
SetWindowPos(getHandle(), HWND_NOTOPMOST,
@@ -640,6 +650,13 @@ CView::processMessage(UINT msg, WPARAM wParam, LPARAM lParam) {
options.fullScreen = !options.fullScreen;
setFullscreen(options.fullScreen);
return 0;
+ case IDM_SHOW_TOOLBAR:
+ toolbar = !toolbar;
+ CheckMenuItem(GetSystemMenu(getHandle(), FALSE), IDM_SHOW_TOOLBAR,
+ (toolbar ? MF_CHECKED : MF_UNCHECKED) | MF_BYCOMMAND);
+ if (toolbar) tb.show();
+ else tb.hide();
+ return 0;
case IDM_CTRL_KEY:
writeKeyEvent(VK_CONTROL, 0, !kbd.keyPressed(VK_CONTROL));
return 0;
diff --git a/vncviewer/cview.h b/vncviewer/cview.h
index d0b32688..0dc00662 100644
--- a/vncviewer/cview.h
+++ b/vncviewer/cview.h
@@ -283,6 +283,7 @@ namespace rfb {
// ToolBar handling
ViewerToolBar tb;
+ bool toolbar;
// Local window state
win32::DIBSectionBuffer* buffer;
diff --git a/vncviewer/resource.h b/vncviewer/resource.h
index 66a4a755..3dfe8e50 100644
--- a/vncviewer/resource.h
+++ b/vncviewer/resource.h
@@ -127,13 +127,14 @@
#define IDM_FTDELETE 40024
#define IDM_FTCANCEL 40025
#define IDM_FTCREATEFOLDER 40026
+#define IDM_SHOW_TOOLBAR 40027
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
-#define _APS_NEXT_COMMAND_VALUE 40027
+#define _APS_NEXT_COMMAND_VALUE 40028
#define _APS_NEXT_CONTROL_VALUE 1083
#define _APS_NEXT_SYMED_VALUE 101
#endif