Gadgets > Creating GUI Applications with Rogue Wave Views Studio > Using the Generated Code > Generating the C++ Code > FirstPanelClass Source File
 
FirstPanelClass Source File
Class Header File
The panel class header file is the first included file:
#include <class1.h>
Panel Data
The lines between the #include statement and the callback definition _SliderCB define the way the panel data is loaded when the panel class constructor is called. If the Data toggle button of the Panel Class inspector (Options notebook page) is turned on, the panel data is generated in a constant character string. In this case, instead of loading the data from a file, the panel can load its description from the generated string (through an istrstream), unless there is a compiler limitation.
Callback
Because the callback name SliderCB is assigned to a panel object, Rogue Wave Views Studio generates the following callback:
static void ILVCALLBACK
_SliderCB(IlvGraphic* g, IlvAny)
{
FirstPanelClass* o = (FirstPanelClass*)
g->GetCurrentCallbackHolder()->getContainer();
if (o) o->SliderCB(g);
}
This function gets the panel class from the graphic object and calls the related method that is declared in the class declaration.
Callback Method Definition
Because the Callbacks Definitions toggle button of the Panel Class inspector (Options notebook page) is turned on, the default definition of the callback method SliderCB is generated in the source file. This lets you compile, link and test your application before writing the real function definition.
The generated callback method looks like this:
void
FirstPanelClass::SliderCB(IlvGraphic* g)
{
const char* className = g->className();
IlvPrint(" %s : SliderCB method ...",className);
}
When called by a slider, this function prints the following message:
IlvSlider : SliderCB method ...
If you do not want Rogue Wave Views Studio to generate this callback method definition, turn off the Callbacks Definitions toggle button of the Panel Class inspector (Options notebook page). In this case, you must write your own version of FirstPanelClass::SliderCB in a separate file and link that file object to the application.
initialize Member Function
The generated constructors of the class FirstPanelClass call the initialize member function to initialize the panel.
The initialize function loads the panel contents from a file or an istrstream, according to the platform you use to compile the application.
void
FirstPanelClass::initialize()
{
#if defined(ILVNOSTATICDATA)
readFile(FILENAME);
#else /* !ILVNOSTATICDATA */
istrstream str((char*)_data);
read(str);
#endif /* !ILVNOSTATICDATA */
registerCallback(“SliderCB”, _SliderCB);
}

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.