예제 #1
0
/**
 * Creates a combobox widget for an enumeration parameter.
 */
Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
    if (_gui_hidden) {
        return NULL;
    }

    Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
    Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
    label->show();
    hbox->pack_start(*label, false, false, _indent);

    ParamComboBoxEntry * combo = Gtk::manage(new ParamComboBoxEntry(this, doc, node, changeSignal));
    // add choice strings:
    Glib::ustring settext;
    for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
        enumentry * entr = reinterpret_cast<enumentry *>(list->data);
        Glib::ustring text = entr->guitext;
        combo->append(text);

        if ( _value && !entr->value.compare(_value) ) {
            settext = entr->guitext;
        }
    }
    if (!settext.empty()) {
        combo->set_active_text(settext);
    }

    combo->show();
    hbox->pack_start(*combo, true, true);

    hbox->show();

    return dynamic_cast<Gtk::Widget *>(hbox);
}
예제 #2
0
/** \brief  Create a label for the description */
Gtk::Widget *
ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
{
	if (_gui_hidden) {
        return NULL;
    }

    Glib::ustring newguitext;

    if (_context != NULL) {
        newguitext = g_dpgettext2(NULL, _context, _value);
    } else {
        newguitext = _(_value);
    }
    
    Gtk::Label * label;
    int padding = 12 + _indent;
    if (_mode == HEADER) {
        label = Gtk::manage(new Gtk::Label(Glib::ustring("<b>") +newguitext + Glib::ustring("</b>"), Gtk::ALIGN_START));
        label->set_padding(0,5);
        label->set_use_markup(true);
        padding = _indent;
    } else {
        label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_START));
    }
    label->set_line_wrap();
    label->show();

    Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
    hbox->pack_start(*label, true, true, padding);
    hbox->show();

    return hbox;
}
예제 #3
0
void WarningListDialog::add_warning(const Glib::ustring& warning)
{
  Gtk::HBox* hb = Gtk::manage(new Gtk::HBox);
  Gtk::Label* l = Gtk::manage(new Gtk::Label);
  hb->show();
  hb->set_spacing(LENGTH_BORDER_WIDTH*2);

  if(warning_icon)
  {
    Gtk::Image* img = Gtk::manage(new Gtk::Image(warning_icon));
    hb->pack_start(*img, false, false);
  }
  l->set_markup(warning);
  l->set_alignment(0., 0.5);
  l->set_line_wrap(true);
  hb->pack_start(*l);

  if(warnings.get_children().size())
  {
    Gtk::HSeparator* s = Gtk::manage(new Gtk::HSeparator);
    s->show();
    warnings.pack_start(*s, false, false, LENGTH_SMALLSPACE);
  }

  hb->show_all_children();
  warnings.pack_start(*hb, false, false);
}
예제 #4
0
WindowLevelToolButton::WindowLevelToolButton() {
	Gtk::HBox* hbox = manage(new Gtk::HBox);

	Gtk::Image* image = manage(new Gtk::Image);
	Glib::RefPtr<Gdk::Pixbuf> p = Aeskulap::IconFactory::load_from_file("cursor_windowlevel.png");
	if(p) {
		image->set(p);
	}
	image->show();
	//image->set_padding(6, 0);

	m_invert = manage(new Gtk::ToggleToolButton(*image));
	m_invert->set_size_request(32, 32);
	m_invert->set_tooltip(m_tooltips, gettext("Invert windowlevel"));
	m_invert->show();
	m_invert->signal_toggled().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_invert));

	Gtk::VBox* vbox = manage(new Gtk::VBox);

	vbox->pack_start(*m_invert, true, false);
	vbox->show();

	hbox->pack_start(*vbox, Gtk::PACK_SHRINK);

	vbox = manage(new Gtk::VBox);
	vbox->show();

	m_combo = manage(new Gtk::ComboBoxText);
	m_combo->set_size_request(-1, 32);
	m_combo->show();
	m_combo->signal_changed().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_changed));

	vbox->pack_start(*m_combo, true, false);

	hbox->pack_start(*vbox, Gtk::PACK_SHRINK);

	vbox = manage(new Gtk::VBox);
	vbox->show();

	image = manage(new Gtk::Image(Gtk::Stock::ADD, Gtk::ICON_SIZE_SMALL_TOOLBAR));
	image->show();

	Gtk::ToolButton* btn = manage(new Gtk::ToolButton(*image));
	btn->set_size_request(32, 32);
	btn->set_tooltip(m_tooltips, gettext("Add new windowlevel preset"));
	btn->show();
	btn->signal_clicked().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_add));

	vbox->pack_start(*btn, true, false);
	hbox->pack_start(*vbox, true,false);
	
	hbox->show();

	add(*hbox);

	update();
	m_widgetlist.insert(this);
}
예제 #5
0
int
NetLogGuiGtkWindow::on_service_added(fawkes::NetworkService *service)
{
  if ( ntb_logviewers.get_n_pages() == 0 ) {
    lab_no_connection->hide();
    //Gtk::Container *thiscon = this;
    //thiscon->remove(lab_no_connection);
    //add(ntb_logviewers);
    ntb_logviewers.show();
  }

  Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, 4));
  Gtk::Button *button = Gtk::manage(new Gtk::Button());
  Gtk::Image *image = Gtk::manage(new Gtk::Image(Gtk::Stock::CONNECT, Gtk::ICON_SIZE_BUTTON));
  button->add(*image);
  button->set_relief(Gtk::RELIEF_NONE);
  Gtk::Label *label = Gtk::manage(new Gtk::Label());
  label->set_markup(Glib::ustring("<b>") + service->host() + "</b>\n" + service->addr_string());
  label->set_line_wrap();
  Gtk::Label *invisible = Gtk::manage(new Gtk::Label(Glib::ustring(service->name()) + "::" + service->type() + "::" + service->domain()));
  Gtk::ScrolledWindow *scrolled = Gtk::manage(new Gtk::ScrolledWindow());
  scrolled->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  LogView *logview =
    Gtk::manage(new LogView(service->addr_string().c_str(), service->port()));
  //scrolled->add(*logview);

  hbox->pack_start(*button);
  hbox->pack_start(*label);
  hbox->pack_start(*invisible);

  button->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &NetLogGuiGtkWindow::on_connbut_clicked), image, logview));
  logview->get_connection_dispatcher()->signal_connected().connect(sigc::bind(sigc::mem_fun(*this, &NetLogGuiGtkWindow::on_connected), image));
  logview->get_connection_dispatcher()->signal_disconnected().connect(sigc::bind(sigc::mem_fun(*this, &NetLogGuiGtkWindow::on_disconnected), image));

  scrolled->show();
  label->show();
  image->show();
  button->show();
  logview->show();
  hbox->show();

  int rv = ntb_logviewers.append_page(*logview, *hbox);

  return rv;
}
예제 #6
0
/**
    \brief  Creates a Float Adjustment for a float parameter

    Builds a hbox with a label and a float adjustment in it.
*/
Gtk::Widget *
ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
	if (_gui_hidden) return NULL;

    Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));

    Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT));
    label->show();
    hbox->pack_start(*label, true, true);

    ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node, changeSignal));
    Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 0.1, _precision));
    spin->show();
    hbox->pack_start(*spin, false, false);

    hbox->show();

    return dynamic_cast<Gtk::Widget *>(hbox);
}
VOMS_menu_item::VOMS_menu_item(Glib::ustring item_label, 
                               VOMS_server_list* parent) :
    Gtk::MenuItem::MenuItem(),
    contact_data_vector() {
    
    label = item_label;
    
    Gtk::HBox *hb = new Gtk::HBox();
    Gtk::Label *lab1 = new Gtk::Label(label);
    lab1->show();
    voms_ac_icon = new Gtk::Image(VOMS_icon_factory::disabled_icon());
    voms_ac_icon->show();
    hb->pack_start(*voms_ac_icon, false, true, 0);
    hb->pack_end(*lab1, true, true, 5);
    hb->show();
    
    add(*hb);
    show();
    
    sig_conn = this->signal_activate().connect(
                     sigc::mem_fun(*parent, &VOMS_server_list::activate_handler));
}
예제 #8
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;
}
예제 #9
0
  void
  RLight::initGTK()
  {
    _optList.reset(new Gtk::VBox);

    { //Intensity
      Gtk::HBox* box = manage(new Gtk::HBox);
      box->show();
      
      {
	Gtk::Label* label = manage(new Gtk::Label("Intensity and Color", 0.95, 0.5));
	box->pack_start(*label, true, true); 
	label->show();
      }

      _intensityEntry.reset(new Gtk::Entry);
      box->pack_start(*_intensityEntry, false, false);
      _intensityEntry->show(); _intensityEntry->set_width_chars(7);
      _intensityEntry->set_text(boost::lexical_cast<std::string>(_intensity));

      _intensityEntry->signal_changed()
	.connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_intensityEntry));
      _intensityEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      {
	_lightColor.reset(new Gtk::ColorButton);
	_lightColor->set_use_alpha(false);
	Gdk::Color color;
	color.set_rgb(_color[0] * G_MAXUSHORT, _color[1] * G_MAXUSHORT, _color[2] * G_MAXUSHORT);
	_lightColor->set_color(color);
	box->pack_start(*_lightColor, false, false);
	_lightColor->show();

	_lightColor->signal_color_set().connect(sigc::mem_fun(*this, &RLight::guiUpdate));
      }

      {
	Gtk::Label* label = manage(new Gtk::Label("Attenuation", 0.95, 0.5));
	box->pack_start(*label, true, true);
	label->show();
      }

      _attenuationEntry.reset(new Gtk::Entry);
      box->pack_start(*_attenuationEntry, false, false);
      _attenuationEntry->show(); _attenuationEntry->set_width_chars(7);
      _attenuationEntry->set_text(boost::lexical_cast<std::string>(_attenuation));

      _attenuationEntry->signal_changed()
	.connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_attenuationEntry));
      _attenuationEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _optList->pack_start(*box, false, false); 
    }

    { //Specular
      Gtk::HBox* box = manage(new Gtk::HBox);
      box->show();

      {
	Gtk::Label* label = manage(new Gtk::Label("Specular Exponent", 0.95, 0.5));
	box->pack_start(*label, true, true); 
	label->show();
      }

      _specularExponentEntry.reset(new Gtk::Entry);
      box->pack_start(*_specularExponentEntry, false, false);
      _specularExponentEntry->show(); _specularExponentEntry->set_width_chars(7);
      _specularExponentEntry->set_text(boost::lexical_cast<std::string>(_specularExponent));

      _specularExponentEntry->signal_changed()
	.connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularExponentEntry));
      _specularExponentEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      {
	Gtk::Label* label = manage(new Gtk::Label("Specular Strength", 0.95, 0.5));
	box->pack_start(*label, true, true); 
	label->show();
      }

      _specularFactorEntry.reset(new Gtk::Entry);
      box->pack_start(*_specularFactorEntry, false, false);
      _specularFactorEntry->show(); _specularFactorEntry->set_width_chars(7);
      _specularFactorEntry->set_text(boost::lexical_cast<std::string>(_specularFactor));

      _specularFactorEntry->signal_changed()
	.connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry));
      _specularFactorEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _optList->pack_start(*box, false, false);
    }

    { //Specular
      Gtk::HBox* box = manage(new Gtk::HBox);
      box->show();

      {
	Gtk::Label* label = manage(new Gtk::Label("Position", 0.95, 0.5));
	box->pack_start(*label, true, true); 
	label->show();
      }

      _positionXEntry.reset(new Gtk::Entry);
      box->pack_start(*_positionXEntry, false, false);
      _positionXEntry->show();
      _positionXEntry->set_width_chars(7);
      _positionXEntry->set_text(boost::lexical_cast<std::string>(getEyeLocationObjSpace()[0]));
      _positionXEntry->signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry));
      _positionXEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _positionYEntry.reset(new Gtk::Entry);
      box->pack_start(*_positionYEntry, false, false);
      _positionYEntry->show();
      _positionYEntry->set_width_chars(7);
      _positionYEntry->set_text(boost::lexical_cast<std::string>(getEyeLocationObjSpace()[1]));
      _positionYEntry->signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry));
      _positionYEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _positionZEntry.reset(new Gtk::Entry);
      box->pack_start(*_positionZEntry, false, false);
      _positionZEntry->show();
      _positionZEntry->set_width_chars(7);
      _positionZEntry->set_text(boost::lexical_cast<std::string>(getEyeLocationObjSpace()[2]));
      _positionZEntry->signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry));
      _positionZEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _optList->pack_start(*box, false, false);
    }

    _optList->show();

    guiUpdate();
  }
