function file_selection_ok(fs) { princ(format("%s\n", fs.get_filename())); fs.destroy(); } function create_file_selection () { local vbox, hbuttonbox, fileop_c_dir, fileop_del_file, fileop_ren_file, hbox, history_pulldown, hbox2, dir_list, file_list, action_area, vbox2, label, fileop_dialog, hbuttonbox2, ok_button, cancel_button; win_file_selection = new (GtkFileSelection); win_file_selection.signal ("destroy", #win_file_selection = nil); win_file_selection.title = "file selection dialog"; win_file_selection.hide_fileop_buttons(); /* Extract some of the widget's children, and name them.*/ vbox = car(win_file_selection.children()); hbuttonbox = car(vbox.children()); fileop_c_dir = car(hbuttonbox.children()); fileop_del_file = cadr(hbuttonbox.children()); fileop_ren_file = caddr(hbuttonbox.children()); hbox = cadr(vbox.children()); history_pulldown = car(hbox.children()); hbox2 = caddr(vbox.children()); dir_list = car(hbox2.children()); file_list = cadr(hbox2.children()); action_area = car(cdddr(vbox.children())); vbox2 = cadr(cdddr(vbox.children())); label = car(vbox2.children()); fileop_dialog = cadr(vbox2.children()); hbuttonbox2 = caddr(cdddr(vbox.children())); ok_button = car(hbuttonbox2.children()); cancel_button = cadr(hbuttonbox2.children()); ok_button.signal("clicked", `file_selection_ok(@win_file_selection)); cancel_button.signal("clicked", `(@win_file_selection).destroy()); ops_hide = new(GtkButton); ops_hide.label = "Hide Fileops"; ops_hide.signal("clicked", `(@win_file_selection).hide_fileop_buttons()); action_area.pack_start(ops_hide, FALSE, FALSE, 0); ops_hide.show(); ops_show = new(GtkButton); ops_show.label = "Show Fileops"; ops_show.signal("clicked", `(@win_file_selection).show_fileop_buttons()); action_area.pack_start(ops_show, FALSE, FALSE, 0); ops_show.show(); win_file_selection.show_all(); win_file_selection; } function main () { local window, win_file_selection; TRUE=1; FALSE=0; window = create_file_selection (); window.signal ("destroy", #exit_program(0)); init_ipc("file_sel", "file_selq"); gtk_main (); }
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.