1 #include "confirmquit.h"
5 #include "mwindowgui.h"
11 ConfirmQuitWindow::ConfirmQuitWindow(MWindow *mwindow)
12 : BC_Window(PROGRAM_NAME ": Question",
13 mwindow->gui->get_abs_cursor_x(1),
14 mwindow->gui->get_abs_cursor_y(1),
18 this->mwindow = mwindow;
21 ConfirmQuitWindow::~ConfirmQuitWindow()
25 int ConfirmQuitWindow::create_objects(char *string)
30 add_subwindow(title = new BC_Title(x, y, string));
32 add_subwindow(title = new BC_Title(x, y, _("( Answering ""No"" will destroy changes )")));
34 add_subwindow(new ConfirmQuitYesButton(mwindow, this));
35 add_subwindow(new ConfirmQuitNoButton(mwindow, this));
36 add_subwindow(new ConfirmQuitCancelButton(mwindow, this));
40 ConfirmQuitYesButton::ConfirmQuitYesButton(MWindow *mwindow,
41 ConfirmQuitWindow *gui)
42 : BC_GenericButton(10,
43 gui->get_h() - BC_GenericButton::calculate_h() - 10,
49 int ConfirmQuitYesButton::handle_event()
55 int ConfirmQuitYesButton::keypress_event()
57 if(get_keypress() == 'y') return handle_event();
61 ConfirmQuitNoButton::ConfirmQuitNoButton(MWindow *mwindow,
62 ConfirmQuitWindow *gui)
63 : BC_GenericButton(gui->get_w() / 2 - BC_GenericButton::calculate_w(gui, _("No")) / 2,
64 gui->get_h() - BC_GenericButton::calculate_h() - 10,
70 int ConfirmQuitNoButton::handle_event()
76 int ConfirmQuitNoButton::keypress_event()
78 if(get_keypress() == 'n') return handle_event();
82 ConfirmQuitCancelButton::ConfirmQuitCancelButton(MWindow *mwindow,
83 ConfirmQuitWindow *gui)
84 : BC_GenericButton(gui->get_w() - BC_GenericButton::calculate_w(gui, _("Cancel")) - 10,
85 gui->get_h() - BC_GenericButton::calculate_h() - 10,
90 int ConfirmQuitCancelButton::handle_event()
96 int ConfirmQuitCancelButton::keypress_event()
98 if(get_keypress() == ESC) return handle_event();