Exemple #1
0
void Audiotheque::GetAlbums(Glib::ustring artist)
{
	std::vector<Gtk::Widget*> children = hbox.get_children();
	for(std::vector<Gtk::Widget*>::iterator it=children.begin()+1; it!=children.end(); it++)
		hbox.remove(**it);

	vbox = Gtk::manage(new Gtk::VBox(false,2));
	vbox->set_size_request(300,0);

	Gtk::Button* button;
	std::string path = dirpath+"/"+artist;
	DIR* rep = opendir(path.c_str());

	button = Gtk::manage(new Gtk::Button("Tous les albums"));
	button->signal_clicked().connect(sigc::bind<Glib::ustring>(sigc::mem_fun(*this,&Audiotheque::GetAllSongsBy),artist));
	vbox->pack_start(*button,Gtk::PACK_SHRINK);

	if(rep!=NULL) {
		struct dirent* ent;
		std::string here = ".";
		std::string parent = "..";
		while((ent=readdir(rep))!=NULL) {
			if(here.compare(ent->d_name)!=0 && parent.compare(ent->d_name)!=0) {
				button = Gtk::manage(new Gtk::Button(ent->d_name));
				button->signal_clicked().connect(sigc::bind<Glib::ustring>(sigc::mem_fun(*this,&Audiotheque::GetSongs),artist+"/"+ent->d_name));
				vbox->pack_start(*button,Gtk::PACK_SHRINK);
			}
		}
		closedir(rep);
	}	

	hbox.pack_start(*vbox,Gtk::PACK_SHRINK);

	hbox.show_all_children();
}
    Gtk::Grid * SmartChessWindow::createOptionsArea() {
        const int OPTIONS_ROWS = 4;
        Gtk::Grid* options = Gtk::manage(new Gtk::Grid());
        options->set_vexpand();
        options->set_hexpand(false);
        options->insert_column(0);

        for(auto i : IntRange(OPTIONS_ROWS))
            options->insert_row(i);

        Gtk::Button* b = Gtk::manage(new Gtk::Button("Start"));
        b->set_hexpand(false);
        b->signal_clicked().connect(sigc::mem_fun(this, &SmartChessWindow::onStartGame));
        options->attach(*b, 0, 0, 1, 1);

        b = Gtk::manage(new Gtk::Button("End"));
        b->set_hexpand(false);
        b->signal_clicked().connect(sigc::mem_fun(this, &SmartChessWindow::onEndGame));
        options->attach(*b, 0, 1, 1, 1);

        b = Gtk::manage(new Gtk::Button("Reset"));
        b->set_hexpand(false);
        b->signal_clicked().connect(sigc::mem_fun(this, &SmartChessWindow::onResetGame));
        options->attach(*b, 0, 2, 1, 1);

        auto suboptions = createSuboptionsArea();
        options->attach(*suboptions, 0, 3, 1, 1);

        return options;
    }
