123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130(**************************************************************************)(* 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$ *)openGauxopenGobjectopenGtkopenGtkBaseopenGtkDataopenGObjopenOgtkBasePropsclassadjustment_signalsobj=object(self)inherit[_]gobject_signalsobjinheritadjustment_sigsendclassadjustmentobj=object(self)inheritgtkobjobjinheritadjustment_propsmethodas_adjustment:Gtk.adjustmentobj=objmethodconnect=newadjustment_signalsobjmethodclamp_page=Adjustment.clamp_pageobjmethodset_bounds?lower?upper?step_incr?page_incr?page_size()=mayself#set_lowerlower;mayself#set_upperupper;mayself#set_step_incrementstep_incr;mayself#set_page_incrementpage_incr;mayself#set_page_sizepage_sizeendletadjustment?(value=0.)?(lower=0.)?(upper=100.)?(step_incr=1.)?(page_incr=10.)?(page_size=10.)()=letw=Adjustment.create~value~lower~upper~step_incr~page_incr~page_sizeinnewadjustmentwletas_adjustment(adj:adjustment)=adj#as_adjustmentletwrap_adjustmentw=newadjustment(unsafe_castw)letunwrap_adjustmentw=unsafe_castw#as_adjustmentletconv_adjustment_option={kind=`OBJECT;proj=(function`OBJECTc->may_map~f:wrap_adjustmentc|_->failwith"GObj.get_object");inj=(func->`OBJECT(may_map~f:unwrap_adjustmentc))}letconv_adjustment={kind=`OBJECT;proj=(function`OBJECT(Somec)->wrap_adjustmentc|`OBJECTNone->raiseGpointer.Null|_->failwith"GObj.get_object");inj=(func->`OBJECT(Some(unwrap_adjustmentc)))}classclipboard_skelclip=object(self)methodas_clipboard=Lazy.forceclipmethodclear()=self#call_clear;Clipboard.clearself#as_clipboardmethodset_text=self#call_clear;Clipboard.set_textself#as_clipboardmethodtext=Clipboard.wait_for_textself#as_clipboardmethodset_image=self#call_clear;Clipboard.set_imageself#as_clipboardmethodimage=Clipboard.wait_for_imageself#as_clipboardmethodtargets=Clipboard.wait_for_targetsself#as_clipboardmethodget_contents~target=newGObj.selection_data(Clipboard.wait_for_contentsself#as_clipboard~target)methodprivatecall_clear=()end(* Additions by SooHyoung Oh *)letdefault_get_cbcontext~info~time=()classclipboard~selection=object(self)inheritclipboard_skel(lazy(GtkBase.Clipboard.getselection))valmutablewidget=Nonevalmutableget_cb=default_get_cbvalmutableclear_cb=Nonemethodprivatecall_getcontext~info~time=get_cbcontext~info~timemethodprivatecall_clear=matchclear_cbwithNone->()|Somecb->get_cb<-default_get_cb;clear_cb<-None;cb()methodprivateinit_widget=matchwidgetwithSomew->w|None->letw=newGObj.widget(GtkBin.Invisible.create[])inwidget<-Somew;ignore(w#misc#connect#selection_get~callback:self#call_get);ignore((newGObj.event_signalsw#as_widget)#selection_clear~callback:(fun_->self#call_clear;true));wmethodset_contents~targets~get:get_func~clear:clear_func=letwidget:widget=self#init_widgetinself#call_clear;get_cb<-get_func;clear_cb<-Someclear_func;widget#misc#grab_selectionselection;widget#misc#clear_selection_targetsselection;List.iter(funtarget->widget#misc#add_selection_target~targetselection)targetsendletclipboardselection=newclipboard~selectionletas_clipboardclip=clip#as_clipboard