1 | /* $Id: QIRichToolButton.h 76581 2019-01-01 06:24:57Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QIRichToolButton class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef FEQT_INCLUDED_SRC_extensions_QIRichToolButton_h
|
---|
19 | #define FEQT_INCLUDED_SRC_extensions_QIRichToolButton_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QWidget>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "UILibraryDefs.h"
|
---|
29 |
|
---|
30 | /* Forward declarations: */
|
---|
31 | class QLabel;
|
---|
32 | class QString;
|
---|
33 | class QIToolButton;
|
---|
34 |
|
---|
35 | /** QWidget extension
|
---|
36 | * representing tool-button with separate text-label. */
|
---|
37 | class SHARED_LIBRARY_STUFF QIRichToolButton : public QWidget
|
---|
38 | {
|
---|
39 | Q_OBJECT;
|
---|
40 |
|
---|
41 | signals:
|
---|
42 |
|
---|
43 | /** Notifies listeners about button click. */
|
---|
44 | void sigClicked();
|
---|
45 |
|
---|
46 | public:
|
---|
47 |
|
---|
48 | /** Constructs rich tool-button passing @a pParent to the base-class. */
|
---|
49 | QIRichToolButton(QWidget *pParent = 0);
|
---|
50 |
|
---|
51 | /** Defines tool-button @a iconSize. */
|
---|
52 | void setIconSize(const QSize &iconSize);
|
---|
53 | /** Defines tool-button @a icon. */
|
---|
54 | void setIcon(const QIcon &icon);
|
---|
55 | /** Animates tool-button click. */
|
---|
56 | void animateClick();
|
---|
57 |
|
---|
58 | /** Defines text-label @a strText. */
|
---|
59 | void setText(const QString &strText);
|
---|
60 |
|
---|
61 | protected:
|
---|
62 |
|
---|
63 | /** Handles paint @a pEvent. */
|
---|
64 | virtual void paintEvent(QPaintEvent *pEvent) /* override */;
|
---|
65 | /** Handles key-press @a pEvent. */
|
---|
66 | virtual void keyPressEvent(QKeyEvent *pEvent) /* override */;
|
---|
67 | /** Handles mouse-press @a pEvent. */
|
---|
68 | virtual void mousePressEvent(QMouseEvent *pEvent) /* override */;
|
---|
69 |
|
---|
70 | protected slots:
|
---|
71 |
|
---|
72 | /** Handles button-click. */
|
---|
73 | virtual void sltButtonClicked() {}
|
---|
74 |
|
---|
75 | private:
|
---|
76 |
|
---|
77 | /** Prepares all. */
|
---|
78 | void prepare();
|
---|
79 |
|
---|
80 | /** Holds the tool-button instance. */
|
---|
81 | QIToolButton *m_pButton;
|
---|
82 | /** Holds the text-label instance. */
|
---|
83 | QLabel *m_pLabel;
|
---|
84 | /** Holds the text for text-label instance. */
|
---|
85 | QString m_strName;
|
---|
86 | };
|
---|
87 |
|
---|
88 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIRichToolButton_h */
|
---|