jcs's openbsd hax
openbsd
at jcs 102 lines 4.6 kB view raw
1'\" t 2.\" $OpenBSD: mitem_current.3,v 1.7 2023/10/17 09:52:10 nicm Exp $ 3.\" 4.\"*************************************************************************** 5.\" Copyright 2018-2022,2023 Thomas E. Dickey * 6.\" Copyright 1998-2006,2010 Free Software Foundation, Inc. * 7.\" * 8.\" Permission is hereby granted, free of charge, to any person obtaining a * 9.\" copy of this software and associated documentation files (the * 10.\" "Software"), to deal in the Software without restriction, including * 11.\" without limitation the rights to use, copy, modify, merge, publish, * 12.\" distribute, distribute with modifications, sublicense, and/or sell * 13.\" copies of the Software, and to permit persons to whom the Software is * 14.\" furnished to do so, subject to the following conditions: * 15.\" * 16.\" The above copyright notice and this permission notice shall be included * 17.\" in all copies or substantial portions of the Software. * 18.\" * 19.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 20.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 21.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 22.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 23.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 24.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 25.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 26.\" * 27.\" Except as contained in this notice, the name(s) of the above copyright * 28.\" holders shall not be used in advertising or otherwise to promote the * 29.\" sale, use or other dealings in this Software without prior written * 30.\" authorization. * 31.\"*************************************************************************** 32.\" 33.\" $Id: mitem_current.3,v 1.7 2023/10/17 09:52:10 nicm Exp $ 34.TH mitem_current 3 2023-07-01 "ncurses 6.4" "Library calls" 35.SH NAME 36\fBmitem_current\fP \- set and get current_menu_item 37.SH SYNOPSIS 38\fB#include <menu.h>\fP 39.sp 40\fBint set_current_item(MENU *\fImenu\fB, ITEM *\fIitem\fB);\fR 41.br 42\fBITEM *current_item(const MENU *\fImenu\fB);\fR 43.sp 44\fBint set_top_row(MENU *\fImenu\fB, int \fIrow\fB);\fR 45.br 46\fBint top_row(const MENU *\fImenu\fB);\fR 47.sp 48\fBint item_index(const ITEM *\fIitem\fB);\fR 49.SH DESCRIPTION 50The function \fBset_current_item\fP sets the current item (the item on which 51the menu cursor is positioned). 52\fBcurrent_item\fP returns a pointer to the 53current item in the given menu. 54.PP 55The function \fBset_top_row\fP sets the top row of the menu to show the given 56row (the top row is initially 0, and is reset to this value whenever the 57\fBO_ROWMAJOR\fP option is toggled). 58The item leftmost on the given row 59becomes current. 60The function \fBtop_row\fP returns the number of the top menu 61row being displayed. 62.PP 63The function \fBitem_index\fP returns the (zero-origin) index of \fIitem\fP in 64the menu's item pointer list. 65.SH RETURN VALUE 66\fBcurrent_item\fP returns a pointer (which may be \fBNULL\fP). 67It does not set \fBerrno\fP. 68.PP 69\fBtop_row\fP and \fBitem_index\fP return \fBERR\fP (the general \fBcurses\fP 70error value) if their \fImenu\fP parameter is \fBNULL\fP. 71.PP 72\fBset_current_item\fP and \fBset_top_row\fP return one of the following: 73.TP 5 74.B E_OK 75The routine succeeded. 76.TP 5 77.B E_BAD_ARGUMENT 78Routine detected an incorrect or out-of-range argument. 79.TP 5 80.B E_BAD_STATE 81Routine was called from an initialization or termination function. 82.TP 5 83.B E_NOT_CONNECTED 84No items are connected to the menu. 85.TP 5 86.B E_SYSTEM_ERROR 87System error occurred (see \fBerrno\fP(3)). 88.SH SEE ALSO 89\fBcurses\fP(3), \fBmenu\fP(3). 90.SH NOTES 91The header file \fB<menu.h>\fP automatically includes the header file 92\fB<curses.h>\fP. 93.SH PORTABILITY 94These routines emulate the System V menu library. 95They were not supported on 96Version 7 or BSD versions. 97.PP 98The SVr4 menu library documentation specifies the \fBtop_row\fP and 99\fBindex_item\fP error value as \-1 (which is the value of \fBERR\fP). 100.SH AUTHORS 101Juergen Pfeifer. 102Manual pages and adaptation for new curses by Eric S. Raymond.