MCPcopy Create free account
hub / github.com/mhammond/pywin32 / CreateView

Method CreateView

Pythonwin/win32splitter.cpp:261–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259 bHaveAllChildren = FALSE;
260}
261BOOL CPythonSplitter::CreateView(int row, int col,
262 CRuntimeClass* pViewClass, SIZE sizeInit, CCreateContext* pContext)
263{
264 // NOTE NOTE NOTE
265 // This is basically cloned from MFC CSplitterWnd::CreateView (winsplit.cpp)
266 ASSERT_VALID(this);
267 if (!(row >= 0 && row < m_nRows)) {
268 PyErr_Format(PyExc_IndexError, "Row number %d is invalid - must be from 0-%d", row, m_nRows-1);
269 return FALSE;
270 }
271 if (!(col >= 0 && col < m_nCols)) {
272 PyErr_Format(PyExc_IndexError, "Column number %d is invalid - must be from 0-%d", col, m_nCols-1);
273 return FALSE;
274 }
275// ASSERT(pViewClass != NULL);
276 CWnd *child;
277 {
278 GUI_BGN_SAVE;
279 child = GetDlgItem(IdFromRowCol(row, col));
280 GUI_END_SAVE;
281 }
282 if (child != NULL) {
283 PyErr_SetString(ui_module_error, "CreateView - pane already exists");
284 return FALSE;
285 }
286 // set the initial size for that pane
287 m_pColInfo[col].nIdealSize = sizeInit.cx;
288 m_pRowInfo[row].nIdealSize = sizeInit.cy;
289
290 if (pContext==NULL || pContext->m_pLastView==NULL) {
291 PyErr_SetString(ui_module_error, "CreateView - Internal error - no valid context");
292 return FALSE;
293 }
294 CWnd *pWnd = pContext->m_pLastView;
295 ASSERT(pWnd->IsKindOf(RUNTIME_CLASS(CWnd)));
296 ASSERT(pWnd->m_hWnd == NULL); // not yet created
297
298 DWORD dwStyle = AFX_WS_DEFAULT_VIEW;
299// if (afxData.bWin4)
300 dwStyle &= ~WS_BORDER;
301
302 // Create with the right size (wrong position)
303 CRect rect(CPoint(0,0), sizeInit);
304 BOOL ok;
305 GUI_BGN_SAVE;
306 ok = pWnd->Create(NULL, NULL, dwStyle,
307 rect, this, IdFromRowCol(row, col), pContext);
308 GUI_END_SAVE;
309 if (!ok)
310 {
311 PyErr_SetString(ui_module_error, "CreateView: couldn't create client pane for splitter");
312 // pWnd will be cleaned up by PostNcDestroy
313 return FALSE;
314 }
315// ASSERT((int)_AfxGetDlgCtrlID(pWnd->m_hWnd) == IdFromRowCol(row, col));
316
317 // send initial notification message
318// if (bSendInitialUpdate)

Callers 1

ui_splitter_create_viewFunction · 0.45

Calls 1

CreateMethod · 0.45

Tested by

no test coverage detected