Bonjour
Je suis sous Linux Ubuntu 16.04 et j'aimerais avec GTK2 charger dans un TBitmap un PGTKWidget (enfin un PGTKImage). Je veux en fait utiliser les thèmes et afficher une icone "Recharger" mais impossible de trouver quoi que ce soit. J'utilise gtk_image_new_from_icon_name (gtk2.pas) pour avoir mon image.
Actuellement mon code ci-dessous n'affiche... rien
En espérant que l'un d'entre vous ait la solution
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 procedure TForm1.FormShow(Sender: TObject); function GetGTKBmp(IconName:string;Size:integer):TBitmap; var GDIObj: PGDIObject; Pixbuf: PGDKPixbuf; Gtkimg:TGtkWidget; gtks:TGtkImage; begin Result := TBitmap.Create; PixBuf := gtk_image_get_pixbuf(PGtkImage(gtk_image_new_from_icon_name(Pgchar(IconName),Size))); GDIObj := Gtk2Widgetset.NewGDIObject(gdiBitmap); with GDIObj^ do begin GDIBitmapType := gbPixbuf; visual := gdk_visual_get_system(); gdk_visual_ref(visual); colormap := gdk_colormap_get_system(); gdk_colormap_ref(colormap); GDIPixbufObject := Pixbuf; end; Result := TBitmap.Create; Result.Handle := HBitmap({%H-}PtrUInt(GDIObj)); Result.MaskHandle := 0; end; begin BitBtnRefresh.Glyph := GetGTKBmp('system-software-update.svg',25); end;!
Partager