[gtkmm] First shot at using gtkmm with libglademm
- From: "Laughlin, Joseph V" <Joseph V Laughlin boeing com>
- To: "gtkmm-list" <gtkmm-list gnome org>
- Subject: [gtkmm] First shot at using gtkmm with libglademm
- Date: Mon, 12 Apr 2004 15:47:29 -0700
Below is my first attempt to get an example up and running. Any
comments? I don't really like the dynamic_cast bit.. the whole thing
seems a bit clumsy.
How can I make this cleaner/simpler?
main.cpp:
#include <iostream>
#include "calculator.h"
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Calculator c;
kit.run(*c.getMainWindowInstance());
return 0;
}
--------------------------------
calculator.h:
#include <gtkmm.h>
#include <libglademm.h>
class Calculator
{
public:
Calculator();
Gtk::Window* getMainWindowInstance();
private:
Gtk::Window* _calculatorWindow;
Glib::RefPtr<Gnome::Glade::Xml> _xml_interface;
};
---------------------------------
calculator.cpp:
#include "calculator.h"
Calculator::Calculator()
{
this->_xml_interface = Gnome::Glade::Xml::create("calculate.glade");
this->_calculatorWindow = dynamic_cast<Gtk::Window*>
(_xml_interface->get_widget("windowCalculator"));
}
Gtk::Window* Calculator::getMainWindowInstance()
{
return _calculatorWindow;
}
Joe Laughlin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]