LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
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>
12 #include "interfaces/ihavetabs.h"
13 
14 class QMainWindow;
15 class ICoreTabWidget;
16 class IMWProxy;
17 
45 class Q_DECL_EXPORT IRootWindowsManager
46 {
47 public:
48  virtual ~IRootWindowsManager () {}
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  {
102  return GetMainWindow (GetPreferredWindowIndex ());
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 
155  Background = 0x01,
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  }
182 protected:
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 
262 Q_DECLARE_OPERATORS_FOR_FLAGS (IRootWindowsManager::AddTabFlags)
263 
264 Q_DECLARE_INTERFACE (IRootWindowsManager, "org.LeechCraft.IRootWindowsManager/1.0")
Interface to the core windows manager.
This interface is used for manipulating the main window.
Definition: imwproxy.h:25
This interface is used to represent LeechCraft&#39;s core tab widget.
No type (item doesn&#39;t correspond to a radio station).
This interface defines methods that should be implemented in widgets added to the main tab widget...
Definition: ihavetabs.h:149
virtual QMainWindow * GetPreferredWindow() const
Returns the currently preferred window.
Q_DECLARE_FLAGS(NotifyFlags, NotifyFlag)
virtual int GetTabWidgetIndex(ICoreTabWidget *ictw) const
Returns the index of the window containing the tab widget.
void AddTab(QWidget *tab, AddTabFlags flags=AddTabFlag::None)