VBoxConsoleView.h revision f9b2767f7f8c2a88d31d6958963c02ca7b72acb1
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* VBoxConsoleView class declaration
*/
/*
* 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;
* 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 ___VBoxConsoleView_h___
#define ___VBoxConsoleView_h___
#include "COMDefs.h"
#include "VBoxDefs.h"
#include "VBoxGlobalSettings.h"
/* Qt includes */
#include <QAbstractScrollArea>
#include <QScrollBar>
#if defined (Q_WS_PM)
#define UM_PREACCEL_CHAR WM_USER
#endif
#if defined (Q_WS_MAC)
# ifdef QT_MAC_USE_COCOA
/** @todo include something chocolatety... */
# else
# endif
#endif
{
enum {
MouseCaptured = 0x01,
MouseAbsolute = 0x02,
MouseAbsoluteDisabled = 0x04,
MouseNeedsHostCursor = 0x08,
KeyboardCaptured = 0x01,
HostKeyPressed = 0x02,
};
~VBoxConsoleView();
void attach();
void detach();
void normalizeGeometry (bool adjustPosition = false);
void setMouseIntegrationEnabled (bool enabled);
bool isMouseAbsolute() const { return mMouseAbsolute; }
void setAutoresizeGuest (bool on);
void onFullscreenChange (bool on);
void onViewOpened();
bool isAutoresizeGuestActive();
/* todo: This are some support functions for the qt4 port. Maybe we get rid
* of them some day. */
int contentsWidth() const;
int contentsHeight() const;
{
}
{
}
void updateSliders();
#if defined(Q_WS_MAC)
void updateDockIcon();
void updateDockOverlay();
void setMouseCoalescingEnabled (bool aOn);
#endif
void keyboardStateChanged (int state);
void mouseStateChanged (int state);
void additionsStateChanged (const QString &, bool, bool, bool);
void networkStateChange();
void usbStateChange();
void sharedFoldersChanged();
void resizeHintDone();
// events
#if defined(Q_WS_WIN32)
void darwinGrabKeyboardEvents (bool fGrab);
#endif
/** Flags for keyEvent(). */
enum {
KeyExtended = 0x01,
KeyPressed = 0x02,
KeyPause = 0x04,
KeyPrint = 0x08,
};
void emitKeyboardStateChanged()
{
(mKbdCaptured ? KeyboardCaptured : 0) |
(mIsHostkeyPressed ? HostKeyPressed : 0));
}
void emitMouseStateChanged() {
(mMouseAbsolute ? MouseAbsolute : 0) |
(!mMouseIntegration ? MouseAbsoluteDisabled : 0));
}
// IConsoleCallback event handlers
void doRefresh();
void resizeEvent (QResizeEvent *);
void paintEvent (QPaintEvent *);
void releaseAllPressedKeys (bool aReleaseHostKey = true);
void saveKeyStates();
void sendChangedKeyStates();
void updateMouseClipping();
void doResizeDesktop (int);
enum DesktopGeo
{
};
void calculateDesktopGeometry();
void maybeRestrictMinimumSize();
const VBoxGlobalSettings &gs;
bool mAttached : 1;
bool mKbdCaptured : 1;
bool mMouseCaptured : 1;
bool mMouseAbsolute : 1;
bool mMouseIntegration : 1;
bool mDisableAutoCapture : 1;
bool mIsHostkeyPressed : 1;
bool mIsHostkeyAlone : 1;
/** mKbdCaptured value during the the last host key press or release */
bool hostkey_in_capture : 1;
bool mIgnoreMainwndResize : 1;
bool mAutoresizeGuest : 1;
bool mIgnoreFrameBufferResize : 1;
/**
* This flag indicates whether the last console resize should trigger
* a size hint to the guest. This is important particularly when
* enabling the autoresize feature to know whether to send a hint.
*/
bool mDoResize : 1;
bool mGuestSupportsGraphics : 1;
bool mNumLock : 1;
bool mScrollLock : 1;
bool mCapsLock : 1;
long muNumLockAdaptionCnt;
long muCapsLockAdaptionCnt;
#if defined(Q_WS_WIN)
#endif
#if defined(Q_WS_MAC)
# if !defined (VBOX_WITH_HACKED_QT) && !defined (QT_MAC_USE_COCOA)
/** Event handler reference. NULL if the handler isn't installed. */
# endif
/** The current modifier key mask. Used to figure out which modifier
* key was pressed when we get a kEventRawKeyModifiersChanged event. */
bool mKeyboardGrabbed;
#endif
#if defined (Q_WS_WIN32)
# if defined (QT_MAC_USE_COCOA)
static bool darwinEventHandlerProc (const void *pvCocoaEvent, const
void *pvCarbonEvent, void *pvUser);
# elif !defined (VBOX_WITH_HACKED_QT)
# else /* VBOX_WITH_HACKED_QT */
# endif /* VBOX_WITH_HACKED_QT */
#endif
#if defined(Q_WS_MAC)
bool mDockIconEnabled;
#endif
bool mPassCAD;
};
#endif // !___VBoxConsoleView_h___