Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 91213ddcfbe7f54821d42c2d9e091326 > files > 3039

gap-system-packages-4.4.12-5mdv2010.0.i586.rpm

<html><head><title>[xgap] 6.1 Graphic Sheet Objects</title></head>
<body text="#000000" bgcolor="#ffffff">
[<a href = "C006S000.htm">Up</a>] [<a href ="C006S002.htm">Next</a>] [<a href = "theindex.htm">Index</a>]
<h1>6.1 Graphic Sheet Objects</h1><p>
<p>
To access any graphics in XGAP you first have to create a <strong>graphic</strong>
<strong>sheet</strong> object. Such objects are linked internally to windows on the
screen. You do <strong>not</strong> have to think about redrawing, resizing and other
organizing stuff. The graphic sheet object is a <font face="Gill Sans,Helvetica,Arial">GAP</font> object
in the category <code>IsGraphicSheet</code> and should be saved because it is needed
later on for all graphic operations.
<p>
<a name = "SSEC1"></a>
<li><code>GraphicSheet( </code><var>title</var><code>, </code><var>width</var><code>, </code><var>height</var><code> ) O</code>
<p>
creates  a  graphic  sheet with  title  <var>title</var> and dimension <var>width</var>  by
<var>height</var>.  A graphic sheet  is the basic  tool  to draw something,  it is
like a piece of  paper on which you can  put your graphic objects, and to
which you  can attach your  menus.   The coordinate <var>(0,0)</var> is  the upper
left corner, <var>(<var>width</var>-1,<var>height</var>-1)</var> the lower right.
<p>
It is  possible to  change the  default behaviour of   a graphic sheet by
installing methods (or   sometimes  called callbacks) for   the following
events.  In order to  avoid  confusion with  the <font face="Gill Sans,Helvetica,Arial">GAP</font> term  ``method'' the
term ``callback'' will be used in the following.  For example, to install
the function <code>MyLeftPBDownCallback</code> as callback for the left mouse button
down  event of a graphic sheet <var>sheet</var>,  you have  to call
<code>InstallCallback</code> as follows.
<p>
<pre>
gap&gt; InstallCallback( sheet, "LeftPBDown", MyLeftPBDownCallback );
</pre>
<p>
XGAP stores for each graphic sheet a list of callback keys and a list
of callback functions for each key. That means that when a certain 
callback key is triggered for a graphic sheet then the corresponding
list of callback functions is called one function after the other. The
following keys have predefined meanings which are explained below:
  <code>Close</code>, <code>LeftPBDown</code>, <code>RightPBDown</code>, <code>ShiftLeftPBDown</code>, 
  <code>ShiftRightPBDown</code>, <code>CtrlLeftPBDown</code>, <code>CtrlRightPBDown</code>.
All of these keys are strings. You can install your own callback 
functions for new keys, however they will not be triggered automatically.
<p>
<a name = "SSEC2"></a>
<li><code>Close( </code><var>sheet</var><code> )</code>
<p>
  the function will be called as soon as the user selects ``close graphic
  sheet'',  the installed  function gets  the graphic sheet <var>sheet</var> to
  close as argument.
<p>
<a name = "SSEC3"></a>
<li><code>LeftPBDown( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code> )</code>
<p>
  the function will be called as soon as  the user presses the left mouse
  button inside  the   graphic sheet, the  installed   function  gets the
  graphic sheet <var>sheet</var>,  the <var>x</var> coordinate and  <var>y</var> coordinate of the
  pointer as arguments.
<p>
<a name = "SSEC4"></a>
<li><code>RightPBDown( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code> )</code>
<p>
  same  as <code>LeftPBDown</code> except that the  user has pressed the right mouse
  button.
<p>
<a name = "SSEC5"></a>
<li><code>ShiftLeftPBDown( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code> )</code>
<p>
  same  as <code>LeftPBDown</code> except that the  user has  pressed the left mouse
  button together with the <var>SHIFT</var> key on the keyboard.
<p>
<a name = "SSEC6"></a>
<li><code>ShiftRightPBDown( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code> )</code>
<p>
  same as  <code>LeftPBDown</code> except that the  user has pressed the right mouse
  button together with the <var>SHIFT</var> key on the keyboard.
<p>
<a name = "SSEC7"></a>
<li><code>CtrlLeftPBDown( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code> )</code>
<p>
  same  as <code>LeftPBDown</code> except that the  user has pressed  the left mouse
  button together with the <var>CTRL</var> key on the keyboard.
