SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from RedHat Other XITE-3.3-3.i386.rpm

DIALOGS

Section: C Library Functions (3)
Updated: 16 Mar 1998
Index

 

NAME

SimpleDialog, FormDialog, CreateDialog, InformationBox,ConfirmationBox, SelectReadFile, SelectWriteFile,init_button_table - Popup dialog widgets

 

SYNTAX


 #include <xite/Xdialog.h>


 int SelectReadFile( Widget parent, char *kind,
    char **return_text );


 int SelectWriteFile( Widget parent, char *kind,
    char **return_text );


 int FormDialog( Widget parent, char *header,
    char *dialog_spec, char **return_text,
    button_table buttons, int nbuttons,
    char *winName, char *iconName );


 int InformationBox( Widget parent, char *message,
    char *winName, char *iconName );


 int ConfirmationBox( Widget parent,
    char *message, char *buttonname1,
    char *buttonname2, char *winName,
    char *iconName );


 int SimpleDialog(Widget parent, char *title,
    char *deftext, char **return_text,
    char *buttonname1, char *buttonname2);


 Widget CreateDialog( Widget parent, char *title,
    char *textField, char *winName, char *iconName,
    struct DialogArg *args, unsigned int count );


 button_table init_button_table(
    button_table buttons, int length );

 

DESCRIPTION

SelectReadFile

Creates and pops up a file selection window which returns thechosen filename through return_text.The file-selectionwindow contains a goto-button (change directory), aselect-button (take the selected filename and return), anup-button (change to parent directory) and a cancel-button.The instance name of the shell widget is "fileSelectorShell".

The file-selector widget (descendant of "fileSelectorShell")is of class XfwfFileSelector. It has instance name given bykind(without the first character). The instance name whenused in XITE is one of the string constants


 readBIFFfile
 readColortabfile
 readColormapfile
 readTIFFfile
 readMATfile
 readPSfile
 readfile

Actions

The QuitFileSelaction function is installed, but notbound to any event. It will typically be bound to aClientMessage event from the window manager, desiring toclose the window.

Return value


 0 : button labeled cancel was pushed or the
     QuitFileSel action function was invoked.
 1 : button labeled select was pushed (or one
     of the accelerators were used).

Accelerators

Accelerators can be installed by the application (e.g. inan X resource file) so that the return key can invoke thecallbacks of the goto-button (while mouse pointer is inthe directory-name field) or the callbacks of theselect-button (while mouse pointer is in the filenamefield). A <Btn2Down> event in the file list can alsoinvoke the select-button callbacks.

Resources

You may find some of the resources for the file-selectorwidget particularly useful.

The directory path used:
 <widget class or instance>*currentDirectory:

Substitute <widget class or instance> byXfwfFileSelector (class) or one of the instancenames mentioned above.

Examples
 XShow*XfwfFileSelector*currentDirectory: .
 XShow*XfwfFileSelector*currentDirectory:
    $HOME/img

A pattern which the filenames, displayed in thefile list, must match:
 <widget class or instance>*pattern:

Example
  XShow*readBIFFfile*pattern: *.img

Whether or not to demand existence of the specified file:
 <widget class or instance>*checkExistence:

Examples
  XShow*readColortabfile*checkExistence:  True
  XShow*writeMacrofile*checkExistence: False

SelectWriteFile

This function is similar to SelectReadFile,except thatthe instance name of the fileselector widget is chosen amongthe string constants


 writeBIFFfile
 writeColortabfile
 writeColormapfile
 writeTIFFfile
 writeMATfile
 writePSfile
 writefile
 writeMacrofile

FormDialog

FormDialogcreates a window which contains various userinput-fields and buttons.

headerwill appear at the top of the window. Use a blankstring if you simply want some space.

dialog_specis expected to be a series of specifications ofthe form
 # <Leading text> # <option> # <type> # <default>

All the specifications will be presented in a window, expectingthe user to take some action. <Leading text> is typicallya question, <default> is the suggested answer. The user canchange the answer. The results of the user actions will bereturned in the string return_text.

