当前位置: 首页>>代码示例>>C++>>正文


C++ waddnstr函数代码示例

本文整理汇总了C++中waddnstr函数的典型用法代码示例。如果您正苦于以下问题:C++ waddnstr函数的具体用法?C++ waddnstr怎么用?C++ waddnstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了waddnstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: print_tag

/*
 * Print the tag of a menu-item
 */
static void
print_tag(WINDOW *win,
	  char **items,
	  int choice, int selected)
{
    int my_x = item_x;
    int my_y = ItemToRow(choice);
    int tag_width = (my_x - tag_x - GUTTER);
    const int *cols;
    const int *indx;
    int limit;
    unsigned prefix;

    cols = dlg_index_columns(ItemName(0));
    indx = dlg_index_wchars(ItemName(0));
    limit = dlg_count_wchars(ItemName(0));
    prefix = indx[1] - indx[0];

    /* highlight first char of the tag to be special */
    (void) wmove(win, my_y, tag_x);
    wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
    if (strlen(ItemName(0)) != 0)
	(void) waddnstr(win, ItemName(0), prefix);
    /* print rest of the string */
    wattrset(win, selected ? tag_selected_attr : tag_attr);
    if (strlen(ItemName(0)) > prefix) {
	limit = dlg_limit_columns(ItemName(0), tag_width, 1);
	if (limit > 0)
	    (void) waddnstr(win, ItemName(0) + indx[1], indx[limit] - indx[1]);
    }
}
开发者ID:guadalinex-archive,项目名称:guadalinex-2005,代码行数:34,代码来源:menubox.c

示例2: wmove

void mrutils::ColChooser::printPrompt(const char * prompt, const char * prefix) {
    int n = 0;

    wmove((WINDOW*)chooserWin,maxLines-1,0);
    wattrset((WINDOW*)chooserWin,ATR_INPUT);
    wclrtoeol((WINDOW*)chooserWin);

    if (prefix != NULL) {
        waddnstr((WINDOW*)chooserWin,prefix,-1);
        n += strlen(prefix);
    }

    waddnstr((WINDOW*)chooserWin,prompt,-1);
    n += strlen(prompt);

    if (data[active].applySearch && !enteringSearch && prompt[0] != '>') {
        waddnstr((WINDOW*)chooserWin," searching /",-1);
        n += 12;
        waddnstr((WINDOW*)chooserWin,data[active].search,-1);
        n += strlen(data[active].search);
        waddnstr((WINDOW*)chooserWin,"/",-1);
        ++n;
    }

    wattrset((WINDOW*)chooserWin,ATR_BLANK);
    wchgat((WINDOW*)chooserWin, -1, A_NORMAL, COL_INPUT, NULL);
    wrefresh((WINDOW*)chooserWin);

    move(maxLines-1,n);
}
开发者ID:mikerobe,项目名称:mrutils,代码行数:30,代码来源:mr_colchooser.cpp

示例3: display_cmd

void display_cmd(const char *cmd, int cl, int cursor_pos)
{
	cmd_len = cl;
	if (cursor_pos == -1 || cursor_pos > cmd_len)
		cursor_pos = cmd_len;
	cmd_cursor_pos = cursor_pos;
	cmd_cmd = cmd;

	display_lock();
	werase(win_cmd);
	if (cursor_pos < cmd_len) {
		waddnstr(win_cmd, cmd, cursor_pos);
		wbkgdset(win_cmd, COLOR_PAIR(YELLOW_ON_BLACK));
		waddnstr(win_cmd, cmd + cursor_pos, 1);
		wbkgdset(win_cmd, COLOR_PAIR(BLACK_ON_YELLOW));
		waddnstr(win_cmd, cmd + cursor_pos + 1, cmd_len - (cursor_pos + 1));
	}
	else {
		waddnstr(win_cmd, cmd, cmd_len);
		wmove(win_cmd, cursor_pos, 0);
		wbkgdset(win_cmd, COLOR_PAIR(YELLOW_ON_BLACK));
		waddstr(win_cmd, " ");
		wbkgdset(win_cmd, COLOR_PAIR(BLACK_ON_YELLOW));
	}

	wattroff(win_stat, A_UNDERLINE);
	wrefresh(win_cmd);
	display_unlock();
}
开发者ID:nvf-crucio,项目名称:PROX,代码行数:29,代码来源:display.c

