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

70 lines
2.1 KiB
Elixir

--------------------------------------------------------------------------
--# Auto-Scrolling text
--------------------------------------------------------------------------
include GtkEngine.e
object txt =
"This library is free software; you can redistribute it " &
"and/or modify it under the terms of the GNU Lesser General " &
"Public License as published by the Free Software Foundation; " &
"either version 2 of the License, or (at your option) any later " &
"version. \n\n" &
"This library is distributed in the hope that it will be useful, " &
"but WITHOUT ANY WARRANTY; without even the implied warranty of " &
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " &
"See the GNU Lesser General Public License for more details. \n\n" &
"You should have received a copy of the GNU Lesser General Public " &
"License along with this library; if not, write to the Free Software " &
"Foundation, Inc., 59 Temple Pl, Suite 330, Boston, MA 02111-1307 USA \n\n"
txt = "<b>EuGTK is licensed under the LGPL</b>\n\n" & txt & txt & txt & "<b><i>That's All, Folks!</i></b>\n"
constant win = create(GtkWindow,"size=600x280,border=10,position=1,$destroy=Quit")
constant panel = create(GtkBox,"orientation=HORIZONTAL")
add(win,panel)
constant ebox = create(GtkEventBox,"background=cornsilk")
add(panel,ebox)
atom eupix = create(GdkPixbuf,"thumbnails/euphoria-linux.gif")
eupix = get(eupix,"scale simple",200,200,1)
constant euimg = create(GtkImage,eupix)
add(ebox,euimg)
constant hadj = create(GtkAdjustment,0,0,1000,.01,.01,.01),
vadj = create(GtkAdjustment,0,0,1000,.01,.01,.01)
atom pos = 1
constant scrolwin = create(GtkScrolledWindow,hadj,vadj)
set(scrolwin,"border width",10)
pack(panel,scrolwin,TRUE,TRUE)
constant scroller = create(GtkViewport)
add(scrolwin,scroller)
constant lbl1 = create(GtkLabel,{
{"markup",txt},
{"line wrap",TRUE}})
add(scroller,lbl1)
constant timer = create(GTimeout,6,call_back(routine_id("Scroll")))
show_all(win)
main()
--------------------------
global function Scroll()
---------------------------
pos += .1
if pos > 50 then
set(vadj,"value",pos-50)
end if
return 1
end function