Example #1
0
// @pymethod <o PyCToolTipCtrl>|win32ui|CreateToolTipCtrl|Creates a progress control object. <om PyToolTipCtrl.Create> creates the actual control.
PyObject *
PyCToolTipCtrl_create(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	CToolTipCtrl *pTTC = new CToolTipCtrl();
	return ui_assoc_object::make( PyCToolTipCtrl::type, pTTC );
}
Example #2
0
// @pymethod <o PyCRgn>|win32ui|CreateRgn|Creates a new rgn object.
// Return Values: a PyCRgn object
PyObject *
PyCRgn::create(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	CRgn *pRgn = new CRgn;
	return ui_assoc_object::make (PyCRgn::type, pRgn);
}
// @pymethod <o PyCEdit>|win32ui|CreateEdit|Creates an Edit object.  <om PyCEdit.CreateWindow> creates the actual control.
PyObject *
PyCEdit_create(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	CEdit *pBut = new CEdit();
	return ui_assoc_object::make( PyCEdit::type, pBut );
}
Example #4
0
// @pymethod <o PyCMenu>|win32ui|CreatePopupMenu|Creates a popup menu object.
PyObject *PyCMenu::create_popup(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	HMENU hMenu = CreatePopupMenu();
	if (!hMenu)
		RETURN_API_ERR("CreatePopupMenu");
	return ui_assoc_object::make(PyCMenu::type, hMenu);
}
// @pymethod |PyCEdit|Paste|Pastes the contents of the clipboard into the control.
static PyObject *PyCEdit_paste(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	CEdit *pEdit = GetEditCtrl(self);
	if (!pEdit)
		return NULL;
	GUI_BGN_SAVE;
	pEdit->Paste(); // @pyseemfc CEdit|Paste
	GUI_END_SAVE;
	RETURN_NONE;
}
Example #6
0
// @pymethod int|PyCTabCtrl|GetItemCountl|Returns the number of tabs in the control.
PyObject *ui_tabctrl_get_item_count( PyObject *self, PyObject *args )
{
	CHECK_NO_ARGS(args);
	CTabCtrl *pTab;
	if ((pTab=PyGetTabCtrl(self))==NULL)
		return NULL;
	GUI_BGN_SAVE;
	int rc = pTab->GetItemCount();
	GUI_END_SAVE;
	return Py_BuildValue("i", rc);
}
Example #7
0
// @pymethod |PyCPropertyPage|CancelToClose|Changes the Cancel button to Close.
PyObject *ui_proppage_cancel_to_close( PyObject *self, PyObject *args )
{
	CPythonPropertyPage *pPP;
	if (!(pPP=GetPropPage(self)))
		return NULL;
	CHECK_NO_ARGS(args);
	GUI_BGN_SAVE;
	pPP->CancelToClose();
	GUI_END_SAVE;
	RETURN_NONE;
}
Example #8
0
// @pymethod int|PyCPropertySheet|GetPageCount|Returns the number of pages.
PyObject *ui_propsheet_get_page_count( PyObject *self, PyObject *args )
{
	CHECK_NO_ARGS(args);
	CPythonPropertySheet *pPS;
	if (!(pPS=GetPythonPropSheet(self)))
		return NULL;
	GUI_BGN_SAVE;
	int rc = pPS->GetPageCount();
	GUI_END_SAVE;
  	return Py_BuildValue("i", rc);
}
// @pymethod int|PyCEdit|GetLineCount|Gets the number of lines in an edit control.
static PyObject *
PyCEdit_get_line_count(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	CEdit *pEdit = GetEditCtrl(self);
	if (!pEdit	)
		return NULL;
	GUI_BGN_SAVE;
	int rc = pEdit->GetLineCount();
	GUI_END_SAVE;
	return Py_BuildValue("i", rc); // @pyseemfc CEdit|GetLineCount
	// @rdesc The number of lines in the buffer.  If the control is empty, the return value is 1.
}
// @pymethod (start, end)|PyCEdit|GetSel|Returns the start and end of the current selection.
static PyObject *PyCEdit_get_sel(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	CEdit *pEdit = GetEditCtrl(self);
	if (!pEdit)
		return NULL;
	int start,end;
	GUI_BGN_SAVE;
	pEdit->GetSel(start,end); // @pyseemfc CEdit|GetSel
	GUI_END_SAVE;
	return Py_BuildValue("(ii)",start,end);
	// @rdesc The return tuple is (the first character in the current selection, first nonselected character past the end of the current selection)
}
Example #11
0
// @pymethod int|PyCTabCtrl|GetCurSel|Gets the current selection of a tab control.
PyObject *ui_tabctrl_get_cur_sel( PyObject *self, PyObject *args )
{
	CHECK_NO_ARGS(args);
	CTabCtrl *pTab;
	if ((pTab=PyGetTabCtrl(self))==NULL)
		return NULL;
	GUI_BGN_SAVE;
	int rc = pTab->GetCurSel();
	GUI_END_SAVE;
	return Py_BuildValue("i", rc);
	// @rdesc The zero-based index of the currently selected item, or -1 if no selection.

}
Example #12
0
// @pymethod <o PyCTabCtrl>|PyCPropertySheet|GetTabCtrl|Returns the tab control used by the sheet.
PyObject *ui_propsheet_get_tab_ctrl( PyObject *self, PyObject *args )
{
	CHECK_NO_ARGS(args);
	CPythonPropertySheet *pPS;
	if (!(pPS=GetPythonPropSheet(self)))
		return NULL;
	GUI_BGN_SAVE;
	CTabCtrl *pTab = pPS->GetTabControl();
	GUI_END_SAVE;
	if (pTab==NULL)
		RETURN_ERR("The property page does not have a tab control");
	return ui_assoc_object::make( ui_tabctrl_object::type, pTab)->GetGoodRet();
}
Example #13
0
// @pymethod |PyCDocument|DeleteContents|Call the MFC DeleteContents method.
// This routine is provided so a document object which overrides this method
// can call the original MFC version if required.
static PyObject *
ui_doc_delete_contents(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	// @xref <vm PyCDocument.DeleteContents>
	GUI_BGN_SAVE;
	pDoc->CDocument::DeleteContents(); // @pyseemfc CDocument|DeleteContents
	GUI_END_SAVE;
	RETURN_NONE;
}
// @pymethod int|PyCEdit|GetFirstVisibleLine|Returns zero-based index of the topmost visible line.
static PyObject *
PyCEdit_get_first_visible(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	CEdit *pEdit = GetEditCtrl(self);
	if (!pEdit)
		return NULL;
	GUI_BGN_SAVE;
	int rc = pEdit->GetFirstVisibleLine();
	GUI_END_SAVE;

	return Py_BuildValue("i",rc); // @pyseemfc CEdit|GetFirstVisibleLine
	// @rdesc The zero-based index of the topmost visible line. For single-line edit controls, the return value is 0.
}
Example #15
0
// @pymethod |PyCDocument|OnNewDocument|Call the MFC OnNewDocument handler.
// This routine is provided so a document object which overrides this method
// can call the original MFC version if required.
static PyObject *
ui_doc_on_new(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS(args);
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	// @xref <vm PyCDocument.OnNewDocument>
	GUI_BGN_SAVE;
	BOOL ok = pDoc->CDocument::OnNewDocument();
	GUI_END_SAVE;
	if (!ok) // @pyseemfc CDocument|OnNewDocument
		RETURN_ERR("OnNewDocument failed");
	RETURN_NONE;
}
Example #16
0
// @pymethod int|PyCPropertySheet|DoModal|Displays the property sheet as a modal dialog.
PyObject *ui_propsheet_do_modal( PyObject *self, PyObject *args )
{
	CHECK_NO_ARGS(args);
	CPropertySheet *pPS;
	if (!(pPS=GetPropSheet(self)))
		return NULL;
	if (!PropSheetCheckForDisplay(pPS))
		return NULL;
	Py_INCREF(self);	// make sure Python doesnt kill the object while in a modal call.
					// really only for the common dialog(!?), and other non CPythonPropSheet's
	INT_PTR ret;
	GUI_BGN_SAVE;
	ret = pPS->DoModal();
	GUI_END_SAVE;
	DODECREF(self);
	return PyWinObject_FromDWORD_PTR(ret);
}