// @pymethod int|PyCWinApp|IsInproc|Returns a flag to indicate if the created CWinApp was in the DLL, or an external EXE. static PyObject * ui_app_isinproc(PyObject *self, PyObject *args) { extern BOOL PyWin_bHaveMFCHost; CHECK_NO_ARGS2(args, IsInproc); return PyInt_FromLong(!PyWin_bHaveMFCHost); }
// @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; }
static PyObject * py_close_clipboard(PyObject* self, PyObject* args) { CHECK_NO_ARGS2(args, "CloseClipboard"); BOOL rc; Py_BEGIN_ALLOW_THREADS; rc = CloseClipboard(); Py_END_ALLOW_THREADS; if (!rc) { return ReturnAPIError("CloseClipboard"); } RETURN_NONE; // @comm When the window has finished examining or changing the clipboard, // close the clipboard by calling CloseClipboard. This enables other windows // to access the clipboard.<nl> // Do not place an object on the clipboard after calling CloseClipboard. // @pyseeapi CloseClipboard // @rdesc If the function succeeds, the return value is None.<nl> // If the function fails, win32api.error is raised with the GetLastError // info. }
static PyObject * py_get_open_clipboard_window(PyObject* self, PyObject* args) { CHECK_NO_ARGS2(args, "GetOpenClipboardWindow"); HWND rc; Py_BEGIN_ALLOW_THREADS; rc = GetOpenClipboardWindow(); Py_END_ALLOW_THREADS; if (!rc) return ReturnAPIError("GetOpenClipboardWindow"); return PyWinLong_FromHANDLE(rc); // @comm If an application or dynamic-link library (DLL) specifies a NULL // window handle when calling the OpenClipboard function, the clipboard is // opened but is not associated with a window. In such a case, // GetOpenClipboardWindow returns NULL. // @pyseeapi GetOpenClipboardWindow // @rdesc If the function succeeds, the return value is the handle of the // window that has the clipboard open. // If the function fails, win32api.error is raised with the GetLastError // info. }
static PyObject * py_get_clipboard_owner(PyObject* self, PyObject* args) { CHECK_NO_ARGS2(args, "GetClipboardOwner"); HWND rc; Py_BEGIN_ALLOW_THREADS; rc = GetClipboardOwner(); Py_END_ALLOW_THREADS; if (!rc) return ReturnAPIError("GetClipboardOwner"); return PyWinLong_FromHANDLE(rc); // @comm The clipboard can still contain data even if the clipboard is not // currently owned.<nl> // In general, the clipboard owner is the window that last placed data in // clipboard. The EmptyClipboard function assigns clipboard ownership. // @pyseeapi GetClipboardOwner // @rdesc If the function succeeds, the return value is the handle of the // window that owns the clipboard. // If the function fails, win32api.error is raised with the GetLastError // info. }
static PyObject * py_empty_clipboard(PyObject* self, PyObject* args) { CHECK_NO_ARGS2(args, "EmptyClipboard"); BOOL rc; Py_BEGIN_ALLOW_THREADS; rc = EmptyClipboard(); Py_END_ALLOW_THREADS; if (!rc) { return ReturnAPIError("EmptyClipboard"); } RETURN_NONE; // @comm Before calling EmptyClipboard, an application must open the // clipboard by using the OpenClipboard function. If the application // specifies a NULL window handle when opening the clipboard, EmptyClipboard // succeeds but sets the clipboard owner to NULL. // @pyseeapi EmptyClipboard // @rdesc If the function succeeds, the return value is None.<nl> // If the function fails, win32api.error is raised with the GetLastError // info. }
static PyObject * py_count_clipboard_formats(PyObject* self, PyObject* args) { CHECK_NO_ARGS2(args, "CountClipboardFormats"); int rc; Py_BEGIN_ALLOW_THREADS; rc = CountClipboardFormats(); Py_END_ALLOW_THREADS; if (!rc) { return ReturnAPIError("CountClipboardFormats"); } return (Py_BuildValue("i", rc)); // @pyseeapi CountClipboardFormats // @rdesc If the function succeeds, the return value is the number of // different data formats currently on the clipboard. // If the function fails, win32api.error is raised with the GetLastError // info. }
// @pymethod |PyCPrintInfo|GetPageDesc|Get the format string used to display the page numbers during print preview // @pyseemfc CPrintInfo|m_strPageDesc static PyObject *ui_get_page_desc(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetPageDesc); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; return Py_BuildValue ("s", pInfo->m_strPageDesc); }
// @pymethod |PyCPrintInfo|GetNumPreviewPages|Get the number of pages displayed in preview mode. // @pyseemfc CPrintInfo|m_nNumPreviewPages static PyObject *ui_get_num_preview_pages(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetNumPreviewPages); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; return Py_BuildValue ("i", pInfo->m_nNumPreviewPages); }
// @pymethod |PyCPrintInfo|GetCurPage|Get the number of the current page. // @pyseemfc CPrintInfo|m_nCurPage static PyObject *ui_get_cur_page(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetCurPage); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; return Py_BuildValue ("i", pInfo->m_nCurPage); }
// @pymethod |PyCPrintInfo|GetContinuePrinting|A flag indicating whether the framework should continue the print loop. // @pyseemfc CPrintInfo|m_bContinuePrinting static PyObject *ui_get_continue_printing(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetContinuePrinting); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; return Py_BuildValue ("i", pInfo->m_bContinuePrinting); }
// @pymethod |PyCPrintInfo|GetDwFlags|A flags specifying DocObject printing operations. Valid only if data member m_bDocObject is TRUE. // @pyseemfc CPrintInfo|m_dwFlags static PyObject *ui_get_dwflags(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetDwFlags); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; return Py_BuildValue ("i", pInfo->m_dwFlags); }
// @pymethod <o PyCToolTopCtrl>|PyCTreeCtrl|GetToolTips|Returns the tooltip control PyObject *PyCTreeCtrl_GetToolTips( PyObject *self, PyObject *args ) { CTreeCtrl *pList = GetTreeCtrl(self); if (!pList) return NULL; CHECK_NO_ARGS2(args,"GetToolTips"); CToolTipCtrl*ret = pList->GetToolTips(); return ui_assoc_object::make( PyCToolTipCtrl::type, ret)->GetGoodRet(); }
// @pymethod [<o PyCDocTemplate>,...]|PyCWinApp|GetDocTemplateList|Returns a list of all document templates. static PyObject * ui_app_get_doc_template_list(PyObject *self, PyObject *args) { CHECK_NO_ARGS2(args, GetDocTemplateList); CProtectedWinApp *pApp = GetProtectedApp(); if (!pApp) return NULL; return pApp->MakePyDocTemplateList(); }
// @pymethod int|PyCImageList|GetSafeHandle|Retrieves the HIMAGELIST for the object PyObject *PyCImageList_GetSafeHandle( PyObject *self, PyObject *args ) { CImageList *pList; if (!(pList=PyCImageList::GetImageList(self))) return NULL; CHECK_NO_ARGS2(args, "GetSafeHandle"); return Py_BuildValue("i", pList->GetSafeHandle()); }
// @pymethod |PyCPrintInfo|DocObject|Return true if the document being printed is a DocObject. // @pyseemfc CPrintInfo|m_bDocObject static PyObject *ui_is_doc_object(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, DocObject); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; return Py_BuildValue ("i", pInfo->m_bDocObject); }
// @pymethod |PyCPrintInfo|GetFlags|A set of bit flags that you can use to initialize the Print common dialog box. When the dialog box returns, it sets these flags to indicate the user's input. This member can be a combination of the following flags: PD_ALLPAGES, PD_COLLATE, PD_DISABLEPRINTTOFILE, PD_ENABLEPRINTHOOK, PD_ENABLEPRINTTEMPLATE, PD_ENABLEPRINTTEMPLATEHANDLE, PD_ENABLESETUPHOOK, PD_ENABLESETUPTEMPLATE, PD_ENABLESETUPTEMPLATEHANDLE, PD_HIDEPRINTTOFILE, PD_NONETWORKBUTTON, PD_NOPAGENUMS, PD_NOSELECTION, PD_NOWARNING, PD_PAGENUMS, PD_PRINTSETUP, PD_PRINTTOFILE, PD_RETURNDC, PD_RETURNDEFAULT, PD_RETURNIC, PD_SELECTION, PD_SHOWHELP, PD_USEDEVMODECOPIES, PD_USEDEVMODECOPIESANDCOLLATE. // @pyseemfc PRINTDLG|Flags static PyObject *ui_get_flags(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetFlags); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; DWORD ret = pInfo->m_pPD->m_pd.Flags; return Py_BuildValue ("i", ret); }
// @pymethod <o PyCWinApp>|win32ui|GetApp|Retrieves the application object. PyObject * ui_get_app(PyObject *self, PyObject *args) { // @comm There will only ever be one application object per application. CHECK_NO_ARGS2(args,GetApp); CWinApp *pApp = GetApp(); if (pApp==NULL) return NULL; return ui_assoc_object::make(PyCWinApp::type, pApp)->GetGoodRet(); }
// @pymethod int|PyCRgn|GetSafeHandle|A HANDLE to the attached Windows GDI object; otherwise NULL if no object is attached // Return Values: the handle of the CRgn object PyObject * PyCRgn::get_safe_handle(PyObject *self, PyObject *args) { CRgn *pRgn = PyCRgn::GetRgn(self); if (!pRgn) return NULL; CHECK_NO_ARGS2(args,GetSafeHandle); HGDIOBJ hgdiobj=pRgn->GetSafeHandle(); return Py_BuildValue("l",hgdiobj); }
// @pymethod |PyCPrintInfo|GetPRINTDLGCopies|Get the initial number of copies for the Copies edit control if hDevMode is NULL; otherwise, the dmCopies member of theDEVMODE structure contains the initial value. When PrintDlg returns, nCopies contains the actual number of copies to print. This value depends on whether the application or the printer driver is responsible for printing multiple copies. If the PD_USEDEVMODECOPIESANDCOLLATE flag is set in the Flags member, nCopies is always 1 on return, and the printer driver is responsible for printing multiple copies. If the flag is not set, the application is responsible for printing the number of copies specified by nCopies. For more information, see the description of the PD_USEDEVMODECOPIESANDCOLLATE flag. // @pyseemfc PRINTDLG|nCopies static PyObject *ui_get_printdlg_copies(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetPRINTDLGCopies); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; DWORD res = pInfo->m_pPD->m_pd.nCopies; return Py_BuildValue ("i", res); }
// @pymethod |PyCPrintInfo|GetHDC|Identifies a device context or an information context, depending on whether the Flags member specifies the PD_RETURNDC or PC_RETURNIC flag. If neither flag is specified, the value of this member is undefined. If both flags are specified, PD_RETURNDC has priority. // @pyseemfc PRINTDLG|hDC static PyObject *ui_get_hdc(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetHDC); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; HDC hDC = pInfo->m_pPD->m_pd.hDC; return PyWinLong_FromHANDLE(hDC); }
// @pymethod int|PyCWinApp|Run|Starts the message pump. Advanced users only static PyObject * ui_app_run(PyObject *self, PyObject *args) { CHECK_NO_ARGS2(args, "Run"); GUI_BGN_SAVE; long rc = AfxGetApp()->CWinApp::Run(); GUI_END_SAVE; return PyInt_FromLong(rc); }
// @pymethod |PyCPropertySheet|SetWizardMode|Enables the wizard mode PyObject *ui_propsheet_set_wizard_mode( PyObject *self, PyObject *args ) { CPropertySheet *pPS = pPS=GetPropSheet(self); if (!pPS) return NULL; CHECK_NO_ARGS2(args,SetWizardMode); GUI_BGN_SAVE; pPS->SetWizardMode(); GUI_END_SAVE; RETURN_NONE; }
// @pymethod |PyCPrintInfo|GetToPage|The number of the last page to be printed. // @pyseemfc CPrintInfo|GetToPage static PyObject *ui_get_to_page(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetToPage); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; GUI_BGN_SAVE; UINT ret = pInfo->GetToPage(); GUI_END_SAVE; return Py_BuildValue ("i", ret); }
// @pymethod |PyCWinApp|OnFileOpen|Calls the underlying OnFileOpen MFC method. static PyObject * ui_on_file_open(PyObject *self, PyObject *args) { CHECK_NO_ARGS2(args,OnFileNew); CProtectedWinApp *pApp = GetProtectedApp(); if (!pApp) return NULL; GUI_BGN_SAVE; pApp->OnFileOpen(); GUI_END_SAVE; RETURN_NONE; }
// @pymethod int|PyCWinThread|Run|Starts the message pump. Advanced users only static PyObject * ui_thread_run(PyObject *self, PyObject *args) { CHECK_NO_ARGS2(args, "Run"); CWinThread *pThread = GetCWinThreadPtr(self); if (!pThread) return NULL; GUI_BGN_SAVE; long rc = pThread->CWinThread::Run(); GUI_END_SAVE; return PyInt_FromLong(rc); }
// @pymethod |PyCWinThread|PumpIdle|Pumps all idle messages. static PyObject * ui_thread_pump_idle(PyObject *self, PyObject *args) { CHECK_NO_ARGS2(args,PumpIdle); CProtectedWinThread *pThread = GetCProtectedWinThreadPtr(self); if (!pThread) return NULL; GUI_BGN_SAVE; pThread->PumpIdle(); GUI_END_SAVE; RETURN_NONE; }
// @pymethod int|PyCImageList|GetImageCount|Retrieves the number of images in an image list. PyObject *PyCImageList_GetImageCount( PyObject *self, PyObject *args ) { CImageList *pList; if (!(pList=PyCImageList::GetImageList(self))) return NULL; CHECK_NO_ARGS2(args, "GetImageCount"); GUI_BGN_SAVE; int rc = pList->GetImageCount(); GUI_END_SAVE; return Py_BuildValue("i", rc); }
// @pymethod |PyCPrintInfo|DoModal|Call DoModal on the dialog. // @pyseemfc CPrintDialog|DoModal static PyObject *ui_do_modal(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, DoModal); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; GUI_BGN_SAVE; INT_PTR res = pInfo->m_pPD->DoModal(); GUI_END_SAVE; return PyWinObject_FromDWORD_PTR(res); }
// @pymethod |PyCPrintInfo|GetPrinterDC|A handle to the printer device context if successful; otherwise NULL. If the bPrintSetupOnly parameter of the CPrintDialog constructor was FALSE (indicating that the Print dialog box is displayed), then GetPrinterDC returns a handle to the printer device context. You must call the WindowsDeleteDC function to delete the device context when you are done using it. // @pyseemfc CPrintDialog|GetPrinterDC static PyObject *ui_get_printer_dc(PyObject * self, PyObject * args) { CHECK_NO_ARGS2(args, GetPrinterDC); CPrintInfo *pInfo = ui_prinfo_object::GetPrintInfo(self); if (!pInfo) return NULL; GUI_BGN_SAVE; HDC hDC = pInfo->m_pPD->GetPrinterDC(); GUI_END_SAVE; return PyWinLong_FromHANDLE(hDC); }