void ResizeWindowControls( EditablePanel *pWindow, int tall, int wide, int offsetX, int offsetY ) { if (!pWindow || !pWindow->GetBuildGroup() || !pWindow->GetBuildGroup()->GetPanelList()) return; CUtlVector<PHandle> *panelList = pWindow->GetBuildGroup()->GetPanelList(); CUtlVector<Panel *> resizedPanels; CUtlVector<Panel *> movedPanels; // Resize to account for 1.25 aspect ratio (1280x1024) screens { for ( int i = 0; i < panelList->Size(); ++i ) { PHandle handle = (*panelList)[i]; Panel *panel = handle.Get(); bool found = false; for ( int j = 0; j < resizedPanels.Size(); ++j ) { if (panel == resizedPanels[j]) found = true; } if (!panel || found) { continue; } resizedPanels.AddToTail( panel ); // don't move a panel more than once if ( panel != pWindow ) { RepositionControl( panel ); } } } // and now re-center them. Woohoo! for ( int i = 0; i < panelList->Size(); ++i ) { PHandle handle = (*panelList)[i]; Panel *panel = handle.Get(); bool found = false; for ( int j = 0; j < movedPanels.Size(); ++j ) { if (panel == movedPanels[j]) found = true; } if (!panel || found) { continue; } movedPanels.AddToTail( panel ); // don't move a panel more than once if ( panel != pWindow ) { int x, y; panel->GetPos( x, y ); panel->SetPos( x + offsetX, y + offsetY ); #if DEBUG_WINDOW_REPOSITIONING DevMsg( "Repositioning '%s' from (%d,%d) to (%d,%d) -- a distance of (%d,%d)\n", panel->GetName(), x, y, x + offsetX, y + offsetY, offsetX, offsetY ); #endif } } }
LUA_API lua_PropertyPage *lua_topropertypage (lua_State *L, int idx) { PHandle *phPanel = dynamic_cast<PHandle *>((PHandle *)lua_touserdata(L, idx)); if (phPanel == NULL) return NULL; return dynamic_cast<lua_PropertyPage *>(phPanel->Get()); }