' ***********************************************************
' PROGRAM:      frame-gtk.bac
' PURPOSE:      port of frame.c
' AUTHOR:               vovchik
' COMMENTS:     GPL
' MODDED:                              
' DEPENDS:      bacon 0.19 beta, gtk
' PLATFORM:     Linux (actually, any *nix)
' DATE:         19-10-2010
' VERSION:      0.1a
' ***********************************************************

' *****************
' INIT VARS
' *****************

SETENVIRON "LANG", "C"
MY_VERSION$ = "v. 0.1a"

' *****************
' END INIT VARS
' *****************

' *****************
' IMPORTS
' *****************

IMPORT "g_signal_connect_data(long,char*,long,long,long,int)" FROM "libgobject-2.0.so" TYPE void
IMPORT "gtk_container_add(long,long)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_container_set_border_width(long,int)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_frame_new(char*)" FROM "libgtk-x11-2.0.so" TYPE long
IMPORT "gtk_frame_set_shadow_type(long,int)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_init(int*,void*)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_main" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_main_quit" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_table_attach_defaults(long,long,int,int,int,int)" FROM "libgtk-x11-2.0.so" TYPE long
IMPORT "gtk_table_new(int,int,int)" FROM "libgtk-x11-2.0.so" TYPE long
IMPORT "gtk_table_set_col_spacings(long,int)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_table_set_row_spacings(long,int)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_widget_show_all(long)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_window_new(int)" FROM "libgtk-x11-2.0.so" TYPE long
IMPORT "gtk_window_set_default_size(long,int,int)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_window_set_position(long,int)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_window_set_title(long,char*)" FROM "libgtk-x11-2.0.so" TYPE void

' *****************
' END IMPORTS
' *****************

' *****************
' DECLARATIONS
' *****************

DECLARE top_level, window, table, frame1, frame2, frame3, frame4

' *****************
' END DECLARATIONS
' *****************


' *****************
' SUBROUTINES
' *****************

' -----------------
SUB destroy(NUMBER widget, void* data)
' -----------------
    gtk_main_quit
END SUB

' *****************
' END SUBROUTINES
' *****************


' *****************
' MAIN
' *****************

gtk_init(0, 0)  
window = gtk_window_new(top_level)
gtk_window_set_position(window, 0)
gtk_window_set_default_size(window, 250, 250)
gtk_window_set_title(window, CONCAT$("GtkFrame - ", MY_VERSION$))
gtk_container_set_border_width(window, 10)
table = gtk_table_new(2, 2, TRUE)
gtk_table_set_row_spacings(table, 10)
gtk_table_set_col_spacings(table, 10)
gtk_container_add(window, table)
frame1 = gtk_frame_new("Shadow In")
gtk_frame_set_shadow_type(frame1, 1)
frame2 = gtk_frame_new("Shadow Out")
gtk_frame_set_shadow_type(frame2, 2)
frame3 = gtk_frame_new("Shadow Etched In")
gtk_frame_set_shadow_type(frame3, 3)
frame4 = gtk_frame_new("Shadow Etched Out")
gtk_frame_set_shadow_type(frame4, 4)
gtk_table_attach_defaults(table, frame1, 0, 1, 0, 1)
gtk_table_attach_defaults(table, frame2, 0, 1, 1, 2)
gtk_table_attach_defaults(table, frame3, 1, 2, 0, 1)
gtk_table_attach_defaults(table, frame4, 1, 2, 1, 2)
g_signal_connect_data(window, "destroy", ADDRESS(destroy), 0, 0, 0)
gtk_widget_show_all(window)
gtk_main

' *****************
' END MAIN
' *****************