2016-11-25 00:33:18 -07:00

47 lines
1.3 KiB
Elixir

------------------------------------------------------------------------
--# Stock Buttons
-- a few buttons may not have icons, don't know why.
------------------------------------------------------------------------
include GtkEngine.e
include std/sort.e
-- Uncomment the following lines if you have spanish language support,
-- or change the country code to one of your choice;
--include std/locale.e
-- locale:set("es_MX.UTF-8")
constant list = create(GtkStockList)
object stock_ids = sort(list)
stock_ids = breakup(stock_ids,5)
constant win = create(GtkWindow,
"title=`Stock Buttons`,border_width=10,position=1,$destroy=Quit")
constant panel = create(GtkBox,VERTICAL)
add(win,panel)
constant grid = create(GtkGrid)
add(panel,grid)
constant theme = create(GtkIconTheme)
atom btn, pix, icon
for row = 1 to length(stock_ids) do
for col = 1 to length(stock_ids[row]) do
btn = create(GtkButton,stock_ids[row][col])
gtk:set(btn,"tooltip text",stock_ids[row][col])
gtk:set(grid,"attach",btn,col,row,1,1)
end for
end for
constant lbl = add(panel,create(GtkLabel,{
{"margin top",5},
{"markup","<b><u>GtkStockItems</u></b> ~ " &
"Mouse over buttons to see name, " &
"change WM themes to see what they look like in different styles"}}))
show_all(win)
main()