QIArrowButtonSwitch.cpp revision 57bad04ee49aecc036182a51108288dae1957782
57bad04ee49aecc036182a51108288dae1957782vboxsync * VBox Qt GUI - QIArrowButtonSwitch class implementation.
57bad04ee49aecc036182a51108288dae1957782vboxsync * Copyright (C) 2006-2014 Oracle Corporation
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync * available from http://www.virtualbox.org. This file is free software;
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync * you can redistribute it and/or modify it under the terms of the GNU
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync * General Public License (GPL) as published by the Free Software
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
57bad04ee49aecc036182a51108288dae1957782vboxsync/* Qt includes: */
57bad04ee49aecc036182a51108288dae1957782vboxsync/* GUI includes: */
57bad04ee49aecc036182a51108288dae1957782vboxsyncQIArrowButtonSwitch::QIArrowButtonSwitch(QWidget *pParent /* = 0 */)
57bad04ee49aecc036182a51108288dae1957782vboxsync /* Update icon: */
57bad04ee49aecc036182a51108288dae1957782vboxsyncvoid QIArrowButtonSwitch::setIconForButtonState(QIArrowButtonSwitch::ButtonState buttonState, const QIcon &icon)
57bad04ee49aecc036182a51108288dae1957782vboxsync /* Assign icon: */
57bad04ee49aecc036182a51108288dae1957782vboxsync /* Update icon: */
57bad04ee49aecc036182a51108288dae1957782vboxsync /* Toggle button-state: */
57bad04ee49aecc036182a51108288dae1957782vboxsync m_buttonState = m_buttonState == ButtonState_Collapsed ?
57bad04ee49aecc036182a51108288dae1957782vboxsync /* Update icon: */
57bad04ee49aecc036182a51108288dae1957782vboxsyncvoid QIArrowButtonSwitch::keyPressEvent(QKeyEvent *pEvent)
57bad04ee49aecc036182a51108288dae1957782vboxsync /* Handle different keys: */
57bad04ee49aecc036182a51108288dae1957782vboxsync /* Animate-click for the Space key: */
57bad04ee49aecc036182a51108288dae1957782vboxsync case Qt::Key_Minus: if (m_buttonState == ButtonState_Expanded) return animateClick(); break;
57bad04ee49aecc036182a51108288dae1957782vboxsync case Qt::Key_Plus: if (m_buttonState == ButtonState_Collapsed) return animateClick(); break;
57bad04ee49aecc036182a51108288dae1957782vboxsync default: break;
57bad04ee49aecc036182a51108288dae1957782vboxsync /* Call to base-class: */