A.11. Font Selection

function font_selection_ok (fs)
{
  local s = fs.get_font_name();
  princ(s,"\n");
  fs.destroy();
}


function create_font_selection ()
{
  local	vbox, font_selection, hbutbox, ok_button, apply_button, cancel_button;
  
  win_font_selection = new (GtkFontSelectionDialog);
  win_font_selection.signal ("destroy", #win_font_selection = nil);
  win_font_selection.title = "Font Selection Dialog";
  win_font_selection.set_position(GTK_WIN_POS_MOUSE);
  
  /* Extract some of the widget's children, and name them.*/
  
  vbox = car(win_font_selection.children());
  font_selection = car(vbox.children());
  hbutbox = cadr(vbox.children());
  ok_button = car(hbutbox.children());
  apply_button = cadr(hbutbox.children());
  cancel_button = caddr(hbutbox.children());
  
  ok_button.signal("clicked", `font_selection_ok(@win_font_selection));
  cancel_button.signal("clicked", `(@win_font_selection).destroy());

  win_font_selection.show_all();
  win_font_selection;
}

function main ()
{
  local window, win_font_selection;
  TRUE=1;
  FALSE=0;
  window = create_font_selection ();
  window.signal ("destroy", #exit_program(0));
  init_ipc("font_sel", "font_selq");
  gtk_main ();
}