예제 #10
0
/**
    \brief  Creates a combobox widget for an enumeration parameter
*/
Gtk::Widget *
ParamRadioButton::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
    if (_gui_hidden) return NULL;

    Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
    Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0));

    Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP));
    label->show();
    hbox->pack_start(*label, false, false);

    Gtk::ComboBoxText* cbt = 0;
    bool comboSet = false;
    if (_mode == MINIMAL) {
        cbt = Gtk::manage(new ComboWdg(this, doc, node));
        cbt->show();
        vbox->pack_start(*cbt, false, false);
    }

    // add choice strings as radiobuttons
    // and select last selected option (_value)
    Gtk::RadioButtonGroup group;
    for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
        optionentry * entr = reinterpret_cast<optionentry *>(list->data);
        Glib::ustring * text = entr->guitext;
        switch ( _mode ) {
        case MINIMAL:
        {
            cbt->append_text(*text);
            if (!entr->value->compare(_value)) {
                cbt->set_active_text(*text);
                comboSet = true;
            }
        }
        break;
        case COMPACT:
        case FULL:
        {
            ParamRadioButtonWdg * radio = Gtk::manage(new ParamRadioButtonWdg(group, *text, this, doc, node, changeSignal));
            radio->show();
            vbox->pack_start(*radio, true, true);
            if (!entr->value->compare(_value)) {
                radio->set_active();
            }
        }
        break;
        }
    }

    if ( (_mode == MINIMAL) && !comboSet) {
        cbt->set_active(0);
    }

    vbox->show();
    hbox->pack_end(*vbox, false, false);
    hbox->show();


    return dynamic_cast<Gtk::Widget *>(hbox);
}
예제 #11
0
파일: utils.cpp 프로젝트: haobug/gnote
    HIGMessageDialog::HIGMessageDialog(Gtk::Window *parent,
                                       GtkDialogFlags flags, Gtk::MessageType msg_type, 
                                       Gtk::ButtonsType btn_type, const Glib::ustring & header,
                                       const Glib::ustring & msg)
      : Gtk::Dialog()
      , m_extra_widget(NULL)
    {
      set_border_width(5);
      set_resizable(false);
      set_title("");

      get_vbox()->set_spacing(12);
      get_action_area()->set_layout(Gtk::BUTTONBOX_END);

      m_accel_group = Glib::RefPtr<Gtk::AccelGroup>(Gtk::AccelGroup::create());
      add_accel_group(m_accel_group);

      Gtk::HBox *hbox = manage(new Gtk::HBox (false, 12));
      hbox->set_border_width(5);
      hbox->show();
      get_vbox()->pack_start(*hbox, false, false, 0);

      switch (msg_type) {
      case Gtk::MESSAGE_ERROR:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_ERROR,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      case Gtk::MESSAGE_QUESTION:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_QUESTION,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      case Gtk::MESSAGE_INFO:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_INFO,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      case Gtk::MESSAGE_WARNING:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_WARNING,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      default:
        m_image = new Gtk::Image ();
        break;
      }

      if (m_image) {
        Gtk::manage(m_image);
        m_image->show();
        m_image->property_yalign().set_value(0);
        hbox->pack_start(*m_image, false, false, 0);
      }

      Gtk::VBox *label_vbox = manage(new Gtk::VBox (false, 0));
      label_vbox->show();
      hbox->pack_start(*label_vbox, true, true, 0);

      std::string title = str(boost::format("<span weight='bold' size='larger'>%1%"
                                            "</span>\n") % header.c_str());

      Gtk::Label *label;

      label = manage(new Gtk::Label (title));
      label->set_use_markup(true);
      label->set_justify(Gtk::JUSTIFY_LEFT);
      label->set_line_wrap(true);
      label->set_alignment (0.0f, 0.5f);
      label->show();
      label_vbox->pack_start(*label, false, false, 0);

      label = manage(new Gtk::Label(msg));
      label->set_use_markup(true);
      label->set_justify(Gtk::JUSTIFY_LEFT);
      label->set_line_wrap(true);
      label->set_alignment (0.0f, 0.5f);
      label->show();
      label_vbox->pack_start(*label, false, false, 0);
      
      m_extra_widget_vbox = manage(new Gtk::VBox (false, 0));
      m_extra_widget_vbox->show();
      label_vbox->pack_start(*m_extra_widget_vbox, true, true, 12);

      switch (btn_type) {
      case Gtk::BUTTONS_NONE:
        break;
      case Gtk::BUTTONS_OK:
        add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true);
        break;
      case Gtk::BUTTONS_CLOSE:
        add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE, true);
        break;
      case Gtk::BUTTONS_CANCEL:
        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, true);
        break;
      case Gtk::BUTTONS_YES_NO:
        add_button (Gtk::Stock::NO, Gtk::RESPONSE_NO, false);
        add_button (Gtk::Stock::YES, Gtk::RESPONSE_YES, true);
        break;
      case Gtk::BUTTONS_OK_CANCEL:
        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, false);
        add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true);
        break;
      }

      if (parent){
        set_transient_for(*parent);
      }

      if ((flags & GTK_DIALOG_MODAL) != 0) {
        set_modal(true);
      }

      if ((flags & GTK_DIALOG_DESTROY_WITH_PARENT) != 0) {
        property_destroy_with_parent().set_value(true);
      }
    }
