LeechCraft  0.6.70-16373-g319c272718
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 {
22  {
25  TFEmpty = 0x0,
26 
39 
53  TFSingle = 1 << 1,
54 
62  TFByDefault = 1 << 2,
63 
73  TFSuggestOpening = 1 << 3,
74 
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 
260  virtual void removeTab () = 0;
261 
272  virtual void changeTabName (const QString& name)
273  {
274  Q_UNUSED (name)
275  }
276 
287  virtual void changeTabIcon (const QIcon& icon)
288  {
289  Q_UNUSED (icon)
290  }
291 
296  virtual void raiseTab ()
297  {
298  }
299 };
300 
341 class Q_DECL_EXPORT IHaveTabs
342 {
343 public:
344  virtual ~IHaveTabs () {}
345 
361  virtual LC::TabClasses_t GetTabClasses () const = 0;
362 
377  virtual void TabOpenRequested (const QByteArray& tabClass) = 0;
378 };
379 
380 Q_DECLARE_OPERATORS_FOR_FLAGS (LC::TabFeatures)
381 
382 Q_DECLARE_INTERFACE (ITabWidget, "org.Deviant.LeechCraft.ITabWidget/1.0")
383 Q_DECLARE_INTERFACE (IHaveTabs, "org.Deviant.LeechCraft.IHaveTabs/1.0")
384 
385 #endif
virtual void changeTabName(const QString &name)
This signal is emitted by a tab to change its name.
Definition: ihavetabs.h:272
virtual QList< QAction * > GetTabBarContextMenuActions() const
Returns the list of QActions for the context menu of the tabbar.
Definition: ihavetabs.h:210
No special features.
Definition: ihavetabs.h:25
QString VisibleName_
Visible name for the given tab class.
Definition: ihavetabs.h:101
There could be only one instance of this tab.
Definition: ihavetabs.h:53
QList< TabClassInfo > TabClasses_t
Definition: ihavetabs.h:131
TabFeatures Features_
The features of this tab class.
Definition: ihavetabs.h:128
virtual void changeTabIcon(const QIcon &icon)
This signal is emitted by a tab to change its icon.
Definition: ihavetabs.h:287
QIcon Icon_
The icon for the given tab class.
Definition: ihavetabs.h:115
Interface for plugins that have one or more tabs.
Definition: ihavetabs.h:341
virtual void raiseTab()
This signal is emitted by a tab to bring itself to the front.
Definition: ihavetabs.h:296
virtual void TabLostCurrent()
This method is called when another tab becomes active.
Definition: ihavetabs.h:251
quint16 Priority_
The priority of this tab class.
Definition: ihavetabs.h:122
The structure describing a single tab class.
Definition: ihavetabs.h:87
virtual ~IHaveTabs()
Definition: ihavetabs.h:344
This tab could be opened by user request.
Definition: ihavetabs.h:38
virtual QMap< QString, QList< QAction * > > GetWindowMenus() const
Returns the list of QActions to be inserted into global menu.
Definition: ihavetabs.h:233
This interface defines methods that should be implemented in widgets added to the main tab widget...
Definition: ihavetabs.h:149
TabFeature
Defines different behavior features of tab classes.
Definition: ihavetabs.h:21
QByteArray TabClass_
The tab class ID, which should be globally unique.
Definition: ihavetabs.h:94
virtual void TabMadeCurrent()
This method is called when this tab becomes active.
Definition: ihavetabs.h:242
virtual ~ITabWidget()
Definition: ihavetabs.h:152
QString Description_
The description of the given tab class.
Definition: ihavetabs.h:108
The tab should be opened by default.
Definition: ihavetabs.h:62
The tab is to be suggested in a quick launch area.
Definition: ihavetabs.h:73
Definition: anutil.h:17
Q_DECLARE_FLAGS(TabFeatures, LC::TabFeature)
The tab uses the standard tab close shortcut (Ctrl+W).
Definition: ihavetabs.h:80