/**** * * Implementation of error-message-dialog.h. * */ #include "error-message-dialog.h" #include "label.h" #include "strlist.h" #include #include #include ErrorMessageDialog::ErrorMessageDialog() : View() { int i; // Temp for-loop var for (i=0; i<5; i++) { roseds[i] = new ReadOnlyStringEditor( " "); } } void ErrorMessageDialog::Compose() { int i; // Temp for-loop var // // Allocation the vbox that is this' window. // w = new VBox(); // // Put the label "Error:" at the top of the window, with some glue above. // The label font is times roman bold 18. // ((VBox*) w)->Insert(new VGlue(round(0.20 * inch))); ((VBox*) w)->Insert(new Label( "Error:", "times", "bold", "r", 18)); // // Insert the five read-only string editors below the "Error:" label, // followed by some glue. // for (i=0; i<5; i++) { ((VBox*) w)->Insert(new VGlue(round(0.10 * inch))); ((VBox*) w)->Insert(roseds[i]); } ((VBox*) w)->Insert(new VGlue(round(0.20 * inch))); // // Add an OK button at the bottom of the window to all the user to dismiss // the error dialog, going back to the previous screen. Put the OK button // in a center-aligned hbox. This h // ((VBox*) w)->Insert( new HBox( new HGlue(), new ErrorMessageDialogOKButton(), new HGlue())->Align(Center) ); void ErrorMessageDialog::SetMessage(String* s) { SetMessage(s, 1); } void ErrorMessageDialog::SetMessages(StrList* sl) { String* s; // Generator temp variable int i; // Temp list position counter for (s = sl->Enum()->GetData(), i = 1; s; s = sl->Enum()->GetData(), i++) { SetMessage(s, i); } } void ErrorMessageDialog::SetMessage(String* s, int pos) { roseds[pos-1]->Message(s->ConstConvert()); }