VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISlidingAnimation.h@ 100347

Last change on this file since 100347 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/* $Id: UISlidingAnimation.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UISlidingAnimation class declaration.
4 */
5
6/*
7 * Copyright (C) 2017-2023 Oracle and/or its affiliates.
8 *
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
26 */
27
28#ifndef FEQT_INCLUDED_SRC_widgets_UISlidingAnimation_h
29#define FEQT_INCLUDED_SRC_widgets_UISlidingAnimation_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QWidget>
36
37/* Forward declarations: */
38class QLabel;
39class QRect;
40class QWidget;
41class UIAnimation;
42
43
44/** Sliding direction. */
45enum SlidingDirection
46{
47 SlidingDirection_Forward,
48 SlidingDirection_Reverse
49};
50
51
52/** QWidget extension which renders a sliding animation
53 * while transiting from one widget to another. */
54class UISlidingAnimation : public QWidget
55{
56 Q_OBJECT;
57 Q_PROPERTY(QRect widgetGeometry READ widgetGeometry WRITE setWidgetGeometry);
58 Q_PROPERTY(QRect startWidgetGeometry READ startWidgetGeometry);
59 Q_PROPERTY(QRect finalWidgetGeometry READ finalWidgetGeometry);
60
61signals:
62
63 /** Commands to move animation in forward direction. */
64 void sigForward();
65 /** Commands to move animation in reverse direction. */
66 void sigReverse();
67
68 /** Notifies listeners about animation in specified @a enmDirection is complete. */
69 void sigAnimationComplete(SlidingDirection enmDirection);
70
71public:
72
73 /** Constructs sliding animation passing @a pParent to the base-class.
74 * @param enmOrientation Brings the widget orientation.
75 * @param fReverse Brings whether the animation should be initially reversed. */
76 UISlidingAnimation(Qt::Orientation enmOrientation, bool fReverse, QWidget *pParent = 0);
77
78 /** Defines @a pWidget1 and @a pWidget2. */
79 void setWidgets(QWidget *pWidget1, QWidget *pWidget2);
80
81 /** Animates cached pWidget1 and pWidget2 in passed @a enmDirection. */
82 void animate(SlidingDirection enmDirection);
83
84private slots:
85
86 /** Handles entering for 'Start' state. */
87 void sltHandleStateEnteredStart();
88 /** Handles entering for 'Final' state. */
89 void sltHandleStateEnteredFinal();
90
91private:
92
93 /** Prepares all. */
94 void prepare();
95
96 /** Defines sub-window geometry. */
97 void setWidgetGeometry(const QRect &rect);
98 /** Returns sub-window geometry. */
99 QRect widgetGeometry() const;
100 /** Returns sub-window start-geometry. */
101 QRect startWidgetGeometry() const { return m_startWidgetGeometry; }
102 /** Returns sub-window final-geometry. */
103 QRect finalWidgetGeometry() const { return m_finalWidgetGeometry; }
104
105 /** Holds the widget orientation. */
106 Qt::Orientation m_enmOrientation;
107 /** Holds whether the animation should be initially reversed. */
108 bool m_fReverse;
109 /** Holds the animation instance. */
110 UIAnimation *m_pAnimation;
111 /** Holds whether animation is in progress. */
112 bool m_fIsInProgress;
113 /** Holds sub-window start-geometry. */
114 QRect m_startWidgetGeometry;
115 /** Holds sub-window final-geometry. */
116 QRect m_finalWidgetGeometry;
117
118 /** Holds the sliding widget instance. */
119 QWidget *m_pWidget;
120 /** Holds the 1st label instance. */
121 QLabel *m_pLabel1;
122 /** Holds the 2nd label instance. */
123 QLabel *m_pLabel2;
124
125 /** Holds the 1st rendered-widget reference. */
126 QWidget *m_pWidget1;
127 /** Holds the 2nd rendered-widget reference. */
128 QWidget *m_pWidget2;
129};
130
131#endif /* !FEQT_INCLUDED_SRC_widgets_UISlidingAnimation_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette