LeechCraft  0.6.70-13729-g7046a9d2a7
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  * 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 LC
39 {
43  {
46  TFEmpty = 0x0,
47 
60 
74  TFSingle = 1 << 1,
75 
83  TFByDefault = 1 << 2,
84 
94  TFSuggestOpening = 1 << 3,
95 
102  };
103 
104  Q_DECLARE_FLAGS (TabFeatures, LC::TabFeature);
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 
170 class Q_DECL_EXPORT ITabWidget
171 {
172 public:
173  virtual ~ITabWidget () {}
174 
184  virtual LC::TabClassInfo GetTabClassInfo () const = 0;
185 
194  virtual QObject* ParentMultiTabs () = 0;
195 
206  virtual void Remove () = 0;
207 
218  virtual QToolBar* GetToolBar () const = 0;
219 
232  {
233  return {};
234  }
235 
255  {
256  return {};
257  }
258 
263  virtual void TabMadeCurrent ()
264  {
265  }
266 
272  virtual void TabLostCurrent ()
273  {
274  }
275 };
276 
317 class Q_DECL_EXPORT IHaveTabs
318 {
319 public:
320  virtual ~IHaveTabs () {}
321 
337  virtual LC::TabClasses_t GetTabClasses () const = 0;
338 
353  virtual void TabOpenRequested (const QByteArray& tabClass) = 0;
354 
372  virtual void addNewTab (const QString& name, QWidget *tabContents) = 0;
373 
387  virtual void removeTab (QWidget *tabContents) = 0;
388 
408  virtual void changeTabName (QWidget *tabContents, const QString& name) = 0;
409 
427  virtual void changeTabIcon (QWidget *tabContents, const QIcon& icon) = 0;
428 
453  virtual void statusBarChanged (QWidget *tabContents, const QString& text) = 0;
454 
467  virtual void raiseTab (QWidget *tabContents) = 0;
468 };
469 
470 Q_DECLARE_OPERATORS_FOR_FLAGS (LC::TabFeatures)
471 
472 Q_DECLARE_INTERFACE (ITabWidget, "org.Deviant.LeechCraft.ITabWidget/1.0")
473 Q_DECLARE_INTERFACE (IHaveTabs, "org.Deviant.LeechCraft.IHaveTabs/1.0")
474 
475 #endif
virtual QList< QAction * > GetTabBarContextMenuActions() const
Returns the list of QActions for the context menu of the tabbar.
Definition: ihavetabs.h:231
No special features.
Definition: ihavetabs.h:46
QString VisibleName_
Visible name for the given tab class.
Definition: ihavetabs.h:122
There could be only one instance of this tab.
Definition: ihavetabs.h:74
QList< TabClassInfo > TabClasses_t
Definition: ihavetabs.h:152
TabFeatures Features_
The features of this tab class.
Definition: ihavetabs.h:149
QIcon Icon_
The icon for the given tab class.
Definition: ihavetabs.h:136
Interface for plugins that have one or more tabs.
Definition: ihavetabs.h:317
virtual void TabLostCurrent()
This method is called when another tab becomes active.
Definition: ihavetabs.h:272
quint16 Priority_
The priority of this tab class.
Definition: ihavetabs.h:143
The structure describing a single tab class.
Definition: ihavetabs.h:108
virtual ~IHaveTabs()
Definition: ihavetabs.h:320
This tab could be opened by user request.
Definition: ihavetabs.h:59
virtual QMap< QString, QList< QAction * > > GetWindowMenus() const
Returns the list of QActions to be inserted into global menu.
Definition: ihavetabs.h:254
This interface defines methods that should be implemented in widgets added to the main tab widget...
Definition: ihavetabs.h:170
TabFeature
Defines different behavior features of tab classes.
Definition: ihavetabs.h:42
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:263
virtual ~ITabWidget()
Definition: ihavetabs.h:173
QString Description_
The description of the given tab class.
Definition: ihavetabs.h:129
Definition: constants.h:35
The tab should be opened by default.
Definition: ihavetabs.h:83
The tab is to be suggested in a quick launch area.
Definition: ihavetabs.h:94
Definition: anutil.h:38
Q_DECLARE_FLAGS(TabFeatures, LC::TabFeature)
The tab uses the standard tab close shortcut (Ctrl+W).
Definition: ihavetabs.h:101