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

63 lines
1.9 KiB
Elixir

-------------------------------------------------------------------------------
--# GtkPaned - split window with adjustable divider
--
-- a widget with two adjustable 'panes' either side-by-side or above/below.
-- each pane is a container which can hold one other widget such as ListView,
-- Image, Box, etc.
-------------------------------------------------------------------------------
include GtkEngine.e
constant docs = `<b><u>GtkPaned</u></b>
a container with an adjustable divider`
constant win = create(GtkWindow,
"size=430x400,border_width=10,position=1,$destroy=Quit")
constant panel = create(GtkBox,"orientation=VERTICAL")
add(win,panel)
constant lbl1 = create(GtkLabel)
set(lbl1,"markup",docs)
pack(panel,lbl1)
constant paned = create(GtkPaned,
"orientation=1,position=220,tooltip markup=Slide the handle below the pix up or down")
add(panel,paned)
constant img1 = create(GtkImage,"thumbnails/jeff.jpg")
set(paned,"add1",img1)
constant lbl2 = create(GtkLabel,"font=8,line wrap=TRUE")
set(lbl2,"markup",LGPL)
constant scrolwin = create(GtkScrolledWindow)
set(scrolwin,"policy",GTK_POLICY_ALWAYS)
set(paned,"add2",scrolwin)
constant scroller = create(GtkViewport)
add(scrolwin,scroller)
add(scroller,lbl2)
constant btnbox = create(GtkButtonBox,"margin top=5")
constant btn1 = create(GtkButton,"gtk-quit","Quit")
constant btn2 = create(GtkButton,"gtk-help",call_back(routine_id("Foo")))
add(btnbox,{btn1,btn2})
pack(panel,-btnbox)
show_all(win)
main()
------------------------------------------------------------------------
function Foo()
------------------------------------------------------------------------
Info(win,"OK","<u>GtkPaned</u>",
"Grab the bar [...] below the photo\nand slide it up/down")
return 1
end function
--[1] orientation can be VERTICAL or HORIZONTAL
--[2] position of the divider, in pixels from top (or left)