Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

question.C

Go to the documentation of this file.
00001 #include "language.h"
00002 #include "mwindow.h"
00003 #include "mwindowgui.h"
00004 #include "question.h"
00005 #include "theme.h"
00006 
00007 
00008 #define WIDTH 375
00009 #define HEIGHT 160
00010 
00011 QuestionWindow::QuestionWindow(MWindow *mwindow)
00012  : BC_Window(PROGRAM_NAME ": Question", 
00013         mwindow->gui->get_abs_cursor_x(1) - WIDTH / 2, 
00014         mwindow->gui->get_abs_cursor_y(1) - HEIGHT / 2, 
00015         WIDTH, 
00016         HEIGHT)
00017 {
00018         this->mwindow = mwindow;
00019 }
00020 
00021 QuestionWindow::~QuestionWindow()
00022 {
00023 }
00024 
00025 int QuestionWindow::create_objects(char *string, int use_cancel)
00026 {
00027         int x = 10, y = 10;
00028         add_subwindow(new BC_Title(10, 10, string));
00029         y += 30;
00030         add_subwindow(new QuestionYesButton(mwindow, this, x, y));
00031         x += get_w() / 2;
00032         add_subwindow(new QuestionNoButton(mwindow, this, x, y));
00033         x = get_w() - 100;
00034         if(use_cancel) add_subwindow(new BC_CancelButton(x, y));
00035         return 0;
00036 }
00037 
00038 QuestionYesButton::QuestionYesButton(MWindow *mwindow, QuestionWindow *window, int x, int y)
00039  : BC_GenericButton(x, y, _("Yes"))
00040 {
00041         this->window = window;
00042         set_underline(0);
00043 }
00044 
00045 int QuestionYesButton::handle_event()
00046 {
00047         set_done(2);
00048 }
00049 
00050 int QuestionYesButton::keypress_event()
00051 {
00052         if(get_keypress() == 'y') { handle_event(); return 1; }
00053         return 0;
00054 }
00055 
00056 QuestionNoButton::QuestionNoButton(MWindow *mwindow, QuestionWindow *window, int x, int y)
00057  : BC_GenericButton(x, y, _("No"))
00058 {
00059         this->window = window;
00060         set_underline(0);
00061 }
00062 
00063 int QuestionNoButton::handle_event()
00064 {
00065         set_done(0);
00066 }
00067 
00068 int QuestionNoButton::keypress_event()
00069 {
00070         if(get_keypress() == 'n') { handle_event(); return 1; }
00071         return 0;
00072 }

Generated on Sun Jan 8 13:38:59 2006 for Cinelerra-svn by  doxygen 1.4.4