LeechCraft 0.6.70-17335-ge406ffdcaf
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
irootwindowsmanager.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#pragma once
10
11#include <QWidget>
13
14class QMainWindow;
15class ICoreTabWidget;
16class IMWProxy;
17
45class Q_DECL_EXPORT IRootWindowsManager
46{
47public:
49
57 virtual QObject* GetQObject () = 0;
58
65 virtual int GetWindowsCount () const = 0;
66
73 virtual int GetPreferredWindowIndex () const = 0;
74
89 virtual int GetPreferredWindowIndex (const QByteArray& tabclass) const = 0;
90
100 virtual QMainWindow* GetPreferredWindow () const
101 {
103 }
104
112 virtual int GetWindowForTab (ITabWidget *tab) const = 0;
113
120 virtual IMWProxy* GetMWProxy (int winIdx) const = 0;
121
129 virtual QMainWindow* GetMainWindow (int idx) const = 0;
130
138 virtual int GetWindowIndex (QMainWindow *window) const = 0;
139
149 virtual ICoreTabWidget* GetTabWidget (int idx) const = 0;
150
151 enum class AddTabFlag
152 {
153 None = 0x00,
154
156 };
157
158 Q_DECLARE_FLAGS (AddTabFlags, AddTabFlag)
159
160 virtual void AddTab (const QString& name, QWidget *tab, AddTabFlags flags = AddTabFlag::None) = 0;
161
162 void AddTab (QWidget *tab, AddTabFlags flags = AddTabFlag::None)
163 {
164 AddTab (qobject_cast<ITabWidget*> (tab)->GetTabClassInfo ().VisibleName_, tab, flags);
165 }
166
174 virtual int GetTabWidgetIndex (ICoreTabWidget *ictw) const
175 {
176 for (int i = 0; i < GetWindowsCount (); ++i)
177 if (GetTabWidget (i) == ictw)
178 return i;
179
180 return -1;
181 }
182protected:
190 virtual void windowAdded (int index) = 0;
191
203 virtual void windowRemoved (int index) = 0;
204
212 virtual void currentWindowChanged (int to, int from) = 0;
213
222 virtual void tabAdded (int windowIdx, QWidget *tab) = 0;
223
233 virtual void tabIsRemoving (int windowIdx, QWidget *tab) = 0;
234
246 virtual void tabIsMoving (int fromWin, int toWin, int tabIdx) = 0;
247
259 virtual void tabMoved (int fromWin, int toWin, int tabIdx) = 0;
260};
261
262Q_DECLARE_OPERATORS_FOR_FLAGS (IRootWindowsManager::AddTabFlags)
263
264Q_DECLARE_INTERFACE (IRootWindowsManager, "org.LeechCraft.IRootWindowsManager/1.0")
This interface is used to represent LeechCraft's core tab widget.
This interface is used for manipulating the main window.
Definition imwproxy.h:26
Interface to the core windows manager.
virtual int GetTabWidgetIndex(ICoreTabWidget *ictw) const
Returns the index of the window containing the tab widget.
virtual QObject * GetQObject()=0
Returns this object as a QObject.
virtual int GetPreferredWindowIndex(const QByteArray &tabclass) const =0
Returns the preferred window for the given tabclass.
virtual void tabAdded(int windowIdx, QWidget *tab)=0
Emitted after a new tab is added to the given window.
virtual ICoreTabWidget * GetTabWidget(int idx) const =0
Returns the tab widget of the window identified by idx.
virtual void windowRemoved(int index)=0
Emitted before a window at the given index is removed.
virtual int GetWindowForTab(ITabWidget *tab) const =0
Returns the window index containing the given tab.
virtual void tabIsRemoving(int windowIdx, QWidget *tab)=0
Emitted before a tab is removed from the given window.
virtual void windowAdded(int index)=0
Emitted after a new window is added.
virtual void tabMoved(int fromWin, int toWin, int tabIdx)=0
Emitted after a tab is moved from a window to another one.
virtual int GetWindowIndex(QMainWindow *window) const =0
Returns the index of the given window.
virtual IMWProxy * GetMWProxy(int winIdx) const =0
Returns the window proxy for the given window index.
virtual int GetPreferredWindowIndex() const =0
Returns the index of the currently preferred window.
virtual QMainWindow * GetPreferredWindow() const
Returns the currently preferred window.
virtual void AddTab(const QString &name, QWidget *tab, AddTabFlags flags=AddTabFlag::None)=0
virtual void tabIsMoving(int fromWin, int toWin, int tabIdx)=0
Emitted before a tab is moved from a window to another one.
virtual QMainWindow * GetMainWindow(int idx) const =0
Returns the window for the given index.
virtual void currentWindowChanged(int to, int from)=0
Emitted when current LeechCraft window changes.
virtual int GetWindowsCount() const =0
Returns the current window count.
This interface defines methods that should be implemented in widgets added to the main tab widget.
Definition ihavetabs.h:151