void AsistenteJerarquia::enlazarWidgets() {
	Gtk::Button* bAceptar = 0;
	Gtk::Button* bCancelar = 0;
	Gtk::Entry *entryNombre = 0;
	Gtk::ScrolledWindow* scrollLista = 0;
	Gtk::Fixed * fixed = 0;

	this->m_builder->get_widget("bAceptar", bAceptar);
	this->m_builder->get_widget("bCancelar", bCancelar);
	this->m_builder->get_widget("entryNombre", entryNombre);
	this->m_builder->get_widget("fixed3", fixed);

	bAceptar->signal_clicked().connect(sigc::mem_fun(*this,
			&AsistenteJerarquia::on_botonAceptar_click));
	bCancelar->signal_clicked().connect(sigc::mem_fun(*this,
			&AsistenteJerarquia::on_botonCancelar_click));
	this->comboBox.signal_changed().connect(sigc::mem_fun(*this,
			&AsistenteJerarquia::on_ComboBox_click));

	this->signal_hide().connect(sigc::mem_fun(*this,
						&AsistenteJerarquia::on_about_hide));

	//Lista
	this->m_builder->get_widget("scrollLista", scrollLista);
	scrollLista->add(this->treeView);
	this->refTreeModel = Gtk::ListStore::create(this->m_Columnas);

	//Agrego modelo a treeview
	this->treeView.set_model(this->refTreeModel);
	this->treeView.append_column("Nombre",
			this->m_Columnas.m_col_Nombre);
	this->treeView.append_column_editable("Selected",
			this->m_Columnas.m_col_selected);

	this->refTreeModelCombo = Gtk::ListStore::create(this->m_ColumnasCombo);
	this->comboBox.set_model(this->refTreeModelCombo);
	this->comboBox.pack_start(this->m_ColumnasCombo.m_col_Nombre);
	this->comboBox.set_active(0);
	this->comboBox.set_size_request(120,25);
	fixed->put(this->comboBox,200,50);

	this->treeView.show();
	this->show_all();
}
예제 #2
0
파일: gtk_1.cpp 프로젝트: hczhcz/ssssss-lib
// Main
int main(int argc, char *argv[])
{
    // Init GTK
    Gtk::Main kit(argc, argv);
    Gtk::Window window;
    window.set_size_request(450, 350);

        Gtk::Fixed fixed;
        window.add(fixed);

            // Lines ////////

            Lines lines;
            lines.set_size_request(500, 425);

            // FLTK
            lines.add_line(230, 45, 110, 115);
            lines.add_line(270, 45, 270, 90);
            lines.add_line(290, 45, 400, 165);
            lines.add_line(310, 40, 350, 60);

            // Point
            lines.add_line(110, 55, 110, 115);
            lines.add_line(150, 55, 210, 90);

            // Graph
            lines.add_line(110, 160, 90, 240);
            lines.add_line(110, 160, 170, 340);

            // Window
            lines.add_line(250, 135, 230, 190);
            lines.add_line(270, 135, 270, 265);
            lines.add_line(320, 135, 400, 165);

            // GUI
            lines.add_line(340, 210, 270, 265);
            lines.add_line(390, 210, 400, 240);

            // Simple
            lines.add_line(200, 310, 170, 340);

            // So difficult... >.<

            fixed.add(lines);

            // Nodes ////////

            TitledText tt1("Point.h", "struct Point { ... };");
            fixed.put(tt1, 50, 25);

            TitledText tt2("Graph.h", "// graphing interface\nstruct Shape { ... };\n...");
            fixed.put(tt2, 50, 100);

            TitledText tt3("Graph.cpp", "Graph code");
            fixed.put(tt3, 25, 225);

            TitledText tt4("Window.h", "// window interface\nclass Window { ... };\n...");
            fixed.put(tt4, 200, 75);

            TitledText tt5("Window.cpp", "Window code");
            fixed.put(tt5, 150, 175);

            TitledText tt6("GUI.h", "// GUI interface\nstruct In_box { ... };\n...");
            fixed.put(tt6, 325, 150);

            TitledText tt7("GUI.cpp", "GUI code");
            fixed.put(tt7, 350, 225);

            TitledText tt8("Simple_window.h", "// window interface\nclass Simple_window { ... };\n...");
            fixed.put(tt8, 175, 250);

            TitledText tt9("chapter12.cpp", "#include \"Graph.h\"\n#include \"Simple_window.h\"\nint main { ... }");
            fixed.put(tt9, 75, 325);

            FramedText ft1("FLTK headers");
            ShadowFrame<FramedText> sfa1(ft1);
            ShadowFrame<ShadowFrame<FramedText> > sfb1(sfa1, 2);
            fixed.put(sfb1, 225, 25);

            FramedText ft2("FLTK code");
            ShadowFrame<FramedText> sfa2(ft2);
            ShadowFrame<ShadowFrame<FramedText> > sfb2(sfa2, 2);
            fixed.put(sfb2, 350, 50);

    // Done, run the application
    window.show_all_children();
    Gtk::Main::run(window);

    return EXIT_SUCCESS;
}