You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KED/ked/ncurses/bakcup/main.cpp

61 lines
1.4 KiB

#include "main.h"
#include "terminal.h"
#include "menuBar.h"
// INFO: wgetch(win); or getch(); // getch will make a refresh for us.
int main(int argv, char ** argc)
{
//Variables
int xMax, yMax, xMouse, yMouse= 0;
char pressed;
std::string menu1[4]={"New","Open","Save","Exit"};
std::string menu2[3]={"Copy","Cut","Paste"};
std::string menu3[5]={"Terminal","Help","Info","Update","Manual"};
// Second stage declarations
Menu menus[3]={ // init the menus
Menu("File", 0, 0, 'f', menu1, 4),
Menu("Edit", 1, 0, 'e', menu2, 3),
Menu("Options", 2, 0, 'o', menu3, 5),
};
Terminal terminal;
MenuBar menuBar = MenuBar(menus,1,5,5,3);
xMax = terminal.getXMax();
yMax = terminal.getYMax();
std::string termToPrint = "Terminal with ";
termToPrint += std::to_string(xMax);
termToPrint += "x";
termToPrint += std::to_string(yMax);
termToPrint += " is drawn";
terminal.draw(1,1,termToPrint);
terminal.draw(1,3,"Press f For Files e For Edit and o for Options");
terminal.draw(1,2,"Press K to kill the menu");
terminal.endDraw();
menuBar.drawBox();
menuBar.drawMenus();
while(pressed != 'k')
{
pressed = menuBar.getKey();
menuBar.handleTrigger(pressed);
menuBar.drawMenus();
terminal.endDraw();
}
menuBar.~MenuBar();
terminal.draw(1,2,"Press any key to exit the application");
terminal.endDraw();
terminal.getKey();
terminal.tearDown();
return 0;
}