/**** * * Implementation of simple-dialog.h. * */ #include "simple-dialog.h" #include #include #include SimpleDialog::SimpleDialog( Interactor* contents, int borderspace = 10) : Dialog(new ButtonState(false), null) { MakeFullContents(contents, borderspace, null, null); } SimpleDialog::SimpleDialog( Interactor* contents, Font* font, char* label, int borderspace = 10) : Dialog(new ButtonState(false), null) { MakeFullContents(contents, borderspace, font, label); } void SimpleDialog::MakeFullContents( Interactor* contents, int borderspace, Font* font, char* label) { VBox* vbox = new VBox( new VGlue(borderspace), contents, new VGlue(borderspace), font ? new QuitButton(font, label) : new QuitButton(label), new VGlue(borderspace)); vbox->Align(Center); Insert(new HBox( new HGlue(borderspace), vbox, new HGlue(borderspace)) ); } void SimpleDialog::Display(World* world) { Coord x = world->Width() / 2; Coord y = world->Height() / 2; world->InsertTransient(this, this, x, y, Center); #ifndef OLD_EXCEPTION_HANDLING try { #else if (not catch(QuitButtonPressed)) { #endif Accept(); } #ifndef OLD_EXCEPTION_HANDLING catch (QuitButtonPressed) {} #endif world->Remove(this); }