QIArrowButtonSwitch.h revision 57bad04ee49aecc036182a51108288dae1957782
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync/** @file
57bad04ee49aecc036182a51108288dae1957782vboxsync * VBox Qt GUI - QIArrowButtonSwitch class declaration.
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync */
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync/*
57bad04ee49aecc036182a51108288dae1957782vboxsync * Copyright (C) 2006-2014 Oracle Corporation
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync *
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.
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync */
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync#ifndef ___QIArrowButtonSwitch_h___
57bad04ee49aecc036182a51108288dae1957782vboxsync#define ___QIArrowButtonSwitch_h___
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync/* Qt includes: */
57bad04ee49aecc036182a51108288dae1957782vboxsync#include <QMap>
57bad04ee49aecc036182a51108288dae1957782vboxsync#include <QIcon>
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync/* GUI includes: */
57bad04ee49aecc036182a51108288dae1957782vboxsync#include "QIRichToolButton.h"
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync/** QIRichToolButton extension
57bad04ee49aecc036182a51108288dae1957782vboxsync * representing arrow tool-button with text-label,
57bad04ee49aecc036182a51108288dae1957782vboxsync * can be used as collaps/expand switch in various places. */
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsyncclass QIArrowButtonSwitch : public QIRichToolButton
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync{
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync Q_OBJECT;
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsyncpublic:
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync /** Button states. */
57bad04ee49aecc036182a51108288dae1957782vboxsync enum ButtonState { ButtonState_Collapsed, ButtonState_Expanded };
57bad04ee49aecc036182a51108288dae1957782vboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync /** Constructor, passes @a pParent to the QIRichToolButton constructor. */
57bad04ee49aecc036182a51108288dae1957782vboxsync QIArrowButtonSwitch(QWidget *pParent = 0);
57bad04ee49aecc036182a51108288dae1957782vboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync /** Defines the @a icon for the @a buttonState. */
57bad04ee49aecc036182a51108288dae1957782vboxsync void setIconForButtonState(ButtonState buttonState, const QIcon &icon);
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync /** Returns whether button-state is ButtonState_Expanded. */
57bad04ee49aecc036182a51108288dae1957782vboxsync bool isExpanded() const { return m_buttonState == ButtonState_Expanded; }
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsyncprotected slots:
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync /** Button-click handler. */
57bad04ee49aecc036182a51108288dae1957782vboxsync virtual void sltButtonClicked();
57bad04ee49aecc036182a51108288dae1957782vboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsyncprotected:
57bad04ee49aecc036182a51108288dae1957782vboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync /** Key-press-event handler. */
57bad04ee49aecc036182a51108288dae1957782vboxsync virtual void keyPressEvent(QKeyEvent *pEvent);
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsyncprivate:
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync /** Updates icon according button-state. */
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync void updateIcon();
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync /** Holds the button-state. */
57bad04ee49aecc036182a51108288dae1957782vboxsync ButtonState m_buttonState;
57bad04ee49aecc036182a51108288dae1957782vboxsync /** Holds icons for button-states. */
57bad04ee49aecc036182a51108288dae1957782vboxsync QMap<ButtonState, QIcon> m_icons;
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync};
ad13c20995d0a1aafbfbd35b2d698ef2ff5fbeefvboxsync
57bad04ee49aecc036182a51108288dae1957782vboxsync#endif /* !___QIArrowButtonSwitch_h___ */