File indexing completed on 2024-05-19 05:47:30
0001 /* 0002 Copyright 2018 Friedrich W. H. Kossebau <kossebau@kde.org> 0003 0004 This program is free software; you can redistribute it and/or modify 0005 it under the terms of the GNU Library General Public License as 0006 published by the Free Software Foundation; either version 2 of the 0007 License, or (at your option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 GNU Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public 0015 License along with this library. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 #ifndef KDEVPLATFORM_SUBLIMEVIEWBARCONTAINER_H 0019 #define KDEVPLATFORM_SUBLIMEVIEWBARCONTAINER_H 0020 0021 #include "sublimeexport.h" 0022 // Qt 0023 #include <QWidget> 0024 0025 namespace Sublime { 0026 0027 class ViewBarContainerPrivate; 0028 0029 /** 0030 @short Container for view bars. 0031 0032 Keeps a list of view bars and shows only one at a time. 0033 */ 0034 class KDEVPLATFORMSUBLIME_EXPORT ViewBarContainer: public QWidget 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 explicit ViewBarContainer(QWidget *parent = nullptr); 0040 ~ViewBarContainer() override; 0041 0042 public: 0043 /** 0044 * Adds @p viewBar to the container. 0045 * It will be reparented to the container object. 0046 * Though it remains the duty of the caller to manage the lifetime of the object. 0047 * 0048 * If on deletion of the container the @p viewBar has not been removed before, 0049 * the @p viewBar will be get nullptr set as parent. 0050 */ 0051 void addViewBar(QWidget* viewBar); 0052 /** 0053 * Removes @p viewBar from the container. 0054 * The ownership of @p viewBar is not changed and should be handled by the caller. 0055 */ 0056 void removeViewBar(QWidget* viewBar); 0057 /** 0058 * Sets @p viewBar as the one currently in front. 0059 */ 0060 void setCurrentViewBar(QWidget* viewBar); 0061 /** 0062 * Ensures @p viewBar is the one currently in front, and being shown. 0063 */ 0064 void showViewBar(QWidget* viewBar); 0065 /** 0066 * Ensures @p viewBar is the one currently in front, but also hidden. 0067 */ 0068 void hideViewBar(QWidget* viewBar); 0069 0070 private: 0071 const QScopedPointer<class ViewBarContainerPrivate> d_ptr; 0072 Q_DECLARE_PRIVATE(ViewBarContainer) 0073 }; 0074 0075 } 0076 0077 #endif 0078