Beispiel #1
0
/**
 * This *creates* a new widget, management of deletion should be done by the caller
 */
Gtk::Widget *
Effect::newWidget(Gtk::Tooltips * tooltips)
{
    // use manage here, because after deletion of Effect object, others might still be pointing to this widget.
    Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox() );

    vbox->set_border_width(5);

    std::vector<Parameter *>::iterator it = param_vector.begin();
    while (it != param_vector.end()) {
        if ((*it)->widget_is_visible) {
            Parameter * param = *it;
            Gtk::Widget * widg = param->param_newWidget(tooltips);
            Glib::ustring * tip = param->param_getTooltip();
            if (widg) {
                vbox->pack_start(*widg, true, true, 2);
                if (tip != NULL) {
                    tooltips->set_tip(*widg, *tip);
                }
            }
        }

        it++;
    }

    return dynamic_cast<Gtk::Widget *>(vbox);
}
Beispiel #2
0
void MakeBoxHIGed(Gtk::VBox& vbox)
{
//     vbox.set_border_width(12);
//     vbox.set_spacing(24);
    vbox.set_border_width(0);
    vbox.set_spacing(WDG_BORDER_WDH);
}
Beispiel #3
0
Gtk::Box* PreferencesPanel::createPanelBox()
{
  Gtk::VBox* PanelBox = Gtk::manage(new Gtk::VBox(false, 5));

  PanelBox->set_border_width(10);

  PanelBox->set_visible(true);

  return PanelBox;
}
Gtk::Widget& DifficultyEditor::createTreeView()
{
	// First, create the treeview
	_settingsView = Gtk::manage(new Gtk::TreeView(_settings->getTreeStore()));
	_settingsView->set_size_request(TREE_VIEW_MIN_WIDTH, -1);

	// Connect the tree view selection
	Glib::RefPtr<Gtk::TreeSelection> selection = _settingsView->get_selection();
	selection->signal_changed().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingSelectionChange));

	// Add columns to this view
	Gtk::CellRendererText* textRenderer = Gtk::manage(new Gtk::CellRendererText);

	Gtk::TreeViewColumn* settingCol = Gtk::manage(new Gtk::TreeViewColumn);
	settingCol->pack_start(*textRenderer, false);

    settingCol->set_title(_("Setting"));
	settingCol->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
    settingCol->set_spacing(3);

	_settingsView->append_column(*settingCol);

	settingCol->add_attribute(textRenderer->property_text(), _settings->getColumns().description);
	settingCol->add_attribute(textRenderer->property_foreground(), _settings->getColumns().colour);
	settingCol->add_attribute(textRenderer->property_strikethrough(), _settings->getColumns().isOverridden);

	Gtk::ScrolledWindow* frame = Gtk::manage(new gtkutil::ScrolledFrame(*_settingsView));

	// Create the action buttons
	Gtk::HBox* buttonHBox = Gtk::manage(new Gtk::HBox(false, 6));

	// Create button
	_createSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::ADD));
	_createSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingCreate));

	// Delete button
	_deleteSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::DELETE));
	_deleteSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingDelete));

	_refreshButton = Gtk::manage(new Gtk::Button(Gtk::Stock::REFRESH));
	_refreshButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onRefresh));

	buttonHBox->pack_start(*_createSettingButton, true, true, 0);
	buttonHBox->pack_start(*_deleteSettingButton, true, true, 0);
	buttonHBox->pack_start(*_refreshButton, true, true, 0);

	Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 6));
	vbox->pack_start(*frame, true, true, 0);
	vbox->pack_start(*buttonHBox, false, false, 0);

	vbox->set_border_width(12);

	return *vbox;
}
void DocumentProperties::onNewExtraField ()
{
	Gtk::Dialog dialog ("New Field", *dialog_, true, false);

	Gtk::VBox *vbox = dialog.get_vbox ();

	Gtk::HBox hbox;
	hbox.set_spacing (12);
	vbox->pack_start (hbox, true, true, 0);

	Gtk::Label label ("Field name:", false);
	hbox.pack_start (label, false, false, 0);

	Gtk::Entry entry;
	entry.set_activates_default (true);
	hbox.pack_start (entry, true, true, 0);

	dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
	dialog.add_button (Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
	dialog.set_default_response (Gtk::RESPONSE_ACCEPT);

	dialog.show_all ();
	vbox->set_border_width (12);

	if (dialog.run () == Gtk::RESPONSE_ACCEPT) {

		Gtk::ListStore::iterator it = extrafieldsstore_->children().begin ();
		Gtk::ListStore::iterator const end = extrafieldsstore_->children().end ();
		bool key_isnew = true;
		for (; it != end; ++it)
			if (Utility::firstCap ((*it)[extrakeycol_]) == Utility::firstCap (entry.get_text ())) {
				key_isnew = false;
			}
		if ( key_isnew ) {
			Gtk::ListStore::iterator row = extrafieldsstore_->append ();
			(*row)[extrakeycol_] = Utility::firstCap (entry.get_text ());
			(*row)[extravalcol_] = "";
		} else {
			Glib::ustring message;
			message = String::ucompose (
			"<b><big>%1</big></b>",
			_("This key already exists.\n"));
			Gtk::MessageDialog dialog (

			message, true,
			Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true);

			dialog.run ();

		}
	}
}
Beispiel #6
0
Gtk::Widget *
LPESimplify::newWidget()
{
    // use manage here, because after deletion of Effect object, others might still be pointing to this widget.
    Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox(Effect::newWidget()) );
    
    vbox->set_border_width(5);
    vbox->set_homogeneous(false);
    vbox->set_spacing(2);
    std::vector<Parameter *>::iterator it = param_vector.begin();
    Gtk::HBox * buttons = Gtk::manage(new Gtk::HBox(true,0));
    while (it != param_vector.end()) {
        if ((*it)->widget_is_visible) {
            Parameter * param = *it;
            Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget());
            if (param->param_key == "simplify_individual_paths" ||
                    param->param_key == "simplify_just_coalesce") {
                Glib::ustring * tip = param->param_getTooltip();
                if (widg) {
                    buttons->pack_start(*widg, true, true, 2);
                    if (tip) {
                        widg->set_tooltip_text(*tip);
                    } else {
                        widg->set_tooltip_text("");
                        widg->set_has_tooltip(false);
                    }
                }
            } else {
                Glib::ustring * tip = param->param_getTooltip();
                if (widg) {
                    Gtk::HBox * horizontal_box = dynamic_cast<Gtk::HBox *>(widg);
                    std::vector< Gtk::Widget* > child_list = horizontal_box->get_children();
                    Gtk::Entry* entry_widg = dynamic_cast<Gtk::Entry *>(child_list[1]);
                    entry_widg->set_width_chars(8);
                    vbox->pack_start(*widg, true, true, 2);
                    if (tip) {
                        widg->set_tooltip_text(*tip);
                    } else {
                        widg->set_tooltip_text("");
                        widg->set_has_tooltip(false);
                    }
                }
            }
        }

        ++it;
    }
    vbox->pack_start(*buttons,true, true, 2);
    return dynamic_cast<Gtk::Widget *>(vbox);
}
Beispiel #7
0
ResolutionDialog::ResolutionDialog( Gtk::Widget * widget )
:	Dialog			( _("Resolution") ),
	m_resetButton	( Gtk::Stock::UNDO ),
	m_applyButton	( Gtk::Stock::APPLY ),
	m_widget		( widget ),
	m_oldResolution	( widget->get_width(), widget->get_height() ),
	m_newResolution	( 0, 0 )
{
	// Creates the main layout.
	Gtk::Label	* label = Gtk::manage( new Gtk::Label(_("Select, in the list bellow, a resolution to apply, \nor specify your own."), 0, 0) );
	Gtk::VBox	* box	= Gtk::manage( new Gtk::VBox(false, 8) );
	
	box->set_border_width( 12 );
	box->pack_start( *label, Gtk::PACK_SHRINK );
	box->pack_start( m_resolutions, Gtk::PACK_SHRINK );
	get_vbox()->add( *box );
	
	
	// Adds buttons.
	get_action_area()->add( m_resetButton );
	get_action_area()->add( m_applyButton );
	add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE );
	
	m_applyButton.set_sensitive( false );
	
	
	// Connects to some signals.
	m_applyButton.signal_clicked().connect( sigc::mem_fun(this, &ResolutionDialog::applyClicked) );
	m_resetButton.signal_clicked().connect( sigc::mem_fun(this, &ResolutionDialog::resetClicked) );
	m_resolutions.get_entry()->signal_changed().connect( sigc::mem_fun(this, &ResolutionDialog::resolutionChanged) );
	
	
	// Fills the resolution box with predefined resolutions.
	m_resolutions.append_text(_("1024x768"));
	m_resolutions.append_text(_("800x600"));
	m_resolutions.append_text(_("720x576"));
	m_resolutions.append_text(_("640x480"));
	
	
	// Shows the whole things
	show_all();
	
	
	// Assigns the initial resolution.
	m_resolutions.get_entry()->set_text( resolutionToString(m_oldResolution.first, m_oldResolution.second) );
}