本文整理汇总了C++中draw_header函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_header函数的具体用法?C++ draw_header怎么用?C++ draw_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_header函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: load_help_popup
/* render help dialog */
void
load_help_popup (WINDOW * main_win)
{
int c, quit = 1;
size_t i, n;
int y, x, h = HELP_WIN_HEIGHT, w = HELP_WIN_WIDTH;
int w2 = w - 2;
n = ARRAY_SIZE (help_main);
getmaxyx (stdscr, y, x);
WINDOW *win = newwin (h, w, (y - h) / 2, (x - w) / 2);
keypad (win, TRUE);
wborder (win, '|', '|', '-', '-', '+', '+', '+', '+');
/* create a new instance of GMenu and make it selectable */
GMenu *menu = new_gmenu (win, HELP_MENU_HEIGHT, HELP_MENU_WIDTH, HELP_MENU_Y,
HELP_MENU_X);
menu->size = n;
/* add items to GMenu */
menu->items = (GItem *) xcalloc (n, sizeof (GItem));
for (i = 0; i < n; ++i) {
menu->items[i].name = alloc_string (help_main[i]);
menu->items[i].checked = 0;
}
post_gmenu (menu);
draw_header (win, "GoAccess Quick Help", 1, 1, w2, 1);
mvwprintw (win, 2, 2, "[UP/DOWN] to scroll - [q] to quit");
wrefresh (win);
while (quit) {
c = wgetch (stdscr);
switch (c) {
case KEY_DOWN:
gmenu_driver (menu, REQ_DOWN);
draw_header (win, "", 2, 3, HELP_MENU_WIDTH, 0);
break;
case KEY_UP:
gmenu_driver (menu, REQ_UP);
draw_header (win, "", 2, 3, HELP_MENU_WIDTH, 0);
break;
case KEY_RESIZE:
case 'q':
quit = 0;
break;
}
wrefresh (win);
}
/* clean stuff up */
for (i = 0; i < n; ++i)
free (menu->items[i].name);
free (menu->items);
free (menu);
touchwin (main_win);
close_win (win);
wrefresh (main_win);
}
开发者ID:denji,项目名称:goaccess,代码行数:61,代码来源:ui.c
示例2: draw_menu_item
/* render an actual menu item */
static void
draw_menu_item (GMenu * menu, char *s, int x, int y, int w, int color,
int checked)
{
char check, *lbl = NULL;
if (menu->selectable) {
check = checked ? 'x' : ' ';
lbl = xmalloc (snprintf (NULL, 0, "[%c] %s", check, s) + 1);
sprintf (lbl, "[%c] %s", check, s);
draw_header (menu->win, lbl, "%s", y, x, w, color, 0);
free (lbl);
} else {
draw_header (menu->win, s, "%s", y, x, w, color, 0);
}
}
开发者ID:Anters,项目名称:Goaccess,代码行数:16,代码来源:gmenu.c
示例3: render_screens
/* render all windows */
static void
render_screens (void)
{
GColors *color = get_color (COLOR_DEFAULT);
int row, col, chg = 0;
getmaxyx (stdscr, row, col);
term_size (main_win);
generate_time ();
chg = logger->processed - logger->offset;
draw_header (stdscr, "", "%s", row - 1, 0, col, color_default);
wattron (stdscr, color->attr | COLOR_PAIR (color->pair->idx));
mvaddstr (row - 1, 1, "[F1]Help [Enter] Exp. Panel");
mvprintw (row - 1, 30, "%d - %s", chg, asctime (now_tm));
mvaddstr (row - 1, col - 21, "[Q]uit GoAccess");
mvprintw (row - 1, col - 5, "%s", GO_VERSION);
wattroff (stdscr, color->attr | COLOR_PAIR (color->pair->idx));
refresh ();
/* call general stats header */
display_general (header_win, conf.ifile, logger);
wrefresh (header_win);
/* display active label based on current module */
update_active_module (header_win, gscroll.current);
display_content (main_win, logger, dash, &gscroll);
}
开发者ID:0-T-0,项目名称:goaccess,代码行数:33,代码来源:goaccess.c
示例4: render_visitors
/* render dashboard hits */
static void
render_visitors (GDashModule * data, GDashRender render, int *x)
{
WINDOW *win = render.win;
GModule module = data->module;
const GDashStyle *style = module_style;
char *visitors;
int y = render.y, w = render.w, idx = render.idx, sel = render.sel;
int len = data->visitors_len;
if (data->module == HOSTS && data->data[idx].is_subitem)
goto out;
/* selected state */
if (sel) {
visitors = int_to_str (data->data[idx].metrics->visitors);
draw_header (win, visitors, "%*s", y, *x, w, HIGHLIGHT, len);
free (visitors);
}
/* regular state */
else {
wattron (win, A_BOLD | COLOR_PAIR (style[module].color_visitors));
mvwprintw (win, y, *x, "%*d", len, data->data[idx].metrics->visitors);
wattroff (win, A_BOLD | COLOR_PAIR (style[module].color_visitors));
}
out:
*x += len + DASH_SPACE;
}
开发者ID:MartinReidy,项目名称:goaccess,代码行数:31,代码来源:gdashboard.c
示例5: render_bandwidth
/* render dashboard bandwidth */
static void
render_bandwidth (GDashModule * data, GDashRender render, int *x)
{
WINDOW *win = render.win;
GModule module = data->module;
const GDashStyle *style = module_style;
int y = render.y, w = render.w, idx = render.idx, sel = render.sel;
char *bw = data->data[idx].metrics->bw.sbw;
if (data->module == HOSTS && data->data[idx].is_subitem)
goto out;
if (style[module].color_bw == -1)
return;
/* selected state */
if (sel) {
draw_header (win, bw, "%11s", y, *x, w, HIGHLIGHT, 0);
}
/* regular state */
else {
wattron (win, A_BOLD | COLOR_PAIR (style[module].color_bw));
mvwprintw (win, y, *x, "%11s", bw);
wattroff (win, A_BOLD | COLOR_PAIR (style[module].color_bw));
}
out:
*x += DASH_BW_LEN + DASH_SPACE;
}
开发者ID:MartinReidy,项目名称:goaccess,代码行数:30,代码来源:gdashboard.c
示例6: render_protocol
/* render dashboard request protocol */
static void
render_protocol (GDashModule * data, GDashRender render, int *x)
{
WINDOW *win = render.win;
GModule module = data->module;
const GDashStyle *style = module_style;
int y = render.y, w = render.w, idx = render.idx, sel = render.sel;
char *protocol = data->data[idx].metrics->protocol;
if (style[module].color_protocol == -1)
return;
if (protocol == NULL || *protocol == '\0')
return;
/* selected state */
if (sel) {
draw_header (win, protocol, "%s", y, *x, w, HIGHLIGHT, 0);
}
/* regular state */
else {
wattron (win, A_BOLD | COLOR_PAIR (style[module].color_protocol));
mvwprintw (win, y, *x, "%s", protocol);
wattroff (win, A_BOLD | COLOR_PAIR (style[module].color_protocol));
}
*x += REQ_PROTO_LEN - 1 + DASH_SPACE;
}
开发者ID:MartinReidy,项目名称:goaccess,代码行数:30,代码来源:gdashboard.c
示例7: render_screens
/* render all windows */
static void
render_screens (void)
{
int row, col, chg = 0;
getmaxyx (stdscr, row, col);
term_size (main_win);
generate_time ();
chg = logger->process - logger->offset;
draw_header (stdscr, "", "%s", row - 1, 0, col, 0, 0);
wattron (stdscr, COLOR_PAIR (COL_WHITE));
mvaddstr (row - 1, 1, "[F1]Help [O]pen detail view");
mvprintw (row - 1, 30, "%d - %s", chg, asctime (now_tm));
mvaddstr (row - 1, col - 21, "[Q]uit GoAccess");
mvprintw (row - 1, col - 5, "%s", GO_VERSION);
wattroff (stdscr, COLOR_PAIR (COL_WHITE));
refresh ();
/* call general stats header */
display_general (header_win, conf.ifile, logger);
wrefresh (header_win);
/* display active label based on current module */
update_active_module (header_win, gscroll.current);
display_content (main_win, logger, dash, &gscroll);
}
开发者ID:kingland,项目名称:goaccess,代码行数:30,代码来源:goaccess.c
示例8: draw_page_text
static void
draw_page_text (GtkPrintOperation * op, GtkPrintContext * cnt, gint page, gpointer data)
{
cairo_t *cr;
PangoLayout *layout;
gint i, line;
cr = gtk_print_context_get_cairo_context (cnt);
/* create header */
if (options.print_data.headers)
draw_header (cnt, page + 1, npages);
/* add text */
layout = gtk_print_context_create_pango_layout (cnt);
pango_layout_set_font_description (layout, fdesc);
cairo_move_to (cr, 0, HEADER_HEIGHT + HEADER_GAP);
line = page * nlines;
for (i = 0; i < nlines; i++)
{
if (text[line + i] == NULL)
break;
pango_layout_set_text (layout, text[line + i], -1);
pango_cairo_show_layout (cr, layout);
cairo_rel_move_to (cr, 0, FONTSIZE);
}
g_object_unref (layout);
}
开发者ID:BunsenLabs,项目名称:yad,代码行数:31,代码来源:print.c
示例9: new_mandel_window
// creates a new MandelPod window
void new_mandel_window(void)
{
// get the graphics context
mandel_gc = pz_get_gc(1);
// create the main window
mandel_wid = pz_new_window (0, 21,
screen_info.cols, screen_info.rows - (HEADER_TOPLINE+1),
draw_header, handle_event);
#ifdef MANDELPOD_STATUS
// create the status window
status_wid = pz_new_window (22, 4, 12, 12, draw_idle_status, handle_event);
#endif
// get screen info
GrGetWindowInfo(mandel_wid, &wi);
// select the event types
GrSelectEvents (mandel_wid, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_KEY_UP | GR_EVENT_MASK_TIMER);
// display the window
GrMapWindow (mandel_wid);
#ifdef MANDELPOD_STATUS
GrMapWindow (status_wid);
#endif
// create the timer for the busy status animation
mandel_timer_id = GrCreateTimer (mandel_wid, 250);
// start main app
init_values();
create_status();
draw_header();
calculate_mandel();
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:35,代码来源:mandelpod.c
示例10: new_tunnel_window
// Creates a new tunnel "app" window
void new_tunnel_window(void)
{
tunnel_gc = pz_get_gc(1); /* Get the graphics context */
/* Open the window: */
tunnel_wid = pz_new_window (0,
21,
screen_info.cols,
screen_info.rows - (HEADER_TOPLINE+1),
draw_header,
handle_event);
GrGetWindowInfo(tunnel_wid, &wi); /* Get screen info */
/* Select the types of events you need for your window: */
GrSelectEvents (tunnel_wid, GR_EVENT_MASK_TIMER|GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN|GR_EVENT_MASK_KEY_UP);
// set up pixmap
temp_pixmap = GrNewPixmap(screen_info.cols,
(screen_info.rows - (HEADER_TOPLINE + 1)),
NULL);
/* Display the window: */
GrMapWindow (tunnel_wid);
draw_header();
readHighScore();
reset();
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:30,代码来源:tunnel.c
示例11: reset_board
static void reset_board()
{
int index;
for(index = 0; index < 9; index++)
board[index] = '-';
difficulty = 6;
gameRunning = 1;
currSquare = 0;
draw_header();
/* Clear the window */
GrClearWindow (tictactoe_wid, GR_FALSE);
GrSetGCUseBackground(tictactoe_gc, GR_TRUE);
GrSetGCBackground(tictactoe_gc, WHITE);
GrSetGCForeground(tictactoe_gc, BLACK);
GrLine(tictactoe_wid, tictactoe_gc, wi.width * .90, (wi.height / 2.) - (wi.height / 2. * .33),
wi.width - wi.width * .90, (wi.height / 2.) - (wi.height / 2. * .33));
GrLine(tictactoe_wid, tictactoe_gc, wi.width * .90, (wi.height / 2.) + (wi.height / 2. * .33),
wi.width - wi.width * .90, (wi.height / 2.) + (wi.height / 2. * .33));
GrLine(tictactoe_wid, tictactoe_gc, (wi.width / 2.) - (wi.width / 2. * .33), wi.height * .90,
(wi.width / 2.) - (wi.width / 2. * .33), wi.height - wi.height * .90);
GrLine(tictactoe_wid, tictactoe_gc, (wi.width / 2.) + (wi.width / 2. * .33), wi.height * .90,
(wi.width / 2.) + (wi.width / 2. * .33), wi.height - wi.height * .90);
currSquare = 0;
drawXO(currSquare, GRAY, 'x');
}
开发者ID:iPodLinux-Community,项目名称:podzillaz,代码行数:30,代码来源:tictactoe.c
示例12: load_confdlg_error
/* Render the help dialog. */
static void
load_confdlg_error (WINDOW * parent_win, char **errors, int nerrors)
{
int c, quit = 1, i = 0;
int y, x, h = ERR_WIN_HEIGHT, w = ERR_WIN_WIDTH;
WINDOW *win;
GMenu *menu;
getmaxyx (stdscr, y, x);
win = newwin (h, w, (y - h) / 2, (x - w) / 2);
keypad (win, TRUE);
wborder (win, '|', '|', '-', '-', '+', '+', '+', '+');
/* create a new instance of GMenu and make it selectable */
menu =
new_gmenu (win, ERR_MENU_HEIGHT, ERR_MENU_WIDTH, ERR_MENU_Y, ERR_MENU_X);
menu->size = nerrors;
/* add items to GMenu */
menu->items = (GItem *) xcalloc (nerrors, sizeof (GItem));
for (i = 0; i < nerrors; ++i) {
menu->items[i].name = alloc_string (errors[i]);
menu->items[i].checked = 0;
free (errors[i]);
}
free (errors);
post_gmenu (menu);
draw_header (win, ERR_HEADER, " %s", 1, 1, w - 2, color_error);
mvwprintw (win, 2, 2, "[UP/DOWN] to scroll - [q] to quit");
wrefresh (win);
while (quit) {
c = wgetch (stdscr);
switch (c) {
case KEY_DOWN:
gmenu_driver (menu, REQ_DOWN);
break;
case KEY_UP:
gmenu_driver (menu, REQ_UP);
break;
case KEY_RESIZE:
case 'q':
quit = 0;
break;
}
wrefresh (win);
}
/* clean stuff up */
for (i = 0; i < nerrors; ++i)
free (menu->items[i].name);
free (menu->items);
free (menu);
touchwin (parent_win);
close_win (win);
wrefresh (parent_win);
}
开发者ID:charpty,项目名称:goaccess,代码行数:60,代码来源:ui.c
示例13: render_overall_header
/* Print out (terminal dashboard) the overall statistics header. */
static void
render_overall_header (WINDOW * win, GHolder * h)
{
char *hd = get_overall_header (h);
int col = getmaxx (stdscr);
draw_header (win, hd, " %s", 0, 0, col, color_panel_header);
free (hd);
}
开发者ID:charpty,项目名称:goaccess,代码行数:10,代码来源:ui.c
示例14: disabled_panel_msg
static void
disabled_panel_msg (GModule module)
{
const char *lbl = module_to_label (module);
int row, col;
getmaxyx (stdscr, row, col);
draw_header (stdscr, lbl, "'%s' panel is disabled", row - 1, 0, col,
WHITE_RED, 0);
}
开发者ID:kingland,项目名称:goaccess,代码行数:10,代码来源:goaccess.c
示例15: render_data
/* render dashboard data */
static void
render_data (GDashModule * data, GDashRender render, int *x)
{
WINDOW *win = render.win;
GModule module = data->module;
const GDashStyle *style = module_style;
int y = render.y, w = render.w, idx = render.idx, sel = render.sel;
char buf[DATE_LEN];
char *value, *padded_data;
value = substring (data->data[idx].metrics->data, 0, w - *x);
if (module == VISITORS) {
/* verify we have a valid date conversion */
if (convert_date (buf, value, "%Y%m%d", "%d/%b/%Y", DATE_LEN) != 0) {
LOG_DEBUG (("invalid date: %s", value));
xstrncpy (buf, "---", 4);
}
}
if (sel) {
if (data->module == HOSTS && data->data[idx].is_subitem) {
padded_data = left_pad_str (value, *x);
draw_header (win, padded_data, "%s", y, 0, w, HIGHLIGHT, 0);
free (padded_data);
} else {
draw_header (win, module == VISITORS ? buf : value, "%s", y, *x, w,
HIGHLIGHT, 0);
}
} else {
wattron (win, COLOR_PAIR (style[module].color_data));
mvwprintw (win, y, *x, "%s", module == VISITORS ? buf : value);
wattroff (win, COLOR_PAIR (style[module].color_data));
}
*x += module == VISITORS ? DATE_LEN - 1 : data->data_len;
*x += DASH_SPACE;
free (value);
}
开发者ID:MartinReidy,项目名称:goaccess,代码行数:41,代码来源:gdashboard.c
示例16: ui_spinner
/* render processing spinner */
static void
ui_spinner (void *ptr_data)
{
GSpinner *sp = (GSpinner *) ptr_data;
GColors *color = NULL;
static char const spin_chars[] = "/-\\|";
char buf[SPIN_LBL];
int i = 0;
long long tdiff = 0, psec = 0;
time_t begin;
if (sp->curses)
color = (*sp->color) ();
time (&begin);
while (1) {
pthread_mutex_lock (&sp->mutex);
if (sp->state == SPN_END)
break;
setlocale (LC_NUMERIC, "");
if (conf.no_progress) {
snprintf (buf, sizeof buf, SPIN_FMT, sp->label);
} else {
tdiff = (long long) (time (NULL) - begin);
psec = tdiff >= 1 ? *(sp->processed) / tdiff : 0;
snprintf (buf, sizeof buf, SPIN_FMTM, sp->label, *(sp->processed), psec);
}
setlocale (LC_NUMERIC, "POSIX");
if (sp->curses) {
/* CURSES */
draw_header (sp->win, buf, " %s", sp->y, sp->x, sp->w, sp->color);
/* caret */
wattron (sp->win, COLOR_PAIR (color->pair->idx));
mvwaddch (sp->win, sp->y, sp->spin_x, spin_chars[i++ & 3]);
wattroff (sp->win, COLOR_PAIR (color->pair->idx));
wrefresh (sp->win);
} else if (!conf.no_progress) {
/* STDOUT */
fprintf (stderr, "%s\r", buf);
}
pthread_mutex_unlock (&sp->mutex);
usleep (100000);
}
sp = NULL;
free (sp);
}
开发者ID:NinjaOSX,项目名称:goaccess,代码行数:51,代码来源:ui.c
示例17: draw_formats
static void
draw_formats (WINDOW * win, int w2)
{
char *date_format = NULL, *log_format = NULL, *time_format = NULL;
draw_header (win, "Log Format Configuration", " %s", 1, 1, w2,
color_panel_header);
mvwprintw (win, 2, 2, "[SPACE] to toggle - [ENTER] to proceed - [q]uit");
/* set log format from config file if available */
draw_header (win, "Log Format - [c] to add/edit format", " %s", 11, 1, w2,
color_panel_header);
if ((log_format = get_input_log_format ())) {
mvwprintw (win, 12, 2, "%.*s", CONF_MENU_W, log_format);
free (log_format);
}
/* set log format from config file if available */
draw_header (win, "Date Format - [d] to add/edit format", " %s", 14, 1, w2,
color_panel_header);
if ((date_format = get_input_date_format ())) {
mvwprintw (win, 15, 2, "%.*s", CONF_MENU_W, date_format);
free (date_format);
}
/* set log format from config file if available */
draw_header (win, "Time Format - [t] to add/edit format", " %s", 17, 1, w2,
color_panel_header);
if ((time_format = get_input_time_format ())) {
mvwprintw (win, 18, 2, "%.*s", CONF_MENU_W, time_format);
free (time_format);
}
}
开发者ID:charpty,项目名称:goaccess,代码行数:36,代码来源:ui.c
示例18: regexp_init
/* compile the regular expression and see if it's valid */
static int
regexp_init (regex_t * regex, const char *pattern)
{
int y, x, rc;
char buf[REGEX_ERROR];
getmaxyx (stdscr, y, x);
rc = regcomp (regex, pattern, REG_EXTENDED | (find_t.icase ? REG_ICASE : 0));
/* something went wrong */
if (rc != 0) {
regerror (rc, regex, buf, sizeof (buf));
draw_header (stdscr, buf, "%s", y - 1, 0, x, WHITE_RED, 0);
refresh ();
return 1;
}
return 0;
}
开发者ID:MartinReidy,项目名称:goaccess,代码行数:18,代码来源:gdashboard.c
示例19: render_total_label
/* render module's total */
static void
render_total_label (WINDOW * win, GDashModule * data, int y, int color)
{
char *s;
int win_h, win_w, total, ht_size;
total = data->holder_size;
ht_size = data->ht_size;
s = xmalloc (snprintf (NULL, 0, "Total: %d/%d", total, ht_size) + 1);
getmaxyx (win, win_h, win_w);
(void) win_h;
sprintf (s, "Total: %d/%d", total, ht_size);
draw_header (win, s, "%s", y, win_w - strlen (s) - 2, win_w, color, 0);
free (s);
}
开发者ID:MartinReidy,项目名称:goaccess,代码行数:18,代码来源:gdashboard.c
示例20: ui_spinner
/* render processing spinner */
static void
ui_spinner (void *ptr_data)
{
GSpinner *sp = (GSpinner *) ptr_data;
static char const spin_chars[] = "/-\\|";
char buf[SPIN_LBL];
long long tdiff = 0, psec = 0;
int i = 0;
time_t begin;
time (&begin);
while (1) {
pthread_mutex_lock (&sp->mutex);
if (sp->state == SPN_END)
break;
tdiff = (long long) (time (NULL) - begin);
psec = tdiff >= 1 ? *(sp->process) / tdiff : 0;
snprintf (buf, sizeof buf, SPIN_FMT, sp->label, *(sp->process), psec);
/* CURSES */
if (sp->curses) {
/* label + metrics */
draw_header (sp->win, buf, " %s", sp->y, sp->x, sp->w, sp->color);
/* caret */
wattron (sp->win, COLOR_PAIR (sp->color));
mvwaddch (sp->win, sp->y, sp->spin_x, spin_chars[i++ & 3]);
wattroff (sp->win, COLOR_PAIR (sp->color));
wrefresh (sp->win);
}
/* STDOUT */
else {
fprintf (stderr, "%s\r", buf);
}
pthread_mutex_unlock (&sp->mutex);
usleep (100000);
}
sp = NULL;
free (sp);
}
开发者ID:phiexz,项目名称:goaccess,代码行数:44,代码来源:ui.c
注:本文中的draw_header函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论