1#include <Interface/Layout.hpp>
2#include <Interface/Ncurses.hpp>
3#include <Config/Globals.hpp>
4#include <Misc/Utils.hpp>
12static int intendedWidth;
13static int intendedHeight;
15Layout::Layout(
int width,
int height):
18 intendedWidth = width;
19 intendedHeight = height;
23void Layout::windowsInit()
28 int current_height, current_width;
29 getmaxyx(stdscr, current_height, current_width);
31 if ((current_width < intendedWidth) ||
32 (current_height < intendedHeight))
35 std::cerr <<
"Error! Your console screen is smaller than"
36 << intendedWidth <<
"x" << intendedHeight <<
"\n"
37 <<
"Please resize your window and try again"
52 if (Globals::Screen::center_horizontally)
53 main_x = current_width/2 - intendedWidth/2;
55 if (Globals::Screen::center_vertically)
56 main_y = current_height/2 - intendedHeight/2;
58 this->
main =
new Window(main_x,
63 if ((Globals::Screen::outer_border) &&
64 (Globals::Screen::show_borders))
66 this->
main->borders(Globals::Screen::fancy_borders ?
67 Window::BORDER_FANCY :
68 Window::BORDER_REGULAR);
71 this->
main->refresh();
73void Layout::windowsExit()
75 SAFE_DELETE(this->
main);
Window * main
Layout's main Window, where all the others are inside.
static int screenWidth
Full width of the terminal right now.
static int screenHeight
Full height of the terminal right now.
void exit()
Warns the user about any errors and warnings found during the program's execution.
void exit()
Quits Ncurses mode.