]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/mitem_current.3x
ncurses 6.2 - patch 20200816
[ncurses.git] / man / mitem_current.3x
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright 2018-2019,2020 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.18 2020/03/28 19:06:28 tom Exp $
32 .TH mitem_current 3X ""
33 .SH NAME
34 \fBmitem_current\fR \- set and get current_menu_item
35 .SH SYNOPSIS
36 \fB#include <menu.h>\fR
37 .br
38 int set_current_item(MENU *menu, ITEM *item);
39 .br
40 ITEM *current_item(const MENU *menu);
41 .br
42 int set_top_row(MENU *menu, int row);
43 .br
44 int top_row(const MENU *menu);
45 .br
46 int item_index(const ITEM *item);
47 .br
48 .SH DESCRIPTION
49 The function \fBset_current_item\fR sets the current item (the item on which
50 the menu cursor is positioned).
51 \fBcurrent_item\fR returns a pointer to the
52 current item in the given menu.
53 .PP
54 The function \fBset_top_row\fR sets the top row of the menu to show the given
55 row (the top row is initially 0, and is reset to this value whenever the
56 \fBO_ROWMAJOR\fR option is toggled).
57 The item leftmost on the given row
58 becomes current.
59 The function \fBtop_row\fR returns the number of the top menu
60 row being displayed.
61 .PP
62 The function \fBitem_index\fR returns the (zero-origin) index of \fIitem\fR in
63 the menu's item pointer list.
64 .SH RETURN VALUE
65 \fBcurrent_item\fR returns a pointer (which may be \fBNULL\fR).
66 It does not set \fBerrno\fP.
67 .PP
68 \fBtop_row\fR and \fBitem_index\fR return \fBERR\fR (the general \fBcurses\fR
69 error value) if their \fImenu\fP parameter is \fBNULL\fP.
70 .PP
71 \fBset_current_item\fR and \fBset_top_row\fR return one of the following:
72 .TP 5
73 .B E_OK
74 The routine succeeded.
75 .TP 5
76 .B E_BAD_ARGUMENT
77 Routine detected an incorrect or out-of-range argument.
78 .TP 5
79 .B E_BAD_STATE
80 Routine was called from an initialization or termination function.
81 .TP 5
82 .B E_NOT_CONNECTED
83 No items are connected to the menu.
84 .TP 5
85 .B E_SYSTEM_ERROR
86 System error occurred (see \fBerrno\fR(3)).
87 .SH SEE ALSO
88 \fBcurses\fR(3X), \fBmenu\fR(3X).
89 .SH NOTES
90 The header file \fB<menu.h>\fR automatically includes the header file
91 \fB<curses.h>\fR.
92 .SH PORTABILITY
93 These routines emulate the System V menu library.
94 They were not supported on
95 Version 7 or BSD versions.
96 .PP
97 The SVr4 menu library documentation specifies the \fBtop_row\fR and
98 \fBindex_item\fR error value as \-1 (which is the value of \fBERR\fR).
99 .SH AUTHORS
100 Juergen Pfeifer.
101 Manual pages and adaptation for new curses by Eric S. Raymond.