mcurrent.c revision d67944fbe3fa0b31893a7116a09b0718eecf6078
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include <stdio.h>
#include <curses.h>
#include "wish.h"
#include "menu.h"
#include "menudefs.h"
#include "vtdefs.h"
#include "attrs.h"
#include "ctl.h"
#include "color_pair.h"
#include "sizes.h"
#define menu_pos(m, i, r, c, dr, dc) ((m->ncols > 1) ? (dc = i / r, dr = i % r) : (dc = 0, dr = i - m->topline))
#define NULLSTR ""
void menu_index();
int
{
register struct menu *m;
vt_current(m->vid);
/*
* This code determines the first menu item reached
* when the menu is first drawn.
*
* Do not match inactive menu items.
*/
}
else {
menu_index(m, 0, MENU_ALL);
}
}
return SUCCESS;
}
int
{
register struct menu *m;
if (MNU_curid < 0)
return FAIL;
MNU_curid = -1;
return SUCCESS;
}
static void menu_show();
void
register struct menu *m;
int newindex;
int hcols;
{
register int col;
register int line;
int cwidth;
int huse;
int duse;
int destrow;
int destcol;
int rows;
int cols;
int scol;
int sind;
if (m->dwidth)
else
duse = 0;
/* remove old indicator (if any) */
}
/* desired index is far away - redraw menu with it in center */
wgo(0, 0);
wclrwin();
m->topline = 0;
scol = 0;
break;
}
}
m->flags &= ~MENU_DIRTY;
}
wscrollwin(1);
m->topline++;
destrow--;
}
else if (destrow == -1) {
wscrollwin(-1);
m->topline--;
destrow++;
}
if (m->index >= 0) {
}
/* update arrows */
if (m->ncols == 1) {
line = 0;
if (m->topline)
line |= VT_UPPARROW;
line |= VT_DNPARROW;
}
}
static void
register struct menu *m;
int len1;
register int len2;
int high;
{
register char *s, ch;
register int tot;
int r = 0;
int c = 0;
ch = '*';
else
if (s == NULL)
s = NULLSTR;
/*
* If a menu item is inactive, set the attributes to dim.
*/
else
if (high > 0) {
}
while (len1-- > 0)
if (m->flags & MENU_TRUNC)
{
len2 -= LEN_TRUNC_STR;
}
else
{
s = ml->description;
if (s == NULL)
s = NULLSTR;
if (s && len2 > 0) {
}
}
while (len2-- > 0)
if (high)
wgo(r, c);
}
/*
* returns the "translated" menu item name (lininfo) or the
* actual menu item name if the translated name is not provided.
*/
char *
menu_list(m, i)
struct menu *m;
int i;
{
return(NULL);
else
}