#include <gtkmm.h>
#include <iostream>

class TestWindow : public Gtk::Window
{
public:
    TestWindow();

private:
    Gtk::VBox m_VBox;
    Gtk::MenuBar m_MenuBar;
    Gtk::Menu m_Menu;
    
    void on_menu_deletethisitem();
};

TestWindow::TestWindow()
{
  m_Menu.items().push_back(
    Gtk::Menu_Helpers::MenuElem("Delete this using remove()", 
      Gtk::Menu::AccelKey("<control>r"), 
      SigC::slot(*this, &TestWindow::on_menu_deletethisitem) ) );

  m_MenuBar.items().push_back(Gtk::Menu_Helpers::MenuElem("Test", m_Menu));
 
  m_VBox.pack_start(m_MenuBar);
  
  add(m_VBox);
  show_all_children();
}

void TestWindow::on_menu_deletethisitem()
{
    m_Menu.items().remove(m_Menu.items()[0]);
    std::cout << "Menu item deleted." << std::endl;
    std::cout << "Bug: try to press Ctrl+r" << std::endl;
}

int main(int argc, char* argv[])
{
    Gtk::Main testMain(argc, argv);

    TestWindow testWindow;  
    Gtk::Main::run(testWindow);
    
    return 0;
}
