Debian Codegraph @

upstream/debian-unstable/man3/menu_current.3menu

raw
1 .\"***************************************************************************
2 .\" Copyright 2018-2023,2024 Thomas E. Dickey *
3 .\" Copyright 1998-2006,2010 Free Software Foundation, Inc. *
4 .\" *
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 .\"
30 .\" $Id: mitem_current.3x,v 1.39 2024/12/28 21:26:21 tom Exp $
31 .TH menu_current 3MENU 2024-12-28 "ncurses 6.6" "Library calls"
32 .SH NAME
33 \fBmitem_current\fP \-
34 set and get current_menu_item
35 .SH SYNOPSIS
36 .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
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
65 .IR NULL ")."
66 It does not set \fBerrno\fP.
67 .PP
68 \fBtop_row\fP and \fBitem_index\fP return \fBERR\fP (the general \fBcurses\fP
69 error value) if their \fImenu\fP parameter is
70 .IR NULL "."
71 .PP
72 \fBset_current_item\fP and \fBset_top_row\fP return one of the following:
73 .TP 5
74 .B E_OK
75 The routine succeeded.
76 .TP 5
77 .B E_BAD_ARGUMENT
78 Routine detected an incorrect or out-of-range argument.
79 .TP 5
80 .B E_BAD_STATE
81 Routine was called from an initialization or termination function.
82 .TP 5
83 .B E_NOT_CONNECTED
84 No items are connected to the menu.
85 .TP 5
86 .B E_SYSTEM_ERROR
87 System error occurred (see \fBerrno\fP(3)).
88 .SH PORTABILITY
89 These routines emulate the System V menu library.
90 They were not supported on
91 Version 7 or BSD versions.
92 .PP
93 The SVr4 menu library documentation specifies the \fBtop_row\fP and
94 \fBindex_item\fP error value as \-1 (which is the value of \fBERR\fP).
95 .SH AUTHORS
96 Juergen Pfeifer.
97 Manual pages and adaptation for new curses by Eric S. Raymond.
98 .SH SEE ALSO
99 \fB\%ncurses\fP(3NCURSES),
100 \fB\%menu\fP(3MENU)