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