Exemple #3
0
SelectJackControlPgm::SelectJackControlPgm(BaseObjectType* cobject, Glib::RefPtr<GxBuilder> bld, gx_engine::GxMachineBase& m)
    : Gtk::Window(cobject),
      description(),
      customstarter(),
      startercombo(),
      dontask(),
      machine(m),
      close() {
    signal_delete_event().connect(sigc::mem_fun(*this, &SelectJackControlPgm::on_delete_event));
    bld->find_widget("description", description);
    bld->find_widget("customstarter", customstarter);
    customstarter->set_text(machine.get_parameter_value<string>("ui.jack_starter"));
    bld->find_widget("startercombo", startercombo);
    const char *v_id = machine.get_parameter("ui.jack_starter_idx").getValueNames()[machine.get_parameter_value<int>("ui.jack_starter_idx")].value_id;
    int n = 0;
    Glib::RefPtr<Gtk::TreeModel> model = startercombo->get_model();
    for (Gtk::TreeIter i = model->children().begin(); i; ++i, ++n) {
	Glib::ustring s;
	i->get_value(1, s);
	if (s == v_id) {
	    startercombo->set_active(n);
	}
    }
    startercombo->signal_changed().connect(sigc::mem_fun(*this, &SelectJackControlPgm::on_starter_changed));
    bld->find_widget("dontask", dontask);
    dontask->set_active(!machine.get_parameter_value<bool>("ui.ask_for_jack_starter"));
    Gtk::Button *button;
    bld->find_widget("ok_button", button);
    button->signal_clicked().connect(
	sigc::mem_fun(*this, &SelectJackControlPgm::on_ok_button));
    bld->find_widget("cancel_button", button);
    button->signal_clicked().connect(
	sigc::mem_fun(*this, &SelectJackControlPgm::on_cancel_button));
    on_starter_changed();
}
SnalpAddLanguageDialog::SnalpAddLanguageDialog( GladeRef gladeref , boost::shared_ptr<SnalpSignals> _signals )
: dialog(0),entry(0),signals(_signals)
{
    try
    {
        Gtk::Button * button = 0;
        gladeref->get_widget<Gtk::Dialog>("AddLanguageDialog",dialog);
        gladeref->get_widget<Gtk::Entry>("LanguageDialogEntry",entry);
        gladeref->get_widget<Gtk::Button>("AddLanguageDialogOkButton",button);
        button->signal_clicked().connect(sigc::mem_fun(*this,&SnalpAddLanguageDialog::OnAccept));        
        gladeref->get_widget<Gtk::Button>("AddLanguageDialogCancelButton",button);
        button->signal_clicked().connect(sigc::mem_fun(*dialog,&Gtk::Dialog::hide));        
        
    }
    catch( Gnome::Glade::XmlError const & xml_error )
    {
        THROW_SNALP_EXCEPTION(SnalpFatalException,xml_error.what());
    }
    catch( std::exception const & e )
    {
        THROW_SNALP_EXCEPTION(SnalpFatalException,e.what());
    }
    catch( Glib::Exception const & e )
    {
        THROW_SNALP_EXCEPTION(SnalpFatalException,e.what());
    }
    catch( ... )
    {
        THROW_SNALP_EXCEPTION(SnalpFatalException, "Unknown exception caught" );
    }
}
ProductoBox::ProductoBox(BaseObjectType* cobject,Glib::RefPtr<Gtk::Builder>& builder):Gtk::Box(cobject){
	Gtk::DrawingArea* stockHistoricoDrawing;
	Gtk::Button* actualizarButton;
	builder -> get_widget("actualizarButton",actualizarButton);
	actualizarButton -> signal_clicked().connect(sigc::mem_fun(this,&ProductoBox::actualizarGrafico));
	builder -> get_widget("stockHistoricoDrawing",stockHistoricoDrawing);
	builder -> get_widget_derived("selectorFechaBox",selectorFecha);
	builder -> get_widget("nombreProductoLabel",nombreProductoLabel);
	Gtk::TextView* descripcionProductoTextView;
	builder -> get_widget("descripcionProductoTextView",descripcionProductoTextView);
	descripcionBuffer = descripcionProductoTextView -> get_buffer();
	builder -> get_widget("iconoProducto",iconoProducto);
	graficoDeBarras = new GraficoDeBarras(stockHistoricoDrawing,GBARRAS_HISTORICO);
	builder -> get_widget("productosTreeView", productosTreeView);
	columnas.add(nombre);
	columnas.add(descripcion);
	columnas.add(icono);
	columnas.add(id);

	selection = productosTreeView -> get_selection();	
	productosTreeView->set_model(listado);
	Gtk::Button* bajaProductoButton;
	Gtk::Button* altaProductoButton;
	builder -> get_widget("bajaProductoButton", bajaProductoButton);
	builder -> get_widget("altaProductoButton", altaProductoButton);
	bajaProductoButton->signal_clicked().connect(sigc::mem_fun(this,&ProductoBox::bajaProducto));
	altaProductoButton->signal_clicked().connect(sigc::mem_fun(this,&ProductoBox::altaProducto));
	selection->signal_changed().connect(sigc::mem_fun(this,&ProductoBox::actualizar));
	Gtk::Button* modificarProductoButton;
	builder -> get_widget("modificarProductoButton", modificarProductoButton);
	modificarProductoButton->signal_clicked().connect(sigc::mem_fun(this,&ProductoBox::imagenesProducto));
}
Exemple #6
0
void Audiotheque::GetArtists()
{
	vbox = Gtk::manage(new Gtk::VBox(false,2));
	vbox->set_size_request(300,0);

	Gtk::Button* button;
	DIR* rep = opendir(dirpath.c_str());

	button = Gtk::manage(new Gtk::Button("Tous les artistes"));
	button->signal_clicked().connect(sigc::mem_fun(*this,&Audiotheque::GetAllAlbums));
	vbox->pack_start(*button,Gtk::PACK_SHRINK);

	if(rep!=NULL) {
		struct dirent* ent;
		std::string here = ".";
		std::string parent = "..";
		while((ent=readdir(rep))!=NULL) {
			if(here.compare(ent->d_name)!=0 && parent.compare(ent->d_name)!=0) {
				button = Gtk::manage(new Gtk::Button(ent->d_name));
				button->signal_clicked().connect(sigc::bind<Glib::ustring>(sigc::mem_fun(*this,&Audiotheque::GetAlbums),ent->d_name));
				vbox->pack_start(*button,Gtk::PACK_SHRINK);
			}
		}
		closedir(rep);
	}
}
// Constructor creates widgets
ObjectivesEditor::ObjectivesEditor() :
	gtkutil::BlockingTransientWindow(
        _(DIALOG_TITLE), GlobalMainFrame().getTopLevelWindow()
    ),
    gtkutil::GladeWidgetHolder("ObjectivesEditor.glade"),
	_objectiveEntityList(Gtk::ListStore::create(_objEntityColumns)),
	_objectiveList(Gtk::ListStore::create(_objectiveColumns))
{
    // Window properties
    set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
    set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
    
    // Add vbox to dialog
    add(*gladeWidget<Gtk::Widget>("mainVbox"));
    g_assert(get_child() != NULL);

    // Setup signals and tree views
    setupEntitiesPanel();
    setupObjectivesPanel();

    // Buttons not associated with a treeview panel
    Gtk::Button* logicButton = gladeWidget<Gtk::Button>(
        "editSuccessLogicButton"
    );
    logicButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onEditLogic)
    );
	Gtk::Button* conditionsButton = gladeWidget<Gtk::Button>(
        "editObjectiveConditionsButton"
    );
    conditionsButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onEditObjConditions)
    );

    gladeWidget<Gtk::Button>("cancelButton")->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onCancel)
    );
	gladeWidget<Gtk::Button>("okButton")->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onOK)
    );

    // Connect the window position tracker
    _windowPosition.loadFromPath(RKEY_WINDOW_STATE);
    _windowPosition.connect(this);
    _windowPosition.applyPosition();

    _objectiveEClasses.clear();

    xml::NodeList nodes = GlobalRegistry().findXPath(RKEY_OBJECTIVE_ENTS);

    for (xml::NodeList::const_iterator i = nodes.begin(); i != nodes.end(); ++i)
    {
        _objectiveEClasses.push_back(i->getAttributeValue("name"));
    }
}
Exemple #8
0
Gtk::Widget *
PathParam::param_newWidget()
{
    Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox());

    Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true);
    pLabel->set_tooltip_text(param_tooltip);

    Gtk::Widget*  pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("tool-node-editor"), Inkscape::ICON_SIZE_BUTTON) );
    Gtk::Button * pButton = Gtk::manage(new Gtk::Button());
    pButton->set_relief(Gtk::RELIEF_NONE);
    pIcon->show();
    pButton->add(*pIcon);
    pButton->show();
    pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_edit_button_click));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
    pButton->set_tooltip_text(_("Edit on-canvas"));

    pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-copy"), Inkscape::ICON_SIZE_BUTTON) );
    pButton = Gtk::manage(new Gtk::Button());
    pButton->set_relief(Gtk::RELIEF_NONE);
    pIcon->show();
    pButton->add(*pIcon);
    pButton->show();
    pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_copy_button_click));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
    pButton->set_tooltip_text(_("Copy path"));

    pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-paste"), Inkscape::ICON_SIZE_BUTTON) );
    pButton = Gtk::manage(new Gtk::Button());
    pButton->set_relief(Gtk::RELIEF_NONE);
    pIcon->show();
    pButton->add(*pIcon);
    pButton->show();
    pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_paste_button_click));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
    pButton->set_tooltip_text(_("Paste path"));

    pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-clone"), Inkscape::ICON_SIZE_BUTTON) );
    pButton = Gtk::manage(new Gtk::Button());
    pButton->set_relief(Gtk::RELIEF_NONE);
    pIcon->show();
    pButton->add(*pIcon);
    pButton->show();
    pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_link_button_click));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
    pButton->set_tooltip_text(_("Link to path on clipboard"));

    static_cast<Gtk::HBox*>(_widget)->show_all_children();

    return dynamic_cast<Gtk::Widget *> (_widget);
}
void c_SelectPointsDlg::InitControls(bool hasAutoBtn)
{
    m_ImgView.signal_ImageAreaBtnPress().connect(sigc::mem_fun(*this, &c_SelectPointsDlg::OnImageBtnPress));

    m_ImgView.signal_DrawImageArea().connect(sigc::slot<bool, const Cairo::RefPtr<Cairo::Context>&>(
        [this](const Cairo::RefPtr<Cairo::Context> &cr)
        {
            for (auto &pt: m_Points)
                Utils::DrawAnchorPoint(cr,
                                       m_ImgView.GetZoomPercentVal() * pt.x / 100,
                                       m_ImgView.GetZoomPercentVal() * pt.y / 100);

            return false;
        }
    ));
    m_ImgView.show();

    Gtk::Button *btnRemovePts = Gtk::manage(new Gtk::Button(_("Remove points")));
    btnRemovePts->signal_clicked().connect(sigc::mem_fun(*this, &c_SelectPointsDlg::OnRemoveClick));
    btnRemovePts->show();

    Gtk::Button *btnAuto = 0;
    if (hasAutoBtn)
    {
        btnAuto = Gtk::manage(new Gtk::Button(_("Automatic")));
        btnAuto->signal_clicked().connect(sigc::mem_fun(*this, &c_SelectPointsDlg::OnAutoClick));
        btnAuto->show();
    }

    Gtk::HButtonBox *btnBox = Gtk::manage(new Gtk::HButtonBox());
    btnBox->set_layout(Gtk::ButtonBoxStyle::BUTTONBOX_START);
    btnBox->pack_start(*btnRemovePts, Gtk::PackOptions::PACK_SHRINK);
    if (hasAutoBtn)
    {
        btnBox->pack_start(*btnAuto, Gtk::PackOptions::PACK_SHRINK);
    }
    btnBox->show();
    get_content_area()->pack_start(*btnBox, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    get_content_area()->pack_start(m_ImgView, Gtk::PackOptions::PACK_EXPAND_WIDGET, Utils::Const::widgetPaddingInPixels);

    m_InfoText.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
    m_InfoText.set_ellipsize(Pango::EllipsizeMode::ELLIPSIZE_END);
    m_InfoText.set_lines(2);
    get_content_area()->pack_start(m_InfoText, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    auto separator = Gtk::manage(new Gtk::Separator());
    separator->show();
    get_content_area()->pack_end(*separator, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    add_button(_("OK"), Gtk::RESPONSE_OK);
    add_button(_("Cancel"), Gtk::RESPONSE_CANCEL);
}
Exemple #10
0
    GUI(Glib::RefPtr<Gtk::Application> _app, SimulationRunner &_runner) : app(_app), runner(_runner)
    {
        builder = Gtk::Builder::create_from_file("gui.glade");
        builder->get_widget("mainWindow", mainWindow);

        Gtk::Button* closeButton;
        builder->get_widget("closeButton", closeButton);
        closeButton->signal_clicked().connect(
            sigc::mem_fun(this, &GUI::stopSimulationRequested));
        mainWindow->signal_hide().connect(
            sigc::mem_fun(this, &GUI::quitCallback));

        builder->get_widget("inputFile", inputFileChooserButton);
        inputFileChooserButton->signal_selection_changed().connect(
            sigc::mem_fun(this, &GUI::inputFileChanged));
        builder->get_widget("impulseFile", impulseResponseFileChooserButton);
        impulseResponseFileChooserButton->signal_selection_changed().connect(
            sigc::mem_fun(this, &GUI::impulseResponseFileChanged));

        Gtk::Button* outputFileButton;
        builder->get_widget("outputFileButton", outputFileButton);
        builder->get_widget(
            "outputFileChooserDialog", outputFileChooserDialog);
        outputFileButton->signal_clicked().connect(
            sigc::mem_fun(
                outputFileChooserDialog, &Gtk::FileChooserDialog::show));

        Gtk::Button* outputFileChooserDialogCloseButton;
        builder->get_widget(
            "outputFileChooserDialogCloseButton",
            outputFileChooserDialogCloseButton);
        outputFileChooserDialogCloseButton->signal_clicked().connect(
            sigc::mem_fun(
                outputFileChooserDialog, &Gtk::FileChooserDialog::hide));

        Gtk::Button* outputFileChooserDialogOKButton;
        builder->get_widget(
            "outputFileChooserDialogOKButton",
            outputFileChooserDialogOKButton);
        outputFileChooserDialogOKButton->signal_clicked().connect(
            sigc::mem_fun(
                this, &GUI::outputFileChooserDialogOKButtonClicked));
        outputFileChooserDialog->signal_file_activated().connect(
            sigc::mem_fun(
                this, &GUI::outputFileChooserDialogOKButtonClicked));

        Gtk::Button* runButton;
        builder->get_widget("runButton", runButton);
        runButton->signal_clicked().connect(
            sigc::mem_fun(this, &GUI::runButtonClicked));

        app->run(*mainWindow);
    }
// Create buttons panel
Gtk::Widget& SoundChooser::createButtons()
{
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 6));

	Gtk::Button* okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));

	okButton->signal_clicked().connect(sigc::mem_fun(*this, &SoundChooser::_onOK));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &SoundChooser::_onCancel));

	hbx->pack_end(*okButton, false, false, 0);
	hbx->pack_end(*cancelButton, false, false, 0);

	return *Gtk::manage(new gtkutil::RightAlignment(*hbx));
}
// Main constructor
TexturePropertyEditor::TexturePropertyEditor(Entity* entity,
											 const std::string& name,
											 const std::string& options)
