#!/usr/bin/env exu
----------------------------------
-- GtkAboutDialog   Aug.2, 2008
----------------------------------
include GtkEngine.e
include dll.e -- required for call_backs

constant win = create(GtkWindow)
	connect(win,"destroy",quit)
	set(win,"default size",300,300)
	set(win,"position",1)

----------------------------------------
function GotoWeb(atom ctl, atom data)
----------------------------------------
	object addr = peek_string(data)
	return Info(win,"Browse Web",sprintf(
           "Browse the website:\n%s\n(not really)",{addr}))
end function
constant goto_web = call_back(routine_id("GotoWeb"))

-----------------------------------------
function GotoMail(atom ctl, atom data)
-----------------------------------------
	object addr = peek_string(data)
	return Info(win,"Send Mail",sprintf(
           "Send an e-mail to\n%s\n(not really)",{addr}))
end function
constant goto_mail = call_back(routine_id("GotoMail"))

-------------------------------------------
-- Create the AboutDialog
-------------------------------------------

constant aboutdlg = create(GtkAboutDialog)

-- ----------------------------------------------
-- hooks must be initialized first,
-- otherwise they don't work right
-- ----------------------------------------------
	junk = get(aboutdlg,"set url hook",goto_web)
	junk = get(aboutdlg,"set email hook",goto_mail)

-- -------------------------------------
-- now, initialize the other properties
-- -------------------------------------
	set(aboutdlg,"Program Name","EuGTK")
	set(aboutdlg,"Version","0.01")
	set(aboutdlg,"Copyright","Copyright 2008 by Irv Mullins")
	set(aboutdlg,"License",LGPL)
	set(aboutdlg,"Wrap License",TRUE)
	set(aboutdlg,"Authors",{"Irv Mullins ","Mike Sabal","Ron Tarrant"})
	set(aboutdlg,"Artists",{"Vince Van Go","Pablo Pickaxo","Salvadore Dolly"})
	set(aboutdlg,"Documenters",{"Who knows -","Any Volunteers?"})
	set(aboutdlg,"Website","http://www.rapideuphoria.com")
	set(aboutdlg,"Website Label","Euphoria")
	set(aboutdlg,"Translator Credits","Kay Pasa ")

------------------------------------
function About() -- runs the dialog
------------------------------------
	if get(aboutdlg,"run") then
		hide(aboutdlg)
	end if
	return 1
end function

-----------------------------------------------
-- MAIN
-----------------------------------------------

constant about = call_back(routine_id("About"))

constant panel = create(GtkVBox)
	add(win,panel)

constant image = create(GtkImage,"MorningRain.jpg")
	add(panel,image)

constant btn1 = create(GtkButton,"gtk-quit")
	set(btn1,"tooltip text","Click to quit the program")
	connect(btn1,"clicked",quit)

constant btn2 = create(GtkButton,"gtk-about")
	set(btn2,"tooltip text","Click me!")
	connect(btn2,"clicked",about)

constant btnbox = create(GtkHButtonBox)
	set(btnbox,"border width",10)
	pack(panel,-btnbox)
	add(btnbox,{btn1,btn2})

show_all(win)
main()

--------------------------------------------------------------
-- copyright 2008 by Irv Mullins, code released under the LGPL
--------------------------------------------------------------