eumandy/eugtk/examples/test77.ex
2016-11-25 00:33:18 -07:00

51 lines
1.4 KiB
Elixir

----------------------------------------------------------------------------
--# Numerable Icons (deprecated)
----------------------------------------------------------------------------
include GtkEngine.e
constant docs = `<u><b>Numerable Icons</b></u>
use an image or stock icon with attached numbers
<span color="red"><small>Numerable Icons are deprecated</small></span>`
constant win = create(GtkWindow,"size=200x100,border_width=5,position=1,$destroy=Quit")
constant panel = create(GtkBox,VERTICAL)
add(win,panel)
constant lbl = create(GtkLabel)
set(lbl,"markup",docs)
add(panel,lbl)
constant top = create(GtkBox,"orientation=0,spacing=20,border_width=10")
add(panel,top)
-- use whatever image you want, it will be sized to fit;
constant f = create(GFile,"thumbnails/mongoose.png")
constant ic1 = create(GFileIcon,f)
-- alternatively, load one from stock, but be careful that there
-- is actually an icon by that name in the theme currently in use,
-- otherwise, you get a 'missing image' icon.
constant ic2 = create(GThemedIcon,"preferences-desktop-locale")
object img = repeat(0,5)
object ico
for i = 1 to 5 do
ico = create(GtkNumerableIcon,ic1) -- try also ic2
img[i] = create(GtkImage)
set(ico,"count",i) -- this sets the #
set(img[i],"from gicon",ico,6)
add(top,img[i])
end for
constant btnbox = create(GtkButtonBox)
add(btnbox,create(GtkButton,"gtk-quit","Quit"))
pack(panel,-btnbox)
show_all(win)
main()