[55401] | 1 | /* $Id: UIPopupPaneDetails.h 103988 2024-03-21 13:49:47Z vboxsync $ */
|
---|
[25177] | 2 | /** @file
|
---|
[68540] | 3 | * VBox Qt GUI - UIPopupPaneDetails class declaration.
|
---|
[25177] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2013-2023 Oracle and/or its affiliates.
|
---|
[25177] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
| 25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
[25177] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_widgets_UIPopupPaneDetails_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_widgets_UIPopupPaneDetails_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[47012] | 33 |
|
---|
[41587] | 34 | /* Qt includes: */
|
---|
[47012] | 35 | #include <QWidget>
|
---|
[34736] | 36 |
|
---|
[71630] | 37 | /* GUI includes: */
|
---|
| 38 | #include "UILibraryDefs.h"
|
---|
| 39 |
|
---|
[47012] | 40 | /* Forward declarations: */
|
---|
[68540] | 41 | class QTextEdit;
|
---|
[47012] | 42 | class UIAnimation;
|
---|
[45468] | 43 |
|
---|
[71515] | 44 | /** QWidget extension providing GUI with popup-pane details-pane prototype class. */
|
---|
[71630] | 45 | class SHARED_LIBRARY_STUFF UIPopupPaneDetails : public QWidget
|
---|
[45523] | 46 | {
|
---|
| 47 | Q_OBJECT;
|
---|
[45658] | 48 | Q_PROPERTY(QSize collapsedSizeHint READ collapsedSizeHint);
|
---|
| 49 | Q_PROPERTY(QSize expandedSizeHint READ expandedSizeHint);
|
---|
| 50 | Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint WRITE setMinimumSizeHint);
|
---|
[45523] | 51 |
|
---|
| 52 | signals:
|
---|
| 53 |
|
---|
[71515] | 54 | /** Notifies about focus enter. */
|
---|
[45588] | 55 | void sigFocusEnter();
|
---|
[71515] | 56 | /** Notifies about focus enter. */
|
---|
[45588] | 57 | void sigFocusLeave();
|
---|
[45523] | 58 |
|
---|
[71515] | 59 | /** Notifies about size-hint change. */
|
---|
[45658] | 60 | void sigSizeHintChanged();
|
---|
[45592] | 61 |
|
---|
[45523] | 62 | public:
|
---|
| 63 |
|
---|
[71515] | 64 | /** Constructs details-pane passing @a pParent to the base-class.
|
---|
| 65 | * @param strText Brings the details text.
|
---|
| 66 | * @param fFcoused Brings whether the pane is focused. */
|
---|
[68540] | 67 | UIPopupPaneDetails(QWidget *pParent, const QString &strText, bool fFocused);
|
---|
[45523] | 68 |
|
---|
[71515] | 69 | /** Defines the details @a strText. */
|
---|
[45523] | 70 | void setText(const QString &strText);
|
---|
| 71 |
|
---|
[71515] | 72 | /** Returns the details minimum size-hint. */
|
---|
[103988] | 73 | QSize minimumSizeHint() const RT_OVERRIDE RT_FINAL;
|
---|
[71515] | 74 | /** Defines the details @a minimumSizeHint. */
|
---|
[45658] | 75 | void setMinimumSizeHint(const QSize &minimumSizeHint);
|
---|
[71515] | 76 | /** Lays the content out. */
|
---|
[45691] | 77 | void layoutContent();
|
---|
[45523] | 78 |
|
---|
[71515] | 79 | /** Returns the collapsed size-hint. */
|
---|
[68540] | 80 | QSize collapsedSizeHint() const { return m_collapsedSizeHint; }
|
---|
[71515] | 81 | /** Returns the expanded size-hint. */
|
---|
[68540] | 82 | QSize expandedSizeHint() const { return m_expandedSizeHint; }
|
---|
[45592] | 83 |
|
---|
[68540] | 84 | public slots:
|
---|
| 85 |
|
---|
[71515] | 86 | /** Handles proposal for @a iWidth. */
|
---|
[47455] | 87 | void sltHandleProposalForWidth(int iWidth);
|
---|
[71515] | 88 | /** Handles proposal for @a iHeight. */
|
---|
[68540] | 89 | void sltHandleProposalForHeight(int iHeight);
|
---|
[47455] | 90 |
|
---|
[71515] | 91 | /** Handles focus enter. */
|
---|
[45592] | 92 | void sltFocusEnter();
|
---|
[71515] | 93 | /** Handles focus leave. */
|
---|
[45592] | 94 | void sltFocusLeave();
|
---|
[45691] | 95 |
|
---|
[45523] | 96 | private:
|
---|
| 97 |
|
---|
[71515] | 98 | /** Prepares all. */
|
---|
[45523] | 99 | void prepare();
|
---|
[71515] | 100 | /** Prepares content. */
|
---|
[45523] | 101 | void prepareContent();
|
---|
[71515] | 102 | /** Prepares animations. */
|
---|
[47031] | 103 | void prepareAnimation();
|
---|
[45523] | 104 |
|
---|
[71515] | 105 | /** Updates size-hint. */
|
---|
[45696] | 106 | void updateSizeHint();
|
---|
[71515] | 107 | /** Updates visibility. */
|
---|
[68540] | 108 | void updateVisibility();
|
---|
[45696] | 109 |
|
---|
[71515] | 110 | /** Adjusts @a font. */
|
---|
[47042] | 111 | static QFont tuneFont(QFont font);
|
---|
| 112 |
|
---|
[71515] | 113 | /** Holds the layout margin. */
|
---|
[45691] | 114 | const int m_iLayoutMargin;
|
---|
[71515] | 115 | /** Holds the layout spacing. */
|
---|
[45691] | 116 | const int m_iLayoutSpacing;
|
---|
[71515] | 117 |
|
---|
| 118 | /** Holds the text-editor size-hint. */
|
---|
[68540] | 119 | QSize m_textEditSizeHint;
|
---|
[71515] | 120 | /** Holds the collapsed size-hint. */
|
---|
[45658] | 121 | QSize m_collapsedSizeHint;
|
---|
[71515] | 122 | /** Holds the expanded size-hint. */
|
---|
[45658] | 123 | QSize m_expandedSizeHint;
|
---|
[71515] | 124 | /** Holds the minimum size-hint. */
|
---|
[45592] | 125 | QSize m_minimumSizeHint;
|
---|
| 126 |
|
---|
[71515] | 127 | /** Holds the text. */
|
---|
[47031] | 128 | QString m_strText;
|
---|
[71515] | 129 |
|
---|
| 130 | /** Holds the text-editor instance. */
|
---|
[68540] | 131 | QTextEdit *m_pTextEdit;
|
---|
[71515] | 132 |
|
---|
| 133 | /** Holds the desired textr-editor width. */
|
---|
[68540] | 134 | int m_iDesiredTextEditWidth;
|
---|
[71515] | 135 | /** Holds the maximum pane height. */
|
---|
[68807] | 136 | int m_iMaximumPaneHeight;
|
---|
[71515] | 137 | /** Holds the desired textr-editor height. */
|
---|
[68807] | 138 | int m_iMaximumTextEditHeight;
|
---|
[71515] | 139 | /** Holds the text content margin. */
|
---|
[68807] | 140 | int m_iTextContentMargin;
|
---|
[45691] | 141 |
|
---|
[71515] | 142 | /** Holds whether details-pane is focused. */
|
---|
[45592] | 143 | bool m_fFocused;
|
---|
[71515] | 144 |
|
---|
| 145 | /** Holds the animation instance. */
|
---|
[46242] | 146 | UIAnimation *m_pAnimation;
|
---|
[45523] | 147 | };
|
---|
| 148 |
|
---|
[76581] | 149 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIPopupPaneDetails_h */
|
---|