This is gtkdialog.info, produced by makeinfo version 4.8 from
gtkdialog.texi.

   This manual documents version {No value for `VERSION'} of the
Gtkdialog utility.

   Copyright (C) 2003 Laszlo Pere.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.1 or any later version published by the Free Software
     Foundation; with no Invariant Sections, with no Front-Cover Texts,
     and with no Back-Cover Texts.


File: gtkdialog.info,  Node: Top,  Next: Getting Gtkdialog,  Up: (dir)

Gtkdialog User's Manual
***********************

This manual documents version {No value for `VERSION'} of the Gtkdialog
utility.

   Copyright (C) 2003 Laszlo Pere.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.1 or any later version published by the Free Software
     Foundation; with no Invariant Sections, with no Front-Cover Texts,
     and with no Back-Cover Texts.

* Menu:

* Getting Gtkdialog::      How to find, download and install the program.
* Introduction::           A brief description of the package.
* Invoking the Program::   How to call the program from various languages.
* Widgets::    		   The elements of dialog boxes.
* Containers::		   Dialog elements grouping widgets together.
* Actions::		   What is happening when something happening.


File: gtkdialog.info,  Node: Getting Gtkdialog,  Next: Introduction,  Prev: Top,  Up: Top

1 Getting Gtkdialog
*******************

1.1 Download
============

The source of Gtkdialog can be downloaded from Anonymous FTP at URL
`ftp://linux.pte.hu/pub/gtkdialog/'.

1.2 How to Install the Program
==============================

The program can be installed using the standard `./configure', `make'
and `make install' command sequence. Further details can be found in
the `INSTALL' file included.

1.3 Copying
===========

Copyright (C) 2003 Laszlo Pere.

   The gtkdialog is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2.0 of the
License, or (at your option) any later version.

   The 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
General Public License for more details.

   You should have received a copy of the GNU General Public License
along with this software; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
USA.


File: gtkdialog.info,  Node: Introduction,  Next: Invoking the Program,  Prev: Getting Gtkdialog,  Up: Top

2 Introduction
**************

Gtkdialog is a small utility program based on the GTK+ library. The
program mainly made for GUI development for shell scripts but can be
used with many other programming languages. The programmer can easily
create GUI not just for any shell script or UNIX command but for any
interpreted or compiled program capable to start child process and use
pipes.


File: gtkdialog.info,  Node: Invoking the Program,  Next: Widgets,  Prev: Introduction,  Up: Top

3 Invoking the Program
**********************

3.1 Examples
============

Our first example program shows how to call the `gtkdialog' from a BASH
script.

     #! /bin/bash

     export MAIN_DIALOG='
      <vbox>
       <text>
         <label>This is a label...</label>
       </text>
       <hbox>
        <button ok></button>
        <button cancel></button>
       </hbox>
      </vbox>'

     gtkdialog --program MAIN_DIALOG

   This example uses a very plain way to open a dialog box. We store the
description of the dialog box in the `MAIN_DIALOG' environment variable
which is exported to the child processes with the BASH `export'
built-in. Then we call the `gtkdialog' program with the `--program'
option which is followed by the name of the variable holding the dialog
box description. It is simple and easy to write BASH scripts in this
manner.

   A similar calling method can be used when user input is needed. The
`gtkdialog' send the state of the widgets to the standard output when
exiting and this is how we can get user input for the BASH program. The
next example code show the reading process.
     #! /bin/bash

     export DIALOG='
     <vbox>
       <entry>
         <variable>ENTRY</variable>
       </entry>
       <hbox>
         <button ok></button>
         <button cancel></button>
       </hbox>
     </vbox>'

     I=$IFS; IFS=""
     for STATEMENTS in  $(gtkdialog --program DIALOG); do
       eval $STATEMENTS
     done
     IFS=$I

     if [ "$EXIT" = "OK" ]; then
       echo "You entered: $ENTRY."
     else
       echo "You pressed the Cancel button."
     fi

   In the example script we use the `for' built-in to go through the
list `gtkdialog' produced. Changing the field separator (IFS) is a
little bit disturbing but necessary since this is the only way to
protect the space characters in user input.

   In larger software projects it may be a good idea to break the code
to separate files. Since `gtkdialog' can read the description program
from file it is easy to write self executable programs with it. This is
how the next example constructed.

     #! /usr/local/bin/gtkdialog -f
     <vbox>
       <checkbox>
         <label>This is a checkbox</label>
         <variable>CHECK1</variable>
       </checkbox>
       <checkbox>
         <label>Another one</label>
         <variable>CHECK2</variable>
       </checkbox>
       <button>
         <label>OK</label>
       </button>
     </vbox>

   When used in this fashion the state of the widgets can get from the
standard output of the script as usually.


File: gtkdialog.info,  Node: Widgets,  Next: Containers,  Prev: Invoking the Program,  Up: Top

4 Widgets
*********

The dialog description language is a simple XML like language capable
to denote any complex dialog box containing widgets and boxes.

   Widgets are simple GUI elements such as buttons, entry fields, lists,
etc. Widget can have attributes, states and actions (*note Actions::).

   The widgets are grouped together with containers (*note
Containers::), horizontal and vertical boxes or frames. Every widget
should placed in one of the containers, no widgets can be alone for it
is dangerous outside.

* Menu:

* Static label::                Labels containing static text
* Pushbutton::			Pushbutton widgets
* Pre-defined pushbuttons::	Pushbuttons with pixmap and text label
* Entry::			One line text entry widgets
* Checkbox::			Checkbox widgets
* Pixmap::			Static pixmap widgets
* Menus::                       Making menubars, menus and menuitems
* Trees::                       Complex widget for trees


File: gtkdialog.info,  Node: Static label,  Next: Pushbutton,  Up: Widgets

4.1 Static label
================

Label is a static text widget created with `<text></text>' tag.

   The text in a static label, can be set with the
`<label>STRING</label>' or the `<input file>FILENAME</input>'
expression.


File: gtkdialog.info,  Node: Pushbutton,  Next: Pre-defined pushbuttons,  Prev: Static label,  Up: Widgets

4.2 Pushbutton
==============

The pushbutton is a clickable widget defined with the
`<button></button>' tags.

4.2.1 `<label></label>'
-----------------------

The `<label>STRING</label>' directive sets the text label of the
pushbutton. If no label and pixmap is given for the button, gtkdialog
will use OK as default.

4.2.2 `<input file></input>'
----------------------------

When creating buttons, the `<input file>FILENAME</input>' tag can be
used to insert a pixmap into the button. The FILENAME must be a pixmap
file. Gtkdialog will find this file with the `locate' utility if
necessary.

   The pushbuttons can contain a label and a pixmap simultaneously. For
this you have to use the `<label></label>' and the `<input
file></input>' as the next example shows:

     <button>
       <input file>/usr/share/GUIcompletion/button_save.xpm</input>
       <label>The label</label>
     </button>

4.2.3 `<action></action>'
-------------------------

The `<action>COMMAND</action>' directive tells the gtkdialog what to
do, when the button is pressed. If the action is not given explicitly
the gtkdialog uses the default action, which is to exit the program. In
this case the printed variable list will contain a variable named EXIT,
with the label of the activated button as value.

   The buttons can handle more than one actions simultaneously. If there
are more `<action></action>' directive for the given button, they will
be executed one by one, in the right order.

4.2.4 `<visible></visible>'
---------------------------

The `<visible>STATE</visible>' specify the initial visibility of the
button. The STATE can be either `enabled' or `disabled'. When a button
is disabled, it is shaded and can not be activated by mouse or keyboard.


File: gtkdialog.info,  Node: Pre-defined pushbuttons,  Next: Entry,  Prev: Pushbutton,  Up: Widgets

4.3 Pre-defined pushbuttons
===========================

Gtkdialog supports a few pre-defined pushbuttons for simplify the
creation of dialog boxes. The pre-defined buttons can be used the same
manner the normal pushbuttons, but they have a default text, pixmap and
output variable.  Here is the list of available pre-defined pushbuttons:

   * `<button ok></button>'

   * `<button cancel></button>'

   * `<button help></button>'

   * `<button yes></button>'

   * `<button no></button>'


File: gtkdialog.info,  Node: Entry,  Next: Checkbox,  Prev: Pre-defined pushbuttons,  Up: Widgets

4.4 Entry
=========

The entry widget is a simple text input field, which can be used to get
a string from the user.

4.4.1 `<default></default>'
---------------------------

The `<default>STRING</default>' directive sets the default content of
the entry.

4.4.2 `<visible></visible>'
---------------------------

The `<visible>VISIBILITY</visible>' sets the initial state of the entry
widget. The VISIBILITY can be `enabled', which means the entry can be
used, `disabled', which means the content of the entry can not be
altered or `password'.

   The entry widgets with the visibility set to `password' are
editable, but unreadable as it is common with entries holding password
style information.

4.4.3 `<action></action>'
-------------------------

The entry widgets are activating actions after their contents are
changed.


File: gtkdialog.info,  Node: Checkbox,  Next: Pixmap,  Prev: Entry,  Up: Widgets

4.5 Checkbox
============

The checkbox is a simple widget with a label and a check mark which can
be turned on and off by the user. Checkboxes are made with the
`<checkbox></checkbox>' directive.

4.5.1 `<label></label>'
-----------------------

The label is the text shown beside the check mark. Every checkbox
should have a label.

4.5.2 `<default></default>'
---------------------------

The initial state of the checkbox can be set by the
`<default>STATE</default>' directive, where the STATE can be either
`yes' or `no'.

4.5.3 `<action></action>'
-------------------------

The `<action></action>' directive tells the gtkdialog what to do, when
the state of the checkbox is changed. As every widgets, the checkbox
can hold multiply actions which are executed serially in the order they
are written.

   Actions of checkboxes can be written as conditional instructions with
`if true' and `if false' prefixes as in the next example:

     <checkbox>
     	<label>This is a checkbox...</label>
     	<variable>CHECKBOX</variable>
     	<action>echo Checkbox is $CHECKBOX now.</action>
     	<action>if true enable:ENTRY</action>
     	<action>if false disable:ENTRY</action>
     </checkbox>

4.5.4 `<visible></visible>'
---------------------------

The `<visible>STATE</visible>' specify the initial visibility of the
checkbox. The STATE can be either `enabled' or `disabled'. When a
checkbox is disabled, it is shaded and its state can not be altered
anyway.

4.5.5 `<variable></variable>'
-----------------------------

The value of a checkbox can be `true' or `false' and depends only on
its state.


File: gtkdialog.info,  Node: Pixmap,  Next: Menus,  Prev: Checkbox,  Up: Widgets

4.6 Pixmap
==========

The `<pixmap></pixmap>' defines a static pixmap widget.

4.6.1 `<input file></input>'
----------------------------

The widget must have an input file defined with the `<input
file>FILENAME</input>' tags. The FILENAME is the graphic image file for
the pixmap. Gtkdialog will load this file if it can be opened for read,
or will try to find a file with similar name (using the `locate'
utility program) if the file is unreadable.

   The next example defines a static pixmap:

     <pixmap>
       <input file>help.png</input>
     </pixmap>


File: gtkdialog.info,  Node: Menus,  Next: Trees,  Prev: Pixmap,  Up: Widgets

4.7 Menubar
===========

The `<menubar></menubar>' defines menu bar which can be placed as any
other screen elements. In the menubar widget you have to create menus
with the `<menu></menu>' tag, and inside the menu must be at least one
menu item created by the `<menuitem></menuitem>' tag.

   The next example shows how to create a simple menubar with only one
menu:

     <menubar>
       <menu>
         <menuitem>
           <label>gtk-open</label>
         </menuitem>
         <menuitem>
           <label>gtk-save</label>
         </menuitem>
         <menuitem>
           <label>gtk-quit</label>
           <action>EXIT="quit"</action>
         </menuitem>
         <label>File</label>
       </menu>
     </menubar>


File: gtkdialog.info,  Node: Trees,  Prev: Menus,  Up: Widgets

4.8 The tree
============

OK, it is not complete, but the next example seems to be just fine.

     <vbox>
       <tree>
         <label>Device    |Directory        |File         </label>
         <item>Hard drive |/usr/            |letter.tex    </item>
         <item>Hard drive |/etc/            |inittab       </item>
         <item>Hard drive |/etc/            |fstab         </item>
         <item>Network    |alpha:/home      |quota.user    </item>
         <item>Network    |alpha:/home      |quota.group   </item>
         <item>Network    |beta:/home/pipas |tmp           </item>
         <item>Network    |beta:/home/pipas |latexfiles    </item>
         <item>Network    |beta:/home/pipas |book          </item>
         <item>Network    |beta:/home/pipas |bin           </item>
         <item>Network    |beta:/home/pipas |documentation </item>
       </tree>
       <button ok></button>
     </vbox>


File: gtkdialog.info,  Node: Containers,  Next: Actions,  Prev: Widgets,  Up: Top

5 Containers
************


File: gtkdialog.info,  Node: Actions,  Prev: Containers,  Up: Top

6 Actions
*********

When the user changes the state of a widget, gtkdialog checks if there
is something to do with it. If the tampered widget have one or more
actions, the program will execute them for the new situation to be
handled.

   Every widget can have multiply actions, a list of commands must be
executed when the widget changed. Gtkdialog executes the axtions in the
order they found in the dialog description program, so one can write a
complet program as a series of instructions.

* Menu:

* Start and exit::	Actions that starts programs and exits dialogs
* Widget manipulation:: Actions affect widgets


File: gtkdialog.info,  Node: Start and exit,  Next: Widget manipulation,  Up: Actions

6.1 Start and exit
==================

6.1.1 Start programs
--------------------

If the action of a widget is created with the simple
`<action>COMMAND</action>' directive, gtkdialog will execute it in a
subshell. That means it will start up `/bin/sh' to handle the
operation. Here is how the subshell operation works:
  1. First gtkdialog updates the environment variables holds the  state
     and value of the widgets. This is how the child process will  know
     what is happening in the GUI called it.

  2. Next the include file is checked. If the gtkdialog started  with
     the `-i FILE' option gtkdialog will ask the  subshell to include
     the FILE before the execution of command.

     This strange method is needed for the action driven programs, where
     the subshell have to load the shell functions from the calling
     script.

  3. At the third step gtkdialog starts the command and waits for  it
     to complete. (Commands usually can be run in the background by
     writing a `&' as last character, so the subshell will not wait
     the program to complete.)

6.1.2 Exit dialog
-----------------

The `Exit:VALUE' command exits `gtkdialog' immediately. The VALUE will
be printed to standard output as the value of the variable named EXIT.


File: gtkdialog.info,  Node: Widget manipulation,  Prev: Start and exit,  Up: Actions

6.2 Widget manipulation
=======================

6.2.1 `Closewindow:NAME'
------------------------

The command closes the named window opened by the `Launch:' command.
The program remain active if there are more windows active.

6.2.2 `Launch:NAME'
-------------------

The command opens a new window using the environment variable `Widget'.

6.2.3 `Disable:NAME'
--------------------

The command disables the given widget if it is enabled. If the widget
is disabled when the command is activated, nothing happens.

   The disabled widgets are insensitive to user actions, their shapes
are indicating they are temporary unavailable.

6.2.4 `Enable:NAME'
-------------------

The command enables the given widget if it is diabled. If the widget is
enabled nothing happens.

6.2.5 `Refresh:NAME'
--------------------

The command refresh the named widget. If the widget have one or more
input actions, they will be called by `gtkdialog'.

6.2.6 `Save:NAME'
-----------------

Some widgets can hold much data. (Currently only the edit widget
capable to perform this action.)

   The `Save:' action will save the data found in the named widget to
the filename found in `<output file>' attribute.

   FIXME: This function is not working now, need to be fixed.

6.2.7 `Fileselect:WIDGET'
-------------------------

6.2.8 `Clear:WIDGET'
--------------------

6.2.9 `RemoveSelected:WIDGET'
-----------------------------



Tag Table:
Node: Top512
Node: Getting Gtkdialog1459
Node: Introduction2705
Node: Invoking the Program3201
Node: Widgets5857
Node: Static label6885
Node: Pushbutton7189
Node: Pre-defined pushbuttons9046
Node: Entry9641
Node: Checkbox10571
Node: Pixmap12263
Node: Menus12912
Node: Trees13720
Node: Containers14702
Node: Actions14814
Node: Start and exit15502
Node: Widget manipulation16861

End Tag Table
