Menu Library
[Reference documentation]

Group of functions related to desktop and window menu handling. More...

Functions

int mt_MenuBar (APPvar *app, OBJECT *menu, int mode)
 Install the desktop menu.
int mt_MenuTnormal (APPvar *app, WINDOW *win, int title, int mode)
 Hilight or unhilight a title in a menu.
int mt_MenuIcheck (APPvar *app, WINDOW *win, int title, int mode)
 Check or uncheck an entry in a menu.
int mt_MenuText (APPvar *app, WINDOW *win, int title, char *txt)
 Change the text of a menu entry.
int mt_MenuDisable (APPvar *app)
 Disable the desktop menu.
int mt_MenuEnable (APPvar *app)
 Enable the desktop menu.
int mt_MenuPopUp (APPvar *app, void *data, int x, int y, int max, int size, int item, int mode)
 Display and handle a menu popup.
void mt_MenuScroll (APPvar *app, WINDOW *win, int dir)
 Scroll the titles of a window menu.

Detailed Description

Group of functions related to desktop and window menu handling.


Function Documentation

int mt_MenuBar APPvar app,
OBJECT *  menu,
int  mode
 

Install the desktop menu.

Parameters:
app application descriptor,
menu objects tree standing for the menu,
mode possible values are :
  • 1 for installing the menu,
  • 0 for removing the menu,
Returns:
0 or a negative code error.
Precondition:
Desktop menu should not contain any G_USERDEF objects (or extended object types) because some AES does not support correctly userdefs.
mt_MenuBar() remplaces the AES mt_menu_bar() function which should never be used in the WinDom environment.

See also:
mt_MenuTnorma(), mt_MenuIcheck(), mt_MenuText().

int mt_MenuDisable APPvar app  ) 
 

Disable the desktop menu.

Parameters:
app application descriptor.
Returns:
0 or a negative code error.
mt_MenuDisable() disables the desktop menu: the user cannot select items except the desktop accessories. This function is used by mt_FormWindBegin(), the file and font selectors.

See also:
mt_MenuEnable()

int mt_MenuEnable APPvar app  ) 
 

Enable the desktop menu.

Parameters:
app application descriptor.
Returns:
O or a negativ code error.
mt_MenuEnable() enables the desktop menu previously disabled by mt_MenuDisable(). This function is used by mt_FormWindEnd(), the file and font selectors.
See also:
mt_MenuDisable()

int mt_MenuIcheck APPvar app,
WINDOW win,
int  item,
int  check
 

Check or uncheck an entry in a menu.

Parameters:
app application descriptor,
win window descriptor containing a menu or NULL for desktop menu,
item index of menu entry,
check possible values are :
  • 0 : uncheck the entry,
  • 1 : check the entry,
Returns:
0 or a negative error.
mt_MenuIcheck() replaces and extendes the AES mt_menu_icheck() function. It can be used on window menu or on the desktop menu (if win parameter is set to NULL).

Extended objects are correctly handled by this function.

int mt_MenuPopUp APPvar app,
void *  list,
int  xpop,
int  ypop,
int  size,
int  seen,
int  item,
int  mode
 

Display and handle a menu popup.

Parameters:
app application descriptor,
list address of a valid object tree or a list of entries (see mode),
xpop,ypop menu popup position in the desktop,
size if P_LIST is used, indicates the number of element in list, otherwise this value is ignored,
seen if P_LIST is used, indicates the maximum of entries seen in the popup, otherwise this value is ignored,
item an index in list array : the entry matching to this item is centered (and popup parent too) on the mouse position,
mode a bit field, possible values are :
  • P_RDRW this bit means that a simple redraw message will be sent to screen to redraw the area hiding by the popup instead of save the area in a buffer. This mode can be used if the popup is called from a window. With the (!B)P_WNDW(!b) mode, this mode is always used,
  • P_WNDW the popup will be drawn in a window instead of a classic formular. This mode does not stop the AES events. It should not be used when the popup is call from a classic formular,
  • P_LIST this mode means that list parameter points to list of entries, ie an array of strings. Each string is an entry in the popup menu. It allows to creating popup without use an object tree.
  • P_CHCK The item index entry will be checked.
Returns:
index of item selected in the popup or -1 if no selection.
If P_WNDW mode is set, it can be disabled by the user if the windom.popup.window variable in the WinDom configuration file is set to FALSE. This mode should be used always be used when it is possible (a call of mt_MenuPopup() over a window) because the user has the choice to enable or disable this feature.

A list of entries is a pointer such as "char *ptxt[]". If the seen parameter is used, the popup is displayed with a slider and contains seen items.

Keyboards can be used to naviguate in the popup (up and down arrow) and validate an entry (RETURN or ENTER keys).

With a P_LIST mode, the menu popup aspect can be defined by the user from the WinDom configuration file (see windom.popup variables).

void mt_MenuScroll APPvar app,
WINDOW win,
int  dir
 

Scroll the titles of a window menu.

Parameters:
app application descriptor,
win window descriptor having an menu,
dir scroll direction :
  • 1 means scroll in left direction,
  • 0 means scroll in right direction.
If the variable windom.menu.scroll in the WinDom configuration file is set to TRUE, a scroller widget appears in the window menu bar: the user can himself scrolls the menu titles. This function can scroll menu titles.

int mt_MenuText APPvar app,
WINDOW win,
int  item,
char *  txt
 

Change the text of a menu entry.

Parameters:
app application descriptor,
win window descriptor containing a menu or NULL for desktop menu,
item index of menu entry,
txt new entry label.
Returns:
0 or a negative error.
mt_MenuText() is the WinDom equivalent of the AES mt_menu_text() function. It is used to change the text of an entry (or a title) in a window menu or in the desktop menu. mt_MenuText() should be always used instead of ObjcString().

Extended objects are correctly handled by this function.

int mt_MenuTnormal APPvar app,
WINDOW win,
int  title,
int  mode
 

Hilight or unhilight a title in a menu.

Parameters:
app application descriptor,
win window descriptor containing a menu or NULL for desktop menu,
title index of title menu,
mode possible values are :
  • 0 : hilights the title,
  • 1 : unhilights the title.
Returns:
0 or a negative error.
mt_MenuTnormal() replaces and extendes the AES mt_menu_tnormal() function. It can be used on window menu or on the desktop menu (if win parameter is set to NULL). mt_MenuTnormal() it usually used to unhilight a menu entry when a MN_SELECTED message occurs.


Generated on Thu Jun 22 11:45:29 2006 for WinDom by  doxygen 1.4.6