File indexing completed on 2024-05-19 12:22:37
0001 /* 0002 SPDX-FileCopyrightText: 2018 Friedrich W. H. Kossebau <kossebau@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_SUBLIMEVIEWBARCONTAINER_H 0008 #define KDEVPLATFORM_SUBLIMEVIEWBARCONTAINER_H 0009 0010 #include "sublimeexport.h" 0011 // Qt 0012 #include <QWidget> 0013 0014 namespace Sublime { 0015 0016 class ViewBarContainerPrivate; 0017 0018 /** 0019 @short Container for view bars. 0020 0021 Keeps a list of view bars and shows only one at a time. 0022 */ 0023 class KDEVPLATFORMSUBLIME_EXPORT ViewBarContainer: public QWidget 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 explicit ViewBarContainer(QWidget *parent = nullptr); 0029 ~ViewBarContainer() override; 0030 0031 public: 0032 /** 0033 * Adds @p viewBar to the container. 0034 * It will be reparented to the container object. 0035 * Though it remains the duty of the caller to manage the lifetime of the object. 0036 * 0037 * If on deletion of the container the @p viewBar has not been removed before, 0038 * the @p viewBar will be get nullptr set as parent. 0039 */ 0040 void addViewBar(QWidget* viewBar); 0041 /** 0042 * Removes @p viewBar from the container. 0043 * The ownership of @p viewBar is not changed and should be handled by the caller. 0044 */ 0045 void removeViewBar(QWidget* viewBar); 0046 /** 0047 * Sets @p viewBar as the one currently in front. 0048 */ 0049 void setCurrentViewBar(QWidget* viewBar); 0050 /** 0051 * Ensures @p viewBar is the one currently in front, and being shown. 0052 */ 0053 void showViewBar(QWidget* viewBar); 0054 /** 0055 * Ensures @p viewBar is the one currently in front, but also hidden. 0056 */ 0057 void hideViewBar(QWidget* viewBar); 0058 0059 private: 0060 const QScopedPointer<class ViewBarContainerPrivate> d_ptr; 0061 Q_DECLARE_PRIVATE(ViewBarContainer) 0062 }; 0063 0064 } 0065 0066 #endif 0067