Changeset 57023 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 20, 2015 3:23:30 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101741
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
r57022 r57023 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIMiniToolBar class implementation (fullscreen/seamless).3 * VBox Qt GUI - UIMiniToolBar class implementation. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2009-201 3Oracle Corporation7 * Copyright (C) 2009-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 44 44 45 /* Mini-toolbar widget prototype: */ 45 /** UIToolBar reimplementation 46 * providing UIMiniToolBar with mini-toolbar. */ 46 47 class UIMiniToolBarPrivate : public UIToolBar 47 48 { … … 50 51 signals: 51 52 52 /* Notifier: Resize stuff:*/53 /** Notifies listeners about we are resized. */ 53 54 void sigResized(); 54 55 55 /* Notifiers: Action stuff:*/56 /** Notifies listeners about action triggered to toggle auto-hide. */ 56 57 void sigAutoHideToggled(); 58 /** Notifies listeners about action triggered to minimize. */ 57 59 void sigMinimizeAction(); 60 /** Notifies listeners about action triggered to exit. */ 58 61 void sigExitAction(); 62 /** Notifies listeners about action triggered to close. */ 59 63 void sigCloseAction(); 60 64 61 65 public: 62 66 63 /* Constructor:*/67 /** Constructor. */ 64 68 UIMiniToolBarPrivate(); 65 69 66 /* API: Alignment stuff:*/70 /** Defines @a alignment. */ 67 71 void setAlignment(Qt::Alignment alignment); 68 72 69 /* API: Auto-hide stuff:*/73 /** Returns whether we do auto-hide. */ 70 74 bool autoHide() const; 75 /** Defines whether we do @a fAutoHide. */ 71 76 void setAutoHide(bool fAutoHide); 72 77 73 /* API: Text stuff:*/78 /** Defines our @a strText. */ 74 79 void setText(const QString &strText); 75 80 76 /* API: Menu aggregator:*/81 /** Adds our @a menus. */ 77 82 void addMenus(const QList<QMenu*> &menus); 78 83 79 84 protected: 80 85 81 /* Handlers: Event-processing stuff:*/86 /** Show @a pEvent handler. */ 82 87 virtual void showEvent(QShowEvent *pEvent); 88 /** Polish @a pEvent handler. */ 83 89 virtual void polishEvent(QShowEvent *pEvent); 90 /** Resize @a pEvent handler. */ 84 91 virtual void resizeEvent(QResizeEvent *pEvent); 92 /** Paint @a pEvent handler. */ 85 93 virtual void paintEvent(QPaintEvent *pEvent); 86 94 87 95 private: 88 96 89 /* Helper: Prepare stuff:*/97 /** Prepare routine. */ 90 98 void prepare(); 91 99 92 /* Helper: Shape stuff:*/100 /** Rebuilds our shape. */ 93 101 void rebuildShape(); 94 102 95 /* Variables: General stuff:*/103 /** Holds whether this widget was polished. */ 96 104 bool m_fPolished; 105 /** Holds the alignment type. */ 97 106 Qt::Alignment m_alignment; 107 /** Holds the shape. */ 98 108 QPainterPath m_shape; 99 109 100 /* Variables: Contents stuff:*/110 /** Holds the action to toggle auto-hide. */ 101 111 QAction *m_pAutoHideAction; 112 /** Holds the name label. */ 102 113 QLabel *m_pLabel; 114 /** Holds the action to trigger minimize. */ 103 115 QAction *m_pMinimizeAction; 116 /** Holds the action to trigger exit. */ 104 117 QAction *m_pRestoreAction; 118 /** Holds the action to trigger close. */ 105 119 QAction *m_pCloseAction; 106 120 107 /* Variables: Menu stuff:*/121 /** Holds the pointer to the place to insert menu. */ 108 122 QAction *m_pMenuInsertPosition; 109 123 110 /* Variables: Spacers stuff:*/124 /** Holds the spacings. */ 111 125 QList<QWidget*> m_spacings; 126 /** Holds the margins. */ 112 127 QList<QWidget*> m_margins; 113 128 }; -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
r57021 r57023 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIMiniToolBar class declaration (fullscreen/seamless).3 * VBox Qt GUI - UIMiniToolBar class declaration. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2009-201 3Oracle Corporation7 * Copyright (C) 2009-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __UIMiniToolBar_h__ 19 #define __UIMiniToolBar_h__ 20 21 /* Qt includes: */ 22 #include <QMainWindow> 18 #ifndef ___UIMiniToolBar_h___ 19 #define ___UIMiniToolBar_h___ 23 20 24 21 /* GUI includes: */ … … 26 23 27 24 /* Forward declarations: */ 25 class QMenu; 28 26 class QTimer; 29 27 class QLabel; 30 class QMenu;31 28 class QMdiArea; 32 class UIMiniToolBar;33 29 class QMdiSubWindow; 34 30 class UIAnimation; … … 42 38 }; 43 39 44 /* Runtime mini-toolbar frameless-window prototype: */ 40 /** QWidget reimplementation 41 * providing GUI with slideable mini-toolbar used in full-screen/seamless modes. */ 45 42 class UIMiniToolBar : public QWidget 46 43 { … … 52 49 signals: 53 50 54 /* Notifiers: Action stuff:*/51 /** Notifies listeners about action triggered to minimize. */ 55 52 void sigMinimizeAction(); 53 /** Notifies listeners about action triggered to exit. */ 56 54 void sigExitAction(); 55 /** Notifies listeners about action triggered to close. */ 57 56 void sigCloseAction(); 58 57 59 /* Notifiers: Hover stuff:*/58 /** Notifies listeners about we are hovered. */ 60 59 void sigHoverEnter(); 60 /** Notifies listeners about we are unhovered. */ 61 61 void sigHoverLeave(); 62 62 … … 66 66 public: 67 67 68 /* Constructor/destructor: */ 68 /** Constructor, passes @a pParent to the QWidget constructor. 69 * @param geometryType determines the geometry type, 70 * @param alignment determines the alignment type, 71 * @param fAutoHide determines whether we should auto-hide. */ 69 72 UIMiniToolBar(QWidget *pParent, 70 73 GeometryType geometryType, 71 74 Qt::Alignment alignment, 72 75 bool fAutoHide = true); 76 /** Destructor. */ 73 77 ~UIMiniToolBar(); 74 78 75 /* API: Alignment stuff:*/79 /** Defines @a alignment. */ 76 80 void setAlignment(Qt::Alignment alignment); 77 81 78 /* API: Auto-hide stuff:*/82 /** Returns whether internal widget do auto-hide. */ 79 83 bool autoHide() const { return m_fAutoHide; } 84 /** Defines whether internal widget do @a fAutoHide. 85 * @param fPropagateToChild determines should we propagate defined 86 * option value to internal widget. */ 80 87 void setAutoHide(bool fAutoHide, bool fPropagateToChild = true); 81 88 82 /* API: Text stuff:*/89 /** Defines @a strText for internal widget. */ 83 90 void setText(const QString &strText); 84 91 85 /* API: Menu stuff:*/92 /** Adds @a menus to internal widget. */ 86 93 void addMenus(const QList<QMenu*> &menus); 87 94 88 /* API: Geometry stuff:*/95 /** Adjusts geometry according to @a iHostScreen. */ 89 96 void adjustGeometry(int iHostScreen = -1); 90 97 91 98 private slots: 92 99 93 /* Handlers: Toolbar stuff:*/100 /** Handles internal widget resize event. */ 94 101 void sltHandleToolbarResize(); 102 103 /** Handles internal widget auto-hide toggling. */ 95 104 void sltAutoHideToggled(); 105 106 /** Handles hovering. */ 96 107 void sltHoverEnter(); 108 /** Handles unhovering. */ 97 109 void sltHoverLeave(); 110 111 /** Notifies listeners about we stole focus. */ 112 void sltNotifyAboutFocusStolen() { emit sigNotifyAboutFocusStolen(); } 98 113 99 114 private: 100 115 101 /* Helpers: Prepare/cleanup stuff:*/116 /** Prepare routine. */ 102 117 void prepare(); 118 /** Cleanup routine. */ 103 119 void cleanup(); 104 120 105 /* Handlers: Event-processing stuff:*/121 /** Mouse enter @a pEvent handler. */ 106 122 void enterEvent(QEvent *pEvent); 123 /** Mouse leave @a pEvent handler. */ 107 124 void leaveEvent(QEvent *pEvent); 108 125 109 126 #ifdef Q_WS_X11 110 /** X11: Resize event handler. */127 /** X11: Resize @a pEvent handler. */ 111 128 void resizeEvent(QResizeEvent *pEvent); 112 129 #endif /* Q_WS_X11 */ … … 116 133 bool eventFilter(QObject *pWatched, QEvent *pEvent); 117 134 118 /* Helper: Hover stuff:*/135 /** Simulates auto-hide animation. */ 119 136 void simulateToolbarAutoHiding(); 120 137 121 /* Property: Hover stuff: */ 122 void setToolbarPosition(QPoint point); 138 /** Defines internal widget @a position. */ 139 void setToolbarPosition(QPoint position); 140 /** Returns internal widget position. */ 123 141 QPoint toolbarPosition() const; 142 /** Returns internal widget position when it's hidden. */ 124 143 QPoint hiddenToolbarPosition() const { return m_hiddenToolbarPosition; } 144 /** Returns internal widget position when it's shown. */ 125 145 QPoint shownToolbarPosition() const { return m_shownToolbarPosition; } 126 146 127 /* Variables: General stuff:*/147 /** Holds the geometry type. */ 128 148 const GeometryType m_geometryType; 149 /** Holds the alignment type. */ 129 150 Qt::Alignment m_alignment; 151 /** Holds whether we should auto-hide. */ 130 152 bool m_fAutoHide; 131 153 132 /* Variables: Contents stuff:*/154 /** Holds the MDI-area. */ 133 155 QMdiArea *m_pMdiArea; 156 /** Holds the internal widget. */ 134 157 UIMiniToolBarPrivate *m_pToolbar; 158 /** Holds the pointer to the wrapped 159 * internal widget inside the MDI-area. */ 135 160 QMdiSubWindow *m_pEmbeddedToolbar; 136 161 137 /* Variables: Hover stuff:*/162 /** Holds whether we are hovered. */ 138 163 bool m_fHovered; 164 /** Holds the hover timer. */ 139 165 QTimer *m_pHoverEnterTimer; 166 /** Holds the unhover timer. */ 140 167 QTimer *m_pHoverLeaveTimer; 168 /** Holds the internal widget position when it's hidden. */ 141 169 QPoint m_hiddenToolbarPosition; 170 /** Holds the internal widget position when it's shown. */ 142 171 QPoint m_shownToolbarPosition; 172 /** Holds the animation framework object. */ 143 173 UIAnimation *m_pAnimation; 144 174 }; 145 175 146 #endif / / __UIMiniToolBar_h__176 #endif /* !___UIMiniToolBar_h___ */ 147 177
Note:
See TracChangeset
for help on using the changeset viewer.