示例4: print_item

/*
 * Print list item
 */
static void
print_item(WINDOW *win, char **items, int status,
	   int choice, int selected)
{
    int i;
    chtype attr = A_NORMAL;
    const int *indx;
    int limit;

    /* Clear 'residue' of last item */
    wattrset(win, menubox_attr);
    (void) wmove(win, choice, 0);
    for (i = 0; i < list_width; i++)
	(void) waddch(win, ' ');

    (void) wmove(win, choice, check_x);
    wattrset(win, selected ? check_selected_attr : check_attr);
    (void) wprintw(win,
		   (checkflag == FLAG_CHECK) ? "[%c]" : "(%c)",
		   status ? 'X' : ' ');
    wattrset(win, menubox_attr);
    (void) waddch(win, ' ');

    if (strlen(ItemName(0)) != 0) {

	indx = dlg_index_wchars(ItemName(0));
	limit = dlg_count_wchars(ItemName(0));

	wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
	(void) waddnstr(win, ItemName(0), indx[1]);

	if ((int) strlen(ItemName(0)) > indx[1]) {
	    limit = dlg_limit_columns(ItemName(0), (item_x - check_x - 6), 1);
	    if (limit > 1) {
		wattrset(win, selected ? tag_selected_attr : tag_attr);
		(void) waddnstr(win,
				ItemName(0) + indx[1],
				indx[limit] - indx[1]);
	    }
	}
    }

    if (strlen(ItemText(0)) != 0) {
	indx = dlg_index_wchars(ItemText(0));
	limit = dlg_limit_columns(ItemText(0), (getmaxx(win) - item_x - 1), 0);

	if (limit > 0) {
	    (void) wmove(win, choice, item_x);
	    wattrset(win, selected ? item_selected_attr : item_attr);
	    dlg_print_text(win, ItemText(0), indx[limit], &attr);
	}
    }

    if (selected) {
	dlg_item_help(ItemHelp(0));
    }
}
开发者ID:guadalinex-archive,项目名称:guadalinex-2005,代码行数:60,代码来源:checklist.c

示例5: drawMenuItem

/*
 * drawMenuItem() is a local function that draws a menu list item (for
 * drawList)
 */
static void
drawMenuItem(Obj *obj, int idx, WINDOW *win, int x, int y)
{
    int current = obj->item.list.cury;
    int iscurrent = (current == idx && (IS_CURRENT(obj) || (obj->flags & ALWAYS_HIGHLIT)));
    int color = iscurrent ? SELECTED_COLOR : WINDOW_COLOR;

    if (iscurrent && !IS_CURRENT(obj))
	color |= READONLY_COLOR;

    wmove(win, y, x);

    if (obj->flags & SHOW_IDS) {
	char *p = obj->item.list.items[idx].id;
	if ((obj->flags & NO_HOTKEYS) == 0) {
	    setcolor(win, iscurrent ? SELECTED_COLOR : HOTKEY_COLOR);
	    waddch(win, (*p++));
	}
	setcolor(win, color);
	waddstr(win, p);
    }

    setcolor(win, color);
    wmove(win, y, x+obj->item.list.itemoffset);
    waddnstr(win, obj->item.list.items[idx].item, obj->width - obj->item.list.itemoffset);
    setcolor(win, WINDOW_COLOR);
} /* drawMenuItem */
开发者ID:Orc,项目名称:ndialog,代码行数:31,代码来源:ndwin.c

示例6: print_line

/*
 * Print a new line of text.
 */
static void
print_line(MY_OBJ * obj, int row, int width)
{
    if (wmove(obj->text, row, 0) != ERR) {
	int i, y, x;
	char *line = get_line(obj);
	const int *cols = dlg_index_columns(line);
	const int *indx = dlg_index_wchars(line);
	int limit = dlg_count_wchars(line);
	int first = 0;
	int last = limit;

	if (width > getmaxx(obj->text))
	    width = getmaxx(obj->text);
	--width;		/* for the leading ' ' */

	for (i = 0; i <= limit && cols[i] < obj->hscroll; ++i)
	    first = i;

	for (i = first; (i <= limit) && ((cols[i] - cols[first]) < width); ++i)
	    last = i;

	(void) waddch(obj->text, ' ');
	(void) waddnstr(obj->text, line + indx[first], indx[last] - indx[first]);

	getyx(obj->text, y, x);
	if (y == row) {		/* Clear 'residue' of previous line */
	    for (i = 0; i <= width - x; i++) {
		(void) waddch(obj->text, ' ');
	    }
	}
    }
}
开发者ID:0mp,项目名称:freebsd,代码行数:36,代码来源:textbox.c

