本文整理汇总了C++中ToxWindow类的典型用法代码示例。如果您正苦于以下问题:C++ ToxWindow类的具体用法?C++ ToxWindow怎么用?C++ ToxWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToxWindow类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_active_window
void draw_active_window(Tox *m)
{
ToxWindow *a = active_window;
wint_t ch = 0;
touchwin(a->window);
#ifndef WIN32
wresize(a->window, LINES - 2, COLS);
#endif
a->blink = false;
draw_bar();
a->onDraw(a, m);
/* Handle input */
#ifdef HAVE_WIDECHAR
wget_wch(stdscr, &ch);
#else
ch = getch();
#endif
if (ch == '\t' || ch == KEY_BTAB)
set_next_window((int) ch);
else if (ch != ERR)
a->onKey(a, m, ch);
}
示例2: draw_active_window
void draw_active_window(Tox *m)
{
ToxWindow *a = active_window;
a->alert0 = false;
a->alert1 = false;
a->alert2 = false;
wint_t ch = 0;
draw_bar();
touchwin(a->window);
#ifndef WIN32
wresize(a->window, LINES - 2, COLS);
#endif
a->onDraw(a, m);
wrefresh(a->window);
/* Handle input */
#ifdef HAVE_WIDECHAR
wget_wch(stdscr, &ch);
#else
ch = getch();
#endif
if (ch == T_KEY_NEXT || ch == T_KEY_PREV)
set_next_window((int) ch);
else if (ch != ERR)
a->onKey(a, m, ch);
}
示例3: draw_active_window
void draw_active_window(Tox *m)
{
ToxWindow *a = active_window;
a->alert0 = false;
a->alert1 = false;
a->alert2 = false;
wint_t ch = 0;
draw_bar();
touchwin(a->window);
#ifndef WIN32
wresize(a->window, LINES - 2, COLS);
#endif
a->onDraw(a, m);
wrefresh(a->window);
/* Handle input */
#ifdef HAVE_WIDECHAR
if (wget_wch(stdscr, &ch) == ERR)
#else
if ((ch = getch()) == ERR)
#endif
return;
if (ch == T_KEY_NEXT || ch == T_KEY_PREV) {
set_next_window((int) ch);
} else {
pthread_mutex_lock(&Winthread.lock);
a->onKey(a, m, ch);
pthread_mutex_unlock(&Winthread.lock);
}
}
示例4: main
int main(int argc, char* argv[]) {
int ch;
int i = 0;
int f_flag = 0;
char *filename = "data";
ToxWindow* a;
for(i = 0; i < argc; i++) {
if(argv[i][0] == '-') {
if(argv[i][1] == 'f') {
if(argv[i + 1] != NULL)
filename = argv[i + 1];
else {
f_flag = -1;
}
}
}
}
init_term();
init_tox();
load_data(filename);
init_windows();
if(f_flag == -1) {
attron(COLOR_PAIR(3) | A_BOLD);
wprintw(prompt->window, "You passed '-f' without giving an argument!\n"
"defaulting to 'data' for a keyfile...\n");
attroff(COLOR_PAIR(3) | A_BOLD);
}
while(true) {
// Update tox.
do_tox();
// Draw.
a = &windows[w_active];
prepare_window(a->window);
a->blink = false;
draw_bar();
a->onDraw(a);
// Handle input.
ch = getch();
if(ch == '\t') {
w_active = (w_active + 1) % w_num;
}
else if(ch == KEY_BTAB) {
w_active = (w_active + w_num - 1) % w_num;
}
else if(ch != ERR) {
a->onKey(a, ch);
}
}
return 0;
}
示例5: main
int main(int argc, char *argv[])
{
int ch;
int f_flag = 0;
char *filename = "data";
ToxWindow* a;
int i = 0;
for (i = 0; i < argc; ++i) {
if (argv[i] == NULL)
break;
else if (argv[i][0] == '-') {
if (argv[i][1] == 'f') {
if (argv[i + 1] != NULL)
filename = argv[i + 1];
else
f_flag = -1;
}
}
}
init_term();
init_tox();
load_data(filename);
init_windows();
init_window_status();
if (f_flag == -1) {
attron(COLOR_PAIR(3) | A_BOLD);
wprintw(prompt->window, "You passed '-f' without giving an argument!\n"
"defaulting to 'data' for a keyfile...\n");
attroff(COLOR_PAIR(3) | A_BOLD);
}
while(true) {
/* Update tox */
do_tox();
/* Draw */
a = &windows[active_window];
prepare_window(a->window);
a->blink = false;
draw_bar();
a->onDraw(a);
/* Handle input */
ch = getch();
if (ch == '\t' || ch == KEY_BTAB)
set_active_window(ch);
else if (ch != ERR)
a->onKey(a, ch);
}
return 0;
}
示例6: add_window
int add_window(Tox *m, ToxWindow w)
{
if (LINES < 2)
return -1;
int i;
for (i = 0; i < MAX_WINDOWS_NUM; i++) {
if (windows[i].active)
continue;
w.window = newwin(LINES - 2, COLS, 0, 0);
if (w.window == NULL)
return -1;
#ifdef URXVT_FIX
/* Fixes text color problem on some terminals. */
wbkgd(w.window, COLOR_PAIR(6));
#endif
windows[i] = w;
w.onInit(&w, m);
++num_active_windows;
return i;
}
return -1;
}
示例7: draw_active_window
void draw_active_window(Messenger * m)
{
ToxWindow *a = &windows[active_window];
prepare_window(a->window);
a->blink = false;
draw_bar();
a->onDraw(a);
/* Handle input */
int ch = getch();
if (ch == '\t' || ch == KEY_BTAB)
set_active_window(ch);
else if (ch != ERR)
a->onKey(a, m, ch);
}
示例8: draw_active_window
void draw_active_window(Tox *m)
{
ToxWindow *a = active_window;
a->alert = WINDOW_ALERT_NONE;
wint_t ch = 0;
draw_bar();
touchwin(a->window);
a->onDraw(a, m);
/* Handle input */
bool ltr;
#ifdef HAVE_WIDECHAR
int status = wget_wch(stdscr, &ch);
if (status == ERR)
return;
if (status == OK)
ltr = iswprint(ch);
else /* if (status == KEY_CODE_YES) */
ltr = false;
#else
ch = getch();
if (ch == ERR)
return;
/* TODO verify if this works */
ltr = isprint(ch);
#endif /* HAVE_WIDECHAR */
if (!ltr && (ch == user_settings_->key_next_tab || ch == user_settings_->key_prev_tab)) {
set_next_window((int) ch);
} else {
pthread_mutex_lock(&Winthread.lock);
a->onKey(a, m, ch, ltr);
pthread_mutex_unlock(&Winthread.lock);
}
}
示例9: main
int main(int argc, char* argv[]) {
int ch;
ToxWindow* a;
init_term();
init_tox();
load_data();
init_windows();
while(true) {
// Update tox.
do_tox();
// Draw.
a = &windows[w_active];
prepare_window(a->window);
a->blink = false;
draw_bar();
a->onDraw(a);
// Handle input.
ch = getch();
if(ch == '\t') {
w_active = (w_active + 1) % w_num;
}
else if(ch == KEY_BTAB) {
w_active = (w_active + w_num - 1) % w_num;
}
else if(ch != ERR) {
a->onKey(a, ch);
}
}
return 0;
}
示例10: add_window
int add_window(ToxWindow w, int n)
{
if (w_num >= TOXWINDOWS_MAX_NUM)
return -1;
if (LINES < 2)
return -1;
w.window = newwin(LINES - 2, COLS, 0, 0);
if (w.window == NULL)
return -1;
windows[n] = w;
w.onInit(&w);
w_num++;
return n;
}
示例11: add_window
int add_window(ToxWindow w) {
if(w_num == TOXWINDOWS_MAX_NUM)
return -1;
if(LINES < 2)
return -1;
w.window = newwin(LINES - 2, COLS, 0, 0);
if(w.window == NULL)
return -1;
windows[w_num++] = w;
w.onInit(&w);
return w_num - 1;
}