[BACK]Return to menus.3 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libmenu

File: [cvs.NetBSD.org] / src / lib / libmenu / menus.3 (download)

Revision 1.15, Wed Apr 16 13:35:12 2003 UTC (17 years, 1 month ago) by wiz
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3, netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2, mjf-devfs2-base, mjf-devfs2, matt-premerge-20091211, matt-nb8-mediatek-base, matt-nb8-mediatek, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-premerge-20101231, matt-mips64-base2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, localcount-20160914, keiichi-mipv6-base, keiichi-mipv6, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf, cherry-xenmp-base, cherry-xenmp, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver, abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.14: +2 -2 lines

Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.

.\"	$NetBSD: menus.3,v 1.15 2003/04/16 13:35:12 wiz Exp $
.\"
.\" Copyright (c) 1999
.\"	Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au
.\"
.\" This code is donated to The NetBSD Foundation by the author.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. The name of the Author may not be used to endorse or promote
.\"    products derived from this software without specific prior written
.\"    permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd September 10, 1999
.Dt MENUS 3
.Os
.Sh NAME
.Nm menus
.Nd menu library
.Sh LIBRARY
.Lb libmenu
.Sh SYNOPSIS
.In menu.h
.Sh DESCRIPTION
The
.Nm
library provides a terminal independent menu system using the
.Xr curses 3
library.
Before using the
.Nm
functions the terminal must be set up by
.Xr curses 3
using the
.Fn initscr
function or similar.
Programs using
.Nm
functions must be linked with the
.Xr curses 3
library.
.Pp
The
.Nm
library provides facilities for defining menu items, placing a menu on the
terminal screen, assign pre- and post-change operations and setting the
attributes of both the menu and its items.
.Ss Defining default attributes for menus and items
The
.Nm
library allows any settable attribute or option of both the menu and item
objects to be defined such that any new menu or item automatically inherits
the value as default.
Setting the default value will not affect any item or
menu that has already been created but will be applied to subsequent objects.
To set the default attribute or option the set routine is passed a NULL
pointer in the item or menu parameter when calling the set routine.
The current default value can be retrieved by calling the get routine with a
NULL pointer for the item or menu parameter.
.Pp
.Bl -tag -width item_description -compact
.It function name
manual page name
.It current_item
.Xr menu_item_current 3
.It free_item
.Xr menu_item_new 3
.It free_menu
.Xr menu_new 3
.It item_count
.Xr menu_items 3
.It item_description
.Xr menu_item_name 3
.It item_index
.Xr menu_item_current 3
.It item_init
.Xr menu_hook 3
.It item_name
.Xr menu_item_name 3
.It item_opts
.Xr menu_item_opts 3
.It item_opts_off
.Xr menu_item_opts 3
.It item_opts_on
.Xr menu_item_opts 3
.It item_selected
.Xr menu_item_value 3
.It item_term
.Xr menu_hook 3
.It item_userptr
.Xr menu_item_userptr 3
.It item_value
.Xr menu_item_value 3
.It item_visible
.Xr menu_item_visible 3
.It menu_back
.Xr menu_attributes 3
.It menu_driver
.Xr menu_driver 3
.It menu_fore
.Xr menu_attributes 3
.It menu_format
.Xr menu_format 3
.It menu_grey
.Xr menu_attributes 3
.It menu_init
.Xr menu_hook 3
.It menu_items
.Xr menu_items 3
.It menu_mark
.Xr menu_mark 3
.It menu_opts
.Xr menu_opts 3
.It menu_opts_off
.Xr menu_opts 3
.It menu_opts_on
.Xr menu_opts 3
.It menu_pad
.Xr menu_attributes 3
.It menu_pattern
.Xr menu_pattern 3
.It menu_sub
.Xr menu_win 3
.It menu_term
.Xr menu_hook 3
.It menu_unmark
.Xr menu_mark 3
.It menu_userptr
.Xr menu_userptr 3
.It men_win
.Xr menu_win 3
.It new_item
.Xr menu_item_new 3
.It new_menu
.Xr menu_new 3
.It pos_menu_cursor
.Xr menu_cursor 3
.It post_menu
.Xr menu_post 3
.It scale_menu
.Xr menu_win 3
.It set_current_item
.Xr menu_item_current 3
.It set_item_init
.Xr menu_hook 3
.It set_item_opts
.Xr menu_item_opts 3
.It set_item_term
.Xr menu_hook 3
.It set_item_userptr
.Xr menu_item_userptr 3
.It set_item_value
.Xr menu_item_value 3
.It set_menu_back
.Xr menu_attributes 3
.It set_menu_fore
.Xr menu_attributes 3
.It set_menu_format
.Xr menu_format 3
.It set_menu_grey
.Xr menu_attributes 3
.It set_menu_init
.Xr menu_hook 3
.It set_menu_items
.Xr menu_items 3
.It set_menu_mark
.Xr menu_mark 3
.It set_menu_opts
.Xr menu_opts 3
.It set_menu_pad
.Xr menu_attributes 3
.It set_menu_pattern
.Xr menu_pattern 3
.It set_menu_sub
.Xr menu_win 3
.It set_menu_term
.Xr menu_hook 3
.It set_menu_unmark
.Xr menu_mark 3
.It set_menu_userptr
.Xr menu_userptr 3
.It set_menu_win
.Xr menu_win 3
.It set_top_row
.Xr menu_item_current 3
.It top_row
.Xr menu_item_current 3
.It unpost_menu
.Xr menu_post 3
.El
.Sh RETURN VALUES
Any function returning a string pointer will return NULL if an error
occurs.
Functions returning an integer will return one of the following:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_SYSTEM_ERROR
There was a system error during the call.
.It Er E_BAD_ARGUMENT
One or more of the arguments passed to the function was incorrect.
.It Er E_POSTED
The menu is already posted.
.It Er E_CONNECTED
An item was already connected to a menu.
.It Er E_BAD_STATE
The function was called from within an initialization or termination
routine.
.It Er E_NO_ROOM
The menu does not fit within the subwindow.
.It Er E_NOT_POSTED
The menu is not posted.
.It Er E_UNKNOWN_COMMAND
The menu driver does not recognize the request passed to it.
.It Er E_NO_MATCH
The character search failed to find a match.
.It Er E_NOT_SELECTABLE
The item could not be selected.
.It Er E_NOT_CONNECTED
The item is not connected to a menu.
.It Er E_REQUEST_DENIED
The menu driver could not process the request.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr menu_attributes 3 ,
.Xr menu_cursor 3 ,
.Xr menu_driver 3 ,
.Xr menu_format 3 ,
.Xr menu_hook 3 ,
.Xr menu_item_current 3 ,
.Xr menu_item_name 3 ,
.Xr menu_item_new 3 ,
.Xr menu_item_opts 3 ,
.Xr menu_item_userptr 3 ,
.Xr menu_item_value 3 ,
.Xr menu_item_visible 3 ,
.Xr menu_items 3 ,
.Xr menu_mark 3 ,
.Xr menu_new 3 ,
.Xr menu_opts 3 ,
.Xr menu_pattern 3 ,
.Xr menu_post 3 ,
.Xr menu_userptr 3 ,
.Xr menu_win 3
.Sh NOTES
This implementation of the menus library does depart in behaviour
subtly from the original AT \*[Am] T implementation.
Some of the more notable departures are:
.Pp
.Bl -tag -width "item marking" -compact
.It unmark
The original implementation did not have a marker for an unmarked field
the mark was only displayed next to a field when it had been marked using
the REQ_TOGGLE_ITEM.
In this implementation a separate marker can be used
to indicate an unmarked item.
This can be set using set_menu_unmark function.
There is no requirement for the mark and unmark strings to be the same
length.
Room will be left for the longest of the two.
The unmark string
is optional, if it is not set then menus defaults to the old behaviour.
.It item marking
In the original implementation the current item was considered selected
and hence had the mark string displayed next to it.
This implementation does not do this because the Author considers the
effect too confusing.
Especially in the case of a multiple selection menu because there was no
way to tell if the current item is selected or not without shifting off
of it.
Since the current item is displayed using the foreground attribute it was
deemed unnecessary to also display the mark string against the current item.
.El
.Pp
The option O_RADIO and the function
.Fn item_selected
are
.Nx
extensions and must not be used in portable code.