LeechCraft  %{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #ifndef INTERFACES_IHAVETABS_H
31 #define INTERFACES_IHAVETABS_H
32 #include <QMetaType>
33 #include <QList>
34 #include <QMap>
35 #include <QByteArray>
36 #include <QIcon>
37 
38 namespace LeechCraft
39 {
43  {
46  TFEmpty = 0x0,
47 
60 
74  TFSingle = 1 << 1,
75 
83  TFByDefault = 1 << 2,
84 
94  TFSuggestOpening = 1 << 3,
95 
102  };
103 
105 
109  {
115  QByteArray TabClass_;
116 
122  QString VisibleName_;
123 
129  QString Description_;
130 
136  QIcon Icon_;
137 
143  quint16 Priority_;
144 
149  TabFeatures Features_;
150  };
151 
153 };
154 
155 class QToolBar;
156 class QAction;
157 
161 class Q_DECL_EXPORT ITabWidget
162 {
163 public:
164  virtual ~ITabWidget () {}
165 
175  virtual LeechCraft::TabClassInfo GetTabClassInfo () const = 0;
176 
185  virtual QObject* ParentMultiTabs () = 0;
186 
197  virtual void Remove () = 0;
198 
209  virtual QToolBar* GetToolBar () const = 0;
210 
223  {
224  return {};
225  }
226 
245  virtual QMap<QString, QList<QAction*>> GetWindowMenus () const
246  {
247  return {};
248  }
249 
254  virtual void TabMadeCurrent ()
255  {
256  }
257 
263  virtual void TabLostCurrent ()
264  {
265  }
266 };
267 
308 class Q_DECL_EXPORT IHaveTabs
309 {
310 public:
311  virtual ~IHaveTabs () {}
312 
328  virtual LeechCraft::TabClasses_t GetTabClasses () const = 0;
329 
344  virtual void TabOpenRequested (const QByteArray& tabClass) = 0;
345 
363  virtual void addNewTab (const QString& name, QWidget *tabContents) = 0;
364 
378  virtual void removeTab (QWidget *tabContents) = 0;
379 
399  virtual void changeTabName (QWidget *tabContents, const QString& name) = 0;
400 
418  virtual void changeTabIcon (QWidget *tabContents, const QIcon& icon) = 0;
419 
444  virtual void statusBarChanged (QWidget *tabContents, const QString& text) = 0;
445 
458  virtual void raiseTab (QWidget *tabContents) = 0;
459 };
460 
461 Q_DECLARE_OPERATORS_FOR_FLAGS (LeechCraft::TabFeatures);
462 
463 Q_DECLARE_INTERFACE (ITabWidget, "org.Deviant.LeechCraft.ITabWidget/1.0");
464 Q_DECLARE_INTERFACE (IHaveTabs, "org.Deviant.LeechCraft.IHaveTabs/1.0");
465 
466 #endif
There could be only one instance of this tab.
Definition: ihavetabs.h:74
QString Description_
The description of the given tab class.
Definition: ihavetabs.h:129
Interface for plugins that have one or more tabs.
Definition: ihavetabs.h:308
virtual void TabLostCurrent()
This method is called when another tab becomes active.
Definition: ihavetabs.h:263
QIcon Icon_
The icon for the given tab class.
Definition: ihavetabs.h:136
This tab could be opened by user request.
Definition: ihavetabs.h:59
Q_DECLARE_INTERFACE(ITabWidget,"org.Deviant.LeechCraft.ITabWidget/1.0")
Q_DECLARE_OPERATORS_FOR_FLAGS(LeechCraft::TabFeatures)
The structure describing a single tab class.
Definition: ihavetabs.h:108
virtual ~IHaveTabs()
Definition: ihavetabs.h:311
TabFeature
Defines different behavior features of tab classes.
Definition: ihavetabs.h:42
The tab uses the standard tab close shortcut (Ctrl+W).
Definition: ihavetabs.h:101
QList< TabClassInfo > TabClasses_t
Definition: ihavetabs.h:152
The tab is to be suggested in a quick launch area.
Definition: ihavetabs.h:94
This interface defines methods that should be implemented in widgets added to the main tab widget...
Definition: ihavetabs.h:161
virtual QMap< QString, QList< QAction * > > GetWindowMenus() const
Returns the list of QActions to be inserted into global menu.
Definition: ihavetabs.h:245
The tab should be opened by default.
Definition: ihavetabs.h:83
QByteArray TabClass_
The tab class ID, which should be globally unique.
Definition: ihavetabs.h:115
virtual void TabMadeCurrent()
This method is called when this tab becomes active.
Definition: ihavetabs.h:254
virtual ~ITabWidget()
Definition: ihavetabs.h:164
Q_DECLARE_FLAGS(TabFeatures, LeechCraft::TabFeature)
TabFeatures Features_
The features of this tab class.
Definition: ihavetabs.h:149
QString VisibleName_
Visible name for the given tab class.
Definition: ihavetabs.h:122
quint16 Priority_
The priority of this tab class.
Definition: ihavetabs.h:143
No special features.
Definition: ihavetabs.h:46
virtual QList< QAction * > GetTabBarContextMenuActions() const
Returns the list of QActions for the context menu of the tabbar.
Definition: ihavetabs.h:222