- MainWindow.cpp
- Saturday, March 29th, 2008 at 11:41:30am MDT
- #include "MainWindow.h"
- MainWindow::MainWindow()
- {
- // Initialise members
- preferences_window = NULL;
- // Load the data for this window and it's widgets.
- refXml = Gnome::Glade::Xml::create("simpleapp.glade", "main_window");
- // The window
- refXml->get_widget("main_window", window);
- window->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::on_delete_event));
- // Widgets
- refXml->connect_clicked("preferences_button", sigc::mem_fun(*this, &MainWindow::on_preferences_open));
- // Show everything.
- window->show_all_children(true);
- }
- MainWindow::~MainWindow()
- {
- delete window; // Frees all the children for the window, too.
- }
- bool MainWindow::on_delete_event(GdkEventAny *e)
- {
- if (preferences_window != NULL)
- return true;
- return false;
- }
- void MainWindow::on_preferences_open()
- {
- if (preferences_window == NULL)
- preferences_window = new PreferencesWindow;
- preferences_window->window->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::on_preferences_close));
- preferences_window->window->signal_hide().connect(sigc::mem_fun(*this, &MainWindow::on_preferences_hide));
- }
- void MainWindow::on_preferences_hide()
- {
- std::cout << "MainWindow::on_preferences_hide() called" << std::endl;
- delete preferences_window;
- preferences_window = NULL;
- std::cout << "MainWindow::on_preferences_hide() finished" << std::endl;
- }
- bool MainWindow::on_preferences_close(GdkEventAny *e)
- {
- on_preferences_hide();
- return false;
- }
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.