Main Page | Class List | File List | Class Members | File Members

gocr_gui.h File Reference

This is the gui header. More...

Go to the source code of this file.

Module GUI functions

int gocr_guiBeginWindow (wchar_t *title, wchar_t **buttons)
 starts a window.

int gocr_guiEndWindow (void)
 ends a window.

int gocr_guiDisplayCheckButton (wchar_t *description, wchar_t *value, int *result)
 adds a check button to a window.

int gocr_guiDisplayImage (gocr_Image *image)
 adds an image to a window.

int gocr_guiDisplayRadioButtons (wchar_t *description, wchar_t **values, int *result)
 adds a radio button group to a window.

int gocr_guiDisplaySpinButton (wchar_t *description, float min, float max, float step, float *result)
 adds a spin button to a window.

int gocr_guiDisplayText (wchar_t *text)
 adds an informative text to a window.

int gocr_guiDisplayTextField (wchar_t *description, wchar_t **result)
 adds a text field to a window.


Detailed Description

This is the gui header.

Author:
Bruno Barberi Gnecco <brunobg@sourceforge.net>

Function Documentation

int gocr_guiBeginWindow wchar_t *  title,
wchar_t **  buttons
 

starts a window.

This functions tells the GUI to start a new window. You may set the window title, or pass NULL if you don't want any (the GUI will provide a default one).

The buttons parameter is a NULL terminated array of (wchar_t) strings. For each string a button will be inserted at the bottom of the window. gocr_guiEndWindow() will return the array index of the clicked button. Example: you want two buttons, "OK" or "Cancel":

  wchar_t *buttons[3] = { "OK", "Cancel", NULL };
  gocr_guiBeginWindow("Title", buttons);
  ...
  switch ( gocr_guiEndWindow() ) {
          case '0':
                  ok();
                  break;
          case '1':
                  cancel();
                  break;
          case '0':
                  error()
                  break;
  }

If the "OK" button is clicked, gocr_guiEndWindow will return 0; if the Cancel button is clicked, gocr_guiEndWindow will return 1. Note that whenever a button is clicked the window will close.

Parameters:
title The window title. May be NULL.
buttons The buttons to display at the bottom of the window. See above.
See also:
gocr_guiEndWindow
Return values:
0 OK
-1 error.

int gocr_guiEndWindow void   ) 
 

ends a window.

long description. See also gocr_guiBeginWindow.

See also:
gocr_guiBeginWindow
Returns:
A negative number if an error happened, otherwise the index of the clicked button.

int gocr_guiDisplayCheckButton wchar_t *  description,
wchar_t *  value,
int *  result
 

adds a check button to a window.

Adds a check button to a window. A check button is a small box that can be turned on or off, with a text besides it explaining what is it for.

Parameters:
description A general description of the button. May be NULL.
value The button name. Must be non-NULL.
result A (non-NULL) pointer to a integer that will hold the result. If the value pointed by it is not zero, the box is checked by default.
See also:
gocr_guiBeginWindow, gocr_guiEndWindow.
Return values:
0 OK
-1 error.

int gocr_guiDisplayImage gocr_Image image  ) 
 

adds an image to a window.

Adds an image to a window. The image won't be editable, and is for illustration purposes only. The GUI is responsible to convert it to a displayable format.

Parameters:
image The image to display.
See also:
gocr_guiBeginWindow, gocr_guiEndWindow.
Return values:
0 OK
-1 error.

int gocr_guiDisplayRadioButtons wchar_t *  description,
wchar_t **  values,
int *  result
 

adds a radio button group to a window.

Adds a radio button group to a window. A radio button group is a set of options, and you can select only one of them.

Parameters:
description A general description of the button. May be NULL.
value A NULL-terminated array of (wchar_t) strings with each button description. Must be non-NULL.
result A (non-NULL) pointer to a integer that will hold the result. If the value pointed by it is non-negative, the box of that index is checked by default.
See also:
gocr_guiBeginWindow, gocr_guiEndWindow.
Return values:
0 OK
-1 error.

int gocr_guiDisplaySpinButton wchar_t *  description,
float  min,
float  max,
float  step,
float *  result
 

adds a spin button to a window.

Adds a spin button to a window. A spin button is a numeric field that has a mininum and a maximum value, and two small icons that let the user increase or decrase that value by a certain step.

This function checks if max is greater than min, and if step is less than (max-min).

Parameters:
description A general description of the button. May be NULL.
min The minimum allowed value.
max The maximum allowed value.
step The step value.
result A (non-NULL) pointer to a float that will hold the result. The value pointed by it is set as the default button value.
See also:
gocr_guiBeginWindow, gocr_guiEndWindow.
Return values:
0 OK
-1 error.

int gocr_guiDisplayText wchar_t *  text  ) 
 

adds an informative text to a window.

Adds an informative text to a window. The text can't be changed by the user.

Parameters:
text The text.
See also:
gocr_guiBeginWindow, gocr_guiEndWindow.
Return values:
0 OK
-1 error.

int gocr_guiDisplayTextField wchar_t *  description,
wchar_t **  result
 

adds a text field to a window.

Adds a text field to a window. A text field is a space to let the user input some text of any kind.

Parameters:
description A general description of the button. May be NULL.
result A pointer to a (wchar_t) string that will hold the result. If NULL, the memory will be automatically allocated to hold it. Otherwise, the text field value is set to the string it points to.
See also:
gocr_guiBeginWindow, gocr_guiEndWindow.
Return values:
0 OK
-1 error.


Generated on Sun Apr 4 11:10:41 2004 for GOCR API by doxygen 1.3.5