LeechCraft 0.6.70-14794-g33744ae6ce
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
ihavetabs.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#ifndef INTERFACES_IHAVETABS_H
10#define INTERFACES_IHAVETABS_H
11#include <QMetaType>
12#include <QList>
13#include <QMap>
14#include <QByteArray>
15#include <QIcon>
16
17namespace LC
18{
22 {
25 TFEmpty = 0x0,
26
39
53 TFSingle = 1 << 1,
54
62 TFByDefault = 1 << 2,
63
74
80 TFOverridesTabClose = 1 << 4
81 };
82
84
88 {
94 QByteArray TabClass_;
95
102
109
115 QIcon Icon_;
116
122 quint16 Priority_;
123
128 TabFeatures Features_;
129 };
130
132};
133
134class QToolBar;
135class QAction;
136
149class Q_DECL_EXPORT ITabWidget
150{
151public:
152 virtual ~ITabWidget () {}
153
163 virtual LC::TabClassInfo GetTabClassInfo () const = 0;
164
173 virtual QObject* ParentMultiTabs () = 0;
174
185 virtual void Remove () = 0;
186
197 virtual QToolBar* GetToolBar () const = 0;
198
211 {
212 return {};
213 }
214
234 {
235 return {};
236 }
237
242 virtual void TabMadeCurrent ()
243 {
244 }
245
251 virtual void TabLostCurrent ()
252 {
253 }
254};
255
296class Q_DECL_EXPORT IHaveTabs
297{
298public:
299 virtual ~IHaveTabs () {}
300
316 virtual LC::TabClasses_t GetTabClasses () const = 0;
317
332 virtual void TabOpenRequested (const QByteArray& tabClass) = 0;
333
351 virtual void addNewTab (const QString& name, QWidget *tabContents) = 0;
352
366 virtual void removeTab (QWidget *tabContents) = 0;
367
387 virtual void changeTabName (QWidget *tabContents, const QString& name) = 0;
388
406 virtual void changeTabIcon (QWidget *tabContents, const QIcon& icon) = 0;
407
432 virtual void statusBarChanged (QWidget *tabContents, const QString& text) = 0;
433
446 virtual void raiseTab (QWidget *tabContents) = 0;
447};
448
449Q_DECLARE_OPERATORS_FOR_FLAGS (LC::TabFeatures)
450
451Q_DECLARE_INTERFACE (ITabWidget, "org.Deviant.LeechCraft.ITabWidget/1.0")
452Q_DECLARE_INTERFACE (IHaveTabs, "org.Deviant.LeechCraft.IHaveTabs/1.0")
453
454#endif
Interface for plugins that have one or more tabs.
Definition: ihavetabs.h:297
virtual void statusBarChanged(QWidget *tabContents, const QString &text)=0
This signal is emitted by plugin to change the status bar text for the tab with the given tabContents...
virtual ~IHaveTabs()
Definition: ihavetabs.h:299
virtual void removeTab(QWidget *tabContents)=0
This signal is emitted by plugin when it wants to remove a tab.
virtual void raiseTab(QWidget *tabContents)=0
This signal is emitted by plugin to bring the tab with the given tabContents to the front.
virtual void changeTabName(QWidget *tabContents, const QString &name)=0
This signal is emitted by plugin to change the name of the tab with the given tabContents.
virtual void addNewTab(const QString &name, QWidget *tabContents)=0
This signal is emitted by plugin to add a new tab.
virtual LC::TabClasses_t GetTabClasses() const =0
Returns the list of tab classes provided by this plugin.
virtual void changeTabIcon(QWidget *tabContents, const QIcon &icon)=0
This signal is emitted by plugin to change the icon of the tab with the given tabContents.
virtual void TabOpenRequested(const QByteArray &tabClass)=0
Opens the new tab from the given tabClass.
This interface defines methods that should be implemented in widgets added to the main tab widget.
Definition: ihavetabs.h:150
virtual void TabMadeCurrent()
This method is called when this tab becomes active.
Definition: ihavetabs.h:242
virtual QObject * ParentMultiTabs()=0
Returns the pointer to the plugin this tab belongs to.
virtual QMap< QString, QList< QAction * > > GetWindowMenus() const
Returns the list of QActions to be inserted into global menu.
Definition: ihavetabs.h:233
virtual void Remove()=0
Requests to remove the tab.
virtual ~ITabWidget()
Definition: ihavetabs.h:152
virtual void TabLostCurrent()
This method is called when another tab becomes active.
Definition: ihavetabs.h:251
virtual QList< QAction * > GetTabBarContextMenuActions() const
Returns the list of QActions for the context menu of the tabbar.
Definition: ihavetabs.h:210
virtual QToolBar * GetToolBar() const =0
Requests tab's toolbar.
virtual LC::TabClassInfo GetTabClassInfo() const =0
Returns the description of the tab class of this tab.
Definition: anutil.h:17
Definition: constants.h:15
TabFeature
Defines different behavior features of tab classes.
Definition: ihavetabs.h:22
@ TFSuggestOpening
The tab is to be suggested in a quick launch area.
Definition: ihavetabs.h:73
@ TFSingle
There could be only one instance of this tab.
Definition: ihavetabs.h:53
@ TFOpenableByRequest
This tab could be opened by user request.
Definition: ihavetabs.h:38
@ TFEmpty
No special features.
Definition: ihavetabs.h:25
@ TFOverridesTabClose
The tab uses the standard tab close shortcut (Ctrl+W).
Definition: ihavetabs.h:80
@ TFByDefault
The tab should be opened by default.
Definition: ihavetabs.h:62
Q_DECLARE_FLAGS(TabFeatures, LC::TabFeature)
QList< TabClassInfo > TabClasses_t
Definition: ihavetabs.h:131
The structure describing a single tab class.
Definition: ihavetabs.h:88
QString VisibleName_
Visible name for the given tab class.
Definition: ihavetabs.h:101
TabFeatures Features_
The features of this tab class.
Definition: ihavetabs.h:128
QByteArray TabClass_
The tab class ID, which should be globally unique.
Definition: ihavetabs.h:94
QString Description_
The description of the given tab class.
Definition: ihavetabs.h:108
QIcon Icon_
The icon for the given tab class.
Definition: ihavetabs.h:115
quint16 Priority_
The priority of this tab class.
Definition: ihavetabs.h:122