12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485(*********************************************************************************)(* OCaml-Stk *)(* *)(* Copyright (C) 2023-2024 INRIA All rights reserved. *)(* Author: Maxence Guesdon, INRIA Saclay *)(* *)(* This program is free software; you can redistribute it and/or modify *)(* it under the terms of the GNU General Public License as *)(* published by the Free Software Foundation, version 3 of the License. *)(* *)(* This program is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU General Public License for more details. *)(* *)(* You should have received a copy of the GNU General Public *)(* License along with this program; if not, write to the Free Software *)(* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *)(* 02111-1307 USA *)(* *)(* As a special exception, you have permission to link this program *)(* with the OCaml compiler and distribute executables, as long as you *)(* follow the requirements of the GNU GPL in regard to all of the *)(* software in the executable aside from the OCaml compiler. *)(* *)(* Contact: Maxence.Guesdon@inria.fr *)(* *)(*********************************************************************************)(** Default application. *)(** This class defines a standard window for application, with
a menu bar and standard menu items. *)classapp?rflags?resizable?show?x?y?w?htitle=letwindow=App.create_window?rflags?resizable?show?x?y?w?htitleinletvbox=Pack.vbox~pack:window#set_child()inletmenubar=Menu.menubar~pack:vbox#pack()inlet(mi_file,mi_file_label)=Menu.label_menuitem~text:"File"()inletmenu_file=Menu.menu~name:"menu_file"()inlet(mi_quit,mi_quit_label)=Menu.label_menuitem~text:"Quit"()inlet(mi_edit,mi_edit_label)=Menu.label_menuitem~text:"Edit"()inletmenu_edit=Menu.menu~name:"menu_edit"~pack:mi_edit#set_menu()inlet(mi_copy,mi_copy_label)=Menu.label_menuitem~name:"mi_copy"~text:"Copy"~pack:menu_edit#add_item()inlet(mi_cut,mi_cut_label)=Menu.label_menuitem~name:"mi_cut"~text:"Cut"~pack:menu_edit#add_item()inlet(mi_paste,mi_paste_label)=Menu.label_menuitem~name:"mi_paste"~text:"Paste"~pack:menu_edit#add_item()inlet_id=mi_quit#connectWidget.Activated(fun()->App.quit())inobjectmethodwindow=windowmethodmainbox:unitPack.box=vboxmethodmenubar=menubarmethodmi_file=mi_filemethodmenu_file=menu_filemethodmi_file_label=mi_file_labelmethodmi_quit=mi_quitmethodmi_quit_label=mi_quit_labelmethodmi_edit=mi_editmethodmi_edit_label=mi_edit_labelmethodmenu_edit=menu_editmethodmi_copy=mi_copymethodmi_copy_label=mi_copy_labelmethodmi_cut=mi_cutmethodmi_cut_label=mi_cut_labelmethodmi_paste=mi_pastemethodmi_paste_label=mi_paste_labelmethodrun=App.run()initializermenu_file#add_itemmi_quit;mi_file#set_menumenu_file;menubar#add_itemmi_file;menubar#add_itemmi_edit;end