added eugtk examples
This commit is contained in:
72
eugtk/examples/test159.ex
Normal file
72
eugtk/examples/test159.ex
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
--# Inline CSS is not really recommended, but it's easy enough to use;
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
|
||||
sequence docs = `
|
||||
|
||||
|
||||
|
||||
<u><b>CSS styling</b></u> from in-line data`
|
||||
|
||||
ifdef WINDOWS then
|
||||
docs &= "\nSorry, CSS backgrounds from files don't work in Windows")
|
||||
end ifdef
|
||||
|
||||
constant styling = text:format(`
|
||||
|
||||
GtkWindow {
|
||||
background-image: uri("[]");
|
||||
border-radius: 200px;
|
||||
}
|
||||
|
||||
GtkLabel#cowsay {
|
||||
font: Comic Sans MS, Purisa Bold 48;
|
||||
color: white;
|
||||
text-shadow: 4px 4px #140B91;
|
||||
}
|
||||
|
||||
GtkButton:hover {
|
||||
background-color: #08F320;
|
||||
}
|
||||
|
||||
GtkButton:active {
|
||||
background-color: #F30808;
|
||||
}
|
||||
`,
|
||||
{canonical_path("~/demos/thumbnails/nature_small.jpg")})
|
||||
|
||||
constant win = create(GtkWindow,
|
||||
"size=420x420,border_width=10,position=1,$destroy=Quit")
|
||||
|
||||
constant panel = create(GtkBox,VERTICAL)
|
||||
add(win,panel)
|
||||
|
||||
constant lbl0 = create(GtkLabel,{
|
||||
{"name","first"},
|
||||
{"markup",docs}})
|
||||
pack(panel,lbl0)
|
||||
|
||||
constant lbl1 = create(GtkLabel,"name=cowsay")
|
||||
set(lbl1,"markup",`MOO<span size="x-small">(n)</span>?`)
|
||||
pack(panel,lbl1)
|
||||
|
||||
constant cow = create(GtkImage,"thumbnails/cowbell.png")
|
||||
pack(panel,cow)
|
||||
|
||||
constant btn1 = create(GtkButton,"gtk-quit","Quit")
|
||||
|
||||
constant btnbox = create(GtkButtonBox)
|
||||
add(btnbox,btn1)
|
||||
pack(panel,-btnbox)
|
||||
|
||||
constant css = create(GtkCssProvider,styling)
|
||||
display(styling)
|
||||
show_all(win)
|
||||
main()
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user