----------------------------------------------------------------------------------------------
--# GtkColorChooserWidget
----------------------------------------------------------------------------------------------
include GtkEngine.e
requires("3.04","GtkColorChooserWidget")
constant docs = `Color Chooser Widget
Select a color, hit the Select-Color button.
`
constant win = create(GtkWindow,"border=10,size=300x200,position=1,$destroy=Quit")
constant panel = create(GtkBox,"orientation=VERTICAL,spacing=10")
add(win,panel)
constant lbl = create(GtkLabel)
set(lbl,"markup",docs)
add(panel,lbl)
constant ccw = create(GtkColorChooserWidget,"rgba=LightGreen,show_editor=FALSE")
connect(ccw,"color-activated",_("ShowSelectedColor"))
add(panel,ccw)
constant
btn1 = create(GtkButton,"gtk-quit","Quit"),
btn2 = create(GtkCheckButton,"Editor",_("ToggleEditor")),
btn3 = create(GtkButton,"gtk-select-color",_("ShowSelectedColor")),
box = create(GtkButtonBox)
add(box,{btn1,btn2,btn3})
pack(panel,-box)
show_all(win)
main()
---------------------------------------
function ToggleEditor(atom ctl)
---------------------------------------
set(ccw,"show-editor",get(ctl,"active"))
return 1
end function
------------------------------------
function ShowSelectedColor()
------------------------------------
object x = get(ccw,"rgba",1)
set(lbl,"markup",sprintf("Color Chooser Widget\nColor selected: %s",{x}))
return 1
end function