@pymethod |PyCFrameWnd|LoadFrame|Loads a Windows frame window and associated resources
| 3502 | |
| 3503 | // @pymethod |PyCFrameWnd|LoadFrame|Loads a Windows frame window and associated resources |
| 3504 | static PyObject * |
| 3505 | ui_frame_load_frame(PyObject *self, PyObject *args) |
| 3506 | { |
| 3507 | int idResource = IDR_PYTHONTYPE; |
| 3508 | long style = -1; |
| 3509 | CPythonMDIChildWnd *pFrame = GetPythonFrame(self); |
| 3510 | BOOL bMakeVisible = TRUE; |
| 3511 | if (!pFrame) |
| 3512 | return NULL; |
| 3513 | if (pFrame->m_hWnd!=NULL) |
| 3514 | RETURN_ERR("The frame already has a window"); |
| 3515 | PythonCreateContext cc; |
| 3516 | PyObject *wndParent = Py_None; |
| 3517 | PyObject *contextObject = Py_None; |
| 3518 | if (!PyArg_ParseTuple(args, "|ilOO:LoadFrame", |
| 3519 | &idResource, // @pyparm int|idResource|IDR_PYTHONTYPE|The Id of the resources (menu, icon, etc) for this window |
| 3520 | &style, // @pyparm long|style|-1|The window style. Note -1 implies win32con.WS_OVERLAPPEDWINDOW\|win32con.FWS_ADDTOTITLE |
| 3521 | &wndParent, // @pyparm <o PyCWnd>|wndParent|None|The parent of the window, or None. |
| 3522 | &contextObject)) // @pyparm object|context|None|An object passed to the OnCreateClient for the frame, |
| 3523 | return NULL; |
| 3524 | if (style==-1) style=WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE; // default frame styles; |
| 3525 | CWnd *pParent = NULL; |
| 3526 | if (wndParent!=Py_None) { |
| 3527 | pParent = GetWndPtrFromParam( wndParent, PyCWnd::type ); |
| 3528 | if (pParent==NULL) |
| 3529 | return NULL; |
| 3530 | } |
| 3531 | cc.SetPythonObject(contextObject); |
| 3532 | // cc. = idResource |
| 3533 | // OnCreateClient will be called during this! |
| 3534 | CProtectedWinApp *pApp = GetProtectedApp(); |
| 3535 | if (!pApp) return NULL; |
| 3536 | BOOL ok; |
| 3537 | CWnd *pMain = pApp->GetMainFrame(); |
| 3538 | if (pMain==NULL) |
| 3539 | RETURN_ERR("There is no main application frame - an MDI child can not be created."); |
| 3540 | if (!pMain->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd))) |
| 3541 | RETURN_ERR("There is no MDI Frame Window available - an MDI child can not be created."); |
| 3542 | |
| 3543 | GUI_BGN_SAVE; |
| 3544 | ok = pFrame->LoadFrame(idResource, style, pParent, &cc); // @pyseemfc CFrameWnd|LoadFrame |
| 3545 | GUI_END_SAVE; |
| 3546 | if (!ok) { |
| 3547 | RETURN_ERR("LoadFrame failed\n"); |
| 3548 | // frame will be deleted in PostNcDestroy cleanup |
| 3549 | } |
| 3550 | RETURN_NONE; |
| 3551 | } |
| 3552 | |
| 3553 | // @pymethod |PyCFrameWnd|RecalcLayout|Called by the framework when the standard control bars are toggled on or off or when the frame window is resized. |
| 3554 | static PyObject * |
nothing calls this directly
no test coverage detected