示例#1
0
ParamsDialog::ParamsDialog(MainWindow *_mw) : Gtk::Dialog("Parameters", *_mw, true),
	mw(_mw)
{
	add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::RESPONSE_CANCEL);
	add_button(Gtk::Stock::OK, Gtk::ResponseType::RESPONSE_OK);

	Gtk::Box* box = get_vbox();
	Gtk::Table *tbl = Gtk::manage(new Gtk::Table(3,2));

	f_c_re = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_re->set_activates_default(true);
	f_c_im = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_im->set_activates_default(true);

	zc = Gtk::manage(new ZoomControl(mw));

	Gtk::Label* label;

	label = Gtk::manage(new Gtk::Label("Centre Real (x) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 0, 1);
	tbl->attach(*f_c_re, 1, 2, 0, 1);

	label = Gtk::manage(new Gtk::Label("Centre Imaginary (y) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 1, 2);
	tbl->attach(*f_c_im, 1, 2, 1, 2);

	tbl->attach(*zc, 0, 2, 2, 3);

	box->pack_start(*tbl);
	set_default_response(Gtk::ResponseType::RESPONSE_OK);
}
示例#2
0
Gobby::FindDialog::FindDialog(GtkDialog* cobject,
                              const Glib::RefPtr<Gtk::Builder>& builder):
	Gtk::Dialog(cobject), m_folder(NULL), m_status_bar(NULL)
{
	builder->get_widget("search-for", m_entry_find);
	builder->get_widget("replace-with-label", m_label_replace);
	builder->get_widget("replace-with", m_entry_replace);

	builder->get_widget("match-case", m_check_case);
	builder->get_widget("match-entire-word-only", m_check_whole_word);
	builder->get_widget("search-backwards", m_check_backwards);
	builder->get_widget("wrap-around", m_check_wrap_around);

	m_entry_find->signal_changed().connect(
		sigc::mem_fun(*this, &FindDialog::on_find_text_changed));
	m_entry_replace->signal_changed().connect(
		sigc::mem_fun(*this, &FindDialog::on_replace_text_changed));

	add_button(_("_Close"), Gtk::RESPONSE_CLOSE);
	m_button_replace_all = add_button(_("Replace _All"),
	                                  RESPONSE_REPLACE_ALL);
	m_button_replace = add_button(_("_Replace"), RESPONSE_REPLACE);
	add_button(_("_Find"), RESPONSE_FIND);

	set_default_response(RESPONSE_FIND);
}
示例#3
0
Gobby::EntryDialog::EntryDialog(Gtk::Window& parent,
                                const Glib::ustring& title,
                                const Glib::ustring& label):
	Gtk::Dialog(title, parent, true, true), m_label(label), m_box(false, 5),
	m_check_valid_entry(false)
{
	m_entry.set_activates_default(true);

	m_box.pack_start(m_label);
	m_box.pack_start(m_entry);

	get_vbox()->set_spacing(5);
	get_vbox()->pack_start(m_box);

	m_entry.signal_changed().connect(
		sigc::mem_fun(*this, &EntryDialog::on_entry_changed)
	);

	add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
	add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
	set_default_response(Gtk::RESPONSE_OK);

	show_all();
	set_border_width(10);
	set_resizable(false);
}
示例#4
0
void
SpinnerDialog::configure(const Glib::ustring & title,
                         const Glib::ustring & text) throw()
{
    set_title(title);
    set_border_width(12);
    set_default_size(408, 108);
    set_has_separator(false);

    Gtk::VBox * const dialog_vbox = get_vbox();
    dialog_vbox->set_spacing(18);
    dialog_vbox->pack_start(hBox_, Gtk::PACK_EXPAND_WIDGET, 0);

    spinner_.set_size(Gtk::ICON_SIZE_DIALOG);
    hBox_.pack_start(spinner_, Gtk::PACK_SHRINK, 0);

    primaryLabel_.set_markup(text);
    primaryLabel_.set_use_markup(true);
    hBox_.pack_start(primaryLabel_, Gtk::PACK_EXPAND_WIDGET, 0);

    add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
    set_default_response(Gtk::RESPONSE_CLOSE);

    show_all_children();
}
示例#5
0
/**
 * Constructor
 */ 
AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) {

    // call this first
    initStrings();

    Gtk::Notebook *tabs=new Gtk::Notebook();

    tabs->set_scrollable();

    Gtk::Widget *splash=build_splash_widget();
    if (splash) {
        tabs->append_page(*manage(splash), _("_Splash"), true);
    }

    tabs->append_page(*manage(
        make_scrolled_text(authors_text)), _("_Authors"), true);
    tabs->append_page(*manage(
        make_scrolled_text(translators_text)), _("_Translators"), true);
    tabs->append_page(*manage(
        make_scrolled_text(license_text)), _("_License"), true);

#if WITH_GTKMM_3_0
    get_content_area()->pack_end(*manage(tabs), true, true);
#else
    get_vbox()->pack_end(*manage(tabs), true, true);
#endif

    tabs->show_all();

    add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
    set_default_response(Gtk::RESPONSE_CLOSE);

    Gtk::Label *label=new Gtk::Label();
    gchar *label_text = 
        g_strdup_printf("<small>Inkscape %s</small>",
              Inkscape::version_string);
    label->set_markup(label_text);
    label->set_alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER);
    label->set_padding(5,0);
    g_free(label_text);
    label->set_selectable(true);
    label->show();

#if WITH_GTKMM_3_0
    get_content_area()->pack_start(*manage(label), false, false);
#else
    get_vbox()->pack_start(*manage(label), false, false);
#endif

    Gtk::Requisition requisition;
#if GTK_CHECK_VERSION(3,0,0)
    gtk_widget_get_preferred_size(reinterpret_cast<GtkWidget*>(gobj()), &requisition, NULL);
#else
    gtk_widget_size_request (reinterpret_cast<GtkWidget*>(gobj()), &requisition);
#endif
    // allow window to shrink
    set_size_request(0, 0);
    set_default_size(requisition.width, requisition.height);
}
示例#6
0
DamageWindow::DamageWindow( Glib::ustring title, Gtk::Window& parent ) :
	Gtk::Dialog( title, parent, true, true ),
	f_value(0)
{
	Gtk::Label* label = new Gtk::Label(" ", Gtk::ALIGN_LEFT);
	label->set_justify( Gtk::JUSTIFY_LEFT );
	f_table.AddItem( Name, gettext("Character Name"), false, label, NULL );
	//
	label = new Gtk::Label(" ", Gtk::ALIGN_LEFT);
	label->set_justify( Gtk::JUSTIFY_LEFT );
	label->set_use_markup( true );
	f_table.AddItem( HitPoints, gettext("Current Hit Points"), false, label, NULL );
	//
	label = new Gtk::Label(" ", Gtk::ALIGN_LEFT);
	label->set_justify( Gtk::JUSTIFY_LEFT );
	label->set_use_markup( true );
	f_table.AddItem( TempHP, gettext("Temporary Hit Points"), false, label, NULL );
	//
	Gtk::Adjustment* adj = Gtk::manage( new Gtk::Adjustment(0.0, 0.0, 10000.0) );
	f_spinButton  = new Gtk::SpinButton;
	f_spinButton->configure( *adj, 0.0, 0 );
	f_spinButton->set_numeric( true );
	f_table.AddItem( DamageHealth, gettext("Enter new damage/health"), false, f_spinButton, NULL );

	// Pack children into a vbox and add buttons
	//
	Gtk::VBox* vbox = get_vbox();
	vbox->pack_start( f_table );
	//
	// Respect system-dependent alternative button order (defined
	// in gtk+ theme).
	//
	const bool alternative_order = alternative_button_order( Glib::RefPtr<const Gdk::Screen>(0) );
	//
	if( !alternative_order )
	{
		add_button( Gtk::Stock::CANCEL,		Gtk::RESPONSE_CANCEL );
	}
	//
	add_button( gettext("Bring to _Full"),	RESPONSE_FULLHEATH   );
	add_button( gettext("Add _Health"),	RESPONSE_HEALTH      );
	add_button( gettext("Add _Damage"),	Gtk::RESPONSE_OK     );
	//
	if( alternative_order )
	{
		add_button( Gtk::Stock::CANCEL,		Gtk::RESPONSE_CANCEL );
	}

	// Dialog stuff
	//
	set_default_response( Gtk::RESPONSE_OK );
	activate_default();
	show_all_children();
}
CreateWireframeDialog::CreateWireframeDialog(const Glib::ustring & title) :
    Dialog(title, true),
    m_filled(false),
    m_minVertices(false),
    m_coordBox(Gtk::manage(new CoordBox())),
    m_nameLabel(Gtk::manage(new Gtk::Label("Name: "))),
    m_nameEntry(Gtk::manage(new Gtk::Entry()))
{
    set_size_request(-1, 230);
    set_resizable(false);
    set_border_width(10);

    // Entry for the name
    Gtk::HBox * const name_hbox = Gtk::manage(new Gtk::HBox());
    name_hbox->pack_start(*m_nameLabel, Gtk::PACK_SHRINK, 0);
    name_hbox->pack_start(*m_nameEntry, Gtk::PACK_EXPAND_WIDGET, 0);
    name_hbox->set_spacing(0);
    name_hbox->set_homogeneous(false);

    // Check box for filling
    Gtk::CheckButton * const filled_button = Gtk::manage(new Gtk::CheckButton("Filled shape"));
    filled_button->signal_toggled().connect(sigc::mem_fun(*this, &CreateWireframeDialog::on_filled_button_toggled));
    filled_button->set_active(false);

    get_content_area()->pack_start(*name_hbox, Gtk::PACK_SHRINK, 5);
    get_content_area()->pack_start(*filled_button, Gtk::PACK_SHRINK, 5);

    Gtk::Frame * const coord_frame = Gtk::manage(new Gtk::Frame("Points"));
    Gtk::ScrolledWindow * const scrolled_window = Gtk::manage(new Gtk::ScrolledWindow());

    scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    scrolled_window->set_size_request(-1, 150);
    scrolled_window->set_border_width(5);
    scrolled_window->add(*m_coordBox);
    m_coordBox->set_spacing(0);
    coord_frame->add(*scrolled_window);
    get_content_area()->pack_start(*coord_frame, Gtk::PACK_SHRINK, 0);

    // Entries for the coordinates
    m_coordBox->add_coord();
    m_coordBox->add_coord();
    m_coordBox->add_coord();

    // Add buttons (from left to right)
    add_button("Cancel", Gtk::RESPONSE_CANCEL);
    add_button("Add point", Gtk::RESPONSE_APPLY);
    add_button("OK", Gtk::RESPONSE_OK);

    signal_response().connect_notify(sigc::mem_fun(*this, &CreateWireframeDialog::on_my_response));
    set_default_response(Gtk::RESPONSE_OK);
    show_all_children();
}
示例#8
0
SimpleTypeBox::SimpleTypeBox(const std::string& title,
			     const std::string& value) :
    Gtk::Dialog(title,true,true),
    mBase(0),
    mValid(false)
{
    add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    set_default_response(Gtk::RESPONSE_OK);
    makeDialog();
    mEntry->set_text(value);
    show_all();
}
示例#9
0
文件: utils.cpp 项目: haobug/gnote
    void HIGMessageDialog::add_button (Gtk::Button *button, Gtk::ResponseType resp, bool is_default)
    {
      button->show();

      add_action_widget (*button, resp);

      if (is_default) {
        set_default_response(resp);
        button->add_accelerator ("activate", m_accel_group,
                                 GDK_KEY_Escape, (Gdk::ModifierType)0,
                                 Gtk::ACCEL_VISIBLE);
      }
    }
示例#10
0
 pinDialogPriv(pinDialog &,const void *opsysParam) :
     Gtk::Dialog("inputDialog",true), m_label("pin entry")
     {
     m_textInput.set_activates_default(true);
     get_vbox()->pack_start(m_label);
     m_label.set_alignment(0.1,0.5);
     get_vbox()->pack_start(m_textInput);
     m_textInput.set_visibility(false);
     set_has_separator(true);
     add_button(Gtk::Stock::OK,Gtk::RESPONSE_OK);
     add_button(Gtk::Stock::CANCEL ,Gtk::RESPONSE_CANCEL);
     set_default_response(Gtk::RESPONSE_CANCEL);
     show_all_children();
     }
示例#11
0
GtkRSSDialog::GtkRSSDialog(GtkDialog *dial, const Glib::RefPtr<Gtk::Builder> rbuilder) : Gtk::Dialog(dial)
{
	m_core = Application::getSingleton()->getCore();
	rbuilder->get_widget("cancelButton", cancelButton);
	rbuilder->get_widget("okButton", okButton);
	rbuilder->get_widget("addButton", addFeedButton);
	rbuilder->get_widget("rssTreeView", rssTreeView);
	set_default_response(1);

	addFeedButton->signal_clicked().connect([this](){ feedAdd();});
	cancelButton->signal_clicked().connect([this](){close();});
	okButton->signal_clicked().connect([this](){close();});

	this->show_all_children();
}
示例#12
0
InteractiveTypeBox::InteractiveTypeBox(const std::string& title,
                                       vpz::CoupledModel* coupledModel,
                                       const std::string& currentValue) :
    Gtk::Dialog(title, true, true),
    mValid(false),
    mState(false),
    mBase(0),
    mCoupledModel(coupledModel),
    mCurrentValue(currentValue)
{
    add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    mButtonOk = add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    set_default_response(Gtk::RESPONSE_OK);
    makeDialog();
    mHBox->pack_start(mImage);
    show_all();
}
AddCategoryDialog::AddCategoryDialog()
{
	//Initial setup
	set_title("Add Category");
	set_default_size(500, 300);

	get_vbox()->pack_start(m_catstuff, Gtk::PACK_SHRINK);
		m_catstuff.pack_start(m_catlabel, Gtk::PACK_SHRINK);
		m_catlabel.set_text("Category name");
		m_catstuff.pack_start(m_catname);
	
	add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
	add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
	
	m_catname.set_activates_default(true);
	set_default_response(Gtk::RESPONSE_ACCEPT);
	
	show_all();
}
示例#14
0
InteractiveTypeBox::InteractiveTypeBox(const std::string& title,
				       vpz::Base* base,
				       const std::string& currentValue) :
    Gtk::Dialog(title, true),
    mValid(false),
    mState(false),
    mBase(base),
    mCoupledModel(0),
    mCurrentValue(currentValue)
{
    add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    mButtonOk = add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    set_default_response(Gtk::RESPONSE_OK);
    makeDialog();
    mHBox->pack_start(mImage);
    
    // Passage GTK-3 mettre show, parceque plus le hide_all n'exite plus ???
    show_all();
}
示例#15
0
CreatePointDialog::CreatePointDialog(const Glib::ustring & title) :
    Dialog(title, true),
    m_nameLabel(Gtk::manage(new Gtk::Label("Name: "))),
    m_xLabel(Gtk::manage(new Gtk::Label("x: "))),
    m_yLabel(Gtk::manage(new Gtk::Label("y: "))),
    m_zLabel(Gtk::manage(new Gtk::Label("z: "))),
    m_nameEntry(Gtk::manage(new Gtk::Entry())),
    m_xEntry(Gtk::manage(new Gtk::Entry())),
    m_yEntry(Gtk::manage(new Gtk::Entry())),
    m_zEntry(Gtk::manage(new Gtk::Entry()))
{
    set_resizable(false);
    set_border_width(10);

    /* Entries size */
    m_xEntry->set_width_chars(6);
    m_yEntry->set_width_chars(6);
    m_zEntry->set_width_chars(6);

    Gtk::HBox * const name_hbox = Gtk::manage(new Gtk::HBox());
    name_hbox->pack_start(*m_nameLabel, Gtk::PACK_SHRINK, 0);
    name_hbox->pack_start(*m_nameEntry, Gtk::PACK_EXPAND_WIDGET, 0);
    name_hbox->set_homogeneous(false);

    Gtk::HBox * const coord_hbox = Gtk::manage(new Gtk::HBox());
    coord_hbox->pack_start(*m_xLabel, Gtk::PACK_EXPAND_PADDING, 0);
    coord_hbox->pack_start(*m_xEntry, Gtk::PACK_SHRINK, 0);
    coord_hbox->pack_start(*m_yLabel, Gtk::PACK_EXPAND_PADDING, 0);
    coord_hbox->pack_start(*m_yEntry, Gtk::PACK_SHRINK, 0);
    coord_hbox->pack_start(*m_zLabel, Gtk::PACK_EXPAND_PADDING, 0);
    coord_hbox->pack_start(*m_zEntry, Gtk::PACK_SHRINK, 0);
    coord_hbox->set_homogeneous(false);

    get_content_area()->pack_start(*name_hbox);
    get_content_area()->pack_start(*coord_hbox);
    add_button("Cancel", Gtk::RESPONSE_CANCEL);
    add_button("OK", Gtk::RESPONSE_OK);

    signal_response().connect_notify(sigc::mem_fun(*this, &CreatePointDialog::on_my_response));
    set_default_response(Gtk::RESPONSE_OK);
    show_all_children();
}
示例#16
0
				NewDialog(Gtk::Window *parent):
					Gtk::Dialog(_("New project"), *this, true),
					xmlmode(_("Read image names in _XML Altos"), true),
					filemode(_("Match images and XML Altos _filenames"), true),
					xmlpath(_("Path to the XML Alto files"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER),
					imgpath(_("Path to the images"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER),
					showimgpath(_("_Images are in a different folder"), true),
					imgpathlab(_("Images path"))
				{
					add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
					okbut = add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
					okbut->set_sensitive(false);
					std::vector<int> altbut;
					altbut.push_back(Gtk::RESPONSE_ACCEPT);
					altbut.push_back(Gtk::RESPONSE_CANCEL);
					set_alternative_button_order_from_array(altbut);	
					set_default_response(Gtk::RESPONSE_ACCEPT);

					Gtk::Table *tab = Gtk::manage(new Gtk::Table(6, 2));
					get_vbox()->pack_start(*tab, true, true);
					tab->attach(*Gtk::manage(new Gtk::Label(_("Project name"))), 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
					tab->attach(projectname, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					projectname.signal_changed().connect(sigc::mem_fun(this, &NewDialog::on_name_changed));
					projectname.set_activates_default(true);
					Gtk::RadioButton::Group g;
					xmlmode.set_group(g);
					tab->attach(xmlmode, 0, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					filemode.set_group(g);
					tab->attach(filemode, 0, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					xmlmode.set_active(false);
					xmlmode.signal_toggled().connect(sigc::mem_fun(this, &NewDialog::on_mode_changed));
					tab->attach(*Gtk::manage(new Gtk::Label(_("XML Altos path"))), 0, 1, 3, 4, Gtk::FILL, Gtk::FILL);
					tab->attach(xmlpath, 1, 2, 3, 4, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					xmlpath.signal_current_folder_changed().connect(sigc::mem_fun(this, &NewDialog::on_xml_folder_changed));
					tab->attach(showimgpath, 0, 2, 4, 5, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					showimgpath.set_active(false);
					showimgpath.signal_toggled().connect(sigc::mem_fun(this, &NewDialog::on_show_img_path));
					show_all();
					tab->attach(imgpathlab, 0, 1, 5, 6, Gtk::FILL, Gtk::FILL);
					tab->attach(imgpath, 1, 2, 5, 6, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
				}
示例#17
0
Gobby::GotoDialog::GotoDialog(Gtk::Window& parent, const Folder& folder):
	Gtk::Dialog(_("Go to line"), parent),
	m_folder(folder),
	m_table(1, 2),
	m_label_line(_("Line _number:"), GtkCompat::ALIGN_LEFT,
	             Gtk::ALIGN_CENTER, true),
	m_current_view(NULL)
{
	m_label_line.set_mnemonic_widget(m_entry_line);
	m_label_line.show();

	m_entry_line.set_increments(1, 10);
	m_entry_line.set_activates_default(true);
	m_entry_line.show();

	m_table.attach(m_label_line, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
	m_table.attach(m_entry_line, 1, 2, 0, 1,
	               Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
	m_table.set_spacings(12);
	m_table.show();

	get_vbox()->pack_start(m_table, Gtk::PACK_EXPAND_WIDGET);

	add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
	Gtk::Button* button =
		add_button(_("Go To _Line"), Gtk::RESPONSE_ACCEPT);

	button->set_image(*Gtk::manage(new Gtk::Image(
		Gtk::Stock::JUMP_TO, Gtk::ICON_SIZE_BUTTON)));

	m_folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &GotoDialog::on_document_changed));

	set_default_response(Gtk::RESPONSE_ACCEPT);
	set_border_width(12);
	set_resizable(false);

	// For initial sensitivity:
	on_document_changed(m_folder.get_current_document());
}
示例#18
0
SimpleTypeBox::SimpleTypeBox(value::Value* b):
    Gtk::Dialog("?",true,true),
    mBase(b),
    mValid(false)
{
    add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    set_default_response(Gtk::RESPONSE_OK);
    makeDialog();

    if (b->isInteger()) {
        set_title(_("Integer"));
    } else if (b->isDouble()) {
        set_title(_("Double"));
    } else if (b->isString()) {
        set_title(_("String"));
    } else if (b->isTuple()) {
        set_title(_("Tuple"));
    }

    show_all();
}
示例#19
0
void
ServiceChooserDialog::ctor()
{
  set_default_size(360, 240);

  __treeview.set_model(__service_model->get_list_store());
  __treeview.append_column("Service", __service_model->get_column_record().name);
  __treeview.append_column("IP Address", __service_model->get_column_record().ipaddr);
  __scrollwin.add(__treeview);
  __scrollwin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  __treeview.show();
  __expander.add(__entry);
  __entry.show();
  __entry.set_activates_default(true);

  char * fawkes_ip = getenv("FAWKES_IP");
  if (fawkes_ip) __entry.set_text(fawkes_ip);
  else __entry.set_text("localhost");

  Gtk::VBox *vbox = get_vbox();
  vbox->pack_start(__scrollwin);
  vbox->pack_end(__expander, Gtk::PACK_SHRINK);
  __scrollwin.show();
  __expander.show();

  add_button(Gtk::Stock::CANCEL, 0);
  add_button(Gtk::Stock::OK, 1);

  set_default_response(1);

  __treeview.signal_row_activated().connect(sigc::bind(sigc::hide<0>(sigc::hide<0>(sigc::mem_fun(*this, &ServiceChooserDialog::response))), 1));

#ifdef GLIBMM_PROPERTIES_ENABLED
  __expander.property_expanded().signal_changed().connect(sigc::mem_fun(*this, &ServiceChooserDialog::on_expander_changed));
#endif
}
示例#20
0
// there's no constraint in removing a feed from the active list nor the global list since filters don't depend on them
void GtkRSSDialog::feedRemove()
{
	// a feed can be removed only from the global list, and will be removed from the active list of every other rss group
	// unless the feed isn't used in any other group, the user will be warned that removing this feeds will impact other rss groups
	
	bool doAnyway = false;
	// when a feed is moved from the global list to the active list for a group, it is made available
	// in the global list of other groups
	auto sel   = globalTreeView->get_selection();
	auto paths = sel->get_selected_rows();
	std::vector<Gtk::TreeModel::RowReference> rows;

	for (auto path : paths)
		rows.push_back(Gtk::TreeModel::RowReference(globalTreeView->get_model(), path));
	for (auto i : rows)
	{
		std::shared_ptr<gt::Feed> f = (*storeGlobalFeeds->get_iter(i.get_path()))[col_globals.feed];
		if(!doAnyway && !f->owners.empty())
		{
			auto errorDial = std::make_shared<Gtk::MessageDialog>("This feed is used in other groups!\nRemoving it will also remove it from every other groups.\nProceed ?",
																  false,
																  Gtk::MESSAGE_QUESTION,
																  Gtk::BUTTONS_YES_NO);
			errorDial->set_default_response(Gtk::RESPONSE_NO);
			switch(errorDial->run())
			{
			case Gtk::RESPONSE_YES: doAnyway = true; break;
			default: return;
			}
		}
		for(auto group : f->owners)
			group->m_feeds.erase(f);
		f->owners.clear();
		storeGlobalFeeds->erase(globalTreeView->get_model()->get_iter(i.get_path()));
	}
}
示例#21
0
NoteRenameDialog::NoteRenameDialog(const NoteBase::List & notes,
                                   const std::string & old_title,
                                   const NoteBase::Ptr & renamed_note)
  : Gtk::Dialog(_("Rename Note Links?"),
                *dynamic_cast<Gtk::Window*>(static_pointer_cast<Note>(renamed_note)->get_window()->host()),
                false)
  , m_notes_model(Gtk::ListStore::create(m_model_column_record))
  , m_dont_rename_button(_("_Don't Rename Links"), true)
  , m_rename_button(_("_Rename Links"), true)
  , m_select_all_button(_("Select All"))
  , m_select_none_button(_("Select None"))
  , m_always_show_dlg_radio(_("Always show this _window"), true)
  , m_always_rename_radio(_("Alwa_ys rename links"),
                          true)
  , m_never_rename_radio(_("Never rename _links"),
                         true)
{
  set_default_response(Gtk::RESPONSE_CANCEL);
  set_border_width(10);

  Gtk::Box * const vbox = get_vbox();

  add_action_widget(m_rename_button, Gtk::RESPONSE_YES);
  add_action_widget(m_dont_rename_button, Gtk::RESPONSE_NO);

  std::for_each(notes.begin(), notes.end(),
                ModelFiller(m_notes_model));

  Gtk::Label * const label = Gtk::manage(new Gtk::Label());
  label->set_use_markup(true);
  label->set_markup(
    Glib::ustring::compose(
      _("Rename links in other notes from "
        "\"<span underline=\"single\">%1</span>\" to "
        "\"<span underline=\"single\">%2</span>\"?\n\n"
        "If you do not rename the links, they will no longer link to "
        "anything."),
      old_title,
      renamed_note->get_title()));
  label->set_line_wrap(true);
  vbox->pack_start(*label, false, true, 5);

  Gtk::TreeView * const notes_view = Gtk::manage(
                                       new Gtk::TreeView(
                                             m_notes_model));
  notes_view->set_size_request(-1, 200);
  notes_view->signal_row_activated().connect(
    sigc::bind(
      sigc::mem_fun(*this,
                    &NoteRenameDialog::on_notes_view_row_activated),
      old_title));

  ModelColumnRecord model_column_record;

  Gtk::CellRendererToggle * const toggle_cell
                                    = Gtk::manage(
                                        new Gtk::CellRendererToggle);
  toggle_cell->set_activatable(true);
  toggle_cell->signal_toggled().connect(
    sigc::mem_fun(*this,
                  &NoteRenameDialog::on_toggle_cell_toggled));

  {
    Gtk::TreeViewColumn * const column = Gtk::manage(
                                           new Gtk::TreeViewColumn(
                                                 _("Rename Links"),
                                                 *toggle_cell));
    column->add_attribute(*toggle_cell,
                          "active",
                          model_column_record.get_column_selected());
    column->set_sort_column(
              model_column_record.get_column_selected());
    column->set_resizable(true);
    notes_view->append_column(*column);
  }

  {
    Gtk::TreeViewColumn * const column
      = Gtk::manage(
          new Gtk::TreeViewColumn(
                _("Note Title"),
                model_column_record.get_column_title()));
    column->set_sort_column(model_column_record.get_column_title());
    column->set_resizable(true);
    notes_view->append_column(*column);
  }

  m_select_all_button.signal_clicked().connect(
    sigc::bind(
      sigc::mem_fun(*this,
                    &NoteRenameDialog::on_select_all_button_clicked),
      true));

  m_select_none_button.signal_clicked().connect(
    sigc::bind(
      sigc::mem_fun(*this,
                    &NoteRenameDialog::on_select_all_button_clicked),
      false));

  Gtk::Grid * const notes_button_box = manage(new Gtk::Grid);
  notes_button_box->set_column_spacing(5);
  notes_button_box->attach(m_select_none_button, 0, 0, 1, 1);
  notes_button_box->attach(m_select_all_button, 1, 0, 1, 1);
  notes_button_box->set_hexpand(true);

  Gtk::ScrolledWindow * const notes_scroll
                                = Gtk::manage(
                                         new Gtk::ScrolledWindow());
  notes_scroll->add(*notes_view);
  notes_scroll->set_hexpand(true);
  notes_scroll->set_vexpand(true);

  m_notes_box.attach(*notes_scroll, 0, 0, 1, 1);
  m_notes_box.attach(*notes_button_box, 0, 1, 1, 1);

  Gtk::Expander * const advanced_expander
                          = Gtk::manage(new Gtk::Expander(
                                              _("Ad_vanced"), true));
  Gtk::Grid * const expand_box = Gtk::manage(new Gtk::Grid);
  expand_box->attach(m_notes_box, 0, 0, 1, 1);

  m_always_show_dlg_radio.signal_clicked().connect(
    sigc::mem_fun(*this,
                  &NoteRenameDialog::on_always_show_dlg_clicked));

  Gtk::RadioButton::Group group = m_always_show_dlg_radio.get_group();

  m_never_rename_radio.set_group(group);
  m_never_rename_radio.signal_clicked().connect(
    sigc::mem_fun(*this,
                  &NoteRenameDialog::on_never_rename_clicked));

  m_always_rename_radio.set_group(group);
  m_always_rename_radio.signal_clicked().connect(
    sigc::mem_fun(*this,
                  &NoteRenameDialog::on_always_rename_clicked));

  expand_box->attach(m_always_show_dlg_radio, 0, 1, 1, 1);
  expand_box->attach(m_never_rename_radio, 0, 2, 1, 1);
  expand_box->attach(m_always_rename_radio, 0, 3, 1, 1);
  advanced_expander->add(*expand_box);
  vbox->pack_start(*advanced_expander, true, true, 5);

  advanced_expander->property_expanded().signal_changed().connect(
    sigc::bind(
      sigc::mem_fun(*this,
                    &NoteRenameDialog::on_advanced_expander_changed),
      advanced_expander->property_expanded().get_value()));

  set_focus(m_dont_rename_button);
  vbox->show_all();
}
示例#22
0
/** \brief  Creates a new preference dialog for extension preferences
    \param  name  Name of the Extension whose dialog this is
    \param  help  The help string for the extension (NULL if none)
    \param  controls  The extension specific widgets in the dialog

    This function initializes the dialog with the name of the extension
    in the title.  It adds a few buttons and sets up handlers for
    them.  It also places the passed-in widgets into the dialog.
*/
PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls, Effect * effect) :
#if WITH_GTKMM_3_0
    Gtk::Dialog::Dialog(_(name.c_str()), true),
#else
    Gtk::Dialog::Dialog(_(name.c_str()), true, true),
#endif
    _help(help),
    _name(name),
    _button_ok(NULL),
    _button_cancel(NULL),
    _button_preview(NULL),
    _param_preview(NULL),
    _effect(effect),
    _exEnv(NULL)
{
    Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox());
    if (controls == NULL) {
        if (_effect == NULL) {
            std::cout << "AH!!!  No controls and no effect!!!" << std::endl;
            return;
        }
        controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, NULL);
        _signal_param_change.connect(sigc::mem_fun(this, &PrefDialog::param_change));
    }

    hbox->pack_start(*controls, true, true, 6);
    hbox->show();
    this->get_vbox()->pack_start(*hbox, true, true, 6);

    /*
    Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP);
    if (_help == NULL)
        help_button->set_sensitive(false);
    */
    _button_cancel = add_button(_effect == NULL ? Gtk::Stock::CANCEL : Gtk::Stock::CLOSE, Gtk::RESPONSE_CANCEL);
    _button_cancel->set_use_stock(true);

    _button_ok = add_button(_effect == NULL ? Gtk::Stock::OK : Gtk::Stock::APPLY, Gtk::RESPONSE_OK);
    _button_ok->set_use_stock(true);
    set_default_response(Gtk::RESPONSE_OK);
    _button_ok->grab_focus();

    if (_effect != NULL && !_effect->no_live_preview) {
        if (_param_preview == NULL) {
            XML::Document * doc = sp_repr_read_mem(live_param_xml, strlen(live_param_xml), NULL);
            _param_preview = Parameter::make(doc->root(), _effect);
        }

        Gtk::HSeparator * sep = Gtk::manage(new Gtk::HSeparator());
        sep->show();
        this->get_vbox()->pack_start(*sep, true, true, 4);

        hbox = Gtk::manage(new Gtk::HBox());
        _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview);
        _button_preview->show();
        hbox->pack_start(*_button_preview, true, true,6);
        hbox->show();
        this->get_vbox()->pack_start(*hbox, true, true, 6);

        Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview);
        if (hbox != NULL) {
#if WITH_GTKMM_3_0
            _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->get_children().front());
#else
            _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->children().back().get_widget());
#endif
        }

        preview_toggle();
        _signal_preview.connect(sigc::mem_fun(this, &PrefDialog::preview_toggle));
    }

    // Set window modality for effects that don't use live preview
    if (_effect != NULL && _effect->no_live_preview) {
        set_modal(false);
    }

    GtkWidget *dlg = GTK_WIDGET(gobj());
    sp_transientize(dlg);

    return;
}
示例#23
0
void GuidelinePropertiesDialog::_setup() {
    set_title(_("Guideline"));
    add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    add_button(Gtk::Stock::DELETE, -12);
    add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);

    Gtk::VBox *mainVBox = get_vbox();

    _layout_table.set_spacings(4);
    _layout_table.resize (3, 4);

    mainVBox->pack_start(_layout_table, false, false, 0);

    _label_name.set_label("foo0");
    _layout_table.attach(_label_name,
                         0, 3, 0, 1, Gtk::FILL, Gtk::FILL);
    _label_name.set_alignment(0, 0.5);

    _label_descr.set_label("foo1");
    _layout_table.attach(_label_descr,
                         0, 3, 1, 2, Gtk::FILL, Gtk::FILL);
    _label_descr.set_alignment(0, 0.5);

    // indent
    _layout_table.attach(*manage(new Gtk::Label(" ")),
                         0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10);

    // mode radio button
    _layout_table.attach(_relative_toggle,
                         1, 3, 9, 10, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
    _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged));

    // unitmenu
    /* fixme: We should allow percents here too, as percents of the canvas size */
    GtkWidget *unit_selector = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE);
    sp_unit_selector_set_unit(SP_UNIT_SELECTOR(unit_selector), _desktop->namedview->doc_units);
    _unit_selector = Gtk::manage(Glib::wrap(unit_selector));

    // position spinbuttons
    sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_x.gobj()));
    sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_y.gobj()));
    _spin_button_x.configure(_adjustment_x, 1.0 , 3);
    _spin_button_x.set_numeric();
    _spin_button_y.configure(_adjustment_y, 1.0 , 3);
    _spin_button_y.set_numeric();
    _layout_table.attach(_label_X,
                         1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
    _layout_table.attach(_spin_button_x,
                         2, 3, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
    _layout_table.attach(_label_Y,
                         1, 2, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
    _layout_table.attach(_spin_button_y,
                         2, 3, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
    gtk_signal_connect_object(GTK_OBJECT(_spin_button_x.gobj()), "activate",
                              GTK_SIGNAL_FUNC(gtk_window_activate_default),
                              gobj());

    _layout_table.attach(_label_units,
                         1, 2, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
    _layout_table.attach(*_unit_selector,
                         2, 3, 6, 7, Gtk::FILL, Gtk::FILL);

    // angle spinbutton
    _spin_angle.configure(_adj_angle, 5.0 , 3);
    _spin_angle.set_numeric();
    _spin_angle.show();
    _layout_table.attach(_label_degrees,
                         1, 2, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
    _layout_table.attach(_spin_angle,
                         2, 3, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);


    // dialog
    set_default_response(Gtk::RESPONSE_OK);
    signal_response().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_response));

    // initialize dialog
    _oldpos = _guide->point_on_line;
    if (_guide->is_vertical()) {
        _oldangle = 90;
    } else if (_guide->is_horizontal()) {
        _oldangle = 0;
    } else {
        _oldangle = Geom::rad_to_deg( std::atan2( - _guide->normal_to_line[Geom::X], _guide->normal_to_line[Geom::Y] ) );
    }

    {
        Inkscape::XML::Node *repr = SP_OBJECT_REPR (_guide);
        const gchar *guide_id = repr->attribute("id");
        gchar *label = g_strdup_printf(_("Guideline ID: %s"), guide_id);
        _label_name.set_label(label);
        g_free(label);
    }
    {
        gchar *guide_description = sp_guide_description(_guide, false);
        gchar *label = g_strdup_printf(_("Current: %s"), guide_description);
        g_free(guide_description);
        _label_descr.set_markup(label);
        g_free(label);
    }

    _modeChanged(); // sets values of spinboxes.

    if ( _oldangle == 90. || _oldangle == 270. || _oldangle == -90. || _oldangle == -270.) {
        _spin_button_x.grab_focus();
        _spin_button_x.select_region(0, 20);
    } else if ( _oldangle == 0. || _oldangle == 180. || _oldangle == -180.) {
        _spin_button_y.grab_focus();
        _spin_button_y.select_region(0, 20);
    } else {
        _spin_angle.grab_focus();
        _spin_angle.select_region(0, 20);
    }

    set_position(Gtk::WIN_POS_MOUSE);

    show_all_children();
    set_modal(true);
    _desktop->setWindowTransient (gobj());
    property_destroy_with_parent() = true;
}