Example #1
0
/*
 * Display and/or allow update for the properties accessed in the opaque
 * window.  Some may change state after refreshing the window, so we
 * distinguish between them using the 'before' parameter.
 */
static int
show_opaque(WINDOW *stswin, WINDOW *txtwin, bool before, int active)
{
    int n;
    int top, bottom;

    if (before) {
	werase(stswin);
    }
    for (n = 0; n < (int) SIZEOF(bool_funcs); ++n) {
	show_keyword(stswin, n, active, bool_funcs[n].name);

	to_result(stswin, n, before);
	wprintw(stswin, "%c", bool_funcs[n].func(txtwin, -1) ? 'T' : 'F');
    }

    show_keyword(stswin, n, active, "wgetparent");
    to_result(stswin, n, TRUE);
    wprintw(stswin, "%p", (void *) wgetparent(txtwin));

    ++n;
    show_keyword(stswin, n, active, "wgetscrreg");
    to_result(stswin, n, TRUE);
    if (wgetscrreg(txtwin, &top, &bottom) == OK)
	wprintw(stswin, "%d,%d", top, bottom);

    wnoutrefresh(stswin);
    return active;
}
Example #2
0
static void
print_both(ALL_DATA * data,
	   int choice)
{
    int selected;
    int cur_y, cur_x;
    WINDOW *dialog = wgetparent(data->list[0].win);

    getyx(dialog, cur_y, cur_x);
    for (selected = 0; selected < 2; ++selected) {
	MY_DATA *moi = data->list + selected;
	WINDOW *win = moi->win;
	int thumb_top = index2row(data, moi->top_index, selected);
	int thumb_max = index2row(data, -1, selected);
	int thumb_end = thumb_top + getmaxy(win);

	print_1_list(data, choice, selected);

	dlg_mouse_setcode(selected * KEY_MAX);
	dlg_draw_scrollbar(dialog,
			   (long) (moi->top_index),
			   (long) (thumb_top),
			   (long) MIN(thumb_end, thumb_max),
			   (long) thumb_max,
			   moi->box_x + data->check_x,
			   moi->box_x + getmaxx(win),
			   moi->box_y,
			   moi->box_y + getmaxy(win) + 1,
			   menubox_border2_attr,
			   menubox_border_attr);
    }
    (void) wmove(dialog, cur_y, cur_x);
    dlg_mouse_setcode(0);
}
Example #3
0
File: arrows.c Project: 0mp/freebsd
void
dlg_draw_arrows2(WINDOW *win,
		 int top_arrow,
		 int bottom_arrow,
		 int x,
		 int top,
		 int bottom,
		 chtype attr,
		 chtype borderattr)
{
    chtype save = dlg_get_attrs(win);
    int cur_x, cur_y;
    int limit_x = getmaxx(win);
    bool draw_top = TRUE;
    bool is_toplevel = (wgetparent(win) == stdscr);

    getyx(win, cur_y, cur_x);

    /*
     * If we're drawing a centered title, do not overwrite with the arrows.
     */
    if (dialog_vars.title && is_toplevel && (top - getbegy(win)) < MARGIN) {
	int have = (limit_x - dlg_count_columns(dialog_vars.title)) / 2;
	int need = x + 5;
	if (need > have)
	    draw_top = FALSE;
    }

    if (draw_top) {
	(void) wmove(win, top, x);
	if (top_arrow) {
	    (void) wattrset(win, merge_colors(uarrow_attr, attr));
	    (void) add_acs(win, ACS_UARROW);
	    (void) waddstr(win, "(-)");
	} else {
	    (void) wattrset(win, attr);
	    (void) whline(win, dlg_boxchar(ACS_HLINE), ON_LEFT);
	}
    }
    mouse_mkbutton(top, x - 1, 6, KEY_PPAGE);

    (void) wmove(win, bottom, x);
    if (bottom_arrow) {
	(void) wattrset(win, merge_colors(darrow_attr, borderattr));
	(void) add_acs(win, ACS_DARROW);
	(void) waddstr(win, "(+)");
    } else {
	(void) wattrset(win, borderattr);
	(void) whline(win, dlg_boxchar(ACS_HLINE), ON_LEFT);
    }
    mouse_mkbutton(bottom, x - 1, 6, KEY_NPAGE);

    (void) wmove(win, cur_y, cur_x);
    wrefresh(win);

    (void) wattrset(win, save);
}
Example #4
0
SCM
gucu_getparent (SCM win)
{
  WINDOW *parent = wgetparent (_scm_to_window (win));
  if (parent != (WINDOW *) NULL)
    return _scm_from_window (parent);
  else
    return SCM_BOOL_F;
}
Example #5
0
void
dlg_trace_win(WINDOW *win)
{
    if (myFP != 0) {
	int y, x;
	int j, k;
	WINDOW *top = wgetparent(win);

	while (top != 0 && top != stdscr) {
	    win = top;
	    top = wgetparent(win);
	}

	if (win != 0) {
	    int rc = getmaxy(win);
	    int cc = getmaxx(win);
	    chtype ch, c2;

	    fprintf(myFP, "window %dx%d at %d,%d\n",
		    rc, cc, getbegy(win), getbegx(win));

	    getyx(win, y, x);
	    for (j = 0; j < rc; ++j) {
		fprintf(myFP, "%3d:", j);
		for (k = 0; k < cc; ++k) {
#ifdef USE_WIDE_CURSES
		    char buffer[80];

		    ch = mvwinch(win, j, k) & (A_CHARTEXT | A_ALTCHARSET);
		    if (ch & A_ALTCHARSET) {
			c2 = dlg_asciibox(ch);
			if (c2 != 0) {
			    ch = c2;
			}
			buffer[0] = (char) ch;
			buffer[1] = '\0';
		    } else {
			cchar_t cch;
			wchar_t *uc;

			if (win_wch(win, &cch) == ERR
			    || (uc = wunctrl((&cch))) == 0
			    || uc[1] != 0
			    || wcwidth(uc[0]) <= 0) {
			    buffer[0] = '.';
			    buffer[1] = '\0';
			} else {
			    mbstate_t state;
			    const wchar_t *ucp = uc;

			    memset(&state, 0, sizeof(state));
			    wcsrtombs(buffer, &ucp, sizeof(buffer), &state);
			    k += wcwidth(uc[0]) - 1;
			}
		    }
		    fputs(buffer, myFP);
#else
		    ch = mvwinch(win, j, k) & (A_CHARTEXT | A_ALTCHARSET);
		    c2 = dlg_asciibox(ch);
		    if (c2 != 0) {
			ch = c2;
		    } else if (unctrl(ch) == 0 || strlen(unctrl(ch)) > 1) {
			ch = '.';
		    }
		    fputc((int) (ch & 0xff), myFP);
#endif
		}
		fputc('\n', myFP);
	    }
	    wmove(win, y, x);
	    fflush(myFP);
	}
    }
}