123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262(**************************************************************************)(* Lablgtk *)(* *)(* This program is free software; you can redistribute it *)(* and/or modify it under the terms of the GNU Library General *)(* Public License as published by the Free Software Foundation *)(* version 2, with the exception described in file COPYING which *)(* comes with the library. *)(* *)(* 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 Library General Public License for more details. *)(* *)(* You should have received a copy of the GNU Library 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 *)(* *)(* *)(**************************************************************************)(* $Id$ *)openGauxopenGobjectopenGtkopenGtkBaseopenGtkContainersopenGtkPackopenOgtkPackPropsopenGObjopenGContainermoduleP=Box.Pclassbox_skelobj=objectinherit[[>Gtk.box]]container_implobjmethodpack?from:f?expand?fill?paddingw=Box.packobj(as_widgetw)?from:f?expand?fill?paddingmethodset_homogeneous=setP.homogeneousobjmethodhomogeneous=getP.homogeneousobjmethodset_spacing=setP.spacingobjmethodspacing=getP.spacingobjmethodset_child_packing?from:f?expand?fill?paddingw=Box.set_child_packingobj(as_widgetw)?from:f?expand?fill?paddingmethodreorder_childw=Box.reorder_childobj(as_widgetw)endclassboxobj=objectinheritbox_skelobjmethodconnect=newcontainer_signals_implobjendletboxdir=Box.make_params[]~cont:(pack_container~create:(funp->newbox(Box.createdirp)))letvbox=box`VERTICALlethbox=box`HORIZONTALclassbutton_boxobj=objectinheritbox_skelobjmethodconnect=newcontainer_signals_implobjmethodset_layout=setBBox.P.layout_styleobjmethodlayout=getBBox.P.layout_styleobjmethodget_child_secondary(w:widget)=BBox.get_child_secondaryobjw#as_widgetmethodset_child_secondary(w:widget)=BBox.set_child_secondaryobjw#as_widgetendletbutton_boxdir?spacing?layout=pack_container[]~create:(funp->letp=Property.may_consBox.P.spacingspacing(Property.may_consBBox.P.layout_stylelayoutp)inletw=BBox.createdirpinnewbutton_boxw)classtableobj=objectinheritcontainer_full(obj:Gtk.tableobj)methodprivateobj=objinherittable_propsmethodattach~left~top?right?bottom?expand?fill?shrink?xpadding?ypaddingw=Table.attachobj(as_widgetw)~left~top?right?bottom?expand?fill?shrink?xpadding?ypaddingmethodset_row_spacing=Table.set_row_spacingobjmethodset_col_spacing=Table.set_col_spacingobjendlettable=Table.make_params[]~cont:(pack_container~create:(funp->newtable(Table.createp)))classgridobj=objectinheritcontainer_full(obj:Gtk.gridobj)methodprivateobj=objinheritgrid_propsmethodattach~left~top?width?heightw=Grid.attachobj(as_widgetw)~left~top?width?heightendletgrid=Grid.make_params[]~cont:(pack_container~create:(funp->newgrid(Grid.createp)))classfixedobj=objectinheritcontainer_full(obj:Gtk.fixedobj)methodevent=newGObj.event_opsobjmethodputw=Fixed.putobj(as_widgetw)methodmovew=Fixed.moveobj(as_widgetw)endletfixed=pack_container[]~create:(funp->newfixed(Fixed.createp))classlayoutobj=objectinheritcontainer_fullobjmethodevent=newGObj.event_opsobjmethodputw=Layout.putobj(as_widgetw)methodmovew=Layout.moveobj(as_widgetw)methodset_hadjustmentadj=setLayout.P.hadjustmentobj(GData.as_adjustmentadj)methodset_vadjustmentadj=setLayout.P.vadjustmentobj(GData.as_adjustmentadj)methodset_width=setLayout.P.widthobjmethodset_height=setLayout.P.heightobjmethodhadjustment=newGData.adjustment(getLayout.P.hadjustmentobj)methodvadjustment=newGData.adjustment(getLayout.P.vadjustmentobj)methodbin_window=Layout.get_bin_windowobjmethodwidth=getLayout.P.widthobjmethodheight=getLayout.P.heightobjendletlayout?hadjustment?vadjustment?layout_width?layout_height=Layout.make_params[]?hadjustment:(may_mapGData.as_adjustmenthadjustment)?vadjustment:(may_mapGData.as_adjustmenthadjustment)?width:layout_width?height:layout_height~cont:(pack_container~create:(funp->newlayout(Layout.createp)))(*
class packer obj = object
inherit container_full (obj : Gtk.packer obj)
method pack ?side ?anchor ?expand ?fill
?border_width ?pad_x ?pad_y ?i_pad_x ?i_pad_y w =
let options = Packer.build_options ?expand ?fill () in
if border_width == None && pad_x == None && pad_y == None &&
i_pad_x == None && i_pad_y == None
then Packer.add_defaults obj (as_widget w) ?side ?anchor ~options
else Packer.add obj (as_widget w) ?side ?anchor ~options
?border_width ?pad_x ?pad_y ?i_pad_x ?i_pad_y
method set_child_packing ?side ?anchor ?expand ?fill
?border_width ?pad_x ?pad_y ?i_pad_x ?i_pad_y w =
Packer.set_child_packing obj (as_widget w) ?side ?anchor
~options:(Packer.build_options ?expand ?fill ())
?border_width ?pad_x ?pad_y ?i_pad_x ?i_pad_y
method reorder_child w = Packer.reorder_child obj (as_widget w)
method set_spacing = Packer.set_spacing obj
method set_defaults = Packer.set_defaults obj
end
let packer ?spacing ?border_width ?width ?height ?packing ?show () =
let w = Packer.create () in
may spacing ~f:(Packer.set_spacing w);
Container.set w ?border_width ?width ?height;
pack_return (new packer w) ~packing ~show
*)letcheck1obj=tryignore(Paned.get_child1obj);raise(Error"GPack.paned#add1: already full")with_->()letcheck2obj=tryignore(Paned.get_child1obj);raise(Error"GPack.paned#add1: already full")with_->()classpanedobj=objectinherit[Gtk.paned]container_implobjinheritpaned_propsmethodconnect=newcontainer_signals_implobjmethodevent=newGObj.event_opsobjmethodaddw=ifList.length(Container.childrenobj)=2thenraise(Error"Gpack.paned#add: already full");Container.addobj(as_widgetw)methodadd1w=check1obj;Paned.add1obj(as_widgetw)methodadd2w=check2obj;Paned.add2obj(as_widgetw)methodpack1?(resize=false)?(shrink=false)w=check1obj;Paned.pack1obj(as_widgetw)~resize~shrinkmethodpack2?(resize=false)?(shrink=false)w=check2obj;Paned.pack2obj(as_widgetw)~resize~shrinkmethodchild1=newwidget(Paned.get_child1obj)methodchild2=newwidget(Paned.get_child2obj)endletpaneddir=pack_container[]~create:(funp->newpaned(Paned.createdirp))classsize_group(obj:[>`sizegroup]obj)=objectinheritGObj.gtkobjobjmethodadd_widget:'a.(#widgetas'a)->_=funw->SizeGroup.add_widgetobjw#as_widgetmethodremove_widget:'a.(#widgetas'a)->_=funw->SizeGroup.remove_widgetobjw#as_widgetendletsize_group_new?mode()=GtkPack.SizeGroup.make_params?mode[]~cont:(fun_->newsize_group(GtkPack.SizeGroup.new_()))classnotebook_signalsobj=object(self)inheritcontainer_signals_implobjmethodswitch_page~callback=self#connectNotebook.S.switch_page(fun_arg1->callbackarg1)inheritnotebook_sigsendclassnotebookobj=object(self)inherit[Gtk.notebook]GContainer.container_implobjinheritnotebook_propsmethodas_notebook=(obj:>Gtk.notebookobj)methodevent=newGObj.event_opsobjmethodconnect=newnotebook_signalsobjmethodinsert_page?tab_label?menu_label?poschild=Notebook.insert_page_menuobj(as_widgetchild)~tab_label:(Gpointer.may_boxtab_label~f:as_widget)~menu_label:(Gpointer.may_boxmenu_label~f:as_widget)?posmethodappend_page?tab_label?menu_labelchild=self#insert_page?tab_label?menu_labelchildmethodprepend_page=self#insert_page~pos:0methodremove_page=Notebook.remove_pageobjmethodcurrent_page=getNotebook.P.pageobjmethodprevious_page()=Notebook.prev_pageobjmethodgoto_page=setNotebook.P.pageobjmethodnext_page()=Notebook.next_pageobjmethodpage_numw=Notebook.page_numobj(as_widgetw)methodget_nth_pagen=newwidget(Notebook.get_nth_pageobjn)methodget_tab_labelw=newwidget(Notebook.get_tab_labelobj(as_widgetw))methodget_menu_labelw=newwidget(Notebook.get_menu_labelobj(as_widgetw))methodreorder_child(w:widget)i=Notebook.reorder_childobj(as_widgetw)imethodset_page?tab_label?menu_labelpage=letchild=as_widgetpageinmaytab_label~f:(funlbl->Notebook.set_tab_labelobjchild(as_widgetlbl));maymenu_label~f:(funlbl->Notebook.set_menu_labelobjchild(as_widgetlbl))methodset_tab_reorderable(w:widget)=Notebook.set_tab_reorderableobj(as_widgetw)methodget_tab_reorderable(w:widget)=Notebook.get_tab_reorderableobj(as_widgetw)endletnotebook=Notebook.make_params[]~cont:(pack_container~create:(funp->newnotebook(Notebook.createp)))