VBoxUtils.h revision 582bc34015779803fcfc18fcf502af48a51cd6cd
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* Declarations of utility classes and functions
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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.
*/
#ifndef __VBoxUtils_h__
#define __VBoxUtils_h__
#include <qobject.h>
#include <qevent.h>
#include <qlistview.h>
#include <qtextedit.h>
#include <qlabel.h>
#include <qlayout.h>
/**
* Simple ListView filter to disable unselecting all items by clicking in the
* unused area of the list (which is actually very annoying for the Single
* selection mode).
*/
{
{
}
{
{
return true;
}
return false;
}
};
/**
* Simple class that filters out presses and releases of the given key
* directed to a widget (the widget acts like if it would never handle
* this key).
*/
{
{
{
{
return false;
}
}
return false;
}
};
/**
* Simple class that filters out all key presses and releases
* got while the Alt key is pressed. For some very strange reason,
* QLineEdit accepts those combinations that are not used as accelerators,
* and inserts the corresponding characters to the entry field.
*/
{
{
{
return true;
}
return false;
}
};
/**
* Watches the given widget and makes sure the minimum widget size set by the layout
* manager does never get smaller than the previous minimum size set by the
* layout manager. This way, widgets with dynamic contents (i.e. text on some
* toggle buttons) will be able only to grow, never shrink, to avoid flicker
* during alternate contents updates (Pause -> Resume -> Pause -> ...).
*
* @todo not finished
*/
{
{
}
{
{
}
}
};
/**
* Simple QTextEdit subclass to return its minimumSizeHint() as sizeHint()
* for getting more compact layout.
*/
{
{
return minimumSizeHint();
}
QSize minimumSizeHint() const
{
}
};
/**
* Simple QLabel subclass to re-query and return its sizeHint()
* before the widget to be shown for getting more compact layout.
*/
{
{
/* setup default size policy and alignment */
(QSizePolicy::SizeType)0,
0, 0,
sizePolicy().hasHeightForWidth()));
/* install show-parent-widget watcher */
}
{
return mShowed ?
}
{
{
{
mShowed = true;
break;
}
default:
break;
}
}
bool mShowed;
};
#ifdef Q_WS_MAC
OSStatus DarwinRegionHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData);
#endif /* Q_WS_MAC */
#endif // __VBoxUtils_h__