| 1 | /* BEGIN_COMMON_COPYRIGHT_HEADER |
| 2 | * (c)LGPL2+ |
| 3 | * |
| 4 | * LXQt - a lightweight, Qt based, desktop toolset |
| 5 | * https://lxqt.org |
| 6 | * |
| 7 | * Copyright: 2012 Razor team |
| 8 | * Authors: |
| 9 | * Alexander Sokoloff <[email protected]> |
| 10 | * |
| 11 | * This program or library is free software; you can redistribute it |
| 12 | * and/or modify it under the terms of the GNU Lesser General Public |
| 13 | * License as published by the Free Software Foundation; either |
| 14 | * version 2.1 of the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This library is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | * Lesser General Public License for more details. |
| 20 | |
| 21 | * You should have received a copy of the GNU Lesser General |
| 22 | * Public License along with this library; if not, write to the |
| 23 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 24 | * Boston, MA 02110-1301 USA |
| 25 | * |
| 26 | * END_COMMON_COPYRIGHT_HEADER */ |
| 27 | |
| 28 | |
| 29 | #ifndef ILXQTPANEL_H |
| 30 | #define ILXQTPANEL_H |
| 31 | #include <QRect> |
| 32 | #include "lxqtpanelglobals.h" |
| 33 | |
| 34 | class ILXQtPanelPlugin; |
| 35 | class QWidget; |
| 36 | |
| 37 | /** |
| 38 | **/ |
| 39 | class LXQT_PANEL_API ILXQtPanel |
| 40 | { |
| 41 | public: |
| 42 | /** |
| 43 | * @brief Specifies the position of the panel on screen. |
| 44 | */ |
| 45 | enum Position{ |
| 46 | PositionBottom, //!< The bottom side of the screen. |
| 47 | PositionTop, //!< The top side of the screen. |
| 48 | PositionLeft, //!< The left side of the screen. |
| 49 | PositionRight //!< The right side of the screen. |
| 50 | }; |
| 51 | |
| 52 | virtual ~ILXQtPanel() { } |
| 53 | |
| 54 | /** |
| 55 | * @brief Returns the position of the panel. Possible values for the |
| 56 | * return value are described by the Position enum. |
| 57 | */ |
| 58 | virtual Position position() const = 0; |
| 59 | |
| 60 | /** |
| 61 | * @brief Returns the edge length of the icons that are shown on the panel |
| 62 | * in pixels. The icons are square. |
| 63 | */ |
| 64 | virtual int iconSize() const = 0; |
| 65 | /** |
| 66 | * @brief Returns the number of lines/rows of this panel. |
| 67 | */ |
| 68 | virtual int lineCount() const = 0; |
| 69 | |
| 70 | /** |
| 71 | * @brief Helper function for convenient direction/alignment checking. |
| 72 | * @return True if the panel is on the top or the bottom of the |
| 73 | * screen; otherwise returns false. |
| 74 | */ |
| 75 | bool isHorizontal() const { return position() == PositionBottom || position() == PositionTop; } |
| 76 | |
| 77 | /** |
| 78 | * @brief Helper method that returns the global screen coordinates of the |
| 79 | * panel, so you do not need to use QWidget::mapToGlobal() by yourself. |
| 80 | * @return The QRect where the panel is located in global screen |
| 81 | * coordinates. |
| 82 | */ |
| 83 | virtual QRect globalGeometry() const = 0; |
| 84 | |
| 85 | /** |
| 86 | * @brief Helper method for calculating the global screen position of a |
| 87 | * popup window with size windowSize. |
| 88 | * @param absolutePos Contains the global screen coordinates where the |
| 89 | * popup should be appear, i.e. the point where the user has clicked. |
| 90 | * @param windowSize The size that the window will occupy. |
| 91 | * @return The global screen position where the popup window can be shown. |
| 92 | */ |
| 93 | virtual QRect calculatePopupWindowPos(const QPoint &absolutePos, const QSize &windowSize) const = 0; |
| 94 | /** |
| 95 | * @brief Helper method for calculating the global screen position of a |
| 96 | * popup window with size windowSize. The parameter plugin should be a |
| 97 | * plugin |
| 98 | * @param plugin Plugin that the popup window will belong to. The position |
| 99 | * will be calculated according to the position of the plugin in the panel. |
| 100 | * @param windowSize The size that the window will occupy. |
| 101 | * @return The global screen position where the popup window can be shown. |
| 102 | */ |
| 103 | virtual QRect calculatePopupWindowPos(const ILXQtPanelPlugin *plugin, const QSize &windowSize) const = 0; |
| 104 | |
| 105 | /*! |
| 106 | * \brief By calling this function, a plugin (or any other object) notifies the panel |
| 107 | * about showing a (standalone) window/menu -> the panel needs this to avoid "hiding" in case any |
| 108 | * standalone window is shown. The widget/window must be shown later than this notification call because |
| 109 | * the panel needs to observe its show/hide/close events. |
| 110 | * |
| 111 | * \param w the window that will be shown |
| 112 | * |
| 113 | */ |
| 114 | virtual void willShowWindow(QWidget * w) = 0; |
| 115 | |
| 116 | /*! |
| 117 | * \brief By calling this function, a plugin notifies the panel about change of it's "static" |
| 118 | * configuration |
| 119 | * |
| 120 | * \param plugin the changed plugin |
| 121 | * |
| 122 | * \sa ILXQtPanelPlugin::isSeparate(), ILXQtPanelPlugin::isExpandable |
| 123 | */ |
| 124 | virtual void pluginFlagsChanged(const ILXQtPanelPlugin * plugin) = 0; |
| 125 | |
| 126 | /*! |
| 127 | * \brief Checks if the panel is locked. |
| 128 | */ |
| 129 | virtual bool isLocked() const = 0; |
| 130 | |
| 131 | /*! |
| 132 | * \brief Gets the name of the Wayland screen of this panel. |
| 133 | */ |
| 134 | virtual QString screenName() const = 0; |
| 135 | }; |
| 136 | |
| 137 | #endif // ILXQTPANEL_H |