Ejemplo n.º 1
0
void pTabFrame::setImage(unsigned selection, const image& image) {
  nall::image copy = image;
  unsigned size = pFont::size(widget.state.font, " ").height;
  copy.scale(size, size);
  GdkPixbuf* pixbuf = CreatePixbuf(copy);
  gtk_image_set_from_pixbuf(GTK_IMAGE(tabs[selection].image), pixbuf);
}
Ejemplo n.º 2
0
void pListView::setImage(unsigned selection, unsigned position, const image& image) {
  GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(subWidget));
  GtkTreeIter iter;
  gtk_tree_model_get_iter_from_string(model, &iter, string(selection));
  if(image.empty() == false) {
    GdkPixbuf* pixbuf = CreatePixbuf(image, true);
    gtk_list_store_set(store, &iter, 1 + position * 2, pixbuf, -1);
  } else {
    gtk_list_store_set(store, &iter, 1 + position * 2, nullptr, -1);
  }
}
Ejemplo n.º 3
0
void CalcAbsSizes(const std::string& txt, const Pango::FontDescription& dsc, 
                      double& wdh, double& hgt, double dpi)
{
    RefPtr<Gdk::Pixbuf> aux_pix = CreatePixbuf(1, 1, true);
    TextContext t_cnvs;
    t_cnvs.Init(aux_pix, dpi);

    RefPtr<Pango::Layout> lay = t_cnvs.PanLay();
    lay->set_font_description(dsc);
    lay->set_text(txt);
    _CalcAbsSizes(lay, wdh, hgt);
}
Ejemplo n.º 4
0
static GtkImage* CreateImage(const nall::image& image, bool scale = false) {
  GdkPixbuf* pixbuf = CreatePixbuf(image, scale);
  GtkImage* gtkImage = (GtkImage*)gtk_image_new_from_pixbuf(pixbuf);
  g_object_unref(pixbuf);
  return gtkImage;
}