LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
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 
17 namespace LC
18 {
21  enum TabFeature
22  {
25  TFEmpty = 0x0,
26 
38  TFOpenableByRequest = 1 << 0,
39 
53  TFSingle = 1 << 1,
54 
62  TFByDefault = 1 << 2,
63 
73  TFSuggestOpening = 1 << 3,
74 
80  TFOverridesTabClose = 1 << 4
81  };
82 
83  Q_DECLARE_FLAGS (TabFeatures, LC::TabFeature);
84 
87  struct TabClassInfo
88  {
94  QByteArray TabClass_;
95 
101  QString VisibleName_;
102 
108  QString Description_;
109 
115  QIcon Icon_;
116 
122  quint16 Priority_;
123 
128  TabFeatures Features_;
129  };
130 
132 };
133 
134 class QToolBar;
135 class QAction;
136 
149 class Q_DECL_EXPORT ITabWidget
150 {
151 public:
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 
296 class Q_DECL_EXPORT IHaveTabs
297 {
298 public:
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 
449 Q_DECLARE_OPERATORS_FOR_FLAGS (LC::TabFeatures)
450 
451 Q_DECLARE_INTERFACE (ITabWidget, "org.Deviant.LeechCraft.ITabWidget/1.0")
452 Q_DECLARE_INTERFACE (IHaveTabs, "org.Deviant.LeechCraft.IHaveTabs/1.0")
453 
454 #endif
LC::TabClassInfo::Icon_
QIcon Icon_
The icon for the given tab class.
Definition: ihavetabs.h:121
LC::Q_DECLARE_FLAGS
Q_DECLARE_FLAGS(TabFeatures, LC::TabFeature)
QList
Definition: ianrulesstorage.h:14
IHaveTabs
Interface for plugins that have one or more tabs.
Definition: ihavetabs.h:296
LC::TabClassInfo::TabClass_
QByteArray TabClass_
The tab class ID, which should be globally unique.
Definition: ihavetabs.h:100
ITabWidget::~ITabWidget
virtual ~ITabWidget()
Definition: ihavetabs.h:152
LC::TFSuggestOpening
@ TFSuggestOpening
The tab is to be suggested in a quick launch area.
Definition: ihavetabs.h:85
LC::TabClassInfo::VisibleName_
QString VisibleName_
Visible name for the given tab class.
Definition: ihavetabs.h:107
LC::TFEmpty
@ TFEmpty
No special features.
Definition: ihavetabs.h:37
LC::TFSingle
@ TFSingle
There could be only one instance of this tab.
Definition: ihavetabs.h:65
LC::TFOpenableByRequest
@ TFOpenableByRequest
This tab could be opened by user request.
Definition: ihavetabs.h:50
LC::TabClassInfo
The structure describing a single tab class.
Definition: ihavetabs.h:93
ITabWidget::GetTabBarContextMenuActions
virtual QList< QAction * > GetTabBarContextMenuActions() const
Returns the list of QActions for the context menu of the tabbar.
Definition: ihavetabs.h:210
LC::TFByDefault
@ TFByDefault
The tab should be opened by default.
Definition: ihavetabs.h:74
ITabWidget::TabMadeCurrent
virtual void TabMadeCurrent()
This method is called when this tab becomes active.
Definition: ihavetabs.h:242
LC::TabClasses_t
QList< TabClassInfo > TabClasses_t
Definition: ihavetabs.h:137
LC::TFOverridesTabClose
@ TFOverridesTabClose
The tab uses the standard tab close shortcut (Ctrl+W).
Definition: ihavetabs.h:92
ITabWidget
This interface defines methods that should be implemented in widgets added to the main tab widget.
Definition: ihavetabs.h:149
LC::TabClassInfo::Description_
QString Description_
The description of the given tab class.
Definition: ihavetabs.h:114
LC::TabClassInfo::Features_
TabFeatures Features_
The features of this tab class.
Definition: ihavetabs.h:134
IHaveTabs::~IHaveTabs
virtual ~IHaveTabs()
Definition: ihavetabs.h:299
ITabWidget::GetWindowMenus
virtual QMap< QString, QList< QAction * > > GetWindowMenus() const
Returns the list of QActions to be inserted into global menu.
Definition: ihavetabs.h:233
LC
Definition: constants.h:14
ITabWidget::TabLostCurrent
virtual void TabLostCurrent()
This method is called when another tab becomes active.
Definition: ihavetabs.h:251
LC::TabClassInfo::Priority_
quint16 Priority_
The priority of this tab class.
Definition: ihavetabs.h:128
QMap
Definition: anutil.h:17
LC::TabFeature
TabFeature
Defines different behavior features of tab classes.
Definition: ihavetabs.h:27