int curses_get_window_orientation(winid wid) { if (!is_main_window(wid)) { panic("curses_get_window_orientation: wid out of range. Not a main window."); } return nhwins[wid].orientation; }
WINDOW *curses_get_nhwin(winid wid) { if (!is_main_window(wid)) { panic("curses_get_nhwin: wid out of range. Not a main window."); } return nhwins[wid].curwin; }
void curses_get_window_xy(winid wid, int *x, int *y) { if (!is_main_window(wid)) { panic("curses_get_window_xy: wid out of range. Not a main window."); } *x = nhwins[wid].x; *y = nhwins[wid].y; }
BOOL CALLBACK enum_windows_callback(HWND handle, LPARAM lParam) { handle_data& data = *(handle_data*)lParam; unsigned long process_id = 0; GetWindowThreadProcessId(handle, &process_id); if (data.process_id != process_id || !is_main_window(handle)) { return TRUE; } data.best_handle = handle; return FALSE; }
void curses_del_nhwin(winid wid) { if (curses_is_menu(wid) || curses_is_text(wid)) { curses_del_menu(wid); return; } if (!is_main_window(wid)) { panic("curses_del_nhwin: wid out of range. Not a main window."); } nhwins[wid].nhwin = -1; }
void curses_puts(winid wid, int attr, const char *text) { anything *identifier; WINDOW *win = NULL; if (is_main_window(wid)) { win = curses_get_nhwin(wid); } if (wid == MESSAGE_WIN) { curses_message_win_puts(text, FALSE); return; } if (wid == STATUS_WIN) { curses_update_stats(FALSE); /* We will do the write ourselves */ return; } if (curses_is_menu(wid) || curses_is_text(wid)) { if (!curses_menu_exists(wid)) { panic("curses_puts: Attempted write to nonexistant window!"); } identifier = malloc(sizeof(anything)); identifier->a_void = NULL; curses_add_nhmenu_item(wid, identifier, 0, 0, attr, text, FALSE); } else { waddstr(win, text); wrefresh(win); } }
void curses_add_nhwin(winid wid, int height, int width, int y, int x, orient orientation, boolean border) { WINDOW *win; int real_width = width; int real_height = height; if (!is_main_window(wid)) { panic("curses_add_nhwin: wid out of range. Not a main window."); } nhwins[wid].nhwin = wid; nhwins[wid].border = border; nhwins[wid].width = width; nhwins[wid].height = height; nhwins[wid].x = x; nhwins[wid].y = y; nhwins[wid].orientation = orientation; if (border) { real_width += 2; /* leave room for bounding box */ real_height += 2; } win = newwin(real_height, real_width, y, x); switch (wid) { case MESSAGE_WIN: { messagewin = win; break; } case STATUS_WIN: { statuswin = win; break; } case MAP_WIN: { mapwin = win; if ((width < COLNO) || (height < ROWNO)) { map_clipped = TRUE; } else { map_clipped = FALSE; } break; } } if (border) { box(win, 0, 0); } nhwins[wid].curwin = win; }