void reset_aspect()
  {
    int w= _image->get_pixbuf()->get_width();
    int h= _image->get_pixbuf()->get_height();

    _be.set_size(w, h);
  }
Example #2
0
void ItemView::drawReminderIcon(const Cairo::RefPtr<Cairo::Context>& cr, const int width, const int height)
{
    cr->save();

    //draw reminder icon
    cr->set_antialias(Cairo::ANTIALIAS_NONE);

    if (data.isReminder())
    {
        Gtk::Image* image = Resources::res->imgReminderIcon;

        if (getColorMode() == COLOR_ALARM)
            image = Resources::res->imgReminderOnIcon;

        const Glib::RefPtr<Gdk::Pixbuf> icon = image->get_pixbuf();

        const int iconLeft = (TIME_WIDTH * 0.5) - (icon->get_width() * 0.5);
        const int iconTop = (height - icon->get_height()) - (PADDING * 3);

        Gdk::Cairo::set_source_pixbuf(cr, icon, iconLeft, iconTop);

        cr->rectangle(iconLeft, iconTop, icon->get_width(), icon->get_height());
        cr->fill();
    }

    cr->restore();
}
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);
}
Example #4
0
void *procesar_boton(void *nada){			// Hilo que se ejecutará cuando se pulse el botón OK Go!. Simula un inicio de sesión que una vez fallará y otra vez no
	Gtk::Label *etiq;			// Estos son los objetos que queremos manejar. En la ventana hay más, pero no les hacemos nada, asique no necesitamos declarar punteros a ellos. Esta es la etiqueta que muestra el Cargando...
	Gtk::Spinner *spin;			// Esto es un dibujito que gira mientras carga
	Gtk::Image *image;			// Esta es la imagen que aparece cuando se inicia sesión (tanto si falla(muestra una X de error) como si no(muestra un tick verde)
	Gtk::RadioButton *radio;		// Este es un botón de los de la izquierda, donde seleccionas si inicias sesion, creas usuario o borras usuario
	Gtk::Entry *entrada;			// Esta es la cajeta de entrada de texto como por ejemplo, donde pones el nombre de usuario y la contraseña

	builder->get_widget("label3", etiq);	// Como el builder crea la ventana, él nos dará las referencias a los objetos definidos arriba
	builder->get_widget("spinner1", spin);
	builder->get_widget("image1", image);
	image->set_visible(false);		// Hacemos que las imagenes no se vean. Mientras está cargando no se muestran. Esta es la imagen de cuando se inicia sesión correctamente
	builder->get_widget("image2", image);	// Reusamos el puntero para referenciar a la otra imagen. Esta se muestra cuando el inicio sesion falla
	image->set_visible(false);
	builder->get_widget("radiobutton1",radio);// Como esto se ejecuta cuando se pulsa el botón OK Go!, se supone que estamos procesando el inicio de sesión. Es habitual bloquearlo todo para que no se pueda cambiar de opción mientras se inicia sesion (En realidad es por estética, porque al programa se la trae floja lo que hagas) :)
	radio->set_sensitive(false);
	builder->get_widget("radiobutton2",radio);
	radio->set_sensitive(false);
	builder->get_widget("radiobutton3",radio);
	radio->set_sensitive(false);
	builder->get_widget("entry1", entrada);
	entrada->set_sensitive(false);
	builder->get_widget("entry2", entrada);
	entrada->set_sensitive(false);

	spin->set_visible(true);		// Como estamos cargando, mostramos el iconito este girando. (Este es el mismo que se muestra cuando buscas archivos en ubuntu)
	etiq->set_label("Conectando...");	// Hacemos que la etiqueta muestre Conectando...

	sleep(1);				// Simulamos que la conexion se establece

	etiq->set_label("Obteniendo datos del servidor");	// Se supone que estamos conectados y ahora intercambiamos datos con el servidor

	sleep(2);				// Simulamos el intercambio de datos
	
	spin->set_visible(false);		// Ya se ha procesado el inicio de sesion y ya no debemos ver el iconico girando, porque eso es sólo cuando carga

	if(i%2){					// Si es impar, el inicio de sesion es correcto
		builder->get_widget("image1", image);	// Obtenemos la imagen1, la del tick verde
		etiq->set_label("Login correcto");	// Cambiamos el texto de la etiqueta (una etiqueta sólo hace eso: mostrar texto)
	} else {
		etiq->set_label("Login incorrecto");	// Si es par, el inicio de sesion es incorrecto. No tenemos que obtener la imagen porque el puntero ya apunta a la imagen correcta
	}

	image->set_visible(true);	// Sea cual sea la imagen escogida, se muestra

	builder->get_widget("radiobutton1",radio);	// Y se desbloquea todo esperando a que el usuario cambie algo y vuelva a pulsar otro botón
	radio->set_sensitive(true);
	builder->get_widget("radiobutton2",radio);
	radio->set_sensitive(true);
	builder->get_widget("radiobutton3",radio);
	radio->set_sensitive(true);
	builder->get_widget("entry1", entrada);
	entrada->set_sensitive(true);
	builder->get_widget("entry2", entrada);
	entrada->set_sensitive(true);

	i++;	// Esto alterna entre simular un inicio de sesion correcto (i impar) y uno incorrecto (i par)
}
 void ArtistsWidget::insertReturn() {
   Gtk::TreeModel::Row row = *(treeModel->append());
   //    row[columns.artist] = "Home";
   row[columns.isArtist] = -1;
   Gtk::Image i;
   //i.set_from_icon_name("gtk-media-pause", Gtk::IconSize::from_name("GTK_ICON_SIZE_BUTTON"));
   i.set("ui/arrowleft.png");
   row[columns.image] = i.get_pixbuf();
 }