예제 #12
0
  void 
  RSphericalParticles::initGTK()
  {
    _optList.reset(new Gtk::VBox);//The Vbox of options
    _colorMap.reset(new magnet::gtk::ColorMapSelector);

    _singleColorMode.reset(new Gtk::RadioButton("Single Color"));
    _colorByIDMode.reset(new Gtk::RadioButton("Color by ID"));
    
    _RFixed.reset(new Gtk::SpinButton);
    _GFixed.reset(new Gtk::SpinButton);
    _BFixed.reset(new Gtk::SpinButton);
    _AFixed.reset(new Gtk::SpinButton);
    
    {
      _optList->add(*_colorMap); _colorMap->show();
      //Horizontal seperator
      Gtk::HSeparator* line = manage(new Gtk::HSeparator);
      line->show();
      _optList->add(*line);
    }
   
    {//Single color and RGBA boxes
      Gtk::HBox* box = manage(new Gtk::HBox);
      
      box->pack_start(*_singleColorMode, true, true);_singleColorMode->show();
      if (_mode == SINGLE_COLOR) _singleColorMode->set_active();
      
      Gtk::Label* label = manage(new Gtk::Label("RGBA"));
      box->pack_start(*label, false, false); label->show();
      
      _RFixed->set_increments(1.0, 1.0);
      _RFixed->set_range(0.0, 255.0);
      _RFixed->set_value(_colorFixed.s[0]);
      
      _GFixed->set_increments(1.0, 1.0);
      _GFixed->set_range(0.0, 255.0);
      _GFixed->set_value(_colorFixed.s[1]);
      
      _BFixed->set_increments(1.0, 1.0);
      _BFixed->set_range(0.0, 255.0);
      _BFixed->set_value(_colorFixed.s[2]);
      
      _AFixed->set_increments(1.0, 1.0);
      _AFixed->set_range(0.0, 255.0);
      _AFixed->set_value(_colorFixed.s[3]);      
      
      box->pack_start(*_RFixed, false, false); _RFixed->show();
      box->pack_start(*_GFixed, false, false); _GFixed->show();
      box->pack_start(*_BFixed, false, false); _BFixed->show();
      box->pack_start(*_AFixed, false, false); _AFixed->show();
      
      _optList->add(*box);
      box->show();
      
      //Horizontal seperator
      Gtk::HSeparator* line = manage(new Gtk::HSeparator);
      line->show();
      _optList->add(*line);
    }
    
    Gtk::RadioButton::Group group = _singleColorMode->get_group();
    
    {//Color by ID
      _colorByIDMode->set_group(group);
      _colorByIDMode->show();
      if (_mode == COLOR_BY_ID) _colorByIDMode->set_active();
      
      _optList->add(*_colorByIDMode);
      
      //Horizontal seperator
      Gtk::HSeparator* line = manage(new Gtk::HSeparator);
      line->show();
      _optList->add(*line);
    }
    
    _optList->show();
    
    _singleColorMode->signal_toggled()
      .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate));
    _colorMap->signal_changed()
      .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate));
    _RFixed->signal_value_changed()
      .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate));
    _GFixed->signal_value_changed()
      .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate));
    _BFixed->signal_value_changed()
      .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate));
    _AFixed->signal_value_changed()
      .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate));
    
    _colorByIDMode->signal_toggled()
      .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate));

    guiUpdate();
  }
