@@ -39,15 +39,15 @@ A number of SysV or ncurses functions don't have wrappers yet; if you need
3939a given function, add it and send a patch. Here's a list of currently
4040unsupported functions:
4141
42- addchnstr addchstr chgat color_set define_key
42+ addchnstr addchstr color_set define_key
4343 del_curterm delscreen dupwin inchnstr inchstr innstr keyok
44- mcprint mvaddchnstr mvaddchstr mvchgat mvcur mvinchnstr
45- mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr mvwchgat
44+ mcprint mvaddchnstr mvaddchstr mvcur mvinchnstr
45+ mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr
4646 mvwinchnstr mvwinchstr mvwinnstr newterm
4747 restartterm ripoffline scr_dump
4848 scr_init scr_restore scr_set scrl set_curterm set_term setterm
4949 tgetent tgetflag tgetnum tgetstr tgoto timeout tputs
50- vidattr vidputs waddchnstr waddchstr wchgat
50+ vidattr vidputs waddchnstr waddchstr
5151 wcolor_set winchnstr winchstr winnstr wmouse_trafo wscrl
5252
5353Low-priority:
@@ -620,6 +620,56 @@ int py_mvwdelch(WINDOW *w, int y, int x)
620620}
621621#endif
622622
623+ /* chgat, added by Fabian Kreutz <fabian.kreutz at gmx.net> */
624+
625+ static PyObject *
626+ PyCursesWindow_ChgAt (PyCursesWindowObject * self , PyObject * args )
627+ {
628+ int rtn ;
629+ int x , y ;
630+ int num = -1 ;
631+ short color ;
632+ attr_t attr = A_NORMAL ;
633+ int use_xy = FALSE;
634+
635+ switch (PyTuple_Size (args )) {
636+ case 1 :
637+ if (!PyArg_ParseTuple (args ,"l;attr" , & attr ))
638+ return NULL ;
639+ break ;
640+ case 2 :
641+ if (!PyArg_ParseTuple (args ,"il;n,attr" , & num , & attr ))
642+ return NULL ;
643+ break ;
644+ case 3 :
645+ if (!PyArg_ParseTuple (args ,"iil;int,int,attr" , & y , & x , & attr ))
646+ return NULL ;
647+ use_xy = TRUE;
648+ break ;
649+ case 4 :
650+ if (!PyArg_ParseTuple (args ,"iiil;int,int,n,attr" , & y , & x , & num , & attr ))
651+ return NULL ;
652+ use_xy = TRUE;
653+ break ;
654+ default :
655+ PyErr_SetString (PyExc_TypeError , "chgat requires 1 to 4 arguments" );
656+ return NULL ;
657+ }
658+
659+ color = (short )((attr >> 8 ) & 0xff );
660+ attr = attr - (color << 8 );
661+
662+ if (use_xy == TRUE) {
663+ rtn = mvwchgat (self -> win ,y ,x ,num ,attr ,color ,NULL );
664+ touchline (self -> win ,y ,1 );
665+ } else {
666+ getyx (self -> win ,y ,x );
667+ rtn = wchgat (self -> win ,num ,attr ,color ,NULL );
668+ touchline (self -> win ,y ,1 );
669+ }
670+ return PyCursesCheckERR (rtn , "chgat" );
671+ }
672+
623673
624674static PyObject *
625675PyCursesWindow_DelCh (PyCursesWindowObject * self , PyObject * args )
@@ -1428,6 +1478,7 @@ static PyMethodDef PyCursesWindow_Methods[] = {
14281478 {"attron" , (PyCFunction )PyCursesWindow_wattron , METH_VARARGS },
14291479 {"attrset" , (PyCFunction )PyCursesWindow_wattrset , METH_VARARGS },
14301480 {"bkgd" , (PyCFunction )PyCursesWindow_Bkgd , METH_VARARGS },
1481+ {"chgat" , (PyCFunction )PyCursesWindow_ChgAt , METH_VARARGS },
14311482 {"bkgdset" , (PyCFunction )PyCursesWindow_BkgdSet , METH_VARARGS },
14321483 {"border" , (PyCFunction )PyCursesWindow_Border , METH_VARARGS },
14331484 {"box" , (PyCFunction )PyCursesWindow_Box , METH_VARARGS },
0 commit comments