@pymethod |PyCToolTipCtrl|AddTool|Adds a tool to tooltip control.
| 115 | |
| 116 | // @pymethod |PyCToolTipCtrl|AddTool|Adds a tool to tooltip control. |
| 117 | static PyObject * |
| 118 | PyCToolTipCtrl_add_tool(PyObject *self, PyObject *args) |
| 119 | { |
| 120 | PyObject *obWnd,*obRect; |
| 121 | TCHAR *pszText; |
| 122 | PyObject *obText; |
| 123 | UINT nIDTool; |
| 124 | if (!PyArg_ParseTuple(args, "OOOi:CreateWindow", |
| 125 | &obWnd, // @pyparm <o PyCWnd>|wnd||The window of the tool. |
| 126 | &obText,// @pyparm string|text||The text for the tool. |
| 127 | &obRect, // @pyparm int, int, int, int|rect|None|The default rectangle |
| 128 | &nIDTool// @pyparm int|id||The id of the tool |
| 129 | )) |
| 130 | return NULL; |
| 131 | |
| 132 | CWnd *pWnd = NULL; |
| 133 | if (obWnd != Py_None) |
| 134 | { |
| 135 | if (!ui_base_class::is_uiobject(obWnd,&PyCWnd::type)) |
| 136 | RETURN_TYPE_ERR("wnd argument must be a window object"); |
| 137 | pWnd = GetWndPtr(obWnd); |
| 138 | if (pWnd==NULL) |
| 139 | RETURN_TYPE_ERR("The window is not a valid PyCWnd"); |
| 140 | } |
| 141 | |
| 142 | RECT rect; |
| 143 | RECT *pRectTool=NULL; |
| 144 | if (obRect != Py_None) |
| 145 | { |
| 146 | if (!PyArg_ParseTuple(obRect, "iiii", &rect.left, &rect.top, &rect.right,&rect.bottom)) |
| 147 | { |
| 148 | PyErr_Clear(); |
| 149 | RETURN_TYPE_ERR("Rect must be None or a tuple of (iiii)"); |
| 150 | } |
| 151 | pRectTool=▭ |
| 152 | } |
| 153 | |
| 154 | |
| 155 | CToolTipCtrl *pTTC = GetToolTipCtrl(self); |
| 156 | if (!pTTC)return NULL; |
| 157 | if (!PyWinObject_AsTCHAR(obText, &pszText, FALSE)) |
| 158 | return NULL; |
| 159 | GUI_BGN_SAVE; |
| 160 | BOOL ok=pTTC->AddTool(pWnd,pszText,pRectTool,nIDTool); |
| 161 | GUI_END_SAVE; |
| 162 | PyWinObject_FreeTCHAR(pszText); |
| 163 | if (!ok) |
| 164 | RETURN_ERR("CToolTipCtrl::AddTool"); |
| 165 | RETURN_NONE; |
| 166 | } |
| 167 | |
| 168 | |
| 169 | // @pymethod int|PyCToolTipCtrl|SetMaxTipWidth| |
nothing calls this directly
no test coverage detected