warning

Description

warning.c is a Motif GUI source file, typically generated by an interface builder tool like X-Designer. Its purpose is to create and manage a “Warning!” dialog box within the “Submetrix 2000 unraveller” application. This dialog is specifically designed to prompt the user for confirmation when they attempt to exit the application with unsaved changes, asking if they truly wish to exit or if they want to return to save their work.

How It Works

This file uses Motif (Xm) and Xt Intrinsics libraries to define and instantiate GUI widgets.

  1. create_warning(Widget parent) function:
    • Creates a DialogShell widget (widget0) as the top-level window for the warning dialog.
    • Creates an XmMessageBox widget (warning_box) as the main content area of the dialog.
    • Sets the dialog title to “Warning!”.
    • Creates an XmLabel widget (widget3) to display the warning message (e.g., “The configuration file has not been saved.\nDo you really want to exit?”).
    • Creates two XmPushButton widgets: one labeled “Exit” (widget4) and another labeled “Return” (widget5).
    • Callbacks: Attaches callback functions (really_quit and dont_quit, likely defined in callbacks.c) to these buttons, which handle the user’s choice to either proceed with exiting or to cancel the exit operation.
    • Manages the children widgets to lay them out within the dialog. This file is primarily a structural definition of a GUI element, providing a standard user confirmation mechanism before a potentially data-losing action.