예제 #13
0
         preferencesDialog::preferencesDialog(int const _min_port, int const _max_port)
            : portrange_begin(0),
              beginPortRangeSpinbuttonAdj(0),
              portrange_end(0),
              endPortRangeSpinbuttonAdj(0),
              workPathEntry(0),
              outputPathEntry(0),
              leechModeCheckbutton(0),
              min_port(_max_port), max_port(_min_port),
              workPath(),
              outputPath(),
              leechmode(false),
              portrange_begin_intial_value(0),
              portrange_end_intial_value(0),
              workPath_initial_value(""),
              outputPath_initial_value(""),
              leechmode_initial_value(false),
              portrange_begin_signal(),
              portrange_end_signal(),
              save_btn_pressed(false)
         {
            Gtk::Label* workLabel      = Gtk::manage(new class Gtk::Label("Working directory"));
            Gtk::Label* outputLabel    = Gtk::manage(new class Gtk::Label("Output directory"));
            Gtk::Label* portRangeLabel = Gtk::manage(new class Gtk::Label("Port range"));
            Gtk::Label* leechModeLabel = Gtk::manage(new class Gtk::Label("Leech mode"));
            outputPathEntry            = Gtk::manage(new class Gtk::Entry());

            workPathEntry              = Gtk::manage(new class Gtk::Entry());

            leechModeCheckbutton       = Gtk::manage(new class Gtk::CheckButton("enabled"));
            Gtk::Table* settingsTable  = Gtk::manage(new class Gtk::Table(2, 2, false));

            // Ports:
            Gtk::Table* portTable       = Gtk::manage(new class Gtk::Table(2, 2, false));;
            Gtk::Label* beginPortLabel  = Gtk::manage(new class Gtk::Label("Begin Port"));
            Gtk::Label* endPortLabel    = Gtk::manage(new class Gtk::Label("End Port"));
            beginPortRangeSpinbuttonAdj = Gtk::manage(new class Gtk::Adjustment(_min_port, _min_port, _max_port, 1, 100, 10));
            portrange_begin             = Gtk::manage(new class Gtk::SpinButton(*beginPortRangeSpinbuttonAdj, 1, 0));
            endPortRangeSpinbuttonAdj   = Gtk::manage(new class Gtk::Adjustment(_min_port, _min_port, _max_port, 1, 100, 10));
            portrange_end               = Gtk::manage(new class Gtk::SpinButton(*endPortRangeSpinbuttonAdj, 1, 0));

            beginPortLabel->set_alignment(0,0.5);
            beginPortLabel->set_padding(5,5);
            beginPortLabel->set_justify(Gtk::JUSTIFY_LEFT);
            beginPortLabel->set_line_wrap(false);
            beginPortLabel->set_use_markup(false);
            beginPortLabel->set_selectable(false);

            endPortLabel->set_alignment(0,0.5);
            endPortLabel->set_padding(5,5);
            endPortLabel->set_justify(Gtk::JUSTIFY_LEFT);
            endPortLabel->set_line_wrap(false);
            endPortLabel->set_use_markup(false);
            endPortLabel->set_selectable(false);

            portrange_end->set_flags(Gtk::CAN_FOCUS);
            portrange_end->set_update_policy(Gtk::UPDATE_ALWAYS);
            portrange_end->set_numeric(false);
            portrange_end->set_digits(0);
            portrange_end->set_wrap(false);
            portrange_end->set_flags(Gtk::CAN_FOCUS);
            portrange_end->set_update_policy(Gtk::UPDATE_ALWAYS);
            portrange_end->set_numeric(true);
            portrange_end->set_digits(0);
            portrange_end->set_wrap(false);

            portrange_begin->set_flags(Gtk::CAN_FOCUS);
            portrange_begin->set_update_policy(Gtk::UPDATE_ALWAYS);
            portrange_begin->set_numeric(false);
            portrange_begin->set_digits(0);
            portrange_begin->set_wrap(false);
            portrange_begin->set_flags(Gtk::CAN_FOCUS);
            portrange_begin->set_update_policy(Gtk::UPDATE_ALWAYS);
            portrange_begin->set_numeric(true);
            portrange_begin->set_digits(0);
            portrange_begin->set_wrap(false);

            portTable->set_border_width(10);
            portTable->set_row_spacings(5);
            portTable->set_col_spacings(5);
            portTable->attach(*beginPortLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            portTable->attach(*endPortLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            portTable->attach(*portrange_end, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            portTable->attach(*portrange_begin, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            beginPortLabel->show();
            endPortLabel->show();
            portrange_begin->show();
            portrange_end->show();
            portTable->show();

            Gtk::VBox *preferencesVbox = Gtk::manage(new class Gtk::VBox(false, 10));

            outputLabel->set_alignment(0,0.5);
            outputLabel->set_padding(5,0);
            outputLabel->set_justify(Gtk::JUSTIFY_LEFT);
            outputLabel->set_line_wrap(false);
            outputLabel->set_use_markup(false);
            outputLabel->set_selectable(false);

            workLabel->set_alignment(0,0.5);
            workLabel->set_padding(5,0);
            workLabel->set_justify(Gtk::JUSTIFY_LEFT);
            workLabel->set_line_wrap(false);
            workLabel->set_use_markup(false);
            workLabel->set_selectable(false);



            portRangeLabel->set_alignment(0,0.5);
            portRangeLabel->set_padding(5,0);
            portRangeLabel->set_justify(Gtk::JUSTIFY_LEFT);
            portRangeLabel->set_line_wrap(false);
            portRangeLabel->set_use_markup(false);
            portRangeLabel->set_selectable(false);

            leechModeLabel->set_alignment(0,0.5);
            leechModeLabel->set_padding(5,0);
            leechModeLabel->set_justify(Gtk::JUSTIFY_LEFT);
            leechModeLabel->set_line_wrap(false);
            leechModeLabel->set_use_markup(false);
            leechModeLabel->set_selectable(false);

            Gtk::HBox* pathHbox     = Gtk::manage(new class Gtk::HBox(false, 10));
            Gtk::HBox* workPathHbox = Gtk::manage(new class Gtk::HBox(false, 10));

            outputPathEntry->set_flags(Gtk::CAN_FOCUS);
            outputPathEntry->set_visibility(true);
            outputPathEntry->set_editable(false);
            outputPathEntry->set_max_length(0);
            outputPathEntry->set_text("");
            outputPathEntry->set_has_frame(true);
            outputPathEntry->set_activates_default(false);

            workPathEntry->set_flags(Gtk::CAN_FOCUS);
            workPathEntry->set_visibility(true);
            workPathEntry->set_editable(false);
            workPathEntry->set_max_length(0);
            workPathEntry->set_text("");
            workPathEntry->set_has_frame(true);
            workPathEntry->set_activates_default(false);

            Gtk::Button* pathButton = Gtk::manage(new class Gtk::Button("Change Path"));
            Gtk::Button* workPathButton = Gtk::manage(new class Gtk::Button("Change Path"));

            pathHbox->pack_start(*outputPathEntry);
            pathHbox->pack_start(*pathButton, Gtk::PACK_SHRINK, 0);

            workPathHbox->pack_start(*workPathEntry);
            workPathHbox->pack_start(*workPathButton, Gtk::PACK_SHRINK, 0);

            leechModeCheckbutton->set_flags(Gtk::CAN_FOCUS);
            leechModeCheckbutton->set_relief(Gtk::RELIEF_NORMAL);
            leechModeCheckbutton->set_mode(true);
            leechModeCheckbutton->set_active(false);

            settingsTable->set_border_width(10);
            settingsTable->set_row_spacings(20);
            settingsTable->set_col_spacings(5);

            // left rigth top bottom

            /*
              table1->attach(*label1, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*label2, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*label3, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*label4, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*entry1, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*entry2, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*entry3, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*entry4, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            */

            settingsTable->attach(*workLabel,            0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*outputLabel,          0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*portRangeLabel,       0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*leechModeLabel,       0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*workPathHbox,         1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*pathHbox,             1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*portTable,            1, 2, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0);
            settingsTable->attach(*leechModeCheckbutton, 1, 2, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            preferencesVbox->pack_start(*settingsTable, Gtk::PACK_SHRINK, 0);

            set_title( GPD->sGUI_CLIENT() + " " + GPD->sFULLVERSION() + " / Preferences" );
            set_modal(true);
            property_window_position().set_value(Gtk::WIN_POS_CENTER);
            set_resizable(true);
            property_destroy_with_parent().set_value(false);
            set_has_separator(true);

            get_vbox()->pack_start(*preferencesVbox);

            set_default_size(300, 200);

            outputLabel->show();
            workLabel->show();
            portRangeLabel->show();
            leechModeLabel->show();
            outputPathEntry->show();
            pathButton->show();
            pathHbox->show();

            workPathEntry->show();
            workPathButton->show();
            workPathHbox->show();

            leechModeCheckbutton->show();
            settingsTable->show();

            preferencesVbox->show();

            // Create buttons and connect their signals.
            add_button("Save", 1);
            add_button("Cancel", 2);

            signal_response().connect(sigc::mem_fun(*this, &preferencesDialog::on_dialog_button_pressed));

            pathButton->signal_clicked().connect(sigc::mem_fun(*this, &preferencesDialog::on_path_select_button_pressed));

            workPathButton->signal_clicked().connect(sigc::mem_fun(*this, &preferencesDialog::on_work_path_select_button_pressed));

            get_vbox()->show();
         }
예제 #14
0
파일: Volume.cpp 프로젝트: herbsolo/DynamO
  void
  RVolume::initGTK()
  {
    _optList.reset(new Gtk::VBox);//The Vbox of options   

    {//Transfer function widget
      _transferFunction.reset(new magnet::gtk::TransferFunction
			      (magnet::function::MakeDelegate
			       (this, &RVolume::transferFunctionUpdated)));
      _transferFunction->set_size_request(-1, 100);
      
      _optList->add(*_transferFunction); _transferFunction->show();
      transferFunctionUpdated(); //Force an update of the transfer function now we have the widget
    }

    {//Volume renderer step size
      _stepSize.reset(new Gtk::Entry);
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Raytrace Step Size"));
      box->pack_start(*label, false, false); label->show();
      box->pack_end(*_stepSize, false, false);
      _stepSize->show(); _stepSize->set_text("0.01");      
      _optList->add(*box); box->show();
    }

    {//Diffusive lighting
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Diffuse Lighting"));
      box->pack_start(*label, false, false); label->show();
      _diffusiveLighting.reset(new Gtk::HScale);
      box->pack_end(*_diffusiveLighting, true, true);
      _diffusiveLighting->set_range(0,2);
      _diffusiveLighting->set_digits(3);
      _diffusiveLighting->show();      
      _diffusiveLighting->set_value(1.0);
      _optList->add(*box); box->show();
    }

    {//Specular lighting
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Specular Lighting"));
      box->pack_start(*label, false, false); label->show();
      _specularLighting.reset(new Gtk::HScale);
      box->pack_end(*_specularLighting, true, true);
      _specularLighting->set_range(0,2);
      _specularLighting->set_digits(3);
      _specularLighting->show();      
      _specularLighting->set_value(1.0);
      _optList->add(*box); box->show();
    }

    {//Ray Dithering
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Ray Dithering"));
      box->pack_start(*label, false, false); label->show();
      _ditherRay.reset(new Gtk::HScale);
      box->pack_end(*_ditherRay, true, true);
      _ditherRay->set_range(0, 1);
      _ditherRay->set_digits(3);
      _ditherRay->show();
      _ditherRay->set_value(1.0);
      _optList->add(*box); box->show();
    }
    
    _optList->show();
    //Callbacks
    _stepSize->signal_changed()
      .connect(sigc::bind<Gtk::Entry&>(&magnet::Gtk::forceNumericEntry, *_stepSize));
    _stepSize->signal_activate().connect(sigc::mem_fun(*this, &RVolume::guiUpdate));

    guiUpdate();
  }
예제 #15
0
PreferencesDialogImpl::PreferencesDialogImpl() : Gtk::Dialog()
{
    m_editorEntry = NULL;
    m_ctagsEntry = NULL;

    // dialog properties
    set_title("Preferences");
    set_position(GTK_WIN_POS_CENTER);
    set_modal(true);
    set_border_width(10);
    set_policy(false, false, true);

    // create the Default button
    Gtk::Button* defaultButton = manage(new Gtk::Button("Default"));
    defaultButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::defaultButtonCB));
    defaultButton->set_usize(80, -1);
    defaultButton->set_flags(GTK_CAN_DEFAULT);
    defaultButton->show();

    // create the Apply button
    Gtk::Button* applyButton = manage(new Gtk::Button("Apply"));
    applyButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::applyButtonCB));
    applyButton->set_usize(80, -1);
    applyButton->set_flags(GTK_CAN_DEFAULT);
    applyButton->show();

    // create the OK button and make it default
    Gtk::Button* okButton = manage(new Gtk::Button("OK"));
    okButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::okButtonCB));
    okButton->set_usize(80, -1);
    okButton->set_flags(GTK_CAN_DEFAULT);
    okButton->grab_default();
    okButton->show();

    // create the Cancel button
    Gtk::Button* cancelButton = manage(new Gtk::Button("Cancel"));
    cancelButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::cancelButtonCB));
    cancelButton->set_usize(80, -1);
    cancelButton->set_flags(GTK_CAN_DEFAULT);
    cancelButton->show();

    // add the buttons to the hbox
    Gtk::HBox* hbox = get_action_area();
    hbox->set_spacing(10);
    hbox->pack_start(*defaultButton, false, false);
    hbox->pack_start(*applyButton, false, false);
    hbox->pack_start(*okButton, false, false);
    hbox->pack_start(*cancelButton, false, false);

    // editor stuff
    Gtk::HBox* editorBox = manage(new Gtk::HBox());
    Gtk::Label* editorLabel = manage(new Gtk::Label("Editor Command: "));
    editorLabel->show();
    editorBox->pack_start(*editorLabel, false, false);
    m_editorEntry = manage(new Gtk::Entry());
    m_editorEntry->set_text(g_configMap[Config::EDITOR[0]]);
    m_editorEntry->show();
    editorBox->pack_end(*m_editorEntry);
    editorBox->show();

    // ctags stuff
    Gtk::HBox* ctagsBox = manage(new Gtk::HBox());
    Gtk::Label* ctagsLabel = manage(new Gtk::Label("Ctags Command: "));
    ctagsLabel->show();
    ctagsBox->pack_start(*ctagsLabel, false, false);
    m_ctagsEntry = manage(new Gtk::Entry());
    m_ctagsEntry->set_text(g_configMap[Config::CTAGS[0]]);
    m_ctagsEntry->show();
    ctagsBox->pack_end(*m_ctagsEntry);
    ctagsBox->show();

    // add everything to the vbox
    Gtk::VBox* vbox = get_vbox();
    vbox->set_spacing(5);
    vbox->pack_start(*editorBox, false, false);
    vbox->pack_start(*ctagsBox, false, false);

    show();
    Gtk::Main::run();
}
예제 #16
0
		void do_toggle() {
			if (resize->get_active())
				inner->show();
			else
				inner->hide();
		}
예제 #17
0
Gobby::StatusBar::MessageHandle
Gobby::StatusBar::add_message(Gobby::StatusBar::MessageType type,
                              const Glib::ustring& message,
                              const Glib::ustring& dialog_message,
                              unsigned int timeout)
{
	if(m_visible_messages >= 12)
	{
		for(MessageHandle iter = m_list.begin();
		    iter != m_list.end();
		    ++iter)
		{
			if(*iter)
			{
				if((*iter)->is_error())
					remove_message(iter);
				else
					// only hide message because whoever
					// installed it is expecting to be
					// able to call remove_message on it
					hide_message(iter);
				break;
			}
		}
	}

	Gtk::HBox* bar = Gtk::manage(new Gtk::HBox);

	Gtk::Image* image = Gtk::manage(new Gtk::Image(
		message_type_to_stock_id(type), Gtk::ICON_SIZE_MENU));
	bar->pack_start(*image, Gtk::PACK_SHRINK);
	image->show();

	Gtk::Label* label = Gtk::manage(
		new Gtk::Label(message, GtkCompat::ALIGN_LEFT));
	label->set_ellipsize(Pango::ELLIPSIZE_END);
	bar->pack_start(*label, Gtk::PACK_EXPAND_WIDGET);
	label->show();

	GtkShadowType shadow_type;
	gtk_widget_style_get(GTK_WIDGET(m_bar_position.gobj()),
	                     "shadow-type", &shadow_type, NULL);
	Gtk::Frame* frame = Gtk::manage(new Gtk::Frame);

	m_list.push_back(0);
	Gobby::StatusBar::MessageHandle iter(--m_list.end());
	sigc::connection timeout_conn;
	if(timeout)
	{
		timeout_conn = Glib::signal_timeout().connect_seconds(
			sigc::bind(
				sigc::bind_return(
					sigc::mem_fun(
						*this,
						&StatusBar::remove_message),
					false),
				iter),
			timeout);
	}
	*iter = new Message(frame, message, dialog_message, timeout_conn);
	++m_visible_messages;

	if(dialog_message.empty())
	{
		frame->add(*bar);
	}
	else
	{
		Gtk::EventBox *eventbox = Gtk::manage(new Gtk::EventBox);
		frame->add(*eventbox);
		eventbox->add(*bar);
		eventbox->signal_button_press_event().connect(
			sigc::bind_return(sigc::bind(
				sigc::mem_fun(
					*this,
					&StatusBar::on_message_clicked),
				iter), false));

		eventbox->show();
	}

	frame->set_shadow_type(static_cast<Gtk::ShadowType>(shadow_type));
	bar->show();

	pack_start(*frame, Gtk::PACK_EXPAND_WIDGET);
	reorder_child(*frame, 0);

	frame->show();

	return iter;
}
예제 #18
0
  void 
  DataSet::initGtk()
  {
    _gtkOptList.reset(new Gtk::VBox);

    {//The heading of the data set window
      Gtk::Frame* frame = Gtk::manage(new Gtk::Frame("Data Set Information")); frame->show();
      _gtkOptList->pack_start(*frame, false, true, 5);
      Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox); vbox->show();
      frame->add(*vbox);

      _infolabel.reset(new Gtk::Label("Points: " + boost::lexical_cast<std::string>(_N))); 
      _infolabel->show();
      vbox->pack_start(*_infolabel, false, true, 5);	
    }

    //Glyph adding mechanism
    {
      Gtk::HBox* box = Gtk::manage(new Gtk::HBox); box->show();
      _gtkOptList->pack_start(*box, false, false, 5);

      _comboPointSet.reset(new Gtk::ComboBoxText); _comboPointSet->show();
      box->pack_start(*_comboPointSet, false, false, 5);

      //Check the combo box is correct
      _comboPointSet->get_model().clear();
      for (const auto& pointset: _pointSets)
	_comboPointSet->insert(-1, pointset.first);
      _comboPointSet->set_active(0);

      Gtk::Button* btn = Gtk::manage(new Gtk::Button("Add Glyphs"));
      btn->signal_clicked().connect(sigc::mem_fun(*this, &DataSet::addGlyphs));
      btn->show();
      box->pack_start(*btn, false, false, 5);

      _comboLinkSet.reset(new Gtk::ComboBoxText); _comboLinkSet->show();
      box->pack_start(*_comboLinkSet, false, false, 5);
      //Check the combo box is correct
      _comboLinkSet->get_model().clear();
      for (const auto& linkset: _linkSets)
	_comboLinkSet->insert(-1, linkset.first);
      _comboLinkSet->set_active(0);

      btn = Gtk::manage(new Gtk::Button("Add Links"));
      btn->signal_clicked().connect(sigc::mem_fun(*this, &DataSet::addLinkGlyphs));
      btn->show();
      box->pack_start(*btn, false, false, 5);
    }
    
    { 
      _attrcolumns.reset(new ModelColumns);
      _attrtreestore = Gtk::TreeStore::create(*_attrcolumns);
      _attrtreestore->set_sort_column(_attrcolumns->components, Gtk::SORT_DESCENDING);

      _attrview.reset(new Gtk::TreeView);
      _attrview->set_model(_attrtreestore);
      _attrview->append_column("Name", _attrcolumns->name);
      _attrview->append_column("Components", _attrcolumns->components);
      _attrview->append_column("Min Values", _attrcolumns->min);
      _attrview->append_column("Max Values", _attrcolumns->max);
      _attrview->show();
      Gtk::ScrolledWindow* win = Gtk::manage(new Gtk::ScrolledWindow);
      win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
      win->add(*_attrview);

      Gtk::Frame* frame = Gtk::manage(new Gtk::Frame("Available Attributes")); frame->show();
      frame->add(*win);
      _gtkOptList->pack_start(*frame, true, true, 5);
      win->show();
    }

    {
      _positionSel.reset(new AttributeSelector(false));
      _gtkOptList->pack_start(*_positionSel, false, false);
    }

    _gtkOptList->show();
    rebuildGui();
  }