1 /* Copyright 2013 Akira Ohta (akohta001@gmail.com)
2 This file is part of ntch.
4 The ntch is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 The ntch is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with ntch. If not, see <http://www.gnu.org/licenses/>.
22 #include <ncursesw/ncurses.h>
27 #include "ui/disp_string.h"
31 int nt_add_wch(WINDOW *w, const wchar_t wc, attr_t attr)
36 * This will supress valgrind's verbose messages.
38 memset(&c, '\0', sizeof(cchar_t));
43 return wadd_wch(w, &c);
47 int nt_add_wstr(WINDOW *w, const wchar_t *wc, attr_t attr)
51 wattr_on(w, attr, NULL);
52 ret = waddwstr(w, wc);
53 wattr_off(w, attr, NULL);
57 int nt_add_wnch(WINDOW *w, const wchar_t wc, attr_t attr, size_t colmns)
62 * This will supress valgrind's verbose messages.
64 memset(&c, '\0', sizeof(cchar_t));
74 for(i = 0; i < colmns; i+=delta){
75 if(ERR == wadd_wch(w, &c))
81 int nt_add_wnstr(WINDOW *w, const wchar_t *wc, attr_t attr, size_t colmns)
87 * This will supress valgrind's verbose messages.
89 memset(&c, '\0', sizeof(cchar_t));
95 for(i = 0; i < len && col < colmns; i++){
97 (wc[i] >= 0xff66 && wc[i] <= 0xff9d)){
105 if(ERR == wadd_wch(w, &c))
111 int nt_get_column_length(const wchar_t *wc)
120 for(i = 0; i < len; i++){
122 if(ch <= 128 || (ch >= 0xff66 && ch <= 0xff9d))
131 int nt_get_wc_count_within_colmns(const wchar_t *wc, size_t colmns)
139 for(i = 0; i < len; i++){
141 if(ch <= 128 || (ch >= 0xff66 && ch <= 0xff9d))