#include <iostream>

#include <gtkmm/application.h>
#include <gtkmm/button.h>
#include <gtkmm/window.h>
#include <gtkmm/grid.h>
#include <gtkmm/expander.h>

void b1_press()
{
    std::cout<<"pressed Button 1"<<std::endl;
}

void b2_press()
{
    std::cout<<"pressed Button 2"<<std::endl;
}

int main(int argc, char * argv[])
{
    Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.test.expandbug", Gio::APPLICATION_NON_UNIQUE);

    Gtk::Window win;
    Gtk::Grid grid;
    Gtk::Expander ex1("Expander 1");
    Gtk::Expander ex2("Expander 2");
    Gtk::Button b1("Button 1");
    Gtk::Button b2("Button 2");

    b1.signal_pressed().connect(sigc::ptr_fun(&b1_press));
    b2.signal_pressed().connect(sigc::ptr_fun(&b2_press));

    ex1.set_expanded(false);
    ex2.set_expanded(true);

    win.add(grid);

    grid.attach(ex1, 0, 0, 1, 1);
    grid.attach(ex2, 0, 1, 1, 1);

    ex1.add(b1);
    ex2.add(b2);

    win.show_all_children();

    return app->run(win);
}
