Dialog_TargetParam::Dialog_TargetParam(Gtk::Window &parent,  
                                       const char* title = _("Target Parameters")):
	Gtk::Dialog(title, parent)
{
	ok_button = manage(new class Gtk::Button(Gtk::StockID("gtk-ok")));
	ok_button->show();
	add_action_widget(*ok_button,Gtk::RESPONSE_OK);
	ok_button->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_TargetParam::on_ok));

	cancel_button = manage(new class Gtk::Button(Gtk::StockID("gtk-cancel")));
	cancel_button->show();
	add_action_widget(*cancel_button,Gtk::RESPONSE_CANCEL);
	cancel_button->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_TargetParam::on_cancel));
}
示例#2
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);
      }
    }
示例#3
0
 ProgressDialog::ProgressDialog(std::string const &title, Gtk::Window &parent)
   : Gtk::Dialog(title, parent, true),
     m_cancel(false),
     mp_progress_bar(Gtk::manage(new Gtk::ProgressBar()))
 {
   set_resizable(false);
   set_has_separator(false);
   
   get_vbox()->set_border_width(Layout::BORDER_WIDTH);
   get_vbox()->pack_start(*mp_progress_bar, Gtk::PACK_SHRINK);
   
   Gtk::Button * const p_cancel_button = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));
   add_action_widget(*p_cancel_button, Gtk::RESPONSE_CANCEL);
   
   p_cancel_button->signal_clicked().connect(
     sigc::mem_fun(*this, &ProgressDialog::cancel_button_clicked));
   
   show_all_children();
 }
示例#4
0
ChoiceWindow::  ChoiceWindow (const std::string& title, const ChoiceSpec& choiceSpec)
: Gtk::Dialog (title, true)
{
  Gtk::VBox * vbox = get_vbox ();
  
  Gtk::Label * message = manage (new Gtk::Label (choiceSpec._message));
  vbox->pack_start (*message);
  
  for (std::list<Choice>::const_iterator it = choiceSpec._choices.begin();
       it != choiceSpec._choices.end ();
       ++it)
    {
      ChoiceWidget * choiceWidget = manage (new ChoiceWidget (choiceSpec._type, *it));
      _choiceWidgets.push_back (choiceWidget);
      vbox->pack_start (*choiceWidget);
    }
  
  Gtk::Button * okButton = manage (new Gtk::Button(Gtk::StockID(GTK_STOCK_OK)));
  add_action_widget (*okButton, 0);
  
  show_all ();
}
示例#5
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();
}
示例#6
0
ExporterDialog::ExporterDialog(Gtk::Widget & browser,
                               gint source_options) throw() :
    HIGDialog(_("Export"), true, false),
    destinationVBox_(false, 6),
    optionsVBox_(false, 6),
    destinationLabel_("", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false),
    destinationAlignment_(Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER,
                          1.0, 1.0),
    optionsLabel_("", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false),
    optionsAlignment_(Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER, 1.0, 1.0),
    optionsVBox2_(false, 6),
    archiveCheckButton_((source_options
                         & PHOTO_DESTINATION_CREATE_ARCHIVE_OPTIONAL)
                         ? Gtk::manage(new Gtk::CheckButton(
                               _("_Create an archive"),
                               true))
                         : 0),
    exportButton_(),
    exportImage_(Gtk::Stock::APPLY, Gtk::ICON_SIZE_BUTTON),
    sourceOptions_(source_options)
{
    set_resizable(false);
    set_size_request(330, -1);

    Gtk::VBox & content_area = get_content_area();
    content_area.set_spacing(18);

    content_area.pack_start(destinationVBox_, Gtk::PACK_SHRINK, 0);
    content_area.pack_start(optionsVBox_, Gtk::PACK_SHRINK, 0);

    destinationLabel_.set_use_markup(true);
    {
        Glib::ustring markup = "<b>";
        markup += C_("A group of UI controls", "Destination");
        markup += "</b>";
        destinationLabel_.set_markup(markup);
    }
    destinationVBox_.pack_start(destinationLabel_,
                                Gtk::PACK_SHRINK,
                                0);

    destinationAlignment_.set_padding(0, 0, 12, 0);
    destinationVBox_.pack_start(destinationAlignment_,
                                Gtk::PACK_SHRINK,
                                0);

    optionsLabel_.set_use_markup(true);
    {
        Glib::ustring markup = "<b>";
        markup += C_("A group of UI controls", "Options");
        markup += "</b>";
        optionsLabel_.set_markup(markup);
    }
    optionsVBox_.pack_start(optionsLabel_, Gtk::PACK_SHRINK, 0);

    optionsAlignment_.set_padding(0, 0, 12, 0);
    optionsVBox_.pack_start(optionsAlignment_, Gtk::PACK_SHRINK, 0);

    // Insert a Gtk::Widget specific to the particular destination.
    destinationAlignment_.add(browser);

    optionsAlignment_.add(optionsVBox2_);

    if (0 != archiveCheckButton_)
    {
        archiveCheckButton_->set_use_underline(true);
        optionsVBox2_.pack_start(*archiveCheckButton_,
                                 Gtk::PACK_SHRINK, 0);
    }

    add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);

    exportButton_.set_image(exportImage_);
    exportButton_.set_use_underline(true);
    exportButton_.set_label(_("_Export"));
    add_action_widget(exportButton_, Gtk::RESPONSE_APPLY);

    show_all_children();
}
CalligraphicProfileRename::CalligraphicProfileRename() :
#if WITH_GTKMM_3_0
    _layout_table(Gtk::manage(new Gtk::Grid())),
