/usr/share/mozart/doc/browser/node5.html is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>4 Using Browser Objects</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node4.html#sec.browser.browsercommandsandoptions"><< Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="idx.html#label287">Next >></A></TD></TR></TABLE><DIV id="sec.browser.applicationbrowsers"><H1><A name="sec.browser.applicationbrowsers">4 Using Browser Objects</A></H1><P>All Browsers in the Oz system are Oz objects. The <CODE>BrowserClass</CODE> is the class definition of these objects. In this section the usage of these objects is described. </P><H2><A name="label233">4.1 Creating A Browser Object</A></H2><P><A name="label235"></A> One can create Browser objects similarly to the pre-defined <CODE>Browser</CODE> one: </P><BLOCKQUOTE class="code"><CODE>BrowserObject = {New Browser<SPAN class="keyword">.</SPAN><SPAN class="string">'class'</SPAN> init}</CODE></BLOCKQUOTE><P></P><P>The plain <CODE>init</CODE> method makes a newly created Browser placed on its own toplevel widget. One can tell a Browser object to use a Tk frame (see for details) as its toplevel frame: <A name="label237"></A> <A name="label239"></A> <A name="label241"></A> </P><BLOCKQUOTE class="code"><CODE><SPAN class="keyword">declare</SPAN> W F BrowserObject <SPAN class="keyword">in</SPAN> <BR>%%<SPAN class="comment"> <BR></SPAN>W = {New Tk<SPAN class="keyword">.</SPAN>toplevel tkInit(bg:ivory)}<BR>{Tk<SPAN class="keyword">.</SPAN>send wm(geometry W <SPAN class="string">"500x300"</SPAN>)}<BR>%%<SPAN class="comment"> <BR></SPAN>F = {New Tk<SPAN class="keyword">.</SPAN>frame tkInit(parent : W<BR> bd : 3<BR> bg : white<BR> relief : groove<BR> width : 450 <BR> height : 250)}<BR>{Tk<SPAN class="keyword">.</SPAN>send pack(F fill:both padx:10 pady:10 expand:<SPAN class="keyword">true</SPAN>)}<BR>%%<SPAN class="comment"> <BR></SPAN>BrowserObject = {New Browser<SPAN class="keyword">.</SPAN><SPAN class="string">'class'</SPAN> init(origWindow: F)}<BR>{BrowserObject createWindow}<BR>%%<SPAN class="comment"> <BR></SPAN>{BrowserObject<BR> browse(<BR> record(<BR> atom: bonjour<BR> quotedAtom: <SPAN class="string">'hello world'</SPAN> <BR> list: [one two three four five six seven nine]<BR> integer: 57<BR> float: 34<SPAN class="keyword">.</SPAN>56e<SPAN class="keyword">~</SPAN>76<BR> string:<SPAN class="string">"adieu, monde cruel!"</SPAN> <BR> byteString:{ByteString<SPAN class="keyword">.</SPAN>make <SPAN class="string">"squeeze me"</SPAN>}<BR> tuple: foo(one(1) two(1 2) three(1 2 3))))}</CODE></BLOCKQUOTE><P></P><P>The window produced that way is shown on <A href="node5.html#fig.browser.oz-em-browser">Figure 4.1</A>. Such a browser is called an <A name="label242"></A><EM>embedded</EM> Browser, compared to a <A name="label243"></A><EM>stand-alone</EM> Browser using its own toplevel widget. </P><DIV id="fig.browser.oz-em-browser"><HR><P><A name="fig.browser.oz-em-browser"></A></P><DIV align="center"><IMG alt="" src="emb_nicebrowser.gif"></DIV><P class="caption"><STRONG>Figure 4.1:</STRONG> An Embedded Application Browser</P><HR></DIV><P> <A name="label245"></A> <A name="label247"></A> Note that when a Browser object is created, either stand-alone or embedded, its window does not appear immediately. This happens when either <CODE>createWindow</CODE> or <CODE>browse</CODE> methods are applied.</P><P><A name="label249"></A> <A name="label251"></A> A Browser window can be closed by means of the <CODE>closeWindow</CODE> method. Each time a Browser window is closed its buffer is flushed. A Browser object itself can be closed by means of the <CODE>close</CODE> method, which deletes its window and frees used by the object memory. A subsequent application of a Browser object closed this way proceeds as it were just created\footnote{This feature is used in the pre-defined <CODE>Browser</CODE>, which can be closed many times but never dies. Note that this behavior <EM>is not</EM> ``re-creating'' since no new Browser object is created immediately.}.</P><P><A name="label253"></A> Note that the <CODE>closeWindow</CODE> method has no effect for embedded application browsers.</P><P><A name="label255"></A> An embedded browser and its frame should be closed by sending the <CODE>close</CODE> messages on the Browser object and on the frame object in that sequence. For instance, in our example it would be </P><BLOCKQUOTE class="code"><CODE> {BO close}<BR> {F close}</CODE></BLOCKQUOTE><P></P><H2><A name="label256">4.2 Browser Object Methods</A></H2><P><A name="label257"></A> <A name="label258"></A> Browser objects are controlled by user through the Browser GUI, and by means of application of them to the <CODE>BrowserClass</CODE> methods. At the glance, there are the following public methods of a Browser object, where <CODE>X</CODE> and <CODE>Y</CODE> are certain internal default values: <A name="label260"></A> <A name="label262"></A> <A name="label264"></A> <A name="label266"></A> <A name="label268"></A> <A name="label270"></A> <A name="label272"></A> <A name="label274"></A> <A name="label276"></A> <A name="label278"></A> <A name="label280"></A> <A name="label282"></A> <A name="label284"></A> <A name="label286"></A> </P><BLOCKQUOTE class="code"><CODE> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(origWindow: OrigWindow <SPAN class="keyword"><=</SPAN> X)<BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">createWindow</SPAN> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">closeWindow</SPAN> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">close</SPAN> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">browse</SPAN>(Term)<BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">break</SPAN> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">clear</SPAN> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">clearAllButLast</SPAN> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">rebrowse</SPAN> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">option</SPAN>(<SPAN class="keyword">...</SPAN>)<BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">add</SPAN>(Action label:Label <SPAN class="keyword"><=</SPAN> Y)<BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">set</SPAN>(Action)<BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">delete</SPAN>(Action)<BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">refineLayout</SPAN></CODE></BLOCKQUOTE><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node4.html#sec.browser.browsercommandsandoptions"><< Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="idx.html#label287">Next >></A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.sics.se/~kost/">Konstantin Popov</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|