The <option> field in the dialog specification will bereturned in front of the answer. It may be empty.

The <type> field has the following interpretation

dInput should be integer. Only digits and the minus-signare allowed in the input. XfwfPrompt is used.

fInput should be float (or double). Only digits, "." and theminus-sign are allowed in the input. XfwfPrompt is used.

sInput should be string. All characters are allowed. Theresulting input will be surrounded by "", to protect amultiword string input as a single string. Use the functionremove_quotes_from_word(3) to remove these quotes.XfwfPrompt is used.

bInput should be boolean. Toggle button of class XfwfToggle isused.

r0Field is part of radio-group (of which exactly one member mustbe chosen). Members of the same radio-group must have the sameleading text. Return default only if member is chosen.XfwfGroup is used.

This member will initially be off.

r1Same as "r0", but this member will initially be on.

r0-Same as "r0", but don't return default value (use only asvisible label).

r1-Same as "r1", but don't return default value (use only asvisible label).

m0Field is part of multiple-choice group (of which none, one orseveral may be chosen). Members of the same multiple-choicegroup must have the same leading text.XfwfGroup is used.

This member will initially be off.

m1Same as "m0", but this member will initially be on.

m0-Same as "m0", but don't return default value (use only asvisible label).

m1-Same as "m1", but don't return default value (use only asvisible label).

For input fields of type d,f,and s:

Translations


 <EnterWindow>: highlight(Always)
 <LeaveWindow>: unhighlight()
 <Btn1Down>,<Btn1Up>: set() notify()

At the bottom of the window, a number of buttons (of classXfwfButton) may appear, depending on the buttonsandnbuttonsarguments. With buttonsequal to NULL andnbuttonsgreater than zero and at most three, nbuttonsdefault buttons are made, in the following order:

First button

X11 resource instance name: button0, label: "Abort".The callback function will close the dialog window, andFormDialogwill return the value 0.

Second buttonX11 resource instance name: button1, label: "Accept".The callback function will process the answers given and returnthem in return_text.Finally, the dialog is closed andFormDialogreturns the value 1.

Third buttonX11 resource instance name: button2, label: "Help".The callback function will create a help window with thedefault text content "For help, consult a manual page.".

Custom buttons can be supplied by giving a non-NULL referencefor buttons.buttonsis a table of button descriptions


 typedef {
   char *name, *label;
   XtCallbackProc callback;
   XtPointer closure;
 } button_element, *button_table;

nameis the X11 resource instance name of the button widget,labelis the visible text in the button, callbackis thecallback procedure added to the button's XtNactivate callbacklist, closureis the data passed to the callback functionin its client_dataargument. The function init_button_tablecan be used to create and initialize a button table with allelement members pointing to NULL.

If nameis NULL, a default X11 resource instance name forthe button will be used. This is the concatenation of thestring "button" and the button number (starting with "0").

If labelis NULL, the same default values as for the abovethree default buttons will be used for the first threebuttons. For additional buttons, no default is supplied. UseX11 resources for nameto set it.

With callbackequal to NULL, a default will be used. For thefirst three buttons the same functions will be used as for thethree default buttons above. For additional buttons, thedefault callback function will close the dialog window andlet FormDialogreturn the button number (starting with 0).

If closureis NULL, the same default values as for the abovethree default buttons will be used (i.e. NULL, NULL and thedefault help text respectively). For additional buttons,the default is a reference to an integer which contains thebutton number (starting with 0).

FormDialogis used by xshow(from XITE version 3.3) tointerpret menu files. Prior versions used SimpleDialog,butFormDialoghas a more user-friendly interface.

InformationBox

Creates a window containing messageand a command buttonwith label "Close", using CreateDialog.The window is poppeddown when the user pushes the button. If a translation isinstalled for the QuitDialog action function, then this couldalso pop down the window (e.g. bound to a ClientMessage eventfrom the window manager).

Return value
 -1: Dialog window deleted by the QuitDialog
     action function. This is often bound to
     a desire by the window manager to close
     the window.
  0: ok-button was pushed.

