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

51 lines
1.3 KiB
Elixir

-------------------------------------------------------------------
--# Using CSS for styling... this uses a radial gradient background
-------------------------------------------------------------------
sequence fnt = "Purisa 48"
ifdef WINDOWS then fnt = "Comic Sans MS bold 48" end ifdef
include GtkEngine.e
include resources/mongoose.e
constant cssfile = locate_file("resources/mystyle2.css")
constant docs = `
<b><u>Radial Gradient</u></b>
specified in mystyle2.css`
constant win = create(GtkWindow,"border=5,size=400x300,position=1,$destroy=Quit")
constant panel = create(GtkBox,VERTICAL)
add(win,panel)
constant css = create(GtkCssProvider,cssfile)
display(read_file(cssfile)) -- optional: show code on terminal
constant lbl0 = create(GtkLabel)
set(lbl0,"markup",docs)
pack(panel,lbl0)
constant lbl1 = create(GtkLabel,"markup=Moo?,angle=23")
set(lbl1,"font",fnt)
pack(panel,lbl1)
constant cow = create(GtkImage,"thumbnails/coweat2.png")
pack(panel,cow)
constant btn1 = create(GtkButton,"gtk-quit","Quit")
set(btn1,"name","button1") -- required so that css can set this by name
-- note: most themes prevent buttons from having background colors.
constant btnbox = create(GtkButtonBox)
add(btnbox,btn1)
pack(panel,-btnbox)
show_all(win)
main()