Пример #1
0
// @pymethod [<o PyCView>,...]|PyCDocument|GetAllViews|Returns a list of all views for the current document.
PyObject *
ui_doc_get_all_views(PyObject *self, PyObject *args)
{
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	CHECK_NO_ARGS2(args,GetAllViews);
	PyObject *retList = PyList_New(0);
	GUI_BGN_SAVE;
	POSITION pos = pDoc->GetFirstViewPosition(); // @pyseemfc CDocument|GetFirstViewPosition
	GUI_END_SAVE;
	while (pos!=NULL) {
		GUI_BGN_SAVE;
		CView *pWnd = pDoc->GetNextView( pos );      // @pyseemfc CDocument|GetNextView
		GUI_END_SAVE;
		ASSERT(pWnd);	// shouldnt be possible.
		if (pWnd==NULL) {
			Py_DECREF(retList);
			RETURN_ERR("No view was available!");
		}
		PyObject *newObj = ui_assoc_object::make(UITypeFromCObject(pWnd), pWnd)->GetGoodRet();
		if (newObj==NULL) {
			Py_DECREF(retList);
			return NULL;
		}
		PyList_Append(retList, newObj);
		Py_DECREF(newObj);
	}
	return retList;
}
Пример #2
0
// @pymethod <o PyCEdit>|PyCListCtrl|GetEditControl|Retrieves the handle of the edit control used to edit the specified list view item.
PyObject *PyCListCtrl_GetEditControl( PyObject *self, PyObject *args )
{
	CListCtrl *pList = GetListCtrl(self);
	if (!pList) return NULL;
	if (!PyArg_ParseTuple( args, ":GetEditControl"))
		return NULL;
	GUI_BGN_SAVE;
	CEdit *pEdit = pList->GetEditControl();
	GUI_END_SAVE;
	if (pEdit==NULL)
		RETURN_ERR("GetEditControl failed");
	return ui_assoc_object::make(UITypeFromCObject(pEdit), pEdit)->GetGoodRet();
}
Пример #3
0
// @pymethod <o PyCEdit>|PyCListCtrl|EditLabel|Edits a specified list view item in-place.
PyObject *PyCListCtrl_EditLabel( PyObject *self, PyObject *args )
{
	CListCtrl *pList = GetListCtrl(self);
	if (!pList) return NULL;
	int item;
	// @pyparm int|item||The index of item to edit.
	if (!PyArg_ParseTuple( args, "i:EditLabel", &item))
		return NULL;
	GUI_BGN_SAVE;
	CEdit *pEdit = pList->EditLabel(item);
	GUI_END_SAVE;
	if (pEdit==NULL)
		RETURN_ERR("EditLabel failed");
	return ui_assoc_object::make(UITypeFromCObject(pEdit), pEdit)->GetGoodRet();
}
Пример #4
0
// @pymethod <o PyCView>|PyCDocument|GetFirstView|Returns the first view object attached to this document.
PyObject *
ui_doc_get_first_view(PyObject *self, PyObject *args)
{
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	CHECK_NO_ARGS2(args,GetFirstView);
	POSITION pos = pDoc->GetFirstViewPosition(); // @pyseemfc CDocument|GetFirstViewPosition
	if (pos==NULL)
		RETURN_NONE;
	GUI_BGN_SAVE;
	CView *pWnd = pDoc->GetNextView( pos );      // @pyseemfc CDocument|GetNextView
	GUI_END_SAVE;

	// @comm For more info, see <om PyCDocument.GetAllViews>
	ASSERT(pWnd);	// shouldnt be possible.
	return ui_assoc_object::make(UITypeFromCObject(pWnd), pWnd)->GetGoodRet();
}
Пример #5
0
// @pymethod <o PyCEdit>|PyCTreeCtrl|EditLabel|Edits a specified tree view item in-place.
PyObject *PyCTreeCtrl_EditLabel( PyObject *self, PyObject *args )
{
	CTreeCtrl *pList = GetTreeCtrl(self);
	if (!pList) return NULL;
	PyObject *obItem;
	// @pyparm HTREEITEM|item||The item to edit.
	if (!PyArg_ParseTuple( args, "O:EditLabel", &obItem))
		return NULL;
	HTREEITEM item;
	if (!PyWinObject_AsHANDLE(obItem, (HANDLE *)&item))
		return NULL;
	GUI_BGN_SAVE;
	CEdit *pEdit = pList->EditLabel(item);
	GUI_END_SAVE;
	if (pEdit==NULL)
		RETURN_ERR("EditLabel failed");
	return ui_assoc_object::make(UITypeFromCObject(pEdit), pEdit)->GetGoodRet();
}