LeechCraft  %{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ihavetabs.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2013 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 = 0x02,
75 
83  TFByDefault = 0x04,
84 
95  };
96 
98 
102  {
108  QByteArray TabClass_;
109 
115  QString VisibleName_;
116 
122  QString Description_;
123 
129  QIcon Icon_;
130 
136  quint16 Priority_;
137 
140  TabFeatures Features_;
141  };
142 
143  typedef QList<TabClassInfo> TabClasses_t;
144 };
145 
146 class QToolBar;
147 class QAction;
148 
152 class Q_DECL_EXPORT ITabWidget
153 {
154 public:
155  virtual ~ITabWidget () {}
156 
166  virtual LeechCraft::TabClassInfo GetTabClassInfo () const = 0;
167 
176  virtual QObject* ParentMultiTabs () = 0;
177 
188  virtual void Remove () = 0;
189 
200  virtual QToolBar* GetToolBar () const = 0;
201 
213  virtual QList<QAction*> GetTabBarContextMenuActions () const
214  {
215  return QList<QAction*> ();
216  }
217 
236  virtual QMap<QString, QList<QAction*>> GetWindowMenus () const
237  {
238  return QMap<QString, QList<QAction*>> ();
239  }
240 
245  virtual void TabMadeCurrent ()
246  {
247  }
248 
254  virtual void TabLostCurrent ()
255  {
256  }
257 };
258 
299 class Q_DECL_EXPORT IHaveTabs
300 {
301 public:
302  virtual ~IHaveTabs () {}
303 
319  virtual LeechCraft::TabClasses_t GetTabClasses () const = 0;
320 
335  virtual void TabOpenRequested (const QByteArray& tabClass) = 0;
336 
354  virtual void addNewTab (const QString& name, QWidget *tabContents) = 0;
355 
369  virtual void removeTab (QWidget *tabContents) = 0;
370 
390  virtual void changeTabName (QWidget *tabContents, const QString& name) = 0;
391 
409  virtual void changeTabIcon (QWidget *tabContents, const QIcon& icon) = 0;
410 
435  virtual void statusBarChanged (QWidget *tabContents, const QString& text) = 0;
436 
449  virtual void raiseTab (QWidget *tabContents) = 0;
450 };
451 
452 Q_DECLARE_OPERATORS_FOR_FLAGS (LeechCraft::TabFeatures);
453 
454 Q_DECLARE_INTERFACE (ITabWidget, "org.Deviant.LeechCraft.ITabWidget/1.0");
455 Q_DECLARE_INTERFACE (IHaveTabs, "org.Deviant.LeechCraft.IHaveTabs/1.0");
456 
457 #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:122
Interface for plugins that have one or more tabs.
Definition: ihavetabs.h:299
virtual void TabLostCurrent()
This method is called when another tab becomes active.
Definition: ihavetabs.h:254
Q_DECLARE_INTERFACE(IColorThemeManager,"org.Deviant.LeechCraft.IColorThemeManager/1.0")
QIcon Icon_
The icon for the given tab class.
Definition: ihavetabs.h:129
This tab could be opened by user request.
Definition: ihavetabs.h:59
Q_DECLARE_OPERATORS_FOR_FLAGS(LeechCraft::TabFeatures)
The structure describing a single tab class.
Definition: ihavetabs.h:101
virtual ~IHaveTabs()
Definition: ihavetabs.h:302
TabFeature
Defines different behavior features of tab classes.
Definition: ihavetabs.h:42
QList< TabClassInfo > TabClasses_t
Definition: ihavetabs.h:143
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:152
virtual QMap< QString, QList< QAction * > > GetWindowMenus() const
Returns the list of QActions to be inserted into global menu.
Definition: ihavetabs.h:236
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:108
virtual void TabMadeCurrent()
This method is called when this tab becomes active.
Definition: ihavetabs.h:245
virtual ~ITabWidget()
Definition: ihavetabs.h:155
Q_DECLARE_FLAGS(TabFeatures, LeechCraft::TabFeature)
TabFeatures Features_
The features of this tab class.
Definition: ihavetabs.h:140
QString VisibleName_
Visible name for the given tab class.
Definition: ihavetabs.h:115
quint16 Priority_
The priority of this tab class.
Definition: ihavetabs.h:136
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:213