55 lines
1.5 KiB
Elixir
55 lines
1.5 KiB
Elixir
|
|
||
|
--------------------------------------------------------------------------------------
|
||
|
--# Icon Themes
|
||
|
-- GTK comes with a large number of named icons. Run ~/demos/examples/icons.ex
|
||
|
-- to see them, organized by category.
|
||
|
--------------------------------------------------------------------------------------
|
||
|
|
||
|
include GtkEngine.e
|
||
|
|
||
|
constant docs = format(`<u><b>Themed Icons</b></u>
|
||
|
Enter an icon name and click OK
|
||
|
or hit <enter>.
|
||
|
|
||
|
Icon names can be found in the file
|
||
|
<a href='FILE://[]'>themeicons.txt</a>
|
||
|
`,{canonical_path(locate_file("resources/themeicons.txt"))})
|
||
|
|
||
|
object selected_icon = valid_icon_name(
|
||
|
{"face-cool","face-glasses","face-laugh","gtk-ok"})
|
||
|
|
||
|
constant win = create(GtkWindow,"position=1,border_width=10,$destroy=Quit")
|
||
|
|
||
|
constant panel = create(GtkBox,VERTICAL)
|
||
|
add(win,panel)
|
||
|
|
||
|
constant img = create(GtkImage)
|
||
|
set(img,"from icon name",selected_icon,GTK_ICON_SIZE_DIALOG)
|
||
|
add(panel,img)
|
||
|
|
||
|
constant lbl = create(GtkLabel)
|
||
|
set(lbl,"markup",docs)
|
||
|
add(panel,lbl)
|
||
|
|
||
|
constant inp = create(GtkEntry,{{"text",selected_icon}})
|
||
|
connect(inp,"activate","Foo")
|
||
|
add(panel,inp)
|
||
|
|
||
|
constant btnbox = create(GtkButtonBox,"margin top=5")
|
||
|
pack(panel,-btnbox)
|
||
|
|
||
|
constant btn1 = create(GtkButton,"gtk-quit","Quit")
|
||
|
constant btn2 = create(GtkButton,"gtk-apply","Foo")
|
||
|
add(btnbox,{btn1,btn2})
|
||
|
|
||
|
show_all(win)
|
||
|
main()
|
||
|
|
||
|
--------------------------------------------------
|
||
|
global function Foo()
|
||
|
--------------------------------------------------
|
||
|
set(img,"from icon name",get(inp,"text"),GTK_ICON_SIZE_DIALOG)
|
||
|
return 1
|
||
|
end function
|
||
|
|