Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /* PDCurses */
  2.  
  3. #include <curspriv.h>
  4.  
  5. /*man-start**************************************************************
  6.  
  7. move
  8. ----
  9.  
  10. ### Synopsis
  11.  
  12.     int move(int y, int x);
  13.     int mvcur(int oldrow, int oldcol, int newrow, int newcol);
  14.     int wmove(WINDOW *win, int y, int x);
  15.  
  16. ### Description
  17.  
  18.    move() and wmove() move the cursor associated with the window to the
  19.    given location. This does not move the physical cursor of the
  20.    terminal until refresh() is called. The position specified is
  21.    relative to the upper left corner of the window, which is (0,0).
  22.  
  23.    mvcur() moves the physical cursor without updating any window cursor
  24.    positions.
  25.  
  26. ### Return Value
  27.  
  28.    All functions return OK on success and ERR on error.
  29.  
  30. ### Portability
  31.                              X/Open  ncurses  NetBSD
  32.     move                        Y       Y       Y
  33.     mvcur                       Y       Y       Y
  34.     wmove                       Y       Y       Y
  35.  
  36. **man-end****************************************************************/
  37.  
  38. int move(int y, int x)
  39. {
  40.     PDC_LOG(("move() - called: y=%d x=%d\n", y, x));
  41.  
  42.     if (!stdscr || x < 0 || y < 0 || x >= stdscr->_maxx || y >= stdscr->_maxy)
  43.         return ERR;
  44.  
  45.     stdscr->_curx = x;
  46.     stdscr->_cury = y;
  47.  
  48.     return OK;
  49. }
  50.  
  51. int mvcur(int oldrow, int oldcol, int newrow, int newcol)
  52. {
  53.     PDC_LOG(("mvcur() - called: oldrow %d oldcol %d newrow %d newcol %d\n",
  54.              oldrow, oldcol, newrow, newcol));
  55.  
  56.     if (!SP || newrow < 0 || newrow >= LINES || newcol < 0 || newcol >= COLS)
  57.         return ERR;
  58.  
  59.     PDC_gotoyx(newrow, newcol);
  60.     SP->cursrow = newrow;
  61.     SP->curscol = newcol;
  62.  
  63.     return OK;
  64. }
  65.  
  66. int wmove(WINDOW *win, int y, int x)
  67. {
  68.     PDC_LOG(("wmove() - called: y=%d x=%d\n", y, x));
  69.  
  70.     if (!win || x < 0 || y < 0 || x >= win->_maxx || y >= win->_maxy)
  71.         return ERR;
  72.  
  73.     win->_curx = x;
  74.     win->_cury = y;
  75.  
  76.     return OK;
  77. }
  78.