Problems With a SDI Implementation



Hi there!

I am implementing a Single Document Interface, and I have some implementation problems.

I have an ApplicationGuiManager that keeps a std::list<ImageWindow*> of ImageWindows, where ImageWindow inherits from Gtk::Window.

The ApplicationGuiManager creates an Gtk::ActionGroup which binds for instance a "FileNew" action to ApplicationGuiManager::on_file_new().

When the application starts, an ApplicationGuiManager is instantiated and its open_default_new_image() is called, which creates a new ImageWindow() and adds the pointer to the internal list.

The ApplicationGuiManager passes itself to each ImageWindow, and each ImageWindow retrives a copy (by a Glib::RefPtr<Gtk::ActionGroup>) of the action group of the ApplicationGuiManager, and creates their own Gtk::UIManager based on the action group of the ApplicationGuiManager.

*The Problem:*

How can the ImageWindows tell the ApplicationGuiManager that the
ApplicationGuiManager can go ahead and delete them?

There is an ApplicationGuiManager::delete_window( ImageWindow& imageWindow) method that deletes a given ImageWindow and removes it from the list of ImageWindows, but this method cannot be called by the ImageWindows themselves in an overridden signal, because if you delete an ImageWindow in the middle of a callback, Gtk freaks out.

So, how can the ApplicationGuiManager know when it can delete a given
ImageWindow?

- Martin Nordholts





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]