コード例 #1
0
ファイル: VRGuiVectorEntry.cpp プロジェクト: Pfeil/polyvr
void VRGuiVectorEntry::init(string placeholder, string label,  sigc::slot<void, OSG::Vec3f&> sig) {
    Gtk::Fixed* ph;
    VRGuiBuilder()->get_widget(placeholder.c_str(), ph);
    Gtk::Container* frame = ph->get_parent();
    frame->remove(*ph);

    Gtk::HBox* hb = new Gtk::HBox();
    frame->add(*hb);

    Gtk::Label* lbl = new Gtk::Label();
    lbl->set_text(label.c_str());
    lbl->set_size_request(50, -1);

    ex = new Gtk::Entry();
    ey = new Gtk::Entry();
    ez = new Gtk::Entry();
    ex->set_has_frame(false);
    ey->set_has_frame(false);
    ez->set_has_frame(false);
    ex->set_size_request(50, -1);
    ey->set_size_request(50, -1);
    ez->set_size_request(50, -1);

    Gtk::VSeparator *s1, *s2, *s3;
    s1 = new Gtk::VSeparator();
    s2 = new Gtk::VSeparator();
    s3 = new Gtk::VSeparator();

    hb->pack_start(*lbl, false, false, 2);
    hb->pack_start(*s1, false, false, 0);
    hb->pack_start(*ex, false, false, 0);
    hb->pack_start(*s2, false, false, 0);
    hb->pack_start(*ey, false, false, 0);
    hb->pack_start(*s3, false, false, 0);
    hb->pack_start(*ez, false, false, 0);
    frame->show_all();

    sigc::slot<bool,GdkEventFocus*> sif = sigc::bind(&VRGuiVectorEntry::proxy, sig, ex, ey, ez);
    ex->signal_focus_out_event().connect( sif );
    ey->signal_focus_out_event().connect( sif );
    ez->signal_focus_out_event().connect( sif );

    sigc::slot<bool> sia_b = sigc::bind<GdkEventFocus*>(&VRGuiVectorEntry::proxy, 0, sig, ex, ey, ez);
    sigc::slot<void> sia = sigc::hide_return( sia_b );
    ex->signal_activate().connect(sia);
    ey->signal_activate().connect(sia);
    ez->signal_activate().connect(sia);
}
コード例 #2
0
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();
}
コード例 #3
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;
}