Integrating the Dialog Box in the Bitmap Editor Application
The code for the dialog box has been generated. It must now be integrated into the application.
The dialog box will be displayed to let the user choose the size when creating a new bitmap. Step 2 demonstrated how the BitmapDocument::initializeDocument method was called to create a new document. This method must now be modified to display the dialog box:
IlvBoolean
BitmapDocument::initializeDocument(IlvAny data)
{
if (!IlvDvDocument::initializeDocument(data))
return IlvFalse;
 
IlvDisplay* display = getDisplay();
// Pops-up a dialog to let the user choose the initial size
BitmapSizeDialog dialog(display, "New Image", "New Image");
dialog.moveToMouse(IlvCenter);
dialog.wait();
IlvDim width = dialog.getWidth()->getIntValue();
IlvDim height = dialog.getHeight()->getIntValue();
IlvBitmap* bitmap =
new IlvBitmap(display, width, height, display->screenDepth());
setBitmap(bitmap);
 
// Initialize it with the display palette
setPalette(display->defaultPalette());
getPalette()->invert();
bitmap->fillRectangle(getPalette(), IlvRect(0, 0, width, height));
getPalette()->invert();
return IlvTrue;
}
The bmpsize.cpp file must be added to the makefile or project in order to link the application.
The Bitmap Editor application at the end of Step 4 is shown in The Bitmap Editor Application After Step 4:
The Bitmap Editor Application After Step 4
Published date: 05/24/2022
Last modified date: 02/24/2022