kNCurses/VerticalTilingWindowManager.cpp
Christian Burger 01b90fe0ef closes #17: own headers are not system headers
This was stupid as it prevented the compiler from doing code analysis
and discovering the bug leading to a segmentation fault when using
compiler optimization (see christian/shellipt#44).

Long overdue update of `README.md`.
2022-05-28 12:39:03 +02:00

42 lines
1.2 KiB
C++

/**
* @author Christian Burger (christian@krikkel.de)
*/
#include "kNCurses/VerticalTilingWindowManager.hpp"
#include "kNCurses/Window.hpp"
#include "Debug.hpp"
#include <ncursesw/ncurses.h>
#include <algorithm>
namespace krikkel::NCurses
{
using std::recursive_mutex;
VerticalTilingWindowManager::VerticalTilingWindowManager(NCursesWindow *rootWindow, std::recursive_mutex *ncursesMutex)
: TilingWindowManager(rootWindow, ncursesMutex)
{}
void VerticalTilingWindowManager::resizeAndMoveWindow(Window *window, windowDimension dimension, windowPosition position)
{
__debug_log("(" + std::to_string(0 + begx()) + ", " + std::to_string(position + begy()) + ", " + std::to_string(width()) + ", " + std::to_string(dimension) + ")");
window->resize(dimension, width());
window->mvwin(position + begy(), 0 + begx());
}
TilingWindowManager::windowDimension VerticalTilingWindowManager::getAvailableSpace()
{
return height();
}
void VerticalTilingWindowManager::windowBorder()
{
hline(width());
}
void VerticalTilingWindowManager::moveCursor(TilingWindowManager::windowPosition position)
{
move(position, 0);
}
}