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

54 lines
1.2 KiB
Elixir

------------------------------------------------------------------------
--# CSS styling
-- If you run this from an xterm or from WEE with term,
-- you can see the css code displayed
------------------------------------------------------------------------
include GtkEngine.e
constant css = locate_file("resources/mystyle4.css")
constant docs = `
<b><u>CSS Styling</u></b>
Users can modify appearance
without changing your code!
(see resources/mystyle.css)
`
constant win = create(GtkWindow,"border_width=10,position=1,$destroy=Quit")
constant panel = create(GtkBox,VERTICAL)
add(win,panel)
constant lbl1 = create(GtkLabel,"font=Courier bold 16")
set(lbl1,"markup",docs)
add(panel,lbl1)
constant
btn = create(GtkButton,"gtk-quit","Quit"),
box = create(GtkButtonBox,"margin_left=10,margin_right=10,margin_bottom=10")
add(box,btn)
pack(panel,-box)
constant cow = create(GtkImage,"thumbnails/cowbell2.png")
pack(panel,-cow)
constant lbl2 = create(GtkLabel,"text=MOO?,name=cowsay")
-- name required so that css can refer to this by name
add(panel,lbl2)
constant provider = create(GtkCssProvider,css)
display(read_file(css)) -- just puts css on terminal
show_all(win)
main()