: PropertyEditor(entity),
  _prefixes(options),
  _key(name)
{
	// Construct the main widget (will be managed by the base class)
	Gtk::VBox* mainVBox = new Gtk::VBox(false, 6);

	// Register the main widget in the base class
	setMainWidget(mainVBox);

	Gtk::VBox* outer = Gtk::manage(new Gtk::VBox(false, 0));
	Gtk::HBox* editBox = Gtk::manage(new Gtk::HBox(false, 3));

	// Create the browse button
	Gtk::Button* browseButton = Gtk::manage(new Gtk::Button(_("Choose texture...")));
	browseButton->set_image(*Gtk::manage(new Gtk::Image(
		PropertyEditorFactory::getPixbufFor("texture"))));

	browseButton->signal_clicked().connect(
		sigc::mem_fun(*this, &TexturePropertyEditor::_onBrowse));

	editBox->pack_start(*browseButton, true, false, 0);
	outer->pack_start(*editBox, true, false, 0);

	mainVBox->pack_start(*outer, true, true, 0);
}
// Create the conversation entity panel
Gtk::Widget& ConversationDialog::createEntitiesPanel()
{
	// Hbox containing the entity list and the buttons vbox
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 6));

	// Tree view listing the conversation_info entities
	_entityView = Gtk::manage(new Gtk::TreeView(_convEntityList));
	_entityView->set_headers_visible(false);

	Glib::RefPtr<Gtk::TreeSelection> sel = _entityView->get_selection();
	sel->signal_changed().connect(sigc::mem_fun(*this, &ConversationDialog::onEntitySelectionChanged));

	// Entity Name column
	_entityView->append_column(*Gtk::manage(new gtkutil::TextColumn("", _convEntityColumns.displayName)));

	hbx->pack_start(*Gtk::manage(new gtkutil::ScrolledFrame(*_entityView)), true, true, 0);

	// Vbox for the buttons
	Gtk::VBox* buttonBox = Gtk::manage(new Gtk::VBox(false, 6));

	Gtk::Button* addButton = Gtk::manage(new Gtk::Button(Gtk::Stock::ADD));
	addButton->signal_clicked().connect(sigc::mem_fun(*this, &ConversationDialog::onAddEntity));
	buttonBox->pack_start(*addButton, true, true, 0);

	_deleteEntityButton = Gtk::manage(new Gtk::Button(Gtk::Stock::DELETE));
	_deleteEntityButton->set_sensitive(false); // disabled at start
	_deleteEntityButton->signal_clicked().connect(sigc::mem_fun(*this, &ConversationDialog::onDeleteEntity));

	buttonBox->pack_start(*_deleteEntityButton, true, true, 0);

	hbx->pack_start(*buttonBox, false, false, 0);

	return *hbx;
}
Exemple #14
0
GtkMainWindow::GtkMainWindow() :
	m_core(Application::getSingleton()->getCore())
{
	this->set_position(Gtk::WIN_POS_CENTER);
	this->set_default_size(800, 500);

	header = Gtk::manage(new Gtk::HeaderBar());
	header->set_title("gTorrent");
	header->set_show_close_button(true);

	// This needs to be refactored

	Gtk::Button *btn = Gtk::manage(new Gtk::Button());
	btn->set_label("Add");
	btn->signal_clicked().connect(sigc::mem_fun(*this, &GtkMainWindow::onAddBtnClicked));
	header->add(*btn);

	Gtk::Button *btn_m = Gtk::manage(new Gtk::Button());
	btn_m->set_label("Add Link");
	btn_m->signal_clicked().connect(sigc::mem_fun(*this, &GtkMainWindow::onAddMagnetBtnClicked));
	header->add(*btn_m);

	this->set_titlebar(*header);

	m_treeview = Gtk::manage(new GtkTorrentTreeView());
	this->add(*m_treeview);

	Glib::signal_timeout().connect(sigc::mem_fun(*this, &GtkMainWindow::onSecTick), 10);
	this->signal_delete_event().connect(sigc::mem_fun(*this, &GtkMainWindow::onDestroy));

	this->show_all();
}
Exemple #15
0
int main(int argc, char* argv[])
{

	const std::string mainLocation = std::string(argv[0]);
	std::size_t pos = mainLocation.find_last_of("/");

	const std::string mainFolder = mainLocation.substr(0, pos);
	const std::string uiFileLocation = mainFolder + "/../Source/Ui.glade";

	// Create application and builder
	Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv);
	Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file(uiFileLocation);

	// Get main window
	Gui::MainWindow* mainWindow = nullptr;
	builder->get_widget_derived("MainWindow", mainWindow);

	// Create controller
	std::shared_ptr<Gui::MainController> controller = std::make_shared<Gui::MainController>(builder, mainFolder);

	// Handle quit button signal
	Gtk::Button* quitButton = nullptr;
	builder->get_widget("QuitButton", quitButton);
	quitButton->signal_clicked().connect(sigc::mem_fun(mainWindow, &Gui::MainWindow::hide));

	// Run application
	int ret = app->run(*mainWindow);

	// Delete pointers (dialogs and windows)
	delete mainWindow;

	return ret;
}
ScriptWindow::ScriptWindow() :
	Gtk::VBox(false, 6),
	_outView(Gtk::manage(new gtkutil::ConsoleView)),
	_view(Gtk::manage(new gtkutil::SourceView(SCRIPT_LANGUAGE_ID, false))) // allow editing
{
	_view->unset_focus_chain();

	Gtk::Button* runButton = Gtk::manage(new Gtk::Button(_("Run Script")));
	runButton->signal_clicked().connect(sigc::mem_fun(*this, &ScriptWindow::onRunScript));

	Gtk::HBox* buttonBar = Gtk::manage(new Gtk::HBox(false, 6));
	buttonBar->pack_start(*runButton, false, false, 0);

	Gtk::VBox* inputVBox = Gtk::manage(new Gtk::VBox(false, 3));
	inputVBox->pack_start(*Gtk::manage(new gtkutil::LeftAlignedLabel(_("Python Script Input"))), false, false, 0);
	inputVBox->pack_start(*_view, true, true, 0);
	inputVBox->pack_start(*buttonBar, false, false, 0);

	// Pack the scrolled textview and the entry box to the vbox
	Gtk::VPaned* paned = Gtk::manage(new Gtk::VPaned);
	paned->add1(*inputVBox);
	paned->add2(*_outView);

	pack_start(*paned, true, true, 0);
	show_all();
}
void dialog::operate4(Image imag,std::string filename)
{
    set_default_size(300, 50);
    set_border_width(10);
    set_position(Gtk::WIN_POS_CENTER);
    set_resizable(false);

    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    add(*vbox);

    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    vbox->add(*grid);

    Gtk::Label *label = Gtk::manage(new Gtk::Label("File Name :"));
    grid->attach(*label,0,0,1,1);
    Gtk::Entry *bvalue = Gtk::manage(new Gtk::Entry());
    grid->attach(*bvalue, 1, 0, 1, 1);
    Gtk::Label *label2 = Gtk::manage(new Gtk::Label(".bmp"));
    grid->attach(*label2,2,0,1,1);

    set_title("Save As");
    bvalue->set_text("Untitled");
    bvalue->set_max_length(50);

    Gtk::Button *bok = Gtk::manage(new Gtk::Button("OK"));
    bok->signal_clicked().connect(sigc::bind<Gtk::Entry*>(sigc::mem_fun(*this, &dialog::on_bok4_click), bvalue,imag,filename));
    grid->attach(*bok, 2, 2, 1, 1);
    show_all_children();
}
// Main constructor
ModalProgressDialog::ModalProgressDialog(const Glib::RefPtr<Gtk::Window>& parent, const std::string& title)
: gtkutil::TransientWindow(title, GlobalMainFrame().getTopLevelWindow()),
  _label(Gtk::manage(new Gtk::Label)),
  _progressBar(Gtk::manage(new Gtk::ProgressBar)),
  _aborted(false)
{
  	// Window properties
	set_modal(true);
	set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
	set_default_size(360, 80);
	set_border_width(12);

	// Create a vbox
	Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 12));

	// Pack a progress bar into the window
	vbx->pack_start(*_progressBar, false, false, 0);

	// Pack the label into the window
	vbx->pack_start(*_label, true, false, 0);
	add(*vbx);

	// Pack a right-aligned cancel button at the bottom
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &ModalProgressDialog::_onCancel));

	vbx->pack_end(*Gtk::manage(new gtkutil::RightAlignment(*cancelButton)), false, false, 0);

	// Connect the realize signal to remove the window decorations
	signal_realize().connect(sigc::mem_fun(*this, &ModalProgressDialog::_onRealize));

	// Show the window
	show_all();
	handleEvents();
}
Exemple #19
0
  AxisRow(Model *model, int axis) :
    m_inhibit_update(false), m_model(model), m_axis(axis)
  {
    add(*(new Gtk::Label(axis_names[axis])));
    Gtk::Button *home = new Gtk::Button("Home");
    home->signal_clicked().connect
      (sigc::mem_fun (*this, &AxisRow::home_clicked));
    add (*home);

    add_nudge_button (-10.0);
    add_nudge_button (-1.0);
    add_nudge_button (-0.1);
    m_target = new Gtk::SpinButton();
    m_target->set_digits (1);
    m_target->set_increments (0.1, 1);
    m_target->set_range(-200.0, +200.0);
    m_target->set_value(0.0);
    add (*m_target);
    m_target->signal_value_changed().connect
      (sigc::mem_fun(*this, &AxisRow::spin_value_changed));

    add_nudge_button (+0.1);
    add_nudge_button (+1.0);
    add_nudge_button (+10.0);
  }
