LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
IRootWindowsManager Class Referenceabstract

Interface to the core windows manager. More...

#include "irootwindowsmanager.h"

Public Member Functions

virtual ~IRootWindowsManager ()
 
virtual QObject * GetQObject ()=0
 Returns this object as a QObject. More...
 
virtual int GetWindowsCount () const =0
 Returns the current window count. More...
 
virtual int GetPreferredWindowIndex () const =0
 Returns the index of the currently preferred window. More...
 
virtual int GetPreferredWindowIndex (const QByteArray &tabclass) const =0
 Returns the preferred window for the given tabclass. More...
 
virtual QMainWindow * GetPreferredWindow () const
 Returns the currently preferred window. More...
 
virtual int GetWindowForTab (ITabWidget *tab) const =0
 Returns the window index containing the given tab. More...
 
virtual IMWProxyGetMWProxy (int winIdx) const =0
 Returns the window proxy for the given window index. More...
 
virtual QMainWindow * GetMainWindow (int idx) const =0
 Returns the window for the given index. More...
 
virtual int GetWindowIndex (QMainWindow *window) const =0
 Returns the index of the given window. More...
 
virtual ICoreTabWidgetGetTabWidget (int idx) const =0
 Returns the tab widget of the window identified by idx. More...
 
virtual int GetTabWidgetIndex (ICoreTabWidget *ictw) const
 Returns the index of the window containing the tab widget. More...
 

Protected Member Functions

virtual void windowAdded (int index)=0
 Emitted after a new window is added. More...
 
virtual void windowRemoved (int index)=0
 Emitted before a window at the given index is removed. More...
 
virtual void currentWindowChanged (int to, int from)=0
 Emitted when current LeechCraft window changes. More...
 
virtual void tabAdded (int windowIdx, int tabIdx)=0
 Emitted after a new tab is added to the given window. More...
 
virtual void tabIsRemoving (int windowIdx, int tabIdx)=0
 Emitted before a tab is removed from the given window. More...
 
virtual void tabIsMoving (int fromWin, int toWin, int tabIdx)=0
 Emitted before a tab is moved from a window to another one. More...
 
virtual void tabMoved (int fromWin, int toWin, int tabIdx)=0
 Emitted after a tab is moved from a window to another one. More...
 

Detailed Description

Interface to the core windows manager.

The implementation of this interface is the core manager of root windows (or main windows). It is used to support various multiwindow features.

Since the implementation is guaranteed to have signals (see the protected functions below), it also has a GetQObject() method that returns a QObject that can be used to expose these signals.

Multiple window notes

There is always at least one window (that is, with the index 0). It is the window initially created during LeechCraft startup, and currently it cannot be destroyed at all (though this may change some time in the future).

There is a concept of preferred window. It's the window best used to be a parent of a message box, or used to determine the preferred screen on a multiscreen system, etc. Typically, it is the window that currently has focus. The functions GetPreferredWindowIndex() and GetPreferredWindow() are used to get the currently preferred window.

Window indices are simply indices in some internal data structure. That's why if a window gets removed all indices following it get invalidated (in fact, decremented by one).

Definition at line 45 of file irootwindowsmanager.h.

Constructor & Destructor Documentation

◆ ~IRootWindowsManager()

virtual IRootWindowsManager::~IRootWindowsManager ( )
inlinevirtual

Definition at line 48 of file irootwindowsmanager.h.

Member Function Documentation

◆ currentWindowChanged()

virtual void IRootWindowsManager::currentWindowChanged ( int  to,
int  from 
)
protectedpure virtual

Emitted when current LeechCraft window changes.

Parameters
[out]toThe new active window index.
[out]fromThe previous active window index.
See also
GetQObject()

◆ GetMainWindow()

virtual QMainWindow* IRootWindowsManager::GetMainWindow ( int  idx) const
pure virtual

Returns the window for the given index.

Parameters
[in]idxThe index of the window.
Returns
The window at the given index, or nullptr if not found.
See also
GetWindowIndex()

◆ GetMWProxy()

virtual IMWProxy* IRootWindowsManager::GetMWProxy ( int  winIdx) const
pure virtual

Returns the window proxy for the given window index.

Parameters
[in]winIdxThe window index for which the proxy is requested.
Returns
The proxy for that window.

◆ GetPreferredWindow()

virtual QMainWindow* IRootWindowsManager::GetPreferredWindow ( ) const
inlinevirtual

Returns the currently preferred window.

It is a helper function returning the window with the index of GetPreferredWindowIndex().

Returns
The currently preferred window.
See also
GetPreferredWindowIndex()

Definition at line 100 of file irootwindowsmanager.h.

◆ GetPreferredWindowIndex() [1/2]

virtual int IRootWindowsManager::GetPreferredWindowIndex ( ) const
pure virtual

