kNCurses/DemoApp.hpp
Christian Burger 3be5336ca0 refactoring tiling window manager
Laying out the windows in the window manager frame, is a very similar
process regardless of doing it horizontally or vertically. So the
template design pattern was applied and the general functionality was
pulled up; only specific functionalities were put into the corresponding
classes.

kNCursesDemoApp: Separated the screen into three windows vertically. The
top and bottom window contain another two windows each, lay out
horizontally. The top left window is fixed to width 1 and the top right
takes the rest of the space. Bottom two windows take 50 % of the space
each.

Remarks: There are still some rendering bugs, when hiding and showing
windows. E. g. when hiding the top or middle window with `<F1>` or
`<F2>` respectively, the bottom window has some errors. Maybe some
timing issue.
2022-05-18 21:15:13 +02:00

40 lines
1 KiB
C++

/**
* @brief demo application for the library
* @author Christian Burger (christian@krikkel.de)
*/
#ifndef A3B2AE4E_0A39_468C_8CCA_E6508166702A
#define A3B2AE4E_0A39_468C_8CCA_E6508166702A
#include <cursesapp.h>
#include <mutex>
namespace krikkel::NCurses
{
class VerticalTilingWindowManager;
class HorizontalTilingWindowManager;
class Window;
class PtyWindow;
class DemoApp : public NCursesApplication
{
public:
DemoApp();
private:
VerticalTilingWindowManager *windowManager;
HorizontalTilingWindowManager *topWindowManager, *bottomWindowManager;
Window *dummyWindowTopLeft, *dummyWindowTopRight
, *dummyWindowBottomLeft, *dummyWindowBottomRight;
PtyWindow *ptyWindow;
std::recursive_mutex ncursesMutex;
int run() override;
void setUpWindows();
void forkShell();
void mainLoop();
};
}
#endif /* A3B2AE4E_0A39_468C_8CCA_E6508166702A */