VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.cpp@ 35740

Last change on this file since 35740 was 33540, checked in by vboxsync, 14 years ago

*: spelling fixes, thanks Timeless!

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1/* $Id: QIArrowButtonPress.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
2/** @file
3 *
4 * VBox frontends: Qt GUI ("VirtualBox"):
5 * VirtualBox Qt extensions: QIArrowButtonPress class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2008 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20/* VBox includes */
21#include "QIArrowButtonPress.h"
22#include "UIIconPool.h"
23
24/* Qt includes */
25#include <QKeyEvent>
26
27
28/** @class QIArrowButtonPress
29 *
30 * The QIArrowButtonPress class is an arrow tool-button with text-label,
31 * used as back/next buttons in QIMessageBox class.
32 *
33 */
34
35QIArrowButtonPress::QIArrowButtonPress (QWidget *aParent)
36 : QIRichToolButton (aParent)
37 , mNext (true)
38{
39 updateIcon();
40}
41
42QIArrowButtonPress::QIArrowButtonPress (bool aNext, const QString &aName, QWidget *aParent)
43 : QIRichToolButton (aName, aParent)
44 , mNext (aNext)
45{
46 updateIcon();
47}
48
49void QIArrowButtonPress::updateIcon()
50{
51 mButton->setIcon(UIIconPool::iconSet(mNext ?
52 ":/arrow_right_10px.png" : ":/arrow_left_10px.png"));
53}
54
55bool QIArrowButtonPress::eventFilter (QObject *aObject, QEvent *aEvent)
56{
57 /* Process only QIArrowButtonPress or children */
58 if (!(aObject == this || children().contains (aObject)))
59 return QIRichToolButton::eventFilter (aObject, aEvent);
60
61 /* Process keyboard events */
62 if (aEvent->type() == QEvent::KeyPress)
63 {
64 QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
65 if ((mNext && kEvent->key() == Qt::Key_PageUp) ||
66 (!mNext && kEvent->key() == Qt::Key_PageDown))
67 animateClick();
68 }
69
70 /* Default one handler */
71 return QIRichToolButton::eventFilter (aObject, aEvent);
72}
73
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use