Returns the index of the currently preferred window.

Returns
The currently preferred window's index.
See also
GetPreferredWindow()

◆ GetPreferredWindowIndex() [2/2]

virtual int IRootWindowsManager::GetPreferredWindowIndex ( const QByteArray &  tabclass) const
pure virtual

Returns the preferred window for the given tabclass.

This function returns the window that would be used to host a new tab of the given tabclass if the tab is opened right after this call.

Please note that preferred windows algorithm can be dynamic, so the result of this function may become irrelevant after a few other tabs are opened, closed or moved.

Parameters
[in]tabclassThe tab class to check.
Returns
The window that would host the tablcass if it's opened right now.

◆ GetQObject()

virtual QObject* IRootWindowsManager::GetQObject ( )
pure virtual

Returns this object as a QObject.

The returned QObject can be used to connect its signals, which are declared as protected functions here.

Returns
This object as a QObject.

◆ GetTabWidget()

virtual ICoreTabWidget* IRootWindowsManager::GetTabWidget ( int  idx) const
pure virtual

Returns the tab widget of the window identified by idx.

Parameters
[in]idxThe index of the window for which to return the tab widget.
Returns
The tab widget of the given index, or nullptr if not found.
See also
GetTabWidgetIndex()

◆ GetTabWidgetIndex()

virtual int IRootWindowsManager::GetTabWidgetIndex ( ICoreTabWidget ictw) const
inlinevirtual

Returns the index of the window containing the tab widget.

Parameters
[in]ictwThe tab widget to search for.
Returns
The index of the given tab widget, or -1 if not found.
See also
GetTabWidget()

Definition at line 158 of file irootwindowsmanager.h.

◆ GetWindowForTab()

virtual int IRootWindowsManager::GetWindowForTab ( ITabWidget tab) const
pure virtual

Returns the window index containing the given tab.

If no window contains the tab, returns -1.

Parameters
[in]tabThe tab to search for.
Returns
The index of the window containing the tab, or -1.

◆ GetWindowIndex()

virtual int IRootWindowsManager::GetWindowIndex ( QMainWindow *  window) const
pure virtual

Returns the index of the given window.

Parameters
[in]windowThe window to search for.
Returns
The index of the given window, or -1 if not found.
See also
GetMainWindow()

◆ GetWindowsCount()

virtual int IRootWindowsManager::GetWindowsCount ( ) const
pure virtual

Returns the current window count.

Please note that there is always at least one window.

Returns
Current window count.

◆ tabAdded()

virtual void IRootWindowsManager::tabAdded ( int  windowIdx,
int  tabIdx 
)
protectedpure virtual

Emitted after a new tab is added to the given window.

Parameters
[out]windowIdxThe index of the window tab is added to.
[out]tabIdxThe index of the tab.
See also
tabIsRemoving()
GetQObject()

◆ tabIsMoving()

virtual void IRootWindowsManager::tabIsMoving ( int  fromWin,
int  toWin,
int  tabIdx 
)
protectedpure virtual

Emitted before a tab is moved from a window to another one.

The tab index is given in the window from which the tab is moved.

Parameters
[out]fromWinThe window from which the tab is being removed.
[out]toWinThe window to which the tab is being added.
[out]tabIdxThe index of the tab being moved in the window it is moved from.
See also
GetQObject()

◆ tabIsRemoving()

virtual void IRootWindowsManager::tabIsRemoving ( int  windowIdx,
int  tabIdx 
)
protectedpure virtual

Emitted before a tab is removed from the given window.

Parameters
[out]windowIdxThe index of the window tab is being removed from.
[out]tabIdxThe index of the tab.
See also
tabAdded()
GetQObject()

◆ tabMoved()

virtual void IRootWindowsManager::tabMoved ( int  fromWin,
int  toWin,
int  tabIdx 
)
protectedpure virtual

Emitted after a tab is moved from a window to another one.

The tab index is given in the window to which the tab is moved.

Parameters
[out]fromWinThe window from which the tab is removed.
[out]toWinThe window to which the tab is added.
[out]tabIdxThe index of the tab being moved in the window it is moved to.
See also
GetQObject()

◆ windowAdded()

virtual void IRootWindowsManager::windowAdded ( int  index)
protectedpure virtual

Emitted after a new window is added.

Parameters
[out]indexThe index of the newly added window.
See also
windowRemoved()
GetQObject()

◆ windowRemoved()

virtual void IRootWindowsManager::windowRemoved ( int  index)
protectedpure virtual

Emitted before a window at the given index is removed.

Since the signal is emitted before the window is removed, the window still can be obtained via GetMainWindow() (as well as its helper classes via GetMWProxy() and GetTabWidget()).

Parameters
[out]indexThe index of the window being removed.
See also
windowAdded()
GetQObject()

The documentation for this class was generated from the following file: