The Bitmap Editor Application > Step 4: Inserting Dialogs Done with Rogue Wave Views Studio > Integrating the Dialog Box in the Bitmap Editor Application
 
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 figure 1.5:
Figure 1.5    The Bitmap Editor Application After Step 4

Version 5.7
Copyright © 2013, Rogue Wave Software, Inc. All Rights Reserved.