LeechCraft  0.6.70-18450-gabe19ee3b0
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 #include <QtPlugin>
17 
18 namespace LC
19 {
23  {
26  TFEmpty = 0x0,
27 
40 
54  TFSingle = 1 << 1,
55 
63  TFByDefault = 1 << 2,
64 
74  TFSuggestOpening = 1 << 3,
75 
82  };
83 
84  Q_DECLARE_FLAGS (TabFeatures, LC::TabFeature);
85 
88  struct TabClassInfo
89  {
95  QByteArray TabClass_;
96 
102  QString VisibleName_;
103 
109  QString Description_;
110 
116  QIcon Icon_;
117 
123  quint16 Priority_;
124 
129  TabFeatures Features_;
130  };
131 
133 };
134 
135 class QToolBar;
136 class QAction;
137 
150 class Q_DECL_EXPORT ITabWidget
151 {
152 public:
153  virtual ~ITabWidget () {}
154 
164  virtual LC::TabClassInfo GetTabClassInfo () const = 0;
165 
174  virtual QObject* ParentMultiTabs () = 0;
175 
186  virtual void Remove () = 0;
187 
198  virtual QToolBar* GetToolBar () const = 0;
199 
212  {
213  return {};
214  }
215 
235  {
236  return {};
237  }
238 
243  virtual void TabMadeCurrent ()
244  {
245  }
246 
252  virtual void TabLostCurrent ()
253  {
254  }
255 
261  virtual void removeTab () = 0;
262 
273  virtual void changeTabName (const QString& name)
274  {
275  Q_UNUSED (name)
276  }
277 
288  virtual void changeTabIcon (const QIcon& icon)
289  {
290  Q_UNUSED (icon)
291  }
292 
297  virtual void raiseTab ()
298  {
299  }
300 };
301 
342 class Q_DECL_EXPORT IHaveTabs
343 {
344 public:
345  virtual ~IHaveTabs () {}
346 
362  virtual LC::TabClasses_t GetTabClasses () const = 0;
363 
378  virtual void TabOpenRequested (const QByteArray& tabClass) = 0;
379 };
380 
381 Q_DECLARE_OPERATORS_FOR_FLAGS (LC::TabFeatures)
382 
383 Q_DECLARE_INTERFACE (ITabWidget, "org.Deviant.LeechCraft.ITabWidget/1.0")
384 Q_DECLARE_INTERFACE (IHaveTabs, "org.Deviant.LeechCraft.IHaveTabs/1.0")
385 
386 #endif
virtual void changeTabName(const QString &name)
This signal is emitted by a tab to change its name.
Definition: ihavetabs.h:273
virtual QList< QAction * > GetTabBarContextMenuActions() const
Returns the list of QActions for the context menu of the tabbar.
Definition: ihavetabs.h:211
No special features.
Definition: ihavetabs.h:26
QString VisibleName_
Visible name for the given tab class.
Definition: ihavetabs.h:102
There could be only one instance of this tab.
Definition: ihavetabs.h:54
QList< TabClassInfo > TabClasses_t
Definition: ihavetabs.h:132
TabFeatures Features_
The features of this tab class.
Definition: ihavetabs.h:129
virtual void changeTabIcon(const QIcon &icon)
This signal is emitted by a tab to change its icon.
Definition: ihavetabs.h:288
QIcon Icon_
The icon for the given tab class.
Definition: ihavetabs.h:116
Interface for plugins that have one or more tabs.
Definition: ihavetabs.h:342
virtual void raiseTab()
This signal is emitted by a tab to bring itself to the front.
Definition: ihavetabs.h:297
virtual void TabLostCurrent()
This method is called when another tab becomes active.
Definition: ihavetabs.h:252
quint16 Priority_
The priority of this tab class.
Definition: ihavetabs.h:123
The structure describing a single tab class.
Definition: ihavetabs.h:88
virtual ~IHaveTabs()
Definition: ihavetabs.h:345
This tab could be opened by user request.
Definition: ihavetabs.h:39
virtual QMap< QString, QList< QAction * > > GetWindowMenus() const
Returns the list of QActions to be inserted into global menu.
Definition: ihavetabs.h:234
This interface defines methods that should be implemented in widgets added to the main tab widget...
Definition: ihavetabs.h:150
TabFeature
Defines different behavior features of tab classes.
Definition: ihavetabs.h:22
QByteArray TabClass_
The tab class ID, which should be globally unique.
Definition: ihavetabs.h:95
virtual void TabMadeCurrent()
This method is called when this tab becomes active.
Definition: ihavetabs.h:243
virtual ~ITabWidget()
Definition: ihavetabs.h:153
QString Description_
The description of the given tab class.
Definition: ihavetabs.h:109
The tab should be opened by default.
Definition: ihavetabs.h:63
The tab is to be suggested in a quick launch area.
Definition: ihavetabs.h:74
Definition: anutil.h:15
Q_DECLARE_FLAGS(TabFeatures, LC::TabFeature)
The tab uses the standard tab close shortcut (Ctrl+W).
Definition: ihavetabs.h:81