X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=c%2B%2B%2Fcursesw.cc;h=47e5cf64dcf0ded1e7ca1d88f1ed69cc2ae8fbfb;hp=527bb7c40e4c39af6c539b7a3e3b6aaea603b999;hb=687aeec3e382083652c3bb2e94fb6d3bf101a1f9;hpb=33b3156f43919fb75726db2647d3364037d9e1d5;ds=inline diff --git a/c++/cursesw.cc b/c++/cursesw.cc index 527bb7c4..47e5cf64 100644 --- a/c++/cursesw.cc +++ b/c++/cursesw.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 2007 Free Software Foundation, Inc. * + * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -42,7 +42,7 @@ #include "internal.h" #include "cursesw.h" -MODULE_ID("$Id: cursesw.cc,v 1.48 2007/03/24 19:00:58 tom Exp $") +MODULE_ID("$Id: cursesw.cc,v 1.51 2009/03/28 21:31:37 tom Exp $") #define COLORS_NEED_INITIALIZATION -1 #define COLORS_NOT_INITIALIZED 0 @@ -84,6 +84,29 @@ NCursesWindow::scanw(int y, int x, const char* fmt, ...) } +int +NCursesWindow::scanw(const char* fmt, va_list args) +{ + int result = ERR; + + result = ::vw_scanw (w, const_cast(fmt), args); + + return result; +} + + +int +NCursesWindow::scanw(int y, int x, const char* fmt, va_list args) +{ + int result = ERR; + + if (::wmove(w, y, x) != ERR) { + result = ::vw_scanw (w, const_cast(fmt), args); + } + return result; +} + + int NCursesWindow::printw(const char * fmt, ...) { @@ -109,6 +132,25 @@ NCursesWindow::printw(int y, int x, const char * fmt, ...) } +int +NCursesWindow::printw(const char * fmt, va_list args) +{ + int result = ::vw_printw(w, fmt, args); + return result; +} + + +int +NCursesWindow::printw(int y, int x, const char * fmt, va_list args) +{ + int result = ::wmove(w, y, x); + if (result == OK) { + result = ::vw_printw(w, fmt, args); + } + return result; +} + + void NCursesWindow::set_keyboard(void) { @@ -245,7 +287,6 @@ NCursesWindow::NCursesWindow(WINDOW *win, int ncols) { initialize(); w = win; - assert((w->_maxx +1 ) == ncols); } int _nc_xx_ripoff_init(WINDOW *w, int ncols) @@ -254,8 +295,7 @@ int _nc_xx_ripoff_init(WINDOW *w, int ncols) RIPOFFINIT init = *prip++; if (init) { - NCursesWindow* W = new NCursesWindow(w,ncols); - res = init(*W); + res = init(*(new NCursesWindow(w,ncols))); } return res; } @@ -422,7 +462,7 @@ NCursesWindow::setcolor(short pair) #if HAVE_HAS_KEY bool NCursesWindow::has_mouse() const { - return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse()) + return ((::has_key(KEY_MOUSE) || ::has_mouse()) ? TRUE : FALSE); } #endif