_curses_panel.c.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. /*[clinic input]
  2. preserve
  3. [clinic start generated code]*/
  4. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  5. # include "pycore_gc.h" // PyGC_Head
  6. # include "pycore_runtime.h" // _Py_ID()
  7. #endif
  8. PyDoc_STRVAR(_curses_panel_panel_bottom__doc__,
  9. "bottom($self, /)\n"
  10. "--\n"
  11. "\n"
  12. "Push the panel to the bottom of the stack.");
  13. #define _CURSES_PANEL_PANEL_BOTTOM_METHODDEF \
  14. {"bottom", _PyCFunction_CAST(_curses_panel_panel_bottom), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_bottom__doc__},
  15. static PyObject *
  16. _curses_panel_panel_bottom_impl(PyCursesPanelObject *self, PyTypeObject *cls);
  17. static PyObject *
  18. _curses_panel_panel_bottom(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  19. {
  20. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  21. PyErr_SetString(PyExc_TypeError, "bottom() takes no arguments");
  22. return NULL;
  23. }
  24. return _curses_panel_panel_bottom_impl(self, cls);
  25. }
  26. PyDoc_STRVAR(_curses_panel_panel_hide__doc__,
  27. "hide($self, /)\n"
  28. "--\n"
  29. "\n"
  30. "Hide the panel.\n"
  31. "\n"
  32. "This does not delete the object, it just makes the window on screen invisible.");
  33. #define _CURSES_PANEL_PANEL_HIDE_METHODDEF \
  34. {"hide", _PyCFunction_CAST(_curses_panel_panel_hide), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_hide__doc__},
  35. static PyObject *
  36. _curses_panel_panel_hide_impl(PyCursesPanelObject *self, PyTypeObject *cls);
  37. static PyObject *
  38. _curses_panel_panel_hide(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  39. {
  40. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  41. PyErr_SetString(PyExc_TypeError, "hide() takes no arguments");
  42. return NULL;
  43. }
  44. return _curses_panel_panel_hide_impl(self, cls);
  45. }
  46. PyDoc_STRVAR(_curses_panel_panel_show__doc__,
  47. "show($self, /)\n"
  48. "--\n"
  49. "\n"
  50. "Display the panel (which might have been hidden).");
  51. #define _CURSES_PANEL_PANEL_SHOW_METHODDEF \
  52. {"show", _PyCFunction_CAST(_curses_panel_panel_show), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_show__doc__},
  53. static PyObject *
  54. _curses_panel_panel_show_impl(PyCursesPanelObject *self, PyTypeObject *cls);
  55. static PyObject *
  56. _curses_panel_panel_show(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  57. {
  58. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  59. PyErr_SetString(PyExc_TypeError, "show() takes no arguments");
  60. return NULL;
  61. }
  62. return _curses_panel_panel_show_impl(self, cls);
  63. }
  64. PyDoc_STRVAR(_curses_panel_panel_top__doc__,
  65. "top($self, /)\n"
  66. "--\n"
  67. "\n"
  68. "Push panel to the top of the stack.");
  69. #define _CURSES_PANEL_PANEL_TOP_METHODDEF \
  70. {"top", _PyCFunction_CAST(_curses_panel_panel_top), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_top__doc__},
  71. static PyObject *
  72. _curses_panel_panel_top_impl(PyCursesPanelObject *self, PyTypeObject *cls);
  73. static PyObject *
  74. _curses_panel_panel_top(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  75. {
  76. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  77. PyErr_SetString(PyExc_TypeError, "top() takes no arguments");
  78. return NULL;
  79. }
  80. return _curses_panel_panel_top_impl(self, cls);
  81. }
  82. PyDoc_STRVAR(_curses_panel_panel_above__doc__,
  83. "above($self, /)\n"
  84. "--\n"
  85. "\n"
  86. "Return the panel above the current panel.");
  87. #define _CURSES_PANEL_PANEL_ABOVE_METHODDEF \
  88. {"above", (PyCFunction)_curses_panel_panel_above, METH_NOARGS, _curses_panel_panel_above__doc__},
  89. static PyObject *
  90. _curses_panel_panel_above_impl(PyCursesPanelObject *self);
  91. static PyObject *
  92. _curses_panel_panel_above(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
  93. {
  94. return _curses_panel_panel_above_impl(self);
  95. }
  96. PyDoc_STRVAR(_curses_panel_panel_below__doc__,
  97. "below($self, /)\n"
  98. "--\n"
  99. "\n"
  100. "Return the panel below the current panel.");
  101. #define _CURSES_PANEL_PANEL_BELOW_METHODDEF \
  102. {"below", (PyCFunction)_curses_panel_panel_below, METH_NOARGS, _curses_panel_panel_below__doc__},
  103. static PyObject *
  104. _curses_panel_panel_below_impl(PyCursesPanelObject *self);
  105. static PyObject *
  106. _curses_panel_panel_below(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
  107. {
  108. return _curses_panel_panel_below_impl(self);
  109. }
  110. PyDoc_STRVAR(_curses_panel_panel_hidden__doc__,
  111. "hidden($self, /)\n"
  112. "--\n"
  113. "\n"
  114. "Return True if the panel is hidden (not visible), False otherwise.");
  115. #define _CURSES_PANEL_PANEL_HIDDEN_METHODDEF \
  116. {"hidden", (PyCFunction)_curses_panel_panel_hidden, METH_NOARGS, _curses_panel_panel_hidden__doc__},
  117. static PyObject *
  118. _curses_panel_panel_hidden_impl(PyCursesPanelObject *self);
  119. static PyObject *
  120. _curses_panel_panel_hidden(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
  121. {
  122. return _curses_panel_panel_hidden_impl(self);
  123. }
  124. PyDoc_STRVAR(_curses_panel_panel_move__doc__,
  125. "move($self, y, x, /)\n"
  126. "--\n"
  127. "\n"
  128. "Move the panel to the screen coordinates (y, x).");
  129. #define _CURSES_PANEL_PANEL_MOVE_METHODDEF \
  130. {"move", _PyCFunction_CAST(_curses_panel_panel_move), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_move__doc__},
  131. static PyObject *
  132. _curses_panel_panel_move_impl(PyCursesPanelObject *self, PyTypeObject *cls,
  133. int y, int x);
  134. static PyObject *
  135. _curses_panel_panel_move(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  136. {
  137. PyObject *return_value = NULL;
  138. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  139. # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
  140. #else
  141. # define KWTUPLE NULL
  142. #endif
  143. static const char * const _keywords[] = {"", "", NULL};
  144. static _PyArg_Parser _parser = {
  145. .keywords = _keywords,
  146. .fname = "move",
  147. .kwtuple = KWTUPLE,
  148. };
  149. #undef KWTUPLE
  150. PyObject *argsbuf[2];
  151. int y;
  152. int x;
  153. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
  154. if (!args) {
  155. goto exit;
  156. }
  157. y = _PyLong_AsInt(args[0]);
  158. if (y == -1 && PyErr_Occurred()) {
  159. goto exit;
  160. }
  161. x = _PyLong_AsInt(args[1]);
  162. if (x == -1 && PyErr_Occurred()) {
  163. goto exit;
  164. }
  165. return_value = _curses_panel_panel_move_impl(self, cls, y, x);
  166. exit:
  167. return return_value;
  168. }
  169. PyDoc_STRVAR(_curses_panel_panel_window__doc__,
  170. "window($self, /)\n"
  171. "--\n"
  172. "\n"
  173. "Return the window object associated with the panel.");
  174. #define _CURSES_PANEL_PANEL_WINDOW_METHODDEF \
  175. {"window", (PyCFunction)_curses_panel_panel_window, METH_NOARGS, _curses_panel_panel_window__doc__},
  176. static PyObject *
  177. _curses_panel_panel_window_impl(PyCursesPanelObject *self);
  178. static PyObject *
  179. _curses_panel_panel_window(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
  180. {
  181. return _curses_panel_panel_window_impl(self);
  182. }
  183. PyDoc_STRVAR(_curses_panel_panel_replace__doc__,
  184. "replace($self, win, /)\n"
  185. "--\n"
  186. "\n"
  187. "Change the window associated with the panel to the window win.");
  188. #define _CURSES_PANEL_PANEL_REPLACE_METHODDEF \
  189. {"replace", _PyCFunction_CAST(_curses_panel_panel_replace), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_replace__doc__},
  190. static PyObject *
  191. _curses_panel_panel_replace_impl(PyCursesPanelObject *self,
  192. PyTypeObject *cls,
  193. PyCursesWindowObject *win);
  194. static PyObject *
  195. _curses_panel_panel_replace(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  196. {
  197. PyObject *return_value = NULL;
  198. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  199. # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
  200. #else
  201. # define KWTUPLE NULL
  202. #endif
  203. static const char * const _keywords[] = {"", NULL};
  204. static _PyArg_Parser _parser = {
  205. .keywords = _keywords,
  206. .fname = "replace",
  207. .kwtuple = KWTUPLE,
  208. };
  209. #undef KWTUPLE
  210. PyObject *argsbuf[1];
  211. PyCursesWindowObject *win;
  212. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
  213. if (!args) {
  214. goto exit;
  215. }
  216. if (!PyObject_TypeCheck(args[0], &PyCursesWindow_Type)) {
  217. _PyArg_BadArgument("replace", "argument 1", (&PyCursesWindow_Type)->tp_name, args[0]);
  218. goto exit;
  219. }
  220. win = (PyCursesWindowObject *)args[0];
  221. return_value = _curses_panel_panel_replace_impl(self, cls, win);
  222. exit:
  223. return return_value;
  224. }
  225. PyDoc_STRVAR(_curses_panel_panel_set_userptr__doc__,
  226. "set_userptr($self, obj, /)\n"
  227. "--\n"
  228. "\n"
  229. "Set the panel\'s user pointer to obj.");
  230. #define _CURSES_PANEL_PANEL_SET_USERPTR_METHODDEF \
  231. {"set_userptr", _PyCFunction_CAST(_curses_panel_panel_set_userptr), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_set_userptr__doc__},
  232. static PyObject *
  233. _curses_panel_panel_set_userptr_impl(PyCursesPanelObject *self,
  234. PyTypeObject *cls, PyObject *obj);
  235. static PyObject *
  236. _curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  237. {
  238. PyObject *return_value = NULL;
  239. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  240. # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
  241. #else
  242. # define KWTUPLE NULL
  243. #endif
  244. static const char * const _keywords[] = {"", NULL};
  245. static _PyArg_Parser _parser = {
  246. .keywords = _keywords,
  247. .fname = "set_userptr",
  248. .kwtuple = KWTUPLE,
  249. };
  250. #undef KWTUPLE
  251. PyObject *argsbuf[1];
  252. PyObject *obj;
  253. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
  254. if (!args) {
  255. goto exit;
  256. }
  257. obj = args[0];
  258. return_value = _curses_panel_panel_set_userptr_impl(self, cls, obj);
  259. exit:
  260. return return_value;
  261. }
  262. PyDoc_STRVAR(_curses_panel_panel_userptr__doc__,
  263. "userptr($self, /)\n"
  264. "--\n"
  265. "\n"
  266. "Return the user pointer for the panel.");
  267. #define _CURSES_PANEL_PANEL_USERPTR_METHODDEF \
  268. {"userptr", _PyCFunction_CAST(_curses_panel_panel_userptr), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_userptr__doc__},
  269. static PyObject *
  270. _curses_panel_panel_userptr_impl(PyCursesPanelObject *self,
  271. PyTypeObject *cls);
  272. static PyObject *
  273. _curses_panel_panel_userptr(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  274. {
  275. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  276. PyErr_SetString(PyExc_TypeError, "userptr() takes no arguments");
  277. return NULL;
  278. }
  279. return _curses_panel_panel_userptr_impl(self, cls);
  280. }
  281. PyDoc_STRVAR(_curses_panel_bottom_panel__doc__,
  282. "bottom_panel($module, /)\n"
  283. "--\n"
  284. "\n"
  285. "Return the bottom panel in the panel stack.");
  286. #define _CURSES_PANEL_BOTTOM_PANEL_METHODDEF \
  287. {"bottom_panel", (PyCFunction)_curses_panel_bottom_panel, METH_NOARGS, _curses_panel_bottom_panel__doc__},
  288. static PyObject *
  289. _curses_panel_bottom_panel_impl(PyObject *module);
  290. static PyObject *
  291. _curses_panel_bottom_panel(PyObject *module, PyObject *Py_UNUSED(ignored))
  292. {
  293. return _curses_panel_bottom_panel_impl(module);
  294. }
  295. PyDoc_STRVAR(_curses_panel_new_panel__doc__,
  296. "new_panel($module, win, /)\n"
  297. "--\n"
  298. "\n"
  299. "Return a panel object, associating it with the given window win.");
  300. #define _CURSES_PANEL_NEW_PANEL_METHODDEF \
  301. {"new_panel", (PyCFunction)_curses_panel_new_panel, METH_O, _curses_panel_new_panel__doc__},
  302. static PyObject *
  303. _curses_panel_new_panel_impl(PyObject *module, PyCursesWindowObject *win);
  304. static PyObject *
  305. _curses_panel_new_panel(PyObject *module, PyObject *arg)
  306. {
  307. PyObject *return_value = NULL;
  308. PyCursesWindowObject *win;
  309. if (!PyObject_TypeCheck(arg, &PyCursesWindow_Type)) {
  310. _PyArg_BadArgument("new_panel", "argument", (&PyCursesWindow_Type)->tp_name, arg);
  311. goto exit;
  312. }
  313. win = (PyCursesWindowObject *)arg;
  314. return_value = _curses_panel_new_panel_impl(module, win);
  315. exit:
  316. return return_value;
  317. }
  318. PyDoc_STRVAR(_curses_panel_top_panel__doc__,
  319. "top_panel($module, /)\n"
  320. "--\n"
  321. "\n"
  322. "Return the top panel in the panel stack.");
  323. #define _CURSES_PANEL_TOP_PANEL_METHODDEF \
  324. {"top_panel", (PyCFunction)_curses_panel_top_panel, METH_NOARGS, _curses_panel_top_panel__doc__},
  325. static PyObject *
  326. _curses_panel_top_panel_impl(PyObject *module);
  327. static PyObject *
  328. _curses_panel_top_panel(PyObject *module, PyObject *Py_UNUSED(ignored))
  329. {
  330. return _curses_panel_top_panel_impl(module);
  331. }
  332. PyDoc_STRVAR(_curses_panel_update_panels__doc__,
  333. "update_panels($module, /)\n"
  334. "--\n"
  335. "\n"
  336. "Updates the virtual screen after changes in the panel stack.\n"
  337. "\n"
  338. "This does not call curses.doupdate(), so you\'ll have to do this yourself.");
  339. #define _CURSES_PANEL_UPDATE_PANELS_METHODDEF \
  340. {"update_panels", (PyCFunction)_curses_panel_update_panels, METH_NOARGS, _curses_panel_update_panels__doc__},
  341. static PyObject *
  342. _curses_panel_update_panels_impl(PyObject *module);
  343. static PyObject *
  344. _curses_panel_update_panels(PyObject *module, PyObject *Py_UNUSED(ignored))
  345. {
  346. return _curses_panel_update_panels_impl(module);
  347. }
  348. /*[clinic end generated code: output=550ee3ad1ce9ec07 input=a9049054013a1b77]*/