blob: 42d36c39754bf08d44ee50b2d0dfc1101bac8ba2 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2018-2023,2024 Thomas E. Dickey *
3.\" Copyright 1998-2006,2010 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
5.\" Permission is hereby granted, free of charge, to any person obtaining a *
6.\" copy of this software and associated documentation files (the *
7.\" "Software"), to deal in the Software without restriction, including *
8.\" without limitation the rights to use, copy, modify, merge, publish, *
9.\" distribute, distribute with modifications, sublicense, and/or sell *
10.\" copies of the Software, and to permit persons to whom the Software is *
11.\" furnished to do so, subject to the following conditions: *
12.\" *
13.\" The above copyright notice and this permission notice shall be included *
14.\" in all copies or substantial portions of the Software. *
15.\" *
16.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23.\" *
24.\" Except as contained in this notice, the name(s) of the above copyright *
25.\" holders shall not be used in advertising or otherwise to promote the *
26.\" sale, use or other dealings in this Software without prior written *
27.\" authorization. *
28.\"***************************************************************************
29.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $Id: mitem_current.3x,v 1.37 2024/03/16 15:35:01 tom Exp $
31.TH mitem_current 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053032.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040033\fBmitem_current\fP \-
34set and get current_menu_item
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053035.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040036.nf
37\fB#include <menu.h>
38.PP
39\fBint set_current_item(MENU *\fImenu\fP, ITEM *\fIitem\fP);
40\fBITEM *current_item(const MENU *\fImenu\fP);
41.PP
42\fBint set_top_row(MENU *\fImenu\fP, int \fIrow\fP);
43\fBint top_row(const MENU *\fImenu\fP);
44.PP
45\fBint item_index(const ITEM *\fIitem\fP);
46.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053047.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040048The function \fBset_current_item\fP sets the current item (the item on which
49the menu cursor is positioned).
50\fBcurrent_item\fP returns a pointer to the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053051current item in the given menu.
52.PP
micky3879b9f5e72025-07-08 18:04:53 -040053The function \fBset_top_row\fP sets the top row of the menu to show the given
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053054row (the top row is initially 0, and is reset to this value whenever the
micky3879b9f5e72025-07-08 18:04:53 -040055\fBO_ROWMAJOR\fP option is toggled).
56The item leftmost on the given row
57becomes current.
58The function \fBtop_row\fP returns the number of the top menu
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053059row being displayed.
60.PP
micky3879b9f5e72025-07-08 18:04:53 -040061The function \fBitem_index\fP returns the (zero-origin) index of \fIitem\fP in
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053062the menu's item pointer list.
63.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -040064\fBcurrent_item\fP returns a pointer (which may be \fBNULL\fP).
65It does not set \fBerrno\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053066.PP
micky3879b9f5e72025-07-08 18:04:53 -040067\fBtop_row\fP and \fBitem_index\fP return \fBERR\fP (the general \fBcurses\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053068error value) if their \fImenu\fP parameter is \fBNULL\fP.
69.PP
micky3879b9f5e72025-07-08 18:04:53 -040070\fBset_current_item\fP and \fBset_top_row\fP return one of the following:
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053071.TP 5
72.B E_OK
73The routine succeeded.
74.TP 5
75.B E_BAD_ARGUMENT
76Routine detected an incorrect or out-of-range argument.
77.TP 5
78.B E_BAD_STATE
79Routine was called from an initialization or termination function.
80.TP 5
81.B E_NOT_CONNECTED
82No items are connected to the menu.
83.TP 5
84.B E_SYSTEM_ERROR
micky3879b9f5e72025-07-08 18:04:53 -040085System error occurred (see \fBerrno\fP(3)).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053086.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -040087These routines emulate the System V menu library.
88They were not supported on
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053089Version 7 or BSD versions.
90.PP
micky3879b9f5e72025-07-08 18:04:53 -040091The SVr4 menu library documentation specifies the \fBtop_row\fP and
92\fBindex_item\fP error value as \-1 (which is the value of \fBERR\fP).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053093.SH AUTHORS
micky3879b9f5e72025-07-08 18:04:53 -040094Juergen Pfeifer.
95Manual pages and adaptation for new curses by Eric S. Raymond.
96.SH SEE ALSO
97\fB\%curses\fP(3X),
98\fB\%menu\fP(3X)