Module: Ncurses
- Defined in:
- lib/ncursesw.rb,
lib/ncursesw.rb
Defined Under Namespace
Modules: Destroy_checker, Form, Menu, Namespace, Panel
Classes: MEVENT, SCREEN, WINDOW
Constant Summary
collapse
- GETSTR_LIMIT =
1024
- Ncurses =
for accessing Ncurses from a Module that includes Ncurses
self
Class Method Summary
collapse
-
.erase ⇒ Object
-
.getbegx(win) ⇒ Object
-
.getbegy(win) ⇒ Object
-
.getcurx(win) ⇒ Object
-
.getcury(win) ⇒ Object
-
.getmaxx(win) ⇒ Object
-
.getmaxy(win) ⇒ Object
-
.getnstr(str, n) ⇒ Object
-
.getparx(win) ⇒ Object
-
.getpary(win) ⇒ Object
-
.getstr(str) ⇒ Object
-
.inchnstr(str, n) ⇒ Object
-
.inchstr(str) ⇒ Object
-
.innstr(str, n) ⇒ Object
-
.instr(str) ⇒ Object
-
.mouse_trafo(pY, pX, to_screen) ⇒ Object
-
.mvgetnstr(y, x, str, n) ⇒ Object
-
.mvgetstr(y, x, str) ⇒ Object
-
.mvinchnstr(y, x, str, n) ⇒ Object
-
.mvinchstr(y, x, str) ⇒ Object
-
.mvinnstr(y, x, str, n) ⇒ Object
-
.mvinstr(y, x, str) ⇒ Object
-
.mvprintw(*args) ⇒ Object
-
.mvscanw(y, x, format, result) ⇒ Object
-
.mvwgetnstr(win, y, x, str, n) ⇒ Object
-
.mvwgetstr(win, y, x, str) ⇒ Object
-
.mvwinchnstr(win, y, x, str, n) ⇒ Object
-
.mvwinchstr(win, y, x, str) ⇒ Object
-
.mvwinnstr(win, y, x, str, n) ⇒ Object
-
.mvwinstr(win, y, x, str) ⇒ Object
-
.mvwprintw(win, y, x, *args) ⇒ Object
-
.mvwscanw(win, y, x, format, result) ⇒ Object
-
.printw(*args) ⇒ Object
-
.scanw(format, result) ⇒ Object
-
.touchline(win, start, count) ⇒ Object
-
.touchwin(win) ⇒ Object
-
.wgetstr(win, str) ⇒ Object
-
.winchstr(win, str) ⇒ Object
-
.winstr(win, str) ⇒ Object
-
.wscanw(win, format, result) ⇒ Object
Class Method Details
.getbegx(win) ⇒ Object
235
236
237
|
# File 'lib/ncursesw.rb', line 235
def Ncurses.getbegx(win)
x = []; y = []; Ncurses.getbegyx(win, y,x); x[0]
end
|
.getbegy(win) ⇒ Object
238
239
240
|
# File 'lib/ncursesw.rb', line 238
def Ncurses.getbegy(win)
x = []; y = []; Ncurses.getbegyx(win, y,x); y[0]
end
|
.getcurx(win) ⇒ Object
229
230
231
|
# File 'lib/ncursesw.rb', line 229
def Ncurses.getcurx(win)
x = []; y = []; Ncurses.getyx(win, y,x); x[0]
end
|
.getcury(win) ⇒ Object
232
233
234
|
# File 'lib/ncursesw.rb', line 232
def Ncurses.getcury(win)
x = []; y = []; Ncurses.getyx(win, y,x); y[0]
end
|
.getmaxx(win) ⇒ Object
241
242
243
|
# File 'lib/ncursesw.rb', line 241
def Ncurses.getmaxx(win)
x = []; y = []; Ncurses.getmaxyx(win, y,x); x[0]
end
|
.getmaxy(win) ⇒ Object
244
245
246
|
# File 'lib/ncursesw.rb', line 244
def Ncurses.getmaxy(win)
x = []; y = []; Ncurses.getmaxyx(win, y,x); y[0]
end
|
.getnstr(str, n) ⇒ Object
181
182
183
|
# File 'lib/ncursesw.rb', line 181
def Ncurses.getnstr(str,n)
Ncurses.wgetnstr(Ncurses.stdscr, str, n)
end
|
.getparx(win) ⇒ Object
247
248
249
|
# File 'lib/ncursesw.rb', line 247
def Ncurses.getparx(win)
x = []; y = []; Ncurses.getparyx(win, y,x); x[0]
end
|
.getpary(win) ⇒ Object
250
251
252
|
# File 'lib/ncursesw.rb', line 250
def Ncurses.getpary(win)
x = []; y = []; Ncurses.getparyx(win, y,x); y[0]
end
|
.inchnstr(str, n) ⇒ Object
151
152
153
|
# File 'lib/ncursesw.rb', line 151
def Ncurses.inchnstr(str,n)
Ncurses.winchnstr(Ncurses.stdscr, str, n)
end
|
.innstr(str, n) ⇒ Object
195
196
197
|
# File 'lib/ncursesw.rb', line 195
def Ncurses.innstr(str,n)
Ncurses.winnstr(Ncurses.stdscr, str, n)
end
|
.mouse_trafo(pY, pX, to_screen) ⇒ Object
225
226
227
|
# File 'lib/ncursesw.rb', line 225
def Ncurses.mouse_trafo(pY, pX, to_screen)
Ncurses.wmouse_trafo(Ncurses.stdscr, pY, pX, to_screen)
end
|
.mvgetnstr(y, x, str, n) ⇒ Object
.mvgetstr(y, x, str) ⇒ Object
.mvinchnstr(y, x, str, n) ⇒ Object
.mvinchstr(y, x, str) ⇒ Object
.mvinnstr(y, x, str, n) ⇒ Object
.mvinstr(y, x, str) ⇒ Object
.mvprintw(*args) ⇒ Object
.mvscanw(y, x, format, result) ⇒ Object
272
273
274
|
# File 'lib/ncursesw.rb', line 272
def Ncurses.mvscanw(y,x, format, result)
Ncurses.mvwscanw(Ncurses.stdscr, y,x, format, result)
end
|
.mvwgetnstr(win, y, x, str, n) ⇒ Object
187
188
189
190
191
192
193
|
# File 'lib/ncursesw.rb', line 187
def Ncurses.mvwgetnstr(win, y,x, str, n)
if (Ncurses.wmove(win,y,x) == Ncurses::ERR)
Ncurses::ERR
else
Ncurses.wgetnstr(win,str,n)
end
end
|
.mvwgetstr(win, y, x, str) ⇒ Object
.mvwinchnstr(win, y, x, str, n) ⇒ Object
163
164
165
166
167
168
169
|
# File 'lib/ncursesw.rb', line 163
def Ncurses.mvwinchnstr(win, y,x, str, n)
if (Ncurses.wmove(win,y,x) == Ncurses::ERR)
Ncurses::ERR
else
Ncurses.winchnstr(win,str,n)
end
end
|
.mvwinchstr(win, y, x, str) ⇒ Object
170
171
172
173
174
|
# File 'lib/ncursesw.rb', line 170
def Ncurses.mvwinchstr(win, y,x, str)
maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
Ncurses.mvwinchnstr(win, y,x, str, maxx[0]+1)
end
|
.mvwinnstr(win, y, x, str, n) ⇒ Object
207
208
209
210
211
212
213
|
# File 'lib/ncursesw.rb', line 207
def Ncurses.mvwinnstr(win, y,x, str, n)
if (Ncurses.wmove(win,y,x) == Ncurses::ERR)
Ncurses::ERR
else
Ncurses.winnstr(win,str,n)
end
end
|
.mvwinstr(win, y, x, str) ⇒ Object
214
215
216
217
218
|
# File 'lib/ncursesw.rb', line 214
def Ncurses.mvwinstr(win, y,x, str)
maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
Ncurses.mvwinnstr(win, y,x, str, maxx[0]+1)
end
|
.mvwprintw(win, y, x, *args) ⇒ Object
295
296
297
298
299
300
301
|
# File 'lib/ncursesw.rb', line 295
def Ncurses.mvwprintw(win, y,x, *args)
if (Ncurses.wmove(win,y,x) == Ncurses::ERR)
Ncurses::ERR
else
wprintw(win, *args)
end
end
|
.mvwscanw(win, y, x, format, result) ⇒ Object
275
276
277
278
279
280
281
|
# File 'lib/ncursesw.rb', line 275
def Ncurses.mvwscanw(win, y,x, format, result)
if (Ncurses.wmove(win, y,x) == Ncurses::ERR)
Ncurses::ERR
else
Ncurses.wscanw(win, format, result)
end
end
|
.printw(*args) ⇒ Object
302
303
304
|
# File 'lib/ncursesw.rb', line 302
def Ncurses.printw(*args)
Ncurses.wprintw(Ncurses.stdscr, *args)
end
|
.scanw(format, result) ⇒ Object
.touchline(win, start, count) ⇒ Object
305
306
307
|
# File 'lib/ncursesw.rb', line 305
def Ncurses.touchline(win, start, count)
Ncurses.wtouchln(win, start, count, 1)
end
|
.touchwin(win) ⇒ Object
308
309
310
|
# File 'lib/ncursesw.rb', line 308
def Ncurses.touchwin(win)
wtouchln(win, 0, getmaxy(win), 1)
end
|
.wgetstr(win, str) ⇒ Object
265
266
267
|
# File 'lib/ncursesw.rb', line 265
def Ncurses.wgetstr(win, str)
Ncurses.wgetnstr(win, str, Ncurses::GETSTR_LIMIT)
end
|
.winchstr(win, str) ⇒ Object
175
176
177
178
179
|
# File 'lib/ncursesw.rb', line 175
def Ncurses.winchstr(win, str)
maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
Ncurses.winchnstr(win, str, maxx[0]+1)
end
|
.winstr(win, str) ⇒ Object
219
220
221
222
223
|
# File 'lib/ncursesw.rb', line 219
def Ncurses.winstr(win, str)
maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
Ncurses.winnstr(win, str, maxx[0]+1)
end
|
.wscanw(win, format, result) ⇒ Object
282
283
284
285
286
287
288
289
290
|
# File 'lib/ncursesw.rb', line 282
def Ncurses.wscanw(win, format, result)
str = ""
if (Ncurses.wgetstr(win, str) == Ncurses::ERR)
Ncurses::ERR
else
require "scanf.rb" result.replace(str.scanf(format))
end
end
|