2022-04-25 15:55:39 +02:00
|
|
|
/**
|
|
|
|
* @author Christian Burger (christian@krikkel.de)
|
|
|
|
*/
|
|
|
|
|
2022-05-06 22:42:09 +02:00
|
|
|
#include <kNCurses/Window.hpp>
|
|
|
|
#include <kNCurses/VerticalTilingWindowManager.hpp>
|
2022-04-25 15:55:39 +02:00
|
|
|
|
2022-04-29 20:25:47 +02:00
|
|
|
namespace krikkel::NCurses
|
2022-04-25 15:55:39 +02:00
|
|
|
{
|
2022-05-03 11:23:32 +02:00
|
|
|
Window::Window(VerticalTilingWindowManager *windowManager)
|
|
|
|
: NCursesWindow(0, 0, 0, 0)
|
|
|
|
{
|
|
|
|
windowManager->addWindow(this);
|
|
|
|
windowManager->updateLayout();
|
|
|
|
}
|
|
|
|
|
2022-05-06 14:02:18 +02:00
|
|
|
Window::Window(const NCursesWindow &window)
|
|
|
|
: NCursesWindow(window)
|
|
|
|
{}
|
|
|
|
|
2022-04-25 15:55:39 +02:00
|
|
|
Window::Window(int lines, int columns, int y, int x)
|
|
|
|
: NCursesWindow(lines, columns, y, x)
|
|
|
|
{}
|
|
|
|
|
2022-04-26 20:53:14 +02:00
|
|
|
int Window::addnwstr(const wchar_t *wstr, int n)
|
|
|
|
{
|
|
|
|
return ::waddnwstr(w, wstr, n);
|
|
|
|
}
|
|
|
|
|
2022-04-25 15:55:39 +02:00
|
|
|
int Window::add_wch(const cchar_t *character)
|
|
|
|
{
|
|
|
|
return ::wadd_wch(w, character);
|
|
|
|
}
|
|
|
|
|
2022-04-26 15:13:25 +02:00
|
|
|
int Window::ins_wch(const cchar_t *character)
|
|
|
|
{
|
|
|
|
return ::wins_wch(w, character);
|
|
|
|
}
|
|
|
|
|
2022-04-25 15:55:39 +02:00
|
|
|
int Window::get_wch(wint_t *character)
|
|
|
|
{
|
|
|
|
return ::wget_wch(w, character);
|
|
|
|
}
|
|
|
|
|
2022-05-06 22:05:57 +02:00
|
|
|
bool Window::isHidden()
|
|
|
|
{
|
|
|
|
return hidden;
|
|
|
|
}
|
|
|
|
|
2022-04-25 15:55:39 +02:00
|
|
|
SingleUserInput Window::readSingleUserInput()
|
|
|
|
{
|
|
|
|
wint_t input;
|
|
|
|
int result = get_wch(&input);
|
|
|
|
return SingleUserInput(result, input);
|
|
|
|
}
|
|
|
|
|
2022-05-03 11:23:32 +02:00
|
|
|
int Window::resize(int rows, int cols)
|
|
|
|
{
|
|
|
|
return NCursesWindow::wresize(rows, cols);
|
|
|
|
}
|
|
|
|
|
2022-05-06 14:02:18 +02:00
|
|
|
int Window::refresh()
|
|
|
|
{
|
|
|
|
if(!hidden)
|
|
|
|
return NCursesWindow::refresh();
|
|
|
|
return 0;
|
|
|
|
}
|
2022-04-25 15:55:39 +02:00
|
|
|
}
|