// Construct the buttons
Gtk::Widget& LightTextureChooser::createButtons()
{
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(true, 6));
	hbx->set_border_width(3);

	Gtk::Button* okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));

	okButton->signal_clicked().connect(sigc::mem_fun(*this, &LightTextureChooser::callbackOK));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &LightTextureChooser::callbackCancel));

	hbx->pack_end(*okButton, true, true, 0);
	hbx->pack_end(*cancelButton, true, true, 0);

	return *Gtk::manage(new gtkutil::RightAlignment(*hbx));
}
// Main constructor
SkinPropertyEditor::SkinPropertyEditor(Entity* entity,
									   const std::string& name,
									   const std::string& options)
: PropertyEditor(entity),
  _key(name)
{
	// Construct the main widget (will be managed by the base class)
	Gtk::VBox* mainVBox = new Gtk::VBox(false, 6);

	// Register the main widget in the base class
	setMainWidget(mainVBox);

	// Horizontal box contains browse button
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3));
	hbx->set_border_width(3);

	// Create the browse button
	Gtk::Button* browseButton = Gtk::manage(new Gtk::Button(_("Choose skin...")));
	browseButton->set_image(*Gtk::manage(new Gtk::Image(
		PropertyEditorFactory::getPixbufFor("skin"))));

	browseButton->signal_clicked().connect(
		sigc::mem_fun(*this, &SkinPropertyEditor::_onBrowseButton));

	hbx->pack_start(*browseButton, true, false, 0);

	// Pack hbox into vbox (to limit vertical size), then edit frame
	Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 0));
	vbx->pack_start(*hbx, true, false, 0);

	mainVBox->pack_start(*vbx, true, true, 0);
}
AIHeadPropertyEditor::AIHeadPropertyEditor(Entity* entity, const std::string& key, const std::string& options) :
	_entity(entity)
{
	_widget = Gtk::manage(new Gtk::HBox(false, 0));
	_widget->set_border_width(6);

	// Horizontal box contains the browse button
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3));
	hbx->set_border_width(3);

	// Browse button for models
	Gtk::Button* browseButton = Gtk::manage(new Gtk::Button(_("Choose AI head...")));

	browseButton->set_image(
		*Gtk::manage(new Gtk::Image(GlobalUIManager().getLocalPixbuf("icon_model.png")))
	);
	browseButton->signal_clicked().connect(sigc::mem_fun(*this, &AIHeadPropertyEditor::onChooseButton));

	hbx->pack_start(*browseButton, true, false, 0);

	// Pack hbox into vbox (to limit vertical size), then edit frame
	Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 0));
	vbx->pack_start(*hbx, true, false, 0);
	_widget->pack_start(*vbx, true, true, 0);
}
// Construct the buttons
Gtk::Widget& ShaderChooser::createButtons()
{
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3));
	hbx->set_border_width(3);

	Gtk::Button* okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));

	okButton->signal_clicked().connect(sigc::mem_fun(*this, &ShaderChooser::callbackOK));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &ShaderChooser::callbackCancel));

	hbx->pack_end(*okButton, false, false, 0);
	hbx->pack_end(*cancelButton, false, false, 0);

	return *hbx;
}
AboutDialog::AboutDialog(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &builder):
        Gtk::AboutDialog(cobject) {

    Gtk::Button* closeButton = nullptr;
    builder->get_widget("closeButton", closeButton);

    closeButton->signal_clicked().connect(sigc::mem_fun(this, &AboutDialog::closeDialog));
}
void EffectEditor::populateWindow()
{
	// Create the overall vbox
	_dialogVBox = Gtk::manage(new Gtk::VBox(false, 3));
	add(*_dialogVBox);

	Gtk::HBox* effectHBox = Gtk::manage(new Gtk::HBox(false, 0));

	_effectTypeCombo = Gtk::manage(new Gtk::ComboBox(static_cast<const Glib::RefPtr<Gtk::TreeModel>&>(_effectStore)));

	// Add the cellrenderer for the caption
	Gtk::CellRendererText* captionRenderer = Gtk::manage(new Gtk::CellRendererText);
	_effectTypeCombo->pack_start(*captionRenderer, false);
	_effectTypeCombo->add_attribute(captionRenderer->property_text(), _effectColumns.caption);

	Gtk::Label* effectLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Effect:")));

	effectHBox->pack_start(*effectLabel, false, false, 0);
	effectHBox->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*_effectTypeCombo, 12, 1.0f)),
		true, true, 0
	);

	_dialogVBox->pack_start(*effectHBox, false, false, 3);

	_stateToggle = Gtk::manage(new Gtk::CheckButton(_("Active")));
	_stateToggle->signal_toggled().connect(sigc::mem_fun(*this, &EffectEditor::onStateToggle));

	_dialogVBox->pack_start(*_stateToggle, false, false, 3);

	Gtk::Label* argLabel =
		Gtk::manage(new gtkutil::LeftAlignedLabel(std::string("<b>") + _("Arguments") + "</b>"));
	_dialogVBox->pack_start(*argLabel, false, false, 0);

	Gtk::Button* saveButton = Gtk::manage(new Gtk::Button(Gtk::Stock::APPLY));
	saveButton->signal_clicked().connect(sigc::mem_fun(*this, &EffectEditor::onSave));

	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &EffectEditor::onCancel));

	Gtk::HBox* buttonHBox = Gtk::manage(new Gtk::HBox(false, 0));
	buttonHBox->pack_end(*saveButton, false, false, 0);
	buttonHBox->pack_end(*cancelButton, false, false, 6);

	_dialogVBox->pack_end(*buttonHBox, false, false, 3);
}
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();
}
Exemple #27
0
void View::connect_button(const char *name, const sigc::slot<void> &slot)
{
  Gtk::Button *button = NULL;
  m_builder->get_widget (name, button);
  if (button)
    button->signal_clicked().connect (slot);
  else {
    std::cerr << "missing button " << name << "\n";
  }
}
Exemple #28
0
Gtk::Widget& FindAndReplaceShader::createButtons()
{
	Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6));

	Gtk::Button* replaceButton = Gtk::manage(new Gtk::Button(Gtk::Stock::FIND_AND_REPLACE));
	Gtk::Button* closeButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CLOSE));

	replaceButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onReplace));
	closeButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onClose));

	hbox->pack_end(*closeButton, false, false, 0);
	hbox->pack_end(*replaceButton, false, false, 0);

	_counterLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(""));
	_counterLabel->set_padding(18, 0);
	hbox->pack_start(*_counterLabel, false, false, 0);

	return *hbox;
}
// Create button panel
Gtk::Widget& OverlayDialog::createButtons()
{
	Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6));

	Gtk::Button* closeButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CLOSE));
	closeButton->signal_clicked().connect(sigc::mem_fun(*this, &OverlayDialog::_onClose));

	hbox->pack_end(*closeButton, false, false, 0);

	return *hbox;
}
Exemple #30
0
 void add_nudge_button (double nudge)
 {
   std::stringstream label;
   if (nudge > 0)
     label << "+";
   label << nudge;
   Gtk::Button *button = new Gtk::Button(label.str());
   add(*button);
   button->signal_clicked().connect
     (sigc::bind(sigc::mem_fun (*this, &AxisRow::nudge_clicked), nudge));
 }