<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2000</year>
      <year>2010</year>
      <holder>Ericsson AB, All Rights Reserved</holder>
    </copyright>
    <legalnotice>
  The contents of this file are subject to the Erlang Public License,
  Version 1.1, (the "License"); you may not use this file except in
  compliance with the License. You should have received a copy of the
  Erlang Public License along with this software. If not, it can be
  retrieved online at http://www.erlang.org/.

  Software distributed under the License is distributed on an "AS IS"
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  the License for the specific language governing rights and limitations
  under the License.

  The Initial Developer of the Original Code is Ericsson AB.
    </legalnotice>

    <title>gs</title>
    <prepared>Gunilla Hugosson</prepared>
    <docno></docno>
    <date></date>
    <rev></rev>
  </header>
  <module>gs</module>
  <modulesummary>The Graphics System for Erlang.</modulesummary>
  <description>
    <warning>
      <p>
	GS is not recommended for use in new applications.
	Instead we recommend WX for applications that need a
	graphical user interface.
      </p>
      <p>
	GS is not maintained and we plan to deprecate and remove it from
	the distribution as soon as possible, maybe already in the next
	major release (R15).
      </p>
    </warning>
    <p>The Graphics System, GS, is easy to learn and
      designed to be portable to many different platforms.</p>
    <p>In the description below, the type <c><![CDATA[gsobj()]]></c> denotes a
      reference to a graphical object created with GS. Such a reference
      is either a GS object identifier or the name of the object (an atom),
      if such a name exists.
      The functions all return the specified values or <c><![CDATA[{error,Reason}]]></c>
      if an error occurs.</p>
    <p>Please refer to the GS User's Guide for a description of
      the different object types and possible options.</p>
  </description>
  <funcs>
    <func>
      <name>config(GSObj, Options) -> ok</name>
      <fsummary>Configure a graphical object.</fsummary>
      <type>
        <v>GSOBj = gsobj()</v>
        <v>Options = [Option] | Option</v>
        <v>&nbsp;Option = {Key,Value}</v>
      </type>
      <desc>
        <p>Configures a graphical object according to the specified
          options.</p>
      </desc>
    </func>
    <func>
      <name>create(ObjType, Parent) -> ObjId</name>
      <name>create(ObjType, Parent, Options) -> ObjId</name>
      <name>create(ObjType, Name, Parent, Options) -> ObjId</name>
      <fsummary>Create a new graphical object.</fsummary>
      <type>
        <v>ObjType = atom()</v>
        <v>Parent = gsobj()</v>
        <v>Name = atom()</v>
        <v>Options = [Option] | Option</v>
        <v>&nbsp;Option = {Key,Value}</v>
      </type>
      <desc>
        <p>Creates a new graphical object of the specified type as a child
          to the specified parent object. The object is configured according
          to the options and its identifier is returned. If no options
          are provided, default option values are used.</p>
        <p>If a name is provided, this name can be used to reference
          the object instead of the object identifier. The name is local
          to the process which creates the object.</p>
        <p>The following object types exist: <c><![CDATA[window | button | radiobutton | checkbutton | label | frame | entry | listbox | canvas | arc | image | line | oval | polygon | rectangle | text | menubar | menubutton | menu | menuitem | grid | gridline | editor | scale]]></c></p>
      </desc>
    </func>
    <func>
      <name>create_tree(Parent, Tree) -> ok</name>
      <fsummary>Create a hierarchy of graphical objects.</fsummary>
      <type>
        <v>Parent = gsobj()</v>
        <v>Tree = [Object]</v>
        <v>&nbsp;Object = {ObjType,Options} | {ObjType,Options,Tree} | {ObjType,Name,Options,Tree}</v>
      </type>
      <desc>
        <p>Creates a hierarchy of graphical objects.</p>
      </desc>
    </func>
    <func>
      <name>destroy(GSObj) -> void()</name>
      <fsummary>Destroy a graphical object.</fsummary>
      <type>
        <v>GSObj = gsobj()</v>
      </type>
      <desc>
        <p>Destroys a graphical object and all its children.</p>
      </desc>
    </func>
    <func>
      <name>ObjType(Parent)</name>
      <name>ObjType(Parent, Options)</name>
      <name>ObjType(Name, Parent, Options)</name>
      <fsummary>Shorthand equivalents of <c><![CDATA[create]]></c>.</fsummary>
      <desc>
        <p>These functions are shorthand equivalents of <c><![CDATA[create/2]]></c>,
          <c><![CDATA[create/3]]></c>, and <c><![CDATA[create/4]]></c>, respectively.</p>
      </desc>
    </func>
    <func>
      <name>read(GSObj, Key) -> Value</name>
      <fsummary>Return the value of an object option.</fsummary>
      <type>
        <v>GSObj = gsobj()</v>
        <v>Key = atom()</v>
        <v>Value = term()</v>
      </type>
      <desc>
        <p>Returns the value of an option key for the specified graphical
          object.</p>
      </desc>
    </func>
    <func>
      <name>start() -> ObjId</name>
      <fsummary>Start GS.</fsummary>
      <desc>
        <p>Starts GS, unless it is already started, and returns its object
          identifier.</p>
      </desc>
    </func>
    <func>
      <name>stop() -> void()</name>
      <fsummary>Stop GS.</fsummary>
      <desc>
        <p>Stops GS and closes all windows. This function is not the opposite
          of <c><![CDATA[start/0]]></c> as it will cause <em>all</em> applications
          to lose their GS objects.</p>
      </desc>
    </func>
  </funcs>
</erlref>

