new feature: support for merging screens together

This commit is contained in:
Andrzej Rybczak
2011-11-12 19:47:47 +01:00
parent e31dec7005
commit 56467eaac6
44 changed files with 633 additions and 218 deletions

View File

@@ -28,6 +28,10 @@
#include "settings.h"
#include "status.h"
void ApplyToVisibleWindows(void (BasicScreen::*f)());
void UpdateInactiveScreen(BasicScreen *);
bool isVisible(BasicScreen *);
/// An interface for various instantiations of Screen template class. Since C++ doesn't like
/// comparison of two different instantiations of the same template class we need the most
/// basic class to be non-template to allow it.
@@ -43,7 +47,7 @@ class BasicScreen
/// @see Screen::ActiveWindow()
///
virtual void *ActiveWindow() = 0;
virtual Window *ActiveWindow() = 0;
/// Method used for switching to screen
///
@@ -129,10 +133,23 @@ class BasicScreen
///
virtual bool isTabbable() { return false; }
/// @return true if screen is mergable, ie. can be "proper" subwindow
/// if one of the screens is locked. Screens that somehow resemble popups
/// will want to return false here.
virtual bool isMergable() = 0;
/// Locks current screen.
/// @return true if lock was successful, false otherwise. Note that
/// if there is already locked screen, it'll not overwrite it.
bool Lock();
/// Should be set to true each time screen needs resize
///
bool hasToBeResized;
/// Unlocks a screen, ie. hides merged window (if there is one set).
static void Unlock();
protected:
/// Since screens initialization is lazy, we don't want to do
/// this in the constructor. This function should be invoked
@@ -141,6 +158,18 @@ class BasicScreen
///
virtual void Init() = 0;
/// @return true if screen can be locked. Note that returning
/// false here doesn't neccesarily mean that screen is also not
/// mergable (eg. lyrics screen is not lockable since that wouldn't
/// make much sense, but it's perfectly fine to merge it).
virtual bool isLockable() = 0;
/// Gets X offset and width of current screen to be used eg. in Resize() function.
/// @param adjust_locked_screen indicates whether this function should
/// automatically adjust locked screen's dimensions (is there is one set)
/// if current screen is going to be subwindow.
void GetWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen = true);
/// Flag that inditates whether the screen is initialized or not
///
bool isInitialized;
@@ -161,7 +190,7 @@ template <typename WindowType> class Screen : public BasicScreen
/// active
/// @return address to window object cast to void *
///
virtual void *ActiveWindow();
virtual Window *ActiveWindow();
/// @return pointer to currently active window
///
@@ -203,7 +232,7 @@ template <typename WindowType> class Screen : public BasicScreen
WindowType *w;
};
template <typename WindowType> void *Screen<WindowType>::ActiveWindow()
template <typename WindowType> Window *Screen<WindowType>::ActiveWindow()
{
return w;
}