Index: /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 20046)
+++ /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 20047)
@@ -254,4 +254,5 @@
 	include/VBoxConsoleWnd.h \
 	include/VBoxConsoleView.h \
+	include/VBoxMiniToolBar.h \
 	include/VBoxProblemReporter.h \
 	include/VBoxProgressDialog.h \
@@ -345,4 +346,5 @@
 	src/VBoxConsoleView.cpp \
 	src/VBoxConsoleWnd.cpp \
+	src/VBoxMiniToolBar.cpp \
 	src/VBoxDownloaderWgt.cpp \
 	src/VBoxVMListView.cpp \
Index: /trunk/src/VBox/Frontends/VirtualBox/VirtualBox.qrc
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/VirtualBox.qrc	(revision 20046)
+++ /trunk/src/VBox/Frontends/VirtualBox/VirtualBox.qrc	(revision 20047)
@@ -340,4 +340,6 @@
     <file alias="chipset_disabled_16px.png">images/chipset_disabled_16px.png</file>
     <file alias="chipset_disabled_32px.png">images/chipset_disabled_32px.png</file>
+    <file alias="pin_16px.png">images/pin_16px.png</file>
+    <file alias="restore_16px.png">images/restore_16px.png</file>
  </qresource>
  </RCC>
Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 20046)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 20047)
@@ -57,4 +57,6 @@
 
 class VBoxChangeDockIconUpdateEvent;
+
+class VBoxMiniToolBar;
 
 /* We want to make the first action highlighted but not
@@ -250,4 +252,7 @@
     void setViewInSeamlessMode (const QRect &aTargetRect);
 
+    void mtExitMode();
+    void mtCloseVM();
+
 private:
 
@@ -307,4 +312,5 @@
 
     QMenu *mVMMenu;
+    QMenu *mMiniVMMenu;
     QMenu *mDevicesMenu;
     QMenu *mDevicesMountFloppyMenu;
@@ -392,4 +398,6 @@
     CGDisplayFadeReservationToken mFadeToken;
 #endif
+
+    VBoxMiniToolBar *mMiniToolBar;
 };
 
Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxMiniToolBar.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxMiniToolBar.h	(revision 20047)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxMiniToolBar.h	(revision 20047)
@@ -0,0 +1,94 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxMiniToolBar class declaration & implementation. This is the toolbar shown on fullscreen mode.
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxMiniToolBar_h__
+#define __VBoxMiniToolBar_h__
+
+/* VBox includes */
+#include <VBoxToolBar.h>
+
+/* Qt includes */
+#include <QBasicTimer>
+
+class QLabel;
+class QMenu;
+
+/**
+ *  The VBoxMiniToolBar class is a toolbar shown inside full screen mode or seamless mode.
+ *  It supports auto hiding and animated sliding up/down.
+ */
+class VBoxMiniToolBar : public VBoxToolBar
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxMiniToolBar (QList <QMenu*> aMenus);
+
+    void updateDisplay (bool aShow, bool aSetHideFlag);
+    void setDisplayText (const QString &aText);
+
+signals:
+
+    void exitAction();
+    void closeAction();
+
+protected:
+
+    void resizeEvent (QResizeEvent *aEvent);
+    void mouseMoveEvent (QMouseEvent *aEvent);
+    void timerEvent (QTimerEvent *aEvent);
+
+private slots:
+
+    void togglePushpin (bool aOn);
+
+private:
+
+    QAction *mAutoHideAct;
+    QLabel *mDisplayLabel;
+
+    QBasicTimer mScrollTimer;
+    QBasicTimer mAutoScrollTimer;
+
+    int mAutoHideCounter;
+    bool mAutoHide;
+    bool mSlideDown;
+    bool mHideAfterSlide;
+
+    /* Wether to animate showing/hiding the toolbar */
+    bool mAnimated;
+
+    /* Interval (in milli seconds) for scrolling the toolbar, default is 20 msec */
+    int mScrollDelay;
+
+    /* The wait time while the cursor is not over the window after this amount of time (in msec),
+     * the toolbar will auto hide if autohide is on. The default is 100msec. */
+    int mAutoScrollDelay;
+
+    /* Number of total steps before hiding. If it is 10 then wait 10 (steps) * 100ms (mAutoScrollDelay) = 1000ms delay.
+     * The default is 10. */
+    int mAutoHideTotalCounter;
+};
+
+#endif // __VBoxMiniToolBar_h__
+
Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxToolBar.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxToolBar.h	(revision 20046)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxToolBar.h	(revision 20047)
@@ -30,6 +30,7 @@
 
 /* Qt includes */
+#include <QLayout>
+#include <QMainWindow>
 #include <QToolBar>
-#include <QMainWindow>
 
 /* Note: This styles are available on _all_ platforms. */
@@ -123,5 +124,5 @@
         ::darwinSetShowsToolbarButton (this, aShow);
 #else  /* Q_WS_MAC */
-        NOREF (aShow);
+        Q_UNUSED (aShow);
 #endif /* !Q_WS_MAC */
     }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp	(revision 20046)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp	(revision 20047)
@@ -2603,4 +2603,8 @@
         doResizeHint (newSize);
     }
+
+    /* Reactivate the console window to preserve the focus position.
+     * Else focus will move to the mini-tool-bar. */
+    activateWindow();
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 20046)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 20047)
@@ -32,4 +32,5 @@
 #include "VBoxGlobal.h"
 #include "VBoxProblemReporter.h"
+#include "VBoxMiniToolBar.h"
 
 #include "QIStateIndicator.h"
@@ -503,4 +504,28 @@
 
     mHelpActions.addTo (mHelpMenu);
+
+    /* Machine submenu for mini toolbar */
+    mMiniVMMenu = new QMenu (this);
+    mMiniVMMenu->addAction (mVmTypeCADAction);
+#ifdef Q_WS_X11
+    mMiniVMMenu->addAction (mVmTypeCABSAction);
+#endif
+    mMiniVMMenu->addSeparator();
+    mMiniVMMenu->addAction (mVmTakeSnapshotAction);
+    mMiniVMMenu->addSeparator();
+    mMiniVMMenu->addAction (mVmShowInformationDlgAction);
+    mMiniVMMenu->addSeparator();
+    mMiniVMMenu->addAction (mVmResetAction);
+    mMiniVMMenu->addAction (mVmPauseAction);
+    mMiniVMMenu->addAction (mVmACPIShutdownAction);
+
+    /* Mini toolbar */
+    QList <QMenu*> menuList;
+    menuList.append (mMiniVMMenu);
+    menuList.append (mDevicesMenu);
+    mMiniToolBar = new VBoxMiniToolBar (menuList);
+    connect (mMiniToolBar, SIGNAL (exitAction()), this, SLOT (mtExitMode()));
+    connect (mMiniToolBar, SIGNAL (closeAction()), this, SLOT (mtCloseVM()));
+    connect (this, SIGNAL (closing()), mMiniToolBar, SLOT (close()));
 
     ///// Status bar ////////////////////////////////////////////////////////
@@ -1742,4 +1767,6 @@
 //    mVMMenu->setIcon (VBoxGlobal::iconSet (":/machine_16px.png"));
 
+    mMiniVMMenu->setTitle (tr ("&Machine"));
+
     mDevicesMenu->setTitle (tr ("&Devices"));
 //    mDevicesMenu->setIcon (VBoxGlobal::iconSet (":/settings_16px.png"));
@@ -1806,4 +1833,5 @@
                         " [" + vboxGlobal().toString (machine_state) + "] - " +
                         caption_prefix);
+        mMiniToolBar->setDisplayText (cmachine.GetName() + snapshotName);
 //#ifdef Q_WS_MAC
 //        SetWindowTitleWithCFString (reinterpret_cast <WindowPtr> (this->winId()), CFSTR("sfds"));
@@ -2327,12 +2355,10 @@
 
         /* Hide all but the central widget containing the console view. */
-        QList<QWidget *> list = findChildren<QWidget *>();
+        QList <QWidget*> list (findChildren <QWidget*> ());
+        QList <QWidget*> excludes;
+        excludes << centralWidget() << centralWidget()->findChildren <QWidget*> ();
         foreach (QWidget *w, list)
         {
-            /* todo: The list is now recursive. So think about a better way to
-             * prevent the childrens of the centralWidget to be hidden */
-            if (w != centralWidget() &&
-                w != console &&
-                w != console->viewport())
+            if (!excludes.contains (w))
             {
                 if (!w->isHidden())
@@ -2401,6 +2427,19 @@
         mIsWaitingModeResize = true;
 
+    if (!aOn)
+    {
+        /* Animation takes a bit long, the mini toolbar is still disappearing
+         * when switched to normal mode so hide it completely */
+        mMiniToolBar->hide();
+        mMiniToolBar->updateDisplay (false, true);
+    }
+
     /* Toggle qt full-screen mode */
     switchToFullscreen (aOn, aSeamless);
+
+    if (aOn)
+    {
+        mMiniToolBar->updateDisplay (true, true);
+    }
 
 #ifdef Q_WS_MAC
@@ -2519,4 +2558,17 @@
     NOREF (aTargetRect);
 #endif // !Q_WS_MAC
+}
+
+void VBoxConsoleWnd::mtExitMode()
+{
+    if (mIsSeamless)
+        mVmSeamlessAction->toggle();
+    else
+        mVmFullscreenAction->toggle();
+}
+
+void VBoxConsoleWnd::mtCloseVM()
+{
+    mVmCloseAction->trigger();
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxMiniToolBar.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxMiniToolBar.cpp	(revision 20047)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxMiniToolBar.cpp	(revision 20047)
@@ -0,0 +1,285 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxMiniToolBar class declaration & implementation. This is the toolbar shown on fullscreen mode.
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+/* VBox includes */
+#include "VBoxGlobal.h"
+#include "VBoxMiniToolBar.h"
+
+/* Qt includes */
+#include <QCursor>
+#include <QDesktopWidget>
+#include <QLabel>
+#include <QMenu>
+#include <QPolygon>
+#include <QRect>
+#include <QRegion>
+#include <QTimer>
+
+VBoxMiniToolBar::VBoxMiniToolBar (QList <QMenu*> aMenus)
+    : VBoxToolBar (0)
+    , mAutoHideCounter (0)
+    , mAutoHide (true)
+    , mSlideDown (true)
+    , mHideAfterSlide (false)
+    , mAnimated (true)
+    , mScrollDelay (20)
+    , mAutoScrollDelay (100)
+    , mAutoHideTotalCounter (10)
+{
+    setWindowFlags (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
+
+    /* Make the toolbar transparent */
+    //setWindowOpacity (0.3);
+
+    /* Play with toolbar mode as child of the main window, rather than top parentless */
+    //setAllowedAreas (Qt::NoToolBarArea);
+    //mMainWindow->addToolBar (/* Qt::NoToolBarArea, */ this);
+
+    // TODO, we need to hide the tab icon in taskbar when in seamless mode
+    setWindowTitle (tr ("VirtualBox Mini Toolbar"));
+
+    setIconSize (QSize (16, 16));
+
+    /* Left margin of tool-bar */
+    QWidget *indent = new QWidget (this);
+    indent->setMinimumWidth (25);
+    addWidget (indent);
+
+    /* Add pushpin */
+    mAutoHideAct = new QAction (this);
+    mAutoHideAct->setIcon (VBoxGlobal::iconSet (":/pin_16px.png"));
+    mAutoHideAct->setToolTip (tr ("Always show the toolbar"));
+    mAutoHideAct->setCheckable (true);
+    mAutoHideAct->setChecked (!mAutoHide);
+    connect (mAutoHideAct, SIGNAL (toggled (bool)), this, SLOT (togglePushpin (bool)));
+    addAction (mAutoHideAct);
+
+    /* Pre-menu spacing */
+    indent = new QWidget (this);
+    indent->setMinimumWidth (5);
+    addWidget (indent);
+
+    /* Add the menus */
+    foreach (QMenu *m, aMenus)
+    {
+        addAction (m->menuAction());
+
+        /* Menu spacing */
+        indent = new QWidget (this);
+        indent->setMinimumWidth (5);
+        addWidget (indent);
+    }
+
+    /* Left spacing of VM Name */
+    indent = new QWidget (this);
+    indent->setMinimumWidth (15);
+    addWidget (indent);
+
+    /* Insert a label for VM Name */
+    mDisplayLabel = new QLabel (this);
+    addWidget (mDisplayLabel);
+
+    /* Right spacing of VM Name */
+    indent = new QWidget (this);
+    indent->setMinimumWidth (20);
+    addWidget (indent);
+
+    /* Restore action */
+    QAction *restoreAct = new QAction (this);
+    restoreAct->setIcon (VBoxGlobal::iconSet (":/restore_16px.png"));
+    restoreAct->setToolTip (tr ("Exit Full Screen or Seamless Mode"));
+    connect (restoreAct, SIGNAL (triggered()), this, SIGNAL (exitAction()));
+    addAction (restoreAct);
+
+    /* Close action */
+    QAction *closeAct = new QAction (this);
+    closeAct->setIcon (VBoxGlobal::iconSet (":/delete_16px.png"));
+    closeAct->setToolTip (tr ("Close VM"));
+    connect (closeAct, SIGNAL (triggered()), this, SIGNAL (closeAction()));
+    addAction (closeAct);
+
+    /* Right margin of tool-bar */
+    indent = new QWidget (this);
+    indent->setMinimumWidth (25);
+    addWidget (indent);
+
+    setMouseTracking (mAutoHide);
+    setVisible (false);
+}
+
+void VBoxMiniToolBar::updateDisplay (bool aShow, bool aSetHideFlag)
+{
+    mAutoHideCounter = 0;
+
+    setMouseTracking (mAutoHide);
+
+    if (aShow)
+    {
+        if (mAnimated)
+        {
+            if (aSetHideFlag)
+            {
+                mHideAfterSlide = false;
+                mSlideDown = true;
+            }
+            show();
+            mScrollTimer.start (mScrollDelay, this);
+        }
+        else
+            show();
+
+        if (mAutoHide)
+            mAutoScrollTimer.start (mAutoScrollDelay, this);
+        else
+            mAutoScrollTimer.stop();
+    }
+    else
+    {
+        if (mAnimated)
+        {
+            if (aSetHideFlag)
+            {
+                mHideAfterSlide = true;
+                mSlideDown = false;
+            }
+            mScrollTimer.start (mScrollDelay, this);
+        }
+        else
+            hide();
+
+        if (mAutoHide)
+            mAutoScrollTimer.start (mAutoScrollDelay, this);
+        else
+            mAutoScrollTimer.stop();
+    }
+}
+
+/* Update the display text, usually the VM Name */
+void VBoxMiniToolBar::setDisplayText (const QString& aText)
+{
+    mDisplayLabel->setText (aText);
+}
+
+/* Create polygon shaped toolbar */
+void VBoxMiniToolBar::resizeEvent (QResizeEvent* /* aEvent */)
+{
+    int triangular_x = height();
+    int points [8];
+
+    points [0] = 0;
+    points [1] = 0;
+
+    points [2] = triangular_x;
+    points [3] = height();
+
+    points [4] = width() - triangular_x;
+    points [5] = height();
+
+    points [6] = width();
+    points [7] = 0;
+
+    QPolygon polygon;
+    polygon.setPoints (4, points);
+
+    QRegion maskedRegion (polygon);
+
+    setMask (maskedRegion);
+
+    /* Position to the top center of the desktop */
+    QDesktopWidget *d = QApplication::desktop();
+    int x = d->width() / 2 - width() / 2;
+    int y = - height() + 1;
+    move (x, y);
+}
+
+void VBoxMiniToolBar::mouseMoveEvent (QMouseEvent *aEvent)
+{
+    if (!mHideAfterSlide)
+    {
+        mSlideDown = true;
+        mScrollTimer.start (mScrollDelay, this);
+    }
+
+    QToolBar::mouseMoveEvent (aEvent);
+}
+
+/* Handles auto hide feature of the toolbar */
+void VBoxMiniToolBar::timerEvent (QTimerEvent *aEvent)
+{
+    if (aEvent->timerId() == mScrollTimer.timerId())
+    {
+        QRect rect (rect());
+        QPoint p (rect.left(), rect.top());
+        QPoint screen_point = mapToGlobal (p);
+
+        int x = screen_point.x();
+        int y = screen_point.y();
+
+        if (((screen_point.y() == 0) && mSlideDown) ||
+            ((screen_point.y() == - height() + 1) && !mSlideDown))
+        {
+            mScrollTimer.stop();
+
+            if (mHideAfterSlide)
+            {
+                mHideAfterSlide = false;
+                hide();
+            }
+            return;
+        }
+
+        if (mSlideDown)
+            ++ y;
+        else
+            -- y;
+
+        move (x, y);
+    }
+    else if (aEvent->timerId() == mAutoScrollTimer.timerId())
+    {
+        QRect rect (rect());
+        QPoint cursor_pos = QCursor::pos();
+        QPoint p = mapFromGlobal (cursor_pos);
+
+        if (!rect.contains(p)) // cursor_pos.y() <= height())
+        {
+            ++ mAutoHideCounter;
+
+            if (mAutoHideCounter == mAutoHideTotalCounter)
+            {
+                mSlideDown = false;
+                mScrollTimer.start (mScrollDelay, this);
+            }
+        }
+        else
+            mAutoHideCounter = 0;
+    }
+    else
+        QWidget::timerEvent (aEvent);
+}
+
+void VBoxMiniToolBar::togglePushpin (bool aOn)
+{
+    mAutoHide = !aOn;
+    updateDisplay (!mAutoHide, false);
+}
+