#else
    _layout_table(Gtk::manage(new Gtk::Table(1, 2))),
#endif
    _applied(false)
{
    set_title(_("Edit profile"));

#if WITH_GTKMM_3_0
    Gtk::Box *mainVBox = get_content_area();
    _layout_table->set_column_spacing(4);
    _layout_table->set_row_spacing(4);
#else
    Gtk::Box *mainVBox = get_vbox();
    _layout_table->set_spacings(4);
#endif

    _profile_name_entry.set_activates_default(true);

    _profile_name_label.set_label(_("Profile name:"));
    _profile_name_label.set_alignment(1.0, 0.5);

#if WITH_GTKMM_3_0
    _layout_table->attach(_profile_name_label, 0, 0, 1, 1);

    _profile_name_entry.set_hexpand();
    _layout_table->attach(_profile_name_entry, 1, 0, 1, 1);
#else
    _layout_table->attach(_profile_name_label,
	           0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
    _layout_table->attach(_profile_name_entry,
	           1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
#endif

    mainVBox->pack_start(*_layout_table, false, false, 4);
    // Buttons
    _close_button.set_use_stock(true);
    _close_button.set_label(Gtk::Stock::CANCEL.id);
    _close_button.set_can_default();

    _delete_button.set_use_underline(true);
    _delete_button.set_label(_("Delete"));
    _delete_button.set_can_default();
    _delete_button.set_visible(false);

    _apply_button.set_use_underline(true);
    _apply_button.set_label(_("Save"));
    _apply_button.set_can_default();

    _close_button.signal_clicked()
            .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_close));
    _delete_button.signal_clicked()
            .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_delete));
    _apply_button.signal_clicked()
            .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_apply));

    signal_delete_event().connect( sigc::bind_return(
        sigc::hide(sigc::mem_fun(*this, &CalligraphicProfileRename::_close)), true ) );

    add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);
    add_action_widget(_delete_button, Gtk::RESPONSE_DELETE_EVENT);
    add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);

    _apply_button.grab_default();

    show_all_children();
}
示例#8
0
KnotPropertiesDialog::KnotPropertiesDialog()
: _desktop(NULL), _knotpoint(NULL), _position_visible(false)
{
    Gtk::Box *mainVBox = get_vbox();

    _layout_table.set_spacings(4);
    _layout_table.resize (2, 2);
    _unit_name = "";
    // Layer name widgets
    _knot_x_entry.set_activates_default(true);
    _knot_x_entry.set_digits(4);
    _knot_x_entry.set_increments(1,1);
    _knot_x_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE);
    _knot_x_label.set_label(_("Position X:"));
    _knot_x_label.set_alignment(1.0, 0.5);

    _knot_y_entry.set_activates_default(true);
    _knot_y_entry.set_digits(4);
    _knot_y_entry.set_increments(1,1);
    _knot_y_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE);
     _knot_y_label.set_label(_("Position Y:"));
    _knot_y_label.set_alignment(1.0, 0.5);

    _layout_table.attach(_knot_x_label,
                         0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
    _layout_table.attach(_knot_x_entry,
                         1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);

    _layout_table.attach(_knot_y_label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL);
    _layout_table.attach(_knot_y_entry, 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);

    mainVBox->pack_start(_layout_table, true, true, 4);

    // Buttons
    _close_button.set_use_stock(true);
    _close_button.set_label(Gtk::Stock::CANCEL.id);
    _close_button.set_can_default();

    _apply_button.set_use_underline(true);
    _apply_button.set_can_default();

    _close_button.signal_clicked()
        .connect(sigc::mem_fun(*this, &KnotPropertiesDialog::_close));
    _apply_button.signal_clicked()
        .connect(sigc::mem_fun(*this, &KnotPropertiesDialog::_apply));

    signal_delete_event().connect(
        sigc::bind_return(
            sigc::hide(sigc::mem_fun(*this, &KnotPropertiesDialog::_close)),
            true
        )
    );
    add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);
    add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);

    _apply_button.grab_default();

    show_all_children();

    set_focus(_knot_y_entry);
}