r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / question.C
blob49c6276f17f4ceb1d6c1ffe0b4b1ae9eb5618db5
1 #include "language.h"
2 #include "mwindow.h"
3 #include "mwindowgui.h"
4 #include "question.h"
5 #include "theme.h"
8 #define WIDTH 375
9 #define HEIGHT 160
11 QuestionWindow::QuestionWindow(MWindow *mwindow)
12  : BC_Window(PROGRAM_NAME ": Question", 
13         mwindow->gui->get_abs_cursor_x(1) - WIDTH / 2, 
14         mwindow->gui->get_abs_cursor_y(1) - HEIGHT / 2, 
15         WIDTH, 
16         HEIGHT)
18         this->mwindow = mwindow;
21 QuestionWindow::~QuestionWindow()
25 int QuestionWindow::create_objects(char *string, int use_cancel)
27         int x = 10, y = 10;
28         add_subwindow(new BC_Title(10, 10, string));
29         y += 30;
30         add_subwindow(new QuestionYesButton(mwindow, this, x, y));
31         x += get_w() / 2;
32         add_subwindow(new QuestionNoButton(mwindow, this, x, y));
33         x = get_w() - 100;
34         if(use_cancel) add_subwindow(new BC_CancelButton(x, y));
35         return 0;
38 QuestionYesButton::QuestionYesButton(MWindow *mwindow, QuestionWindow *window, int x, int y)
39  : BC_GenericButton(x, y, _("Yes"))
41         this->window = window;
42         set_underline(0);
45 int QuestionYesButton::handle_event()
47         set_done(2);
50 int QuestionYesButton::keypress_event()
52         if(get_keypress() == 'y') { handle_event(); return 1; }
53         return 0;
56 QuestionNoButton::QuestionNoButton(MWindow *mwindow, QuestionWindow *window, int x, int y)
57  : BC_GenericButton(x, y, _("No"))
59         this->window = window;
60         set_underline(0);
63 int QuestionNoButton::handle_event()
65         set_done(0);
68 int QuestionNoButton::keypress_event()
70         if(get_keypress() == 'n') { handle_event(); return 1; }
71         return 0;