2016-11-25 00:33:18 -07:00

254 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>EuGTK Internals</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<heading>
<img src="../thumbnails/gtk-logo-rgb.gif" alt="GTK LOGO" />
<img src="../thumbnails/mongoose.png" alt="mongoose" />
<img src="../thumbnails/gnome-run.png"alt="gnome-run" align="right" />
<h2> <hr />EuGTK 4.12.0<hr /> </h2>
<h3>Quick Function List</h3>
</heading>
<nav>
<div class="hdr">Quick Links</div>
<a href="#functions"><button>Functions</button></a>
<a href="#utilities"><button>Utilities</button></a>
<a href="#constants"><button>Constants</button></a>
<a href="#identifiers"><button>Identifiers</button></a>
<a href="#misc"><button>Other</button></a>
</nav>
<nav>
<div class="hdr">Other Files:</div>
<a href="HowItWorks.html"><button>How EuGTK Works</button></a>
<a href="README.html"><button>README</button></a>
<a href="guide_a.html"><button>Alphabetical Guide</button></a>
<a href="dialogs.html"><button>Built-in EuGTK Dialogs</button></a>
<a href="treeviews.html"><button>ListView/TreeView widgets</button></a>
<a href="pango_markup.html"><button>Markup</button></a>
<a href="printing.html"><button>Printing</button></a>
<a href="ServerHelp.html"><button>Web Server</button></a>
<a href="Glade.html"><button>Glade GUI Builder</button></a>
<a href="platforms.html"><button>Platforms</button></a>
</nav>
<body>
<a name="functions" />
<h3><hr />Public functions ~ commonly-used<hr /></h3>
<ul>
<li>create() <dfn>returns handle to newly-created widget:<em> win = create(GtkWindow)</em></dfn></li>
<li>set() <dfn>sets a property for a widget: <em>set(win,"background","blue")</em></dfn></li>
<li>get() <dfn>gets a property: <em>? get(win,"background")</em></dfn></li>
<li>add() <dfn>adds a widget to a container: <em>add(win,panel)</em>; spaces divided equally</dfn></li>
<li>pack_start() <dfn> adds at top/left</dfn></li>
<li>pack_end() <dfn> adds at bottom/right</dfn></li>
<li>show() <dfn>show a widget: <em>show(btn)</em></dfn></li>
<li>show_all() <dfn>show a container and all items contained within: <em>show_all(win)</em></dfn></li>
<li>hide() <dfn>hide a widget: <em>hide(btn)</em></dfn></li>
<li>hide_all() <dfn>hide a container and all items contained within: <em>hide_all(win)</em></dfn></li>
<li>connect() <dfn>connect a signal to a Eu function: <em>connect(btn1,"clicked","FooBar",33)</em> Note: connect() returns a sigid, usually ignored unless you plan to disconnect.</dfn></li>
<li>disconnect() <dfn>disconnect a signal: <em>disconnect(btn1,sigid)</em></dfn></li>
<li>main() <dfn>start the GTK main processing loop: <em>main()</em></dfn></li>
<li>requires() <dfn>pop up an Error dialog if not available: <em>requires("3.10","GtkRevealer")</em></dfn></li>
<li>destroy() <dfn>destroy a widget: <em>destroy(win)</em></dfn></li>
<li>unpack() <dfn>convert data attached to a control back into format usable by Euphoria: <em>unpack(data)</em></dfn></li>
<li>show_uri() <dfn>call default handler for uri (file, http, etc...): <em>show_uri("http://gtk.org")</em></dfn></li>
<li>"Quit" <dfn>global call to shut down the GTK main processing loop: <em>connect(win,"destroy","Quit")</em></dfn></li>
<li> pointer() <dfn>obtains a handle, a.k.a. pointer, to an object loaded from Glade
<em>constant win = pointer("help:window1")</em></dfn></li>
<li>_() <dfn>shorthand for call_back(routine_id()), links signals to local functions, no global declarations required</dfn></li>
<li>$... <dfn>shorthand for signal links e.g. $destroy=Quit</dfn></li>
</ul>
<p>
See <a href="HowItWorks.html">HowItWorks</a> for details on the above functions, you will use some of them frequently!
</p>
<p> See also: <a href="HowItWorks.html#settings"> settings</a></p>
<a name="utilities" />
<h3><hr />Utility functions ~ sometimes used<hr /></h3>
<h5>General functions</h5>
<ul>
<li> has_icon(name) <dfn>returns TRUE if named icon exists in current theme</dfn></li>
<li> list_icons() <dfn>returns a {list} of all icon names in current theme</dfn></li>
<li> valid_icon({list}) <dfn>given a list of possible icon names, returns handle to an image made from first valid name</dfn> </li>
<li> valid_icon_name({list}) <dfn>given a list of possible icon names, returns first valid name</dfn> </li>
<li> icon_info(handle) <dfn>returns a sequence: pointer to info struct, name, path, size, scale</dfn></li>
<li> class_name(handle) <dfn>returns the classname from a widget handle: <em>display(classname(win))</em> => &quot;GtkWindow&quot; </dfn></li>
<li> class_id(handle) <dfn>returns the enumerated class for the handle: <em>if classid(win) = GtkWindow then ...</em> </dfn></li>
<li> object_name(handle) <dfn>returns name if object has a name, -nil- otherwise</dfn></li>
<li> register(handle,class) <dfn>registers handle as a class: <em>register(win,GtkWindow)</em> hardly ever needed.</dfn></li>
<li> to_sequence(GList) <dfn>converts a glist pointer back into a Eu sequence: <em>rarely used!</em></dfn></li>
<li> to_rgba(str) <dfn>converts a color description to a pointer: <em>? to_rgba("skyblue")</em></dfn></li>
<li> from_rgba(ptr) <dfn>converts a color pointer into <em>&quot;rgb(r,g,b)&quot;</em> or <em>&quot;rgba(r,g,b,a)&quot;</em></dfn></li>
<li> pixbuf_formats() <dfn>returns a list of implemented formats for pixbuf loader</dfn></li>
</ul>
<hr />
<h5>Settings</h5>
<ul>
<li>settings:Save()</li>
<li>settings:Load()</li>
<li>settings:Add()</li>
</ul>
<hr />
<h5>Events</h5>
<ul>
<li> events:id <dfn>returns unique event id: <em>? events:id(event)</em></dfn></li>
<li> events:xy <dfn> returns location of event</dfn></li>
<li> events:axes </li>
<li> events:time </li>
<li> events:state</li>
<li> events:window</li>
<li> events:device</li>
<li> events:clicks <dfn>returns # of mouse clicks in event</dfn></li>
<li> events:scroll_dir</li>
<li> events:key <dfn>returns keypressed value</dfn></li>
<li> events:button <dfn>returns mouse button 1..3 when given an event:
<em>? events:button(event)</em></dfn></li>
<li> events:pending <dfn>used when multitasking</dfn></li>
<li> events:main_iteration </li>
<li> events:main_iteration_do </li>
</ul)
</ul></ul>
<hr />
<h5>Networking</h5>
<ul>
<li> networked <dfn> returns TRUE if your computer is part of a network</dfn></li>
<li> inet_connected <dfn> returns TRUE if internet could be reached</dfn></li>
<li> get_net_address <dfn> returns 127.0.0.1 or your current ip</dfn></li>
</ul>
<p> See <a href="../GtkEvents.e"> events</a></p>
<a name="constants" />
<h3><hr />Exported constants ~ available if you need them<hr /></h3>
<img src="../screenshots/test0.png" alt="test0 screenshot" title="Test0 demonstrates most of these!" align="right" width="50%" />
<ul class="constants">
<li>version<dfn> EuGTK version: <em> "4.11.8"</em></dfn></li>
<li>release<dfn> EuGTK release date: <em>"Aug 1, 2014"</em></dfn></li>
<li>copyright<dfn> EuGTK copyright: <em> "(c) 2015 by Irv Mullins"</em></dfn></li>
<li>major_version<dfn> for GTK 3.10.1: <em>3</em></dfn></li>
<li>minor_version<dfn> for GTK 3.10.1: <em>10</em></dfn></li>
<li>micro_version<dfn> for GTK 3.10.1: <em>1</em></dfn></li>
<li>user_name<dfn> The user logged-in: <em> irv </em></dfn></li>
<li>real_name<dfn> Full name: <em> Irv Mullins</em></dfn></li>
<li>host_name<dfn> host name of computer: <em> Mint17</em></dfn></li>
<li>host_addr <dfn> host address: <em>192.168.1.100</em></li>
<li>home_dir<dfn> logged-in user's home: <em> /home/irv</em></dfn></li>
<li>temp_dir<dfn> user's temp dir: <em> /tmp</em></dfn></li>
<li>curr_dir<dfn> user's currently-logged into directory </dfn></li>
<li>conf_dir<dfn> user's config directory <em> /home/irv/.conf</em></dfn></li>
<li>runt_dir<dfn> user's runtime directory <em> /run/user/1000</em></dfn></li>
<li>prg_name<dfn> current program <em> test0.ex</em></dfn></li>
<li>os_name <dfn><em>Linux</em></dfn></li>
<li>os_distro <dfn><em> Mint 17</em></dfn></li>
<li>os_version <dfn><em>3.13.0-24-generic</em></dfn></li>
<li>os_comp <dfn><em>#46-Ubuntu SMP Thu Apr 10...</em></dfn></li>
<li>os_arch <dfn><em>x86_64</em></dfn> </li>
<li>os_term <dfn><em>xterm</em></dfn></li>
<li>os_shell <dfn><em>/bin/bash</em></dfn></li>
<li>eu_version <dfn> version string: <em>"4.1.0"</em></dfn></li>
<li>eu_revision <dfn> revision # <em>6318</em></dfn></li>
<li>eu_date <dfn>date compiled</dfn></li>
<li>today <dfn>date program started</dfn></li>
<li>start_time <dfn>time program started</dfn></li>
<br />
<li>def_lang <dfn>default language <em>en-us</em></dfn></li>
<br />
<li>CMD1 <dfn>command_line[1] <em>e.g. eui</em></dfn></li>
<li>CMD2 <dfn>command_line[2] <em>e.g. /home/irv/demos/test1.ex</em></dfn></li>
<br />
<li>LGPL<dfn> Text of the Lesser General Public License</dfn></li>
<li>stock_list<dfn> List of GTK stock items - soon to be deprecated!</dfn></li>
</ul>
<p>
<em>Note 1:</em> these constants are generated when EuGTK starts up, and are available in two different forms:
<ul>
<li>As individual constants</li>
<li>As key/value pairs in the gtk:info structure,
provided mainly for convenience when displaying them:
&nbsp;<code> display("[{prg_name}]",gtk:info)</code></li>
</ul>
See <a href="../test0.ex">test0</a> for an example.
<br /><br />
</p>
<h3><hr />Other Stuff<hr /></h3>
<a name="identifiers" />
<b>Identifiers</b>
<p>Below are unique identifiers used to specify storage types in List/Tree models, not only do these control how the value
is stored, but also how it is displayed:
<ul>
<li>gINT <dfn>Store and display as an integer (rounds floats down)</dfn></li>
<li>gDBL <dfn>Store and display as a double</dfn></li>
<li>gSTR <dfn>Store and display as a string</dfn></li>
<li>gPTR <dfn>Generic pointer - seldom used</dfn></li>
<li>gFLT <dfn>Displays with six digits following the decimal point</dfn></li>
<li>gBOOL <dfn>anything other than 0 displays TRUE, 0 displays FALSE</dfn></li>
<li>gPIX <dfn>Stores handle to a pixbuf, displays that image</dfn></li>
<li>gCOMBO <dfn>Stores handle to a GtkComboBox</dfn></li>
</ul>
<p>Unique identifiers below save space in method prototypes;
programmer may use them when calling the three user functions which follow.
<ul>
<li>P <dfn>= C_POINTER expected parameter is a pointer</dfn></li>
<li>I <dfn>= C_INT expected parameter is an integer</dfn></li>
<li>S <dfn>= E_OBJECT expected parameter is a string</dfn></li>
<li>B <dfn>= C_BYTE expected parameter is boolean</dfn></li>
<li>D <dfn>= C_DOUBLE expected parameter is a double</dfn></li>
<li>F <dfn>= C_FLOAT expected parameter is a floating-point value</dfn></li>
<li>A <dfn>= E_SEQUENCE expected parameter is an array</dfn></li>
</ul>
<a name="misc" />
<b>User functions</b>
<p>While mostly used internally by EuGTK, they may be useful
when testing or when implementing GTK methods which haven't been added to EuGTK.
</p>
<ul>
<li>gtk_func<dfn> Example:<code> <em>gtk_func("gtk_label_set_text",{P},{allocate_string("Hello")})</em></code></dfn></li>
<li>gtk_str_func<dfn> Example:<code><em> puts(1,gtk_str_func("gtk_label_get_text",{P},{lbl})</em></code></dfn></li>
<li>gtk_proc<dfn> Example:<code><em> gtk_proc("gtk_widget_hide",{P},{win})</em></code></dfn></li>
</ul>
<footer>
<div class="hint">
<img class="hint" src="../thumbnails/mongoose.png" alt="hint" align="left" float="right" />
<p>
This page edited by The <a href="README.html#bear">Bear</a>,
a web-page and programming editor
written in <a href="OpenEuphoria.org">Euphoria</a>.
</p>
<p>
Updated for EuGTK version 4.12.0, Sept 15, 2016<br />
All code &copy; 2016 by Irv Mullins
</p>
</div>
</footer>
</body>
</html>