<p>
<a name = "SSEC8"></a>
<li><code>CtrlRightPBDown( </code><var>sheet</var><code>, </code><var>x</var><code>, </code><var>y</var><code> )</code>
<p>
  same as <code>LeftPBDown</code>  except that the  user has pressed the right mouse
  button together with the <var>CTRL</var> key on the keyboard.
<p>
Here is the documentation for the operations to control the callback 
functions:
<p>
<a name = "SSEC9"></a>
<li><code>InstallCallback( </code><var>sheet</var><code>, </code><var>key</var><code>, </code><var>func</var><code> ) O</code>
<p>
Installs a new callback function for the sheet <var>sheet</var> for the key <var>key</var>.
Note that the old functions for this key are <strong>not</strong> deleted.
<p>
<a name = "SSEC10"></a>
<li><code>RemoveCallback( </code><var>sheet</var><code>, </code><var>func</var><code>, </code><var>call</var><code> ) O</code>
<p>
Removes an old callback. Note that you have to specify not only the 
<var>key</var> but also explicitly the <var>func</var> which should be removed from the 
list!
<p>
<a name = "SSEC11"></a>
<li><code>Callback( </code><var>sheet</var><code>, </code><var>key</var><code>, </code><var>args</var><code> ) O</code>
<p>
Executes all callback functions of the sheet <var>sheet</var> that are stored under
the key <var>func</var> with the argument list <var>args</var>.
<p>
Every graphic object in XGAP can be <var>alive</var> or not. This is controlled
by the filter <code>IsAlive</code>. Being <var>alive</var> means that the object can be used
for further operations. If for example the user closes a window by a 
mouse operation the corresponding graphic sheet object is no longer 
<var>alive</var>.
<p>
<a name = "SSEC12"></a>
<li><code>IsAlive( </code><var>gobj</var><code> ) F</code>
<p>
This filter controls if a graphic object is <var>alive</var>, meaning that it can
be used for further graphic operations.
<p>
The following operations apply to graphic sheets:
<p>
<a name = "SSEC13"></a>
<li><code>Close( </code><var>sheet</var><code> ) O</code>
<p>
The graphic sheet <var>sheet</var> is closed which means that the corresponding
window is closed and the sheet becomes <var>not alive</var>.
<p>
<a name = "SSEC14"></a>
<li><code>Resize( </code><var>sheet</var><code>, </code><var>width</var><code>, </code><var>height</var><code> ) O</code>
<p>
The <var>width</var> and <var>height</var> of the sheet <var>sheet</var> are changed. That does <strong>not</strong> 
automatically mean that the window size is changed. It may also happen
that only the scrollbars are changed.
<p>
<a name = "SSEC15"></a>
<li><code>WindowId( </code><var>sheet</var><code> ) A</code>
<p>
Every graphic sheet has a unique number, its <var>window id</var>. This is mainly
used internally.
<p>
<a name = "SSEC16"></a>
<li><code>SetTitle( </code><var>sheet</var><code>, </code><var>title</var><code> ) O</code>
<p>
Every graphic sheet has a title which appears somewhere on the window.
It is initially set via the call to the constructor <code>GraphicSheet</code> and
can be changed later with this operation.
<p>
<a name = "SSEC17"></a>
<li><code>SaveAsPS( </code><var>sheet</var><code>, </code><var>filename</var><code> ) O</code>
<p>
Saves the graphics in the sheet <var>sheet</var> as postscript into the file
<var>filename</var>, which is overwritten, if it exists.
<p>
<a name = "SSEC18"></a>
<li><code>FastUpdate( </code><var>sheet</var><code>, </code><var>flag</var><code> ) O</code>
<p>
Switches the <code>UseFastUpdate</code> filter for the sheet <var>sheet</var> to the
boolean value of <var>flag</var>. If this filter is set for a sheet, the screen
is no longer updated completely if a graphic object is moved or
deleted.  You should call <code>FastUpdate( </code><var>sheet</var><code>, true )</code> before you
start large rearrangements of the graphic objects and 
<code>FastUpdate( </code><var>sheet</var><code>, false )</code> at the end.
<p>
<p>
[<a href = "C006S000.htm">Up</a>] [<a href ="C006S002.htm">Next</a>] [<a href = "theindex.htm">Index</a>]
<P>
<address>xgap manual<br>Mai 2003
</address></body></html>