这篇教程C++ tty_setcolor函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tty_setcolor函数的典型用法代码示例。如果您正苦于以下问题:C++ tty_setcolor函数的具体用法?C++ tty_setcolor怎么用?C++ tty_setcolor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tty_setcolor函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: tree_show_mini_infostatic void tree_show_mini_info (WTree *tree, int tree_lines, int tree_cols){ Dlg_head *h = tree->widget.parent; int line; /* Show mini info */ if (tree->is_panel){ if (!show_mini_info) return; line = tree_lines+2; } else line = tree_lines+1; tty_draw_hline (tree->widget.y + line, tree->widget.x + 1, ' ', tree_cols); widget_move (&tree->widget, line, 1); if (tree->searching){ /* Show search string */ tty_setcolor (TREE_NORMALC (h)); tty_setcolor (DLG_FOCUSC (h)); tty_print_char (PATH_SEP); tty_print_string (str_fit_to_term (tree->search_buffer, tree_cols - 2, J_LEFT_FIT)); tty_print_char (' '); tty_setcolor (DLG_FOCUSC (h)); } else { /* Show full name of selected directory */ tty_print_string (str_fit_to_term (tree->selected_ptr->name, tree_cols, J_LEFT_FIT)); }}
开发者ID:sfionov,项目名称:mc-dev,代码行数:32,
示例2: groupbox_callbackstatic cb_ret_tgroupbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data){ WGroupbox *g = GROUPBOX (w); switch (msg) { case MSG_DRAW: { WDialog *h = w->owner; gboolean disabled; disabled = widget_get_state (w, WST_DISABLED); tty_setcolor (disabled ? DISABLED_COLOR : h->color[DLG_COLOR_NORMAL]); tty_draw_box (w->y, w->x, w->lines, w->cols, TRUE); if (g->title != NULL) { tty_setcolor (disabled ? DISABLED_COLOR : h->color[DLG_COLOR_TITLE]); widget_move (w, 0, 1); tty_print_string (g->title); } return MSG_HANDLED; } case MSG_DESTROY: g_free (g->title); return MSG_HANDLED; default: return widget_default_callback (w, sender, msg, parm, data); }}
开发者ID:idispatch,项目名称:mc,代码行数:34,
示例3: menubar_paint_idxstatic voidmenubar_paint_idx (WMenuBar * menubar, unsigned int idx, int color){ const Menu *menu = g_list_nth_data (menubar->menu, menubar->selected); const menu_entry_t *entry = g_list_nth_data (menu->entries, idx); const int y = 2 + idx; int x = menu->start_x; if (x + menu->max_entry_len + 4 > (gsize) menubar->widget.cols) x = menubar->widget.cols - menu->max_entry_len - 4; if (entry == NULL) { /* menu separator */ tty_setcolor (MENU_ENTRY_COLOR); widget_move (&menubar->widget, y, x - 1); tty_print_alt_char (ACS_LTEE, FALSE); tty_draw_hline (menubar->widget.y + y, menubar->widget.x + x, ACS_HLINE, menu->max_entry_len + 3); widget_move (&menubar->widget, y, x + menu->max_entry_len + 3); tty_print_alt_char (ACS_RTEE, FALSE); } else { int yt, xt; /* menu text */ tty_setcolor (color); widget_move (&menubar->widget, y, x); tty_print_char ((unsigned char) entry->first_letter); tty_getyx (&yt, &xt); tty_draw_hline (yt, xt, ' ', menu->max_entry_len + 2); /* clear line */ tty_print_string (entry->text.start); if (entry->text.hotkey != NULL) { tty_setcolor (color == MENU_SELECTED_COLOR ? MENU_HOTSEL_COLOR : MENU_HOT_COLOR); tty_print_string (entry->text.hotkey); tty_setcolor (color); } if (entry->text.end != NULL) tty_print_string (entry->text.end); if (entry->shortcut != NULL) { widget_move (&menubar->widget, y, x + menu->max_hotkey_len + 3); tty_print_string (entry->shortcut); } /* move cursor to the start of entry text */ widget_move (&menubar->widget, y, x + 1); }}
开发者ID:ryanlee,项目名称:mc,代码行数:57,
示例4: menubar_set_colorstatic voidmenubar_set_color (WMenuBar * menubar, gboolean current, gboolean hotkey){ if (!menubar->is_active) tty_setcolor (MENU_INACTIVE_COLOR); else if (current) tty_setcolor (hotkey ? MENU_HOTSEL_COLOR : MENU_SELECTED_COLOR); else tty_setcolor (hotkey ? MENU_HOT_COLOR : MENU_ENTRY_COLOR);}
开发者ID:BpArCuCTeMbI,项目名称:mc,代码行数:10,
示例5: buttonbar_callbackstatic cb_ret_tbuttonbar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data){ WButtonBar *bb = BUTTONBAR (w); int i; const char *text; switch (msg) { case MSG_FOCUS: return MSG_NOT_HANDLED; case MSG_HOTKEY: for (i = 0; i < BUTTONBAR_LABELS_NUM; i++) if (parm == KEY_F (i + 1) && buttonbar_call (bb, i)) return MSG_HANDLED; return MSG_NOT_HANDLED; case MSG_DRAW: if (bb->visible) { buttonbar_init_button_positions (bb); widget_move (w, 0, 0); tty_setcolor (DEFAULT_COLOR); tty_printf ("%-*s", w->cols, ""); widget_move (w, 0, 0); for (i = 0; i < BUTTONBAR_LABELS_NUM; i++) { int width; width = buttonbar_get_button_width (bb, i); if (width <= 0) break; tty_setcolor (BUTTONBAR_HOTKEY_COLOR); tty_printf ("%2d", i + 1); tty_setcolor (BUTTONBAR_BUTTON_COLOR); text = (bb->labels[i].text != NULL) ? bb->labels[i].text : ""; tty_print_string (str_fit_to_term (text, width - 2, J_LEFT_FIT)); } } return MSG_HANDLED; case MSG_DESTROY: for (i = 0; i < BUTTONBAR_LABELS_NUM; i++) g_free (bb->labels[i].text); return MSG_HANDLED; default: return widget_default_callback (w, sender, msg, parm, data); }}
开发者ID:GalaxyTab4,项目名称:workbench,代码行数:54,
示例6: hline_callbackstatic cb_ret_thline_callback (Widget * w, widget_msg_t msg, int parm){ WHLine *l = (WHLine *) w; Dlg_head *h = l->widget.owner; switch (msg) { case WIDGET_INIT: case WIDGET_RESIZED: if (l->auto_adjust_cols) { if (((w->owner->flags & DLG_COMPACT) != 0)) { w->x = w->owner->x; w->cols = w->owner->cols; } else { w->x = w->owner->x + 1; w->cols = w->owner->cols - 2; } } case WIDGET_FOCUS: /* We don't want to get the focus */ return MSG_NOT_HANDLED; case WIDGET_DRAW: if (l->transparent) tty_setcolor (DEFAULT_COLOR); else tty_setcolor (h->color[DLG_COLOR_NORMAL]); tty_draw_hline (w->y, w->x + 1, ACS_HLINE, w->cols - 2); if (l->auto_adjust_cols) { widget_move (w, 0, 0); tty_print_alt_char (ACS_LTEE, FALSE); widget_move (w, 0, w->cols - 1); tty_print_alt_char (ACS_RTEE, FALSE); } return MSG_HANDLED; default: return default_proc (msg, parm); }}
开发者ID:artzub,项目名称:mc,代码行数:49,
示例7: chown_refreshstatic void chown_refresh (void){ common_dialog_repaint (ch_dlg); tty_setcolor (COLOR_NORMAL); dlg_move (ch_dlg, BY - 1, 8); tty_print_string (_("owner")); dlg_move (ch_dlg, BY - 1, 16); tty_print_string (_("group")); dlg_move (ch_dlg, BY - 1, 24); tty_print_string (_("other")); dlg_move (ch_dlg, BY - 1, 35); tty_print_string (_("owner")); dlg_move (ch_dlg, BY - 1, 53); tty_print_string (_("group")); dlg_move (ch_dlg, 3, 4); tty_print_string (_("On")); dlg_move (ch_dlg, BY + 1, 4); tty_print_string (_("Flag")); dlg_move (ch_dlg, BY + 2, 4); tty_print_string (_("Mode")); if (!single_set){ dlg_move (ch_dlg, 3, 54); tty_printf (_("%6d of %d"), files_on_begin - (current_panel->marked) + 1, files_on_begin); } print_flags ();}
开发者ID:sfionov,项目名称:mc-dev,代码行数:34,
示例8: widget_selectcolorvoidwidget_selectcolor (Widget * w, gboolean focused, gboolean hotkey){ Dlg_head *h = w->owner; int color; if ((w->options & W_DISABLED) != 0) color = DISABLED_COLOR; else if (hotkey) { if (focused) color = h->color[DLG_COLOR_HOT_FOCUS]; else color = h->color[DLG_COLOR_HOT_NORMAL]; } else { if (focused) color = h->color[DLG_COLOR_FOCUS]; else color = h->color[DLG_COLOR_NORMAL]; } tty_setcolor (color);}
开发者ID:ilia-maslakov,项目名称:mc,代码行数:25,
示例9: print_flagsstatic void print_flags (void){ int i; tty_setcolor (COLOR_NORMAL); for (i = 0; i < 3; i++){ dlg_move (ch_dlg, BY+1, 9+i); tty_print_char (ch_flags [i]); } for (i = 0; i < 3; i++){ dlg_move (ch_dlg, BY + 1, 17 + i); tty_print_char (ch_flags [i+3]); } for (i = 0; i < 3; i++){ dlg_move (ch_dlg, BY + 1, 25 + i); tty_print_char (ch_flags [i+6]); } update_permissions (); for (i = 0; i < 15; i++){ dlg_move (ch_dlg, BY+1, 35+i); tty_print_char (ch_flags[9]); } for (i = 0; i < 15; i++){ dlg_move (ch_dlg, BY + 1, 53 + i); tty_print_char (ch_flags[10]); }}
开发者ID:sfionov,项目名称:mc-dev,代码行数:32,
示例10: update_splitstatic voidupdate_split (const WDialog * h){ /* Check split has to be done before testing if it changed, since it can change due to calling check_split() as well */ check_split (&panels_layout); if (panels_layout.horizontal_split) check_options[0].widget->state = panels_layout.horizontal_equal ? 1 : 0; else check_options[0].widget->state = panels_layout.vertical_equal ? 1 : 0; widget_redraw (WIDGET (check_options[0].widget)); tty_setcolor (check_options[0].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL); widget_move (h, 6, 5); if (panels_layout.horizontal_split) tty_printf ("%03d", panels_layout.top_panel_size); else tty_printf ("%03d", panels_layout.left_panel_size); widget_move (h, 6, 17); if (panels_layout.horizontal_split) tty_printf ("%03d", height - panels_layout.top_panel_size); else tty_printf ("%03d", COLS - panels_layout.left_panel_size); widget_move (h, 6, 12); tty_print_char ('=');}
开发者ID:m32,项目名称:mc,代码行数:30,
示例11: update_modestatic void update_mode (Dlg_head * h){ print_flags (); tty_setcolor (COLOR_NORMAL); dlg_move (h, BY + 2, 9); tty_printf ("%12o", get_mode ()); send_message (h->current, WIDGET_FOCUS, 0);}
开发者ID:sfionov,项目名称:mc-dev,代码行数:8,
示例12: edit_draw_framestatic inline voidedit_draw_frame (const WEdit * edit, int color, gboolean active){ const Widget *w = (const Widget *) edit; /* draw a frame around edit area */ tty_setcolor (color); /* draw double frame for active window if skin supports that */ tty_draw_box (w->y, w->x, w->lines, w->cols, !active); /* draw a drag marker */ if (edit->drag_state == MCEDIT_DRAG_NORMAL) { tty_setcolor (EDITOR_FRAME_DRAG); widget_move (w, w->lines - 1, w->cols - 1); tty_print_alt_char (ACS_LRCORNER, TRUE); }}
开发者ID:TomyLobo,项目名称:mc,代码行数:17,
示例13: mcview_display_cleanvoidmcview_display_clean (mcview_t * view){ tty_setcolor (NORMAL_COLOR); widget_erase ((Widget *) view); if (view->dpy_frame_size != 0) tty_draw_box (view->widget.y, view->widget.x, view->widget.lines, view->widget.cols, FALSE);}
开发者ID:artzub,项目名称:mc,代码行数:8,
示例14: chmod_toggle_selectstatic voidchmod_toggle_select (Dlg_head * h, int Id){ tty_setcolor (COLOR_NORMAL); check_perm[Id].selected = !check_perm[Id].selected; dlg_move (h, PY + check_perm_num - Id, PX + 1); tty_print_char (check_perm[Id].selected ? '*' : ' '); dlg_move (h, PY + check_perm_num - Id, PX + 3);}
开发者ID:BrEacK,项目名称:mc,代码行数:10,
示例15: mcview_display_cleanvoidmcview_display_clean (WView * view){ Widget *w = WIDGET (view); tty_setcolor (VIEW_NORMAL_COLOR); widget_erase (w); if (view->dpy_frame_size != 0) tty_draw_box (w->y, w->x, w->lines, w->cols, FALSE);}
开发者ID:Acidburn0zzz,项目名称:mc,代码行数:10,
示例16: common_dialog_repaint/** Clean the dialog area, draw the frame and the title */voidcommon_dialog_repaint (Dlg_head * h){ int space; if (h->state != DLG_ACTIVE) return; space = (h->flags & DLG_COMPACT) ? 0 : 1; tty_setcolor (h->color[DLG_COLOR_NORMAL]); dlg_erase (h); draw_box (h, space, space, h->lines - 2 * space, h->cols - 2 * space, FALSE); if (h->title != NULL) { tty_setcolor (h->color[DLG_COLOR_TITLE]); dlg_move (h, space, (h->cols - str_term_width1 (h->title)) / 2); tty_print_string (h->title); }}
开发者ID:ryanlee,项目名称:mc,代码行数:22,
示例17: tty_init_START void tty_init(void){ int i = 0; int j = 0; for (i = 0; i < TTY_MAX_ROW; i++){ for (j = 0; j < TTY_MAX_COL; j++){ tty_setcolor(i, j, clWhite, clBlack); tty_putchar(i, j, ' '); } }}
开发者ID:liusongwei,项目名称:mkernel,代码行数:12,
示例18: groupbox_callbackstatic cb_ret_tgroupbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data){ WGroupbox *g = GROUPBOX (w); switch (msg) { case MSG_INIT: return MSG_HANDLED; case MSG_FOCUS: return MSG_NOT_HANDLED; case MSG_DRAW: { gboolean disabled; disabled = (w->options & W_DISABLED) != 0; tty_setcolor (disabled ? DISABLED_COLOR : COLOR_NORMAL); tty_draw_box (w->y, w->x, w->lines, w->cols, TRUE); if (g->title != NULL) { Widget *wo = WIDGET (w->owner); tty_setcolor (disabled ? DISABLED_COLOR : COLOR_TITLE); widget_move (wo, w->y - wo->y, w->x - wo->x + 1); tty_print_string (g->title); } return MSG_HANDLED; } case MSG_DESTROY: g_free (g->title); return MSG_HANDLED; default: return widget_default_callback (w, sender, msg, parm, data); }}
开发者ID:GarothLongint,项目名称:mc,代码行数:40,
示例19: mcview_display_rulervoidmcview_display_ruler (mcview_t * view){ static const char ruler_chars[] = "|----*----"; const screen_dimen top = view->ruler_area.top; const screen_dimen left = view->ruler_area.left; const screen_dimen width = view->ruler_area.width; const screen_dimen height = view->ruler_area.height; const screen_dimen line_row = (ruler == RULER_TOP) ? 0 : 1; const screen_dimen nums_row = (ruler == RULER_TOP) ? 1 : 0; char r_buff[10]; off_t cl; screen_dimen c; if (ruler == RULER_NONE || height < 1) return; tty_setcolor (VIEW_BOLD_COLOR); for (c = 0; c < width; c++) { cl = view->dpy_text_column + c; if (line_row < height) { widget_move (view, top + line_row, left + c); tty_print_char (ruler_chars[cl % 10]); } if ((cl != 0) && (cl % 10) == 0) { g_snprintf (r_buff, sizeof (r_buff), "%" PRIuMAX, (uintmax_t) cl); if (nums_row < height) { widget_move (view, top + nums_row, left + c - 1); tty_print_string (r_buff); } } } tty_setcolor (NORMAL_COLOR);}
开发者ID:artzub,项目名称:mc,代码行数:40,
示例20: tree_show_mini_infostatic voidtree_show_mini_info (WTree * tree, int tree_lines, int tree_cols){ Dlg_head *h = tree->widget.owner; int line; /* Show mini info */ if (tree->is_panel) { if (!panels_options.show_mini_info) return; line = tree_lines + 2; } else line = tree_lines + 1; if (tree->searching) { /* Show search string */ tty_setcolor (INPUT_COLOR); tty_draw_hline (tree->widget.y + line, tree->widget.x + 1, ' ', tree_cols); widget_move (&tree->widget, line, 1); tty_print_char (PATH_SEP); tty_print_string (str_fit_to_term (tree->search_buffer, tree_cols - 2, J_LEFT_FIT)); tty_print_char (' '); } else { /* Show full name of selected directory */ char *tmp_path; tty_setcolor (tree->is_panel ? NORMAL_COLOR : TREE_NORMALC (h)); tty_draw_hline (tree->widget.y + line, tree->widget.x + 1, ' ', tree_cols); widget_move (&tree->widget, line, 1); tmp_path = vfs_path_to_str (tree->selected_ptr->name); tty_print_string (str_fit_to_term (tmp_path, tree_cols, J_LEFT_FIT)); g_free (tmp_path); }}
开发者ID:ryanlee,项目名称:mc,代码行数:39,
示例21: groupbox_callbackstatic cb_ret_tgroupbox_callback (Widget * w, widget_msg_t msg, int parm){ WGroupbox *g = (WGroupbox *) w; switch (msg) { case WIDGET_INIT: return MSG_HANDLED; case WIDGET_FOCUS: return MSG_NOT_HANDLED; case WIDGET_DRAW: { gboolean disabled = (w->options & W_DISABLED) != 0; tty_setcolor (disabled ? DISABLED_COLOR : COLOR_NORMAL); draw_box (g->widget.owner, g->widget.y - g->widget.owner->y, g->widget.x - g->widget.owner->x, g->widget.lines, g->widget.cols, TRUE); if (g->title != NULL) { tty_setcolor (disabled ? DISABLED_COLOR : COLOR_TITLE); dlg_move (g->widget.owner, g->widget.y - g->widget.owner->y, g->widget.x - g->widget.owner->x + 1); tty_print_string (g->title); } return MSG_HANDLED; } case WIDGET_DESTROY: g_free (g->title); return MSG_HANDLED; default: return default_proc (msg, parm); }}
开发者ID:artzub,项目名称:mc,代码行数:38,
示例22: dlg_default_repaint/** Clean the dialog area, draw the frame and the title */voiddlg_default_repaint (WDialog * h){ Widget *wh = WIDGET (h); int space; if (h->state != DLG_ACTIVE) return; space = (h->flags & DLG_COMPACT) ? 0 : 1; tty_setcolor (h->color[DLG_COLOR_NORMAL]); dlg_erase (h); tty_draw_box (wh->y + space, wh->x + space, wh->lines - 2 * space, wh->cols - 2 * space, FALSE); if (h->title != NULL) { tty_setcolor (h->color[DLG_COLOR_TITLE]); widget_move (h, space, (wh->cols - str_term_width1 (h->title)) / 2); tty_print_string (h->title); }}
开发者ID:GalaxyTab4,项目名称:workbench,代码行数:24,
示例23: edit_dialog_callbackstatic cb_ret_tedit_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data){ WEdit *edit; WMenuBar *menubar; WButtonBar *buttonbar; edit = (WEdit *) find_widget_type (h, edit_callback); menubar = find_menubar (h); buttonbar = find_buttonbar (h); switch (msg) { case DLG_INIT: edit_set_buttonbar (edit, buttonbar); return MSG_HANDLED; case DLG_DRAW: /* don't use common_dialog_repaint() -- we don't need a frame */ tty_setcolor (EDITOR_NORMAL_COLOR); dlg_erase (h); return MSG_HANDLED; case DLG_RESIZE: /* dlg_set_size() is surplus for this case */ h->lines = LINES; h->cols = COLS; widget_set_size (&buttonbar->widget, h->lines - 1, h->x, 1, h->cols); widget_set_size (&menubar->widget, h->y, h->x, 1, h->cols); menubar_arrange (menubar); widget_set_size (&edit->widget, h->y + 1, h->x, h->lines - 2, h->cols); return MSG_HANDLED; case DLG_ACTION: if (sender == (Widget *) menubar) return send_message ((Widget *) edit, WIDGET_COMMAND, parm); if (sender == (Widget *) buttonbar) return send_message ((Widget *) edit, WIDGET_COMMAND, parm); return MSG_HANDLED; case DLG_VALIDATE: h->state = DLG_ACTIVE; /* don't stop the dialog before final decision */ if (edit_ok_to_exit (edit)) h->state = DLG_CLOSED; return MSG_HANDLED; default: return default_dlg_callback (h, sender, msg, parm, data); }}
开发者ID:artzub,项目名称:mc,代码行数:50,
注:本文中的tty_setcolor函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tty_termios_baud_rate函数代码示例 C++ tty_set_operations函数代码示例 |