Example #6
0
bool Controls::run_set_estado(Glib::ustring valor){
    if (estado != valor){
        estado = valor;
        Gtk::Image *img = dynamic_cast<Gtk::Image*> (pla->get_icon_widget());
        if (estado == "playing"){
            img->set(pixbufplay);
            pla->set_tooltip_text("Pausar");}
        else{
            img->set(pixbufpause);
            pla->set_tooltip_text("Reproducir");}}
    return false;}
//------------------------------------------------------------------------------
static void swap_icons(Gtk::ToggleButton *btn) {
  Gtk::Image *img = 0;

  if (btn->get_active())
    img = cast<Gtk::Image *>(btn->get_data("alt_icon"));
  else
    img = cast<Gtk::Image *>(btn->get_data("icon"));

  img->show();
  btn->set_image(*img);
}
//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::set_item_icon(mforms::ToolBarItem *item, const std::string &image_path) {
  Gtk::Button *btn = cast<Gtk::Button *>(item->get_data_ptr());
  if (btn) {
    static ImageCache *images = ImageCache::get_instance();
    Gtk::Image *img = new Gtk::Image(images->image_from_path(image_path));
    if (img) {
      btn->set_image(*img);
      btn->set_data("icon", img, free_icon);
      img->show();
    }
  }
}
void
ToggleDucksDial::init_label_button(Gtk::ToggleToolButton &button, Gtk::IconSize iconsize, const char *stockid, const char *label, const char *tooltip)
{
	Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID(stockid), iconsize));
	icon->set_padding(0, 0);
	icon->show();

	button.set_label(label);
	button.set_tooltip_text(tooltip);
	button.set_icon_widget(*icon);
	button.show();
}
Gtk::RadioButton * dv_selector_widget::create_radio_button(
    Gtk::RadioButtonGroup & group,
    const Glib::RefPtr<Gdk::Pixbuf> & pixbuf)
{
    Gtk::Image * image = manage(new Gtk::Image(pixbuf));
    image->show();

    Gtk::RadioButton * button = manage(new Gtk::RadioButton(group));
    button->set_image(*image);
    button->set_mode(/*draw_indicator=*/false);

    return button;
}
SelectionSetToolmenu::SelectionSetToolmenu() :
	Gtk::ToolItem(),
	_listStore(Gtk::ListStore::create(_columns)),
	_clearSetsButton(NULL),
	_entry(Gtk::manage(new Gtk::ComboBoxEntry(_listStore, _columns.name)))
{
	// Hbox containing all our items
	Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 3));
	add(*hbox);

	// Pack Label
	hbox->pack_start(
		*Gtk::manage(new gtkutil::LeftAlignedLabel(_("Selection Set: "))),
		false, false, 0);

	// Pack Combo Box
	hbox->pack_start(*_entry, true, true, 0);

	// Add tooltip
	_entry->set_tooltip_markup(_(ENTRY_TOOLTIP));

	// Add clear button
	{
		Gtk::Image* image = Gtk::manage(new Gtk::Image(GlobalUIManager().getLocalPixbufWithMask("delete.png")));
		image->show();

		_clearSetsButton = Gtk::manage(new Gtk::ToolButton(*image, _("Clear Selection Sets")));

		// Set tooltip
		_clearSetsButton->set_tooltip_text(_("Clear Selection Sets"));

		// Connect event
		_clearSetsButton->signal_clicked().connect(sigc::mem_fun(*this, &SelectionSetToolmenu::onDeleteAllSetsClicked));

		hbox->pack_start(*_clearSetsButton, false, false, 0);
	}

	// Connect the signals
	Gtk::Entry* childEntry = _entry->get_entry();
	childEntry->signal_activate().connect(sigc::mem_fun(*this, &SelectionSetToolmenu::onEntryActivated));

	_entry->signal_changed().connect(sigc::mem_fun(*this, &SelectionSetToolmenu::onSelectionChanged));

	// Populate the list
	update();

	// Add self as observer
	GlobalSelectionSetManager().addObserver(*this);

	show_all();
}
Example #12
0
Gtk::Button *
FrameDial::create_icon(Gtk::IconSize iconsize, const char * stockid, const char * tooltip)
{
	iconsize = Gtk::IconSize::from_name("synfig-small_icon_16x16");
	Gtk::Image *icon = Gtk::manage(new Gtk::Image(Gtk::StockID(stockid), iconsize));
	Gtk::Button *button = Gtk::manage(new class Gtk::Button());
	button->add(*icon);
	button->set_tooltip_text(tooltip);
	icon->set_padding(0, 0);
	icon->show();
	button->set_relief(Gtk::RELIEF_NONE);
	button->show();

	return button;
}
Example #13
0
Gtk::ToggleButton *
ToggleDucksDial::create_label_button(Gtk::IconSize iconsize, const char *stockid,
		const char * tooltip)
{
	Gtk::ToggleButton *tbutton = manage(new class Gtk::ToggleButton());
	Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID(stockid), iconsize));
	tbutton->set_tooltip_text(tooltip);
	tbutton->add(*icon);
	icon->set_padding(0, 0);
	icon->show();
	tbutton->set_relief(Gtk::RELIEF_NONE);
	tbutton->show();

	return tbutton;
}
Example #14
0
Gtk::Button *
ZoomDial::create_icon(Gtk::IconSize size, const Gtk::BuiltinStockID & stockid,
		const char * tooltip)
{
	Gtk::Button *button = manage(new class Gtk::Button());
	Gtk::Image *icon = manage(new Gtk::Image(stockid, size));
	button->add(*icon);
	button->set_tooltip_text(tooltip);
	icon->set_padding(0, 0);
	icon->show();
	button->set_relief(Gtk::RELIEF_NONE);
	button->show();

	return button;
}
Example #15
0
ControlItem::ControlItem(Gtk::Widget* icon, double x, double y, double width,
    double height, bool moving, bool overlaps) {
  rect_ = Goocanvas::Rect::create(x, y, width, height);
  if (moving) {
    rect_->set_property("fill_color_rgba", LIGHT_BLUE);
  } else if (overlaps) {
    rect_->set_property("fill_color_rgba", LIGHT_RED);
  } else {
    rect_->set_property("fill_color_rgba", LIGHT_GREEN);
  }

  add_child(rect_);
  Gtk::Image* image = dynamic_cast<Gtk::Image*>(icon);
  Glib::RefPtr<Goocanvas::Image> item = Goocanvas::Image::create(image->get_pixbuf(), x, y);
  add_child(item);
}
DbMySQLViewEditor::DbMySQLViewEditor(grt::Module *m, bec::GRTManager *grtm, const grt::BaseListRef &args)
    : PluginEditorBase(m ,grtm, args, "modules/data/editor_view.glade")
    , _be(new MySQLViewEditorBE(grtm, db_mysql_ViewRef::cast_from(args[0])))
{
  xml()->get_widget("mysql_view_editor_notebook", _editor_notebook);

  Gtk::Image *image;
  xml()->get_widget("view_editor_image", image);
  image->set(ImageCache::get_instance()->image_from_filename("db.View.editor.48x48.png", false));
  xml()->get_widget("view_editor_image2", image);
  image->set(ImageCache::get_instance()->image_from_filename("db.View.editor.48x48.png", false));

  _be->set_refresh_ui_slot(sigc::mem_fun(this, &DbMySQLViewEditor::refresh_form_data));
  
  _editor_notebook->reparent(*this);
  _editor_notebook->show();



  Gtk::VBox *ddl_win;
  xml()->get_widget("editor_placeholder", ddl_win);
  embed_code_editor(_be->get_sql_editor()->get_container(), ddl_win);
  _be->load_view_sql();

  if (!is_editing_live_object())
  {
    _privs_page     = new DbMySQLEditorPrivPage(_be);
    _editor_notebook->append_page(_privs_page->page(), "Privileges");

    Gtk::TextView *tview(0);
    xml()->get_widget("viewcomment", tview);
    tview->get_buffer()->set_text(_be->get_comment());

    tview->signal_focus_out_event().connect(sigc::bind(sigc::mem_fun(this, &DbMySQLViewEditor::comment_lost_focus), tview), false);
  }
  else
  {
    _editor_notebook->remove_page(1);
    _privs_page= NULL;
  }
    
  refresh_form_data();

  _be->reset_editor_undo_stack();

  show_all();
}
  void ArtistsWidget::loadArtistsSongs(std::string artist) {

    selectedArtist = artist;

    // set label of tab
    artistsLabel->set_text(selectedArtist);

    Gtk::TreeModel::Path path;
    Gtk::CellRenderer* cell;
    artistsView->get_cursor(path, cell);
    std::cout << "sel path:" << path.to_string();
    //    cell->;

    // clear treemodel
    m_actualSongs.clear();


    // start searching for artist
    MPD::Client::GetInstance()->StartSearch(1);
    MPD::Client::GetInstance()->AddSearch(MPD_TAG_ARTIST, artist);
    MPD::Client::GetInstance()->CommitSearch(m_actualSongs);

    // sort songs
    std::sort(m_actualSongs.begin(), m_actualSongs.end(), actualSongSortCond);

    artistsView->unset_model();
    treeModel->clear();

    // insert return button
    insertReturn();

    for (int i = 0; i < m_actualSongs.size(); i++) {
      Gtk::TreeModel::Row row = *(treeModel->append());
      row[columns.artist] = m_actualSongs[i]->GetTitle();
      Gtk::Image image;
      image.set("ui/icon_smaller.png");
      row[columns.image] = image.get_pixbuf();
      row[columns.isArtist] = 0;
      row[columns.song] = m_actualSongs[i];
    }


    artistsView->set_model(treeModel);
    //scroll to top
    artistScrolledWindow->get_vadjustment()->set_value(0);

  }
Example #18
0
Gtk::Image* DLWindow::createImage(const Glib::RefPtr<Gdk::Pixbuf> &pixBuf)
{
	Gtk::Image *result = new Gtk::Image(pixBuf);
	result->set_hexpand(true);
	result->set_vexpand(true);
	result->override_background_color(Gdk::RGBA("white"));
	result->set_margin_bottom(1);
	result->set_margin_top(1);
	result->set_margin_left(1);
	result->set_margin_right(1);
	result->show();
	return result;
}
//------------------------------------------------------------------------------
DbMySQLRoutineGroupEditor::DbMySQLRoutineGroupEditor(grt::Module *m, bec::GRTManager *grtm, const grt::BaseListRef &args)
    : PluginEditorBase(m, grtm, args, "modules/data/editor_rg.glade")
    , _be(new MySQLRoutineGroupEditorBE(grtm, db_mysql_RoutineGroupRef::cast_from(args[0])))
    , _routines_model(model_from_string_list(std::vector<std::string>(), &_routines_columns))
{
  xml()->get_widget("mysql_rg_editor_notebook", _editor_notebook);

  Gtk::Image *image;
  xml()->get_widget("rg_image", image);
  image->set(ImageCache::get_instance()->image_from_filename("db.RoutineGroup.editor.48x48.png", false));
  
  _be->set_refresh_ui_slot(sigc::mem_fun(this, &DbMySQLRoutineGroupEditor::refresh_form_data));
  
  _editor_notebook->reparent(*this);
  _editor_notebook->show();

  bind_entry_and_be_setter("rg_name", this, &DbMySQLRoutineGroupEditor::set_group_name);
  
  Gtk::TextView* tv;
  xml()->get_widget("rg_comment", tv);
  add_text_change_timer(tv, sigc::mem_fun(this, &DbMySQLRoutineGroupEditor::set_comment));
  
  Gtk::VBox* code_win;
  xml()->get_widget("rg_code_holder", code_win);
  embed_code_editor(_be->get_sql_editor()->get_container(), code_win);
  _be->load_routines_sql();
  
  refresh_form_data();
  
  xml()->get_widget("rg_list", _rg_list);
  
  _rg_list->set_model(_routines_model);
  _rg_list->append_column("Routine", _routines_columns->item);
  _rg_list->set_headers_visible(false);
  _rg_list->signal_row_activated().connect(sigc::mem_fun(this, &DbMySQLRoutineGroupEditor::activate_row));

  // Setup DnD
  std::vector<Gtk::TargetEntry> targets;

  targets.push_back(Gtk::TargetEntry(WB_DBOBJECT_DRAG_TYPE, Gtk::TARGET_SAME_APP));
  _rg_list->drag_dest_set(targets, Gtk::DEST_DEFAULT_ALL,Gdk::ACTION_COPY);
  _rg_list->signal_drag_data_received().connect(sigc::mem_fun(this, &DbMySQLRoutineGroupEditor::on_routine_drop));
  _rg_list->signal_event().connect(sigc::mem_fun(*this, &DbMySQLRoutineGroupEditor::process_event));

  show_all();
}
Example #20
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;
}
    SchemaEditor(grt::Module *m, bec::GRTManager *grtm, const grt::BaseListRef &args)
        : PluginEditorBase(m, grtm, args, "modules/data/editor_schema.glade")
        , _be(new MySQLSchemaEditorBE(grtm, db_mysql_SchemaRef::cast_from(args[0])))
    {
        xml()->get_widget("mysql_schema_editor_notebook", _editor_notebook);

        Gtk::Widget *widget;
        xml()->get_widget("base_table", widget);

        Gtk::Image *image;
        xml()->get_widget("image", image);
        image->set(ImageCache::get_instance()->image_from_filename("db.Schema.editor.48x48.png", false));

        bind_entry_and_be_setter("name_entry", this, &SchemaEditor::set_name);
        if (_be->is_editing_live_object() && _be->get_schema()->oldName() != "")
        {
            Gtk::Entry *entry;
            xml()->get_widget("name_entry", entry);
            entry->set_sensitive(false);
        }

        Gtk::Button *btn;
        xml()->get_widget("refactor_btn", btn);
        btn->set_sensitive(_be->refactor_possible());
        btn->signal_clicked().connect(sigc::mem_fun(this, &SchemaEditor::refactor_schema));

        Gtk::ComboBox *combo;
        xml()->get_widget("collation_combo", combo);
        Glib::RefPtr<Gtk::ListStore> store(Glib::RefPtr<Gtk::ListStore>::cast_dynamic(xml()->get_object("collation_store")));
        setup_combo_for_string_list(combo);
        fill_combo_from_string_list(combo, _be->get_charset_collation_list());
        add_option_combo_change_handler(combo, "CHARACTER SET - COLLATE", sigc::mem_fun(this, &SchemaEditor::set_schema_option_by_name));

        Gtk::TextView *tview;
        xml()->get_widget("text_view", tview);
        add_text_change_timer(tview, sigc::mem_fun(this, &SchemaEditor::set_comment));

        //!widget->reparent(*this);
        add(*_editor_notebook);
        _editor_notebook->show();

        show_all();

        refresh_form_data();
    }