示例7: draw_chars

static bool
draw_chars(struct view *view, enum line_type type, const char *string,
	   int max_len, bool use_tilde)
{
	int len = 0;
	int col = 0;
	int trimmed = FALSE;
	size_t skip = view->pos.col > view->col ? view->pos.col - view->col : 0;

	if (max_len <= 0)
		return VIEW_MAX_LEN(view) <= 0;

	if (opt_iconv_out != ICONV_NONE) {
		string = encoding_iconv(opt_iconv_out, string);
		if (!string)
			return VIEW_MAX_LEN(view) <= 0;
	}

	len = utf8_length(&string, skip, &col, max_len, &trimmed, use_tilde, opt_tab_size);

	set_view_attr(view, type);
	if (len > 0) {
		waddnstr(view->win, string, len);

		if (trimmed && use_tilde) {
			set_view_attr(view, LINE_DELIMITER);
			waddch(view->win, '~');
			col++;
		}
	}

	view->col += col;
	return VIEW_MAX_LEN(view) <= 0;
}
开发者ID:jlsandell,项目名称:tig,代码行数:34,代码来源:draw.c

示例8: draw_chars

static bool
draw_chars(struct view *view, enum line_type type, const char *string, int length,
	   int max_width, bool use_tilde)
{
	int len = 0;
	int col = 0;
	int trimmed = false;
	size_t skip = view->pos.col > view->col ? view->pos.col - view->col : 0;

	if (max_width <= 0)
		return VIEW_MAX_LEN(view) <= 0;

	len = utf8_length(&string, length, skip, &col, max_width, &trimmed, use_tilde, opt_tab_size);

	if (opt_iconv_out != ICONV_NONE) {
		string = encoding_iconv(opt_iconv_out, string, len);
		if (!string)
			return VIEW_MAX_LEN(view) <= 0;
	}

	set_view_attr(view, type);
	if (len > 0)
		waddnstr(view->win, string, len);

	if (trimmed && use_tilde) {
		set_view_attr(view, LINE_DELIMITER);
		waddstr(view->win, opt_truncation_delimiter ? opt_truncation_delimiter : "~");
		col++;
	}

	view->col += col;
	return VIEW_MAX_LEN(view) <= 0;
}
开发者ID:phschoen,项目名称:tig,代码行数:33,代码来源:draw.c

示例9: simplewin

/*
 * simplewin() draws a simple window
 */
void
simplewin(WINDOW *win,			/* ... in the given WINDOW */
	  int lines,			/* of this many lines */
	  int cols,			/* and this many cols */
	  char *title,			/* with this title */
	  int formy,			/* starting here */
	  int withbuttons)		/* and with buttons, perhaps? */
{
    werase(win);
    drawbox(win, 0, 0, lines, cols, withbuttons ? lines-3 : 0,
				    RELIEF_COLOR, WINDOW_COLOR);

    if (title) {
	int titlex = (cols - strlen(title)) / 2;

	setcolor(win, TITLE_COLOR);
	if (titlex < 1) {
	    wmove(win, 0, 0);
	    waddnstr(win, title, cols-2);
	}
	else
	    mvwaddstr(win, 0, titlex, title);
    }
    setcolor(win, WINDOW_COLOR);
} /* simplewin */
开发者ID:Orc,项目名称:ndialog,代码行数:28,代码来源:ndwin.c

示例10: addstr4