ConfirmationBox

ConfirmationBoxcreates a window containing messageandtwo command buttons labeled buttonname1and buttonname2,using CreateDialog.The window is popped down when the userpushes one of the buttons. If a translation is installed forthe QuitDialog action function, then this could also pop downthe window (e.g. bound to a ClientMessage event from thewindow manager).

Return value
 -1: Dialog window deleted by the QuitDialog
     action function. This is often bound to
     a desire by the window manager to close
     the window.
  0: button labeled buttonname1 was pushed.
  1: button labeled buttonname2 was pushed.

SimpleDialog

Creates a dialog widget with a title,a text field deftextand two buttons (using CreateDialog).The user can edit thedeftextfield. The button labels are buttonname1andbuttonname2.The widget is popped up centered at the currentmouse pointer position.

Callbacks

An event handling loop is installed so that the callingapplication waits for the dialog to finish. The callbackfunction for the two buttons will break the event handlerloop and return the (possibly user-edited) deftextstring in return_text.

Actions

SimpleDialoginstalls the action function "returnok". Itwill break the event-handling loop, just as if the userhad pushed one of the buttons. A copy of the (possiblyuser-edited) deftextstring is returned in return_textin both cases.

"returnok" behaves as if the user had pushed the buttonlabeled buttonname2.This action function is bound tothe return key by CreateDialog,as explained below.Using the return key is in other words a keyboard shortcutfor pushing the button.

Return value
 -1: Dialog window deleted by the QuitDialog
     action function. This is often bound to
     a desire by the window manager to close
     the window.
  0: button labeled buttonname1 was pushed.
  1: button labeled buttonname2 was pushed (or
     the keyboard shortcut was used)

CreateDialog

Creates a dialog widget with titleat the top, atextField,countcommand-buttons, winNameas windowmanager decoration title and iconNameas window managerdecoration title of iconified window. CreateDialogdoesnot actually pop up the window.

The dialog widget is of class Dialog with instancename "dialog". It has two children, one of classLabel (instance name "label") which holds title,the otherof class AsciiText (instance name "value") which holdsthe user-editable textField.

argsdescribes the countbuttons of class XfwfButtoninside the window. It is an array of structures with theattributes buttonName(type char *), handler(typeXtCallbackProc) and data(type XtPointer). buttonNamewill become the button label, handleris a functionwhich will be added to the XtNactivate list of allbuttons, datais the client-data which is passed intothe callback function when it is activated. The resourceinstance names of the buttons will be "button1", "button2"etc.

Actions

CreateDialoginstalls the action function QuitDialog.The action function will invoke the callback-function ofthe buttons, with client-data equal to -1 (or actually apointer to this value). The action function is not boundto any event by CreateDialog,but will typically bebound to the event which is sent from the window managerto kill the window (<ClientMessage>WM_PROTOCOLS). Thismust be done by the calling application (e.g. via an Xresource file).

Translations

If textFieldis not NULL, the following translationbinding is installed on the textFieldpart of the dialogwidget:


 <Key>0xff0a: returnok()
 <Key>Return: returnok()

where the two keysymbols represent newline and carriagereturn respectively. The expected action function"returnok" is not installed by CreateDialog.It must bedone by the caller. If it is installed, it means that thereturn key can be used as a shortcut to invoke "returnok"(typically the same as pushing an ok-button).

Return value

A reference to a transientShellWidgetClass widget withinstance name "popup".

 

SEE ALSO

xshow(1),XfwfButton(3),XfwfFileSelector(3),XfwfGroup(3),XfwfPrompt(3),XfwfToggle(3)

 

FILES

$XSHOWPATH/xshow_menues

 

AUTHOR

Otto Milvang and Svein Bøe

 

DOC

Svein Bøe

 

ID

$Id: Xdialog.c,v 1.69 1997/05/25 11:51:23 svein Exp $


 

Index

NAME
SYNTAX
DESCRIPTION
SEE ALSO
FILES
AUTHOR
DOC
ID

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector