improve doxygen documentation of PMsgBox.*
This commit is contained in:
@@ -29,10 +29,42 @@
|
||||
|
||||
#include "PMsgBox.h"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* \brief Constructor that creates and displays the message box GUI.
|
||||
*
|
||||
* This constructor performs the following steps:
|
||||
* 1. Creates a scrollable list box widget
|
||||
* 2. Parses the error message string by splitting at newline characters
|
||||
* 3. Populates the list box with individual message lines
|
||||
* 4. Creates an Exit button with callback to DoExit()
|
||||
* 5. Configures layout and displays the window
|
||||
*
|
||||
* The message parsing algorithm:
|
||||
* - Adds an initial empty line
|
||||
* - Splits the input string at each '\n' character
|
||||
* - Each substring becomes a separate list box entry
|
||||
* - Handles multi-line messages gracefully
|
||||
*
|
||||
* GUI Layout:
|
||||
* - List box: 600x200 pixels, expandable, with 5-pixel margins
|
||||
* - Button frame: Fixed width (150px), contains Exit button
|
||||
* - Window title: "Error Message"
|
||||
*
|
||||
* \param errMsg Multi-line error message string with '\n' separators
|
||||
* \param p Parent window pointer (typically gClient->GetRoot())
|
||||
* \param w Initial window width in pixels
|
||||
* \param h Initial window height in pixels
|
||||
*
|
||||
* \note The window is automatically mapped (displayed) after construction
|
||||
* \note The list box ID is set to 89 (ROOT widget identifier)
|
||||
*/
|
||||
PMsgBox::PMsgBox(const std::string errMsg, const TGWindow *p, UInt_t w, UInt_t h) : TGMainFrame(p, w, h)
|
||||
{
|
||||
fListBox = new TGListBox(this, 89);
|
||||
|
||||
|
||||
// feed list box with errMsg
|
||||
size_t start = 0;
|
||||
size_t end = errMsg.find("\n");
|
||||
@@ -45,7 +77,7 @@ PMsgBox::PMsgBox(const std::string errMsg, const TGWindow *p, UInt_t w, UInt_t h
|
||||
end = errMsg.find("\n", start);
|
||||
fListBox->AddEntry(tok.c_str(), i++);
|
||||
}
|
||||
|
||||
|
||||
fListBox->Resize(600, 200);
|
||||
AddFrame(fListBox, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5));
|
||||
|
||||
@@ -67,11 +99,45 @@ PMsgBox::PMsgBox(const std::string errMsg, const TGWindow *p, UInt_t w, UInt_t h
|
||||
MapWindow();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Destructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* \brief Destructor that cleans up the message box resources.
|
||||
*
|
||||
* The ROOT framework automatically handles cleanup of GUI components
|
||||
* (list box, buttons, frames) through the TGMainFrame destructor chain,
|
||||
* so no explicit cleanup is required here.
|
||||
*
|
||||
* \note GUI widgets are managed by ROOT and are automatically deleted
|
||||
* when the main frame is destroyed
|
||||
*/
|
||||
PMsgBox::~PMsgBox()
|
||||
{
|
||||
// nothing to be done here?
|
||||
// nothing to be done here - ROOT handles GUI cleanup automatically
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// DoExit
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* \brief Exit button callback that terminates the application.
|
||||
*
|
||||
* This method is invoked when the user clicks the Exit button.
|
||||
* It terminates the entire ROOT application with exit code 0,
|
||||
* which causes a clean shutdown of the program.
|
||||
*
|
||||
* The method is connected to the Exit button's "Pressed()" signal
|
||||
* in the constructor via ROOT's signal/slot mechanism:
|
||||
* \code
|
||||
* exit->Connect("Pressed()", "PMsgBox", this, "DoExit()");
|
||||
* \endcode
|
||||
*
|
||||
* \note This terminates the entire application, not just the message box window
|
||||
* \note Exit code 0 indicates successful termination
|
||||
*
|
||||
* \see gApplication for ROOT's global application object
|
||||
*/
|
||||
void PMsgBox::DoExit()
|
||||
{
|
||||
gApplication->Terminate(0);
|
||||
|
||||
Reference in New Issue
Block a user