static int 
addstr4(SCR *sp, const void *str, size_t len, int wide)
{
	WINDOW *win;
	size_t y, x;
	int iv;

	win = CLSP(sp) ? CLSP(sp) : stdscr;

	/*
	 * If ex isn't in control, it's the last line of the screen and
	 * it's a split screen, use inverse video.
	 */
	iv = 0;
	getyx(win, y, x);
	__USE(x);
	if (!F_ISSET(sp, SC_SCR_EXWROTE) &&
	    y == RLNO(sp, LASTLINE(sp)) && IS_SPLIT(sp)) {
		iv = 1;
		(void)wstandout(win);
	}

#ifdef USE_WIDECHAR
	if (wide) {
	    if (waddnwstr(win, str, len) == ERR)
		return (1);
	} else 
#endif
	    if (waddnstr(win, str, len) == ERR)
		    return (1);

	if (iv)
		(void)wstandend(win);
	return (0);
}
开发者ID:Hooman3,项目名称:minix,代码行数:35,代码来源:cl_funcs.c

示例11: update_text_lines

static void update_text_lines(void)
{
	int i;
	int width;
	const char *line_begin;
	const char *line_end;
	int cur_y, cur_x;
	int rest_of_line;

	for (i = 0; i < text_box_y; ++i) {
		width = current_left;
		line_begin = mbs_at_width(text_lines[current_top + i], &width, 1);
		wmove(text_widget.window, i + 1, 1);
		if (width > current_left)
			waddch(text_widget.window, ' ');
		if (*line_begin != '\0') {
			width = text_box_x - (width > current_left);
			line_end = mbs_at_width(line_begin, &width, -1);
			if (width)
				waddnstr(text_widget.window, line_begin,
					 line_end - line_begin);
		}
		getyx(text_widget.window, cur_y, cur_x);
		if (cur_y == i + 1) {
			rest_of_line = text_box_x + 1 - cur_x;
			if (rest_of_line > 0)
				wprintw(text_widget.window, "%*s", rest_of_line, "");
		}
	}
}
开发者ID:rodan,项目名称:ampy,代码行数:30,代码来源:textbox.c

示例12: drawHighlitItem

/*
 * drawHighlitItem() is a local function that draws a highlit
 * checklist item (for drawList)
 */
static void
drawHighlitItem(Obj* obj, int idx, WINDOW* win, int x, int y)
{
    int current = obj->item.list.cury;
    int selected = obj->item.list.items[idx].selected;
    int color = selected ? SELECTED_COLOR : WINDOW_COLOR;

    if ((current == idx) && IS_CURRENT(obj)) {
	mvwaddch(win, y, x+obj->width-1, ACS_LARROW);
	mvwaddch(win, y, x, ACS_RARROW);
    }
    wmove(win, y, x + 1);

    if (obj->flags & SHOW_IDS) {
	char *p = obj->item.list.items[idx].id;
	if ((obj->flags & NO_HOTKEYS) == 0) {
	    setcolor(win, HOTKEY_COLOR);
	    waddch(win, (*p++));
	}
	setcolor(win, color);
	waddstr(win, p);
    }
    setcolor(win, color);
    wmove(win, y, x+obj->item.list.itemoffset);
    waddnstr(win, obj->item.list.items[idx].item, obj->width - obj->item.list.itemoffset);
    setcolor(win, WINDOW_COLOR);
} /* drawHighlitItem */
开发者ID:Orc,项目名称:ndialog,代码行数:31,代码来源:ndwin.c

示例13: mvwaddnstr

/*
 * mvwaddnstr --
 *      Add a string of at most n characters to the given window
 *      starting at (y, x).
 */
int
mvwaddnstr(WINDOW *win, int y, int x, const char *str, int count)
{
    if (wmove(win, y, x) == ERR)
        return ERR;

    return waddnstr(win, str, count);
}
开发者ID:mluszczyk,项目名称:so-minix,代码行数:13,代码来源:addnstr.c

示例14: addstr

int
addstr(const char *str)
{
	int code;

	code = waddnstr(stdscr, str, -1);

	return (code);
}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:9,代码来源:addnstr.c

示例15: mvaddstr

int mvaddstr(int y, int x, const char *str)
{
	PDC_LOG(("mvaddstr() - called: y %d x %d string=\"%s\"\n", y, x, str));

	if (move(y, x) == ERR)
		return ERR;

	return waddnstr(stdscr, str, -1);
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:9,代码来源:addstr.c


注:本文中的waddnstr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。