MainWindow::MainWindow(int w, int h, const string& c)
: Fl_Window(w, h, c.c_str()) // Don't call constructor over here
{
script.load_file(WIN_CONFIG_SCRIPT);
int width = script.get_global_int("width");
int height = script.get_global_int("height");
const char* caption = script.get_global_string("caption").c_str();
/** CALL CONSTRUCTOR NOW **/
//NOTE: I don't know a way to change an FLTK Fl_Window's Caption after
//initialising it.
Toolbar* toolbar = new Toolbar(0, 0, this->w(),30);
toolbar->add_button("Hello");
toolbar->add_button("World!");
end();
}
如何在构造函数中初始化基类?或者,如何在初始化后更改 FLTK Fl_Window 的标题?有没有其他办法摆脱这种混乱?