LeechCraft  0.6.70-15082-g543737046d
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 <QObject>
12 
13 class ITabWidget;
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 
158  virtual int GetTabWidgetIndex (ICoreTabWidget *ictw) const
159  {
160  for (int i = 0; i < GetWindowsCount (); ++i)
161  if (GetTabWidget (i) == ictw)
162  return i;
163 
164  return -1;
165  }
166 protected:
174  virtual void windowAdded (int index) = 0;
175 
187  virtual void windowRemoved (int index) = 0;
188 
196  virtual void currentWindowChanged (int to, int from) = 0;
197 
206  virtual void tabAdded (int windowIdx, int tabIdx) = 0;
207 
217  virtual void tabIsRemoving (int windowIdx, int tabIdx) = 0;
218 
230  virtual void tabIsMoving (int fromWin, int toWin, int tabIdx) = 0;
231 
243  virtual void tabMoved (int fromWin, int toWin, int tabIdx) = 0;
244 };
245 
246 Q_DECLARE_INTERFACE (IRootWindowsManager, "org.LeechCraft.IRootWindowsManager/1.0")
ICoreTabWidget
This interface is used to represent LeechCraft's core tab widget.
Definition: icoretabwidget.h:24
IRootWindowsManager::~IRootWindowsManager
virtual ~IRootWindowsManager()
Definition: irootwindowsmanager.h:48
IMWProxy
This interface is used for manipulating the main window.
Definition: imwproxy.h:25
ITabWidget
This interface defines methods that should be implemented in widgets added to the main tab widget.
Definition: ihavetabs.h:149
IRootWindowsManager::GetPreferredWindow
virtual QMainWindow * GetPreferredWindow() const
Returns the currently preferred window.
Definition: irootwindowsmanager.h:100
IRootWindowsManager::GetTabWidgetIndex
virtual int GetTabWidgetIndex(ICoreTabWidget *ictw) const
Returns the index of the window containing the tab widget.
Definition: irootwindowsmanager.h:158
IRootWindowsManager
Interface to the core windows manager.
Definition: irootwindowsmanager.h:45