Example #22
0
HGTalkLoginBox::HGTalkLoginBox()
{
	Gtk::Image * pImage = Gtk::manage(new Gtk::Image(HGTALK_ICON_128));
	pack_start(*pImage, FALSE, TRUE, 0);
	pImage->set_size_request(-1, 180);

	Gtk::Label * pTemp = Gtk::manage(new Gtk::Label(HGTALK_USERNAME));
	pTemp->set_alignment(0.0, 0.5);
	pack_start(*pTemp, FALSE, TRUE, 0);
	m_pUsername = Gtk::manage(new HGTalkUsernameEntry);
	pack_start(*m_pUsername, FALSE, TRUE, 0);

	pTemp = Gtk::manage(new Gtk::Label(HGTALK_PASSWORD));
	pTemp->set_alignment(0.0, 0.5);
	pack_start(*pTemp, FALSE, TRUE, 0);
	m_pPassword = Gtk::manage(new HGTalkPasswordEntry);
	pack_start(*m_pPassword, FALSE, TRUE, 0);

	m_pRemPass = 
		Gtk::manage(new HGTalkRempassButton);
	pack_start(*m_pRemPass, FALSE, TRUE, 0);

	Gtk::ButtonBox * pButtonBox =
		Gtk::manage(new Gtk::HButtonBox);
	pack_start(*pButtonBox, FALSE, TRUE, 0);
	Gtk::Button * pButton = 
		Gtk::manage(new HGTalkLoginButton);
	pButtonBox->pack_start(*pButton, FALSE, FALSE, 0);

	m_pTip = Gtk::manage(new Gtk::Label());
	pack_start(*m_pTip, TRUE, TRUE, 0);

	pButtonBox = Gtk::manage(new Gtk::HButtonBox);
	pButtonBox->set_layout(Gtk::BUTTONBOX_END);
	pack_start(*pButtonBox, FALSE, TRUE, 0);

	Gtk::LinkButton * pLinkButton =
		Gtk::manage(new HGTalkPreferencesButton);
	pButtonBox->pack_start(*pLinkButton, FALSE, FALSE, 0);
	pLinkButton = Gtk::manage(new HGTalkAboutButton);
	pButtonBox->pack_start(*pLinkButton, FALSE, FALSE, 0);

	show_all();
}
Example #23
0
void Widget_Link::on_toggled()
{
	Gtk::Image *icon;

	if(get_active())
	{
		icon= icon_on_;
		set_tooltip_text(tooltip_active_);
	}
	else
	{
		icon=icon_off_;
		set_tooltip_text(tooltip_inactive_);
	}

	remove();
	add(*icon);
	icon->show();
}
Example #24
0
/*! \fn Toolbox::add_state(const Smach::state_base *state)
 *  \brief Add and connect a toogle button to the toolbox defined by a state
 *  \param state a const pointer to Smach::state_base
*/
void
Toolbox::add_state(const Smach::state_base *state)
{
	Gtk::Image *icon;

	assert(state);

	String name=state->get_name();

	Gtk::StockItem stock_item;
	Gtk::Stock::lookup(Gtk::StockID("synfig-"+name),stock_item);

	Gtk::ToggleButton* button;
	button=manage(new class Gtk::ToggleButton());

	Gtk::AccelKey key;
	//Have a look to global fonction init_ui_manager() from app.cpp for "accel_path" definition
	Gtk::AccelMap::lookup_entry ("<Actions>/action_group_state_manager/state-"+name, key);
	//Gets the accelerator representation for labels
	Glib::ustring accel_path = key.get_abbrev ();

	icon=manage(new Gtk::Image(stock_item.get_stock_id(),Gtk::IconSize(4)));
	button->add(*icon);
	button->set_tooltip_text(stock_item.get_label()+" "+accel_path);
	icon->show();
	button->show();

	int row=state_button_map.size()/5;
	int col=state_button_map.size()%5;

	tool_table->attach(*button,col,col+1,row,row+1, Gtk::EXPAND, Gtk::EXPAND, 0, 0);

	state_button_map[name]=button;

	button->signal_clicked().connect(
		sigc::bind(
			sigc::mem_fun(*this,&studio::Toolbox::change_state_),
			state
		)
	);

	refresh();
}
Example #25
0
bool refresh_captcha() {
	///Refresh the CAPTCHA in the post section
	
	string s1 = getRemoteFile("http://www.google.com/recaptcha/api/challenge?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc");
	
	std::ifstream t(s1.c_str());
	string s2;
	t.seekg(0, ios::end);
	s2.reserve(t.tellg());
	t.seekg(0, ios::beg);
	s2.assign((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
	
	//Google tries to be clever and make the script JSONP, so we need to remove all of the JavaScript stuff
	boost::regex jsonp1("var RecaptchaState = ");
	string s3 = boost::regex_replace(s2, jsonp1, "");
	
	boost::regex jsonp2("^\\s*([a-zA-Z0-9_]*)\\s:");
	string s4 = boost::regex_replace(s3, jsonp2, "\"$1\":");
	
	boost::regex jsonp3("^document.write\\(.*$");
	string s5 = boost::regex_replace(s4, jsonp3, "");
	
	boost::regex jsonp4(";");
	string s6 = boost::regex_replace(s5, jsonp4, "");
	
	boost::regex jsonp5("'");
	string s7 = boost::regex_replace(s6, jsonp5, "\"");
	
	Json::Value root;   // will contain the root value after parsing.
	Json::Reader reader;
	bool parsingSuccessful = reader.parse(s7, root);
	
	Gtk::Image *captcha = 0;
	builder->get_widget("image7", captcha);

	captcha->set(getRemoteFile("http://www.google.com/recaptcha/api/image?c="+root["challenge"].asString()));
	CHALLENGE = root["challenge"].asString();
	
	return true;
}
//------------------------------------------------------------------------------
void DbMySQLTableEditor::toggle_header_part()
{
  Gtk::Button *hide_button = 0;
  xml()->get_widget("hide_button", hide_button);

  Gtk::Image *image = 0;
  xml()->get_widget("table_editor_image", image);
  const bool make_image_small = image->get_data("is_large");
  image->set(ImageCache::get_instance()->image_from_filename(make_image_small ? "db.Table.editor.24x24.png" : "db.Table.editor.48x48.png", false));
  image->set_data("is_large", (void*)(!make_image_small));

  Gtk::VBox* image_box = dynamic_cast<Gtk::VBox*>(hide_button->get_image());
  if (image_box)
  {
    const std::vector<Gtk::Widget*> images = image_box->get_children();
    for (int i = ((int)images.size()) - 1; i >= 0; --i)
    {
      if (images[i]->is_visible())
        images[i]->hide();
      else
        images[i]->show();
    }

    const char* const names[] = {"collation_label", "collation_combo", "engine_label", "engine_combo", "comment_box"};
    const int names_size = sizeof(names) / sizeof(const char**);
    for (int i = 0; i < names_size; ++i)
    {
      Gtk::Widget* w = 0;
      xml()->get_widget(names[i], w);
      if (w)
      {
        if (w->is_visible())
          w->hide();
        else
          w->show();
      }
    }
  }
}
Example #27
0
Gobby::ClosableFrame::ClosableFrame(const Glib::ustring& title,
                                    const Glib::ustring& icon_name,
                                    Preferences::Option<bool>& option):
	m_option(option), m_allow_visible(true)
{
	CloseButton* button = Gtk::manage(new CloseButton);

	button->set_hexpand(true);
	button->set_halign(Gtk::ALIGN_END);

	button->signal_clicked().connect(
		sigc::mem_fun(*this, &ClosableFrame::on_clicked));
	m_option.signal_changed().connect(
		sigc::mem_fun(*this, &ClosableFrame::on_option));

	button->show();

	Gtk::Image* image = Gtk::manage(
		new Gtk::Image);
	image->set_from_icon_name(icon_name, Gtk::ICON_SIZE_MENU);
	image->show();

	Gtk::Label* label_title = Gtk::manage(
		new Gtk::Label(title, Gtk::ALIGN_START));
	label_title->show();

	m_grid.set_border_width(6);
	m_grid.set_column_spacing(6);
	m_grid.set_row_spacing(6);
	m_grid.attach(*image, 0, 0, 1, 1);
	m_grid.attach(*label_title, 1, 0, 1, 1);
	m_grid.attach(*button, 2, 0, 1, 1);
	m_grid.show();

	add(m_grid);

	on_option();
}
Example #28
0
  void cIconTheme::LoadStockIconRotatedClockwise(const std::string& sStockIconName, Gtk::Image& image)
  {
    std::cout<<"cIconTheme::LoadStockIconRotatedClockwise"<<std::endl;

    // This doesn't seem to work
    //Gtk::StockItem item;
    //Gtk::Stock::lookup(idStockIcon, item);

    Glib::RefPtr<Gdk::Pixbuf> pixbuf = icon_theme->load_icon(sStockIconName.c_str(), 32, Gtk::ICON_LOOKUP_USE_BUILTIN);

    ASSERT(pixbuf);

    // Rotate the pixbuf and assign it to our image
    image.set(pixbuf->rotate_simple(Gdk::PixbufRotation::PIXBUF_ROTATE_CLOCKWISE));
  }
Example #29
0
 void make_image(Gtk::Image& image) {
   boost::lock_guard<boost::mutex> scoped_lock(predata_mutex_);
   auto pixbuf = Gdk::Pixbuf::create_from_data(
       &data_[0],
       Gdk::COLORSPACE_RGB,
       has_alpha_,
       8 /*bits per sample*/,
       dims_.width(),
       dims_.height(),
       rowstride_
     );
   image.set(pixbuf);
   boost::lock_guard<boost::mutex> scoped_lock2(barrier_mutex_);
   barrier_->wait();
 }
 virtual void do_refresh_form_data()
 {    
   Gtk::Entry *entry;
   int w, h;
   _be.get_size(w, h);
   _xml->get_widget("width_entry", entry);
   entry->set_text(strfmt("%i", w));
   _xml->get_widget("height_entry", entry);
   entry->set_text(strfmt("%i", h));
   
   Gtk::CheckButton *check;
   _xml->get_widget("aspect_check", check);
   check->set_active(_be.get_keep_aspect_ratio());
 
   Glib::RefPtr<Gdk::Pixbuf> pixbuf(Gdk::Pixbuf::create_from_file(_be.get_attached_image_path()));
   if (pixbuf)
     _image->set(pixbuf);  
   else
     g_message("ImageEditorFE: can not set image from %s[%s]", _be.get_filename().c_str(), _be.get_attached_image_path().c_str());    
 }