(* This file is created with Camldsgn *)

#open "windows";;
#open "camlwin";;




#open "ic_empty";;


let win_width = 150;;
let win_height = 100;;


let MorpionWin_def = 
{
  win_left     = (screen_width() - (gr_to_real_coord win_width))/2;
  win_top      = (screen_height() + (gr_to_real_coord win_height))/2;
  win_width    = win_width;
  win_height   = win_height;
  win_id       = gr_undef_window;
  win_name     = "Morpion";
  win_state    = Destroyed
};;

let place_0_0 =
{
  bm_window   = MorpionWin_def;
  bm_left     = 5;
  bm_top      = 85;
  bm_bitmap   = make_image ic_empty;
  bm_callback = gr_do_nothing
};;

let rond_0_0 =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (place_0_0.bm_left+8, place_0_0.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let place_1_0 =
{
  bm_window   = MorpionWin_def;
  bm_left     = 30;
  bm_top      = 85;
  bm_bitmap   = make_image ic_empty;
  bm_callback = gr_do_nothing
};;

let rond_1_0 =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (place_1_0.bm_left+8, place_1_0.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let place_2_0 =
{
  bm_window   = MorpionWin_def;
  bm_left     = 55;
  bm_top      = 85;
  bm_bitmap   = make_image ic_empty;
  bm_callback = gr_do_nothing
};;

let rond_2_0 =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (place_2_0.bm_left+8, place_2_0.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let place_0_1 =
{
  bm_window   = MorpionWin_def;
  bm_left     = 5;
  bm_top      = 60;
  bm_bitmap   = make_image ic_empty;
  bm_callback = gr_do_nothing
};;

let rond_0_1 =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (place_0_1.bm_left+8, place_0_1.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let place_1_1 =
{
  bm_window   = MorpionWin_def;
  bm_left     = 30;
  bm_top      = 60;
  bm_bitmap   = make_image ic_empty;
  bm_callback = gr_do_nothing
};;

let rond_1_1 =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (place_1_1.bm_left+8, place_1_1.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let place_2_1 =
{
  bm_window   = MorpionWin_def;
  bm_left     = 55;
  bm_top      = 60;
  bm_bitmap   = make_image ic_empty;
  bm_callback = gr_do_nothing
};;

let rond_2_1 =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (place_2_1.bm_left+8, place_2_1.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let place_0_2 =
{
  bm_window   = MorpionWin_def;
  bm_left     = 5;
  bm_top      = 35;
  bm_bitmap   = make_image ic_empty;
  bm_callback = gr_do_nothing
};;

let rond_0_2 =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (place_0_2.bm_left+8, place_0_2.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let place_1_2 =
{
  bm_window   = MorpionWin_def;
  bm_left     = 30;
  bm_top      = 35;
  bm_bitmap   = make_image ic_empty;
  bm_callback = gr_do_nothing
};;

let rond_1_2 =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (place_1_2.bm_left+8, place_1_2.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let place_2_2 =
{
  bm_window   = MorpionWin_def;
  bm_left     = 55;
  bm_top      = 35;
  bm_bitmap   = make_image ic_empty;
  bm_callback = gr_do_nothing
};;

let rond_2_2 =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (place_2_2.bm_left+8, place_2_2.bm_top-8);
  el_xray     = 8;
  el_yray     = 8
};;

let rond_player =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (95, 59);
  el_xray     = 8;
  el_yray     = 8
};;

let rond_caml =
{
  el_window   = MorpionWin_def;
  el_filled   = true;
  el_color    = black;
  el_center   = (95, 39);
  el_xray     = 8;
  el_yray     = 8
};;

let help = 
{
  hl_window   = MorpionWin_def;
  hl_help     = "It's your turn"
};;

let player_prt = 
{
  pt_window   = MorpionWin_def;
  pt_left     = 105;
  pt_top      = 62;
  pt_name     = "Player"
};;

let caml_ptr = 
{
  pt_window   = MorpionWin_def;
  pt_left     = 105;
  pt_top      = 42;
  pt_name     = "Computer"
};;

let quit_button = 
{
  bt_window   = MorpionWin_def;
  bt_left     = 87;
  bt_top      = 27;
  bt_width    = 48;
  bt_height   = 11;
  bt_state    = Up;
  bt_name     = string_type "Quit";
  bt_callback = gr_do_nothing
};;

let new_game = 
{
  it_window   = MorpionWin_def;
  it_name     = "New Game";
  it_state    = Unselected;
  it_callback = gr_do_nothing
};;

let config_color = 
{
  it_window   = MorpionWin_def;
  it_name     = "Color";
  it_state    = Unselected;
  it_callback = gr_do_nothing
};;

let config_turn = 
{
  it_window   = MorpionWin_def;
  it_name     = "Turn";
  it_state    = Unselected;
  it_callback = gr_do_nothing
};;

let menu17 = 
{
  mn_window   = MorpionWin_def;
  mn_left     = 0;
  mn_top      = 0;
  mn_nu_item  = 0;
  mn_hide_area= gr_empty_image;
  mn_name     = "New game";
  mn_state    = Unvisible;
  mn_items    = [|
                 new_game
                |]
};;

let menu18 = 
{
  mn_window   = MorpionWin_def;
  mn_left     = 0;
  mn_top      = 0;
  mn_nu_item  = 0;
  mn_hide_area= gr_empty_image;
  mn_name     = "Configuration";
  mn_state    = Unvisible;
  mn_items    = [|
                 config_color;
                 config_turn
                |]
};;

let toolbar = 
{
  tb_window   = MorpionWin_def;
  tb_items    = [|
                 menu18;
                 menu17
                |]
};;

let MorpionWin = 
{
  win_def      = MorpionWin_def;
  win_objects  = [
                  g_bitmap    place_0_0;
                  g_bitmap    place_1_0;
                  g_bitmap    place_2_0;
                  g_bitmap    place_0_1;
                  g_bitmap    place_1_1;
                  g_bitmap    place_2_1;
                  g_bitmap    place_0_2;
                  g_bitmap    place_1_2;
                  g_bitmap    place_2_2;
                  g_ellipse   rond_0_0;
                  g_ellipse   rond_1_0;
                  g_ellipse   rond_2_0;
                  g_ellipse   rond_0_1;
                  g_ellipse   rond_1_1;
                  g_ellipse   rond_2_1;
                  g_ellipse   rond_0_2;
                  g_ellipse   rond_1_2;
                  g_ellipse   rond_2_2;
                  g_ellipse   rond_player;
                  g_ellipse   rond_caml;
                  g_helpbar   help;
                  g_prompt    player_prt;
                  g_prompt    caml_ptr;
                  g_button    quit_button;
                  g_toolbar   toolbar
                 ]
;
  time_callback = gr_do_nothing;
  resize_callback = gr_do_nothing;
  help_file = "";
  miscellaneous = [| |]
};;

quit_button.bt_callback <- gr_quit_callback;;

