MCPcopy Create free account
hub / github.com/acl-dev/acl / Create

Method Create

lib_acl_cpp/samples/gui_rpc/ui/WndResizer.cpp:2196–2253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2194}
2195
2196CSplitContainer * CSplitContainer::Create(CPanel * pPanelA, CPanel * pPanelB)
2197{
2198 CSplitPanel * pSplitPanelA = dynamic_cast<CSplitPanel *>( pPanelA );
2199 if (pSplitPanelA != NULL)
2200 {
2201 return NULL; // already a part of a CSplitContainer
2202 }
2203
2204 CSplitPanel * pSplitPanelB = dynamic_cast<CSplitPanel *>( pPanelB );
2205 if (pSplitPanelB != NULL)
2206 {
2207 return NULL; // already a part of a CSplitContainer
2208 }
2209
2210 CRect rcDest(0, 0, 0, 0);
2211 SplitterOrientation orien = SPLIT_CONTAINER_H;
2212
2213 if (::IntersectRect(&rcDest, pPanelA, pPanelB) == TRUE) // invalid spliter container, a spliter continer's two panel cannot intersect each other
2214 {
2215 return NULL;
2216 }
2217
2218
2219 if (pPanelA->right < pPanelB->left)
2220 {
2221 orien = SPLIT_CONTAINER_H;
2222 }
2223 else if (pPanelA->bottom < pPanelB->top)
2224 {
2225 orien = SPLIT_CONTAINER_V;
2226 }
2227 else
2228 {
2229 return NULL;
2230 }
2231 if (pPanelA->Parent != NULL)
2232 {
2233 if (pPanelA->Parent->RemoveChild( pPanelA ) == FALSE)
2234 {
2235 return NULL;
2236 }
2237 }
2238 if (pPanelB->Parent != NULL)
2239 {
2240 if (pPanelB->Parent->RemoveChild( pPanelB ) == FALSE)
2241 {
2242 return NULL;
2243 }
2244 }
2245
2246 pSplitPanelA = new CSplitPanel( pPanelA );
2247 pSplitPanelB = new CSplitPanel( pPanelB );
2248
2249
2250 CSplitContainer * pSpliter = new CSplitContainer(pSplitPanelA, pSplitPanelB, orien);
2251 return pSpliter;
2252
2253}

Callers

nothing calls this directly

Calls 1

RemoveChildMethod · 0.45

Tested by

no test coverage detected