void unFilterListCtrl::UpdateBoxes() { // get my size wxSize mysize = GetClientSize(); // get leftmost listitem position wxPoint itempos; List->GetItemPosition(0,itempos); // update sizes list EditSizes.resize( List->GetColumnCount() ); // get list border wxRect rb,rl; List->GetItemRect(0,rb,wxLIST_RECT_BOUNDS); List->GetItemRect(0,rl,wxLIST_RECT_LABEL); dword listborder = rl.GetX() - rb.GetX(); // update sizes dword width, acc = 0, y = 0; for(dword i=0; i<EditSizes.size(); ++i) { width = List->GetColumnWidth(i); // stretch first box to left edge if( i == 0 ) { width += listborder; acc -= listborder; } EditSizes[i].SetX(acc+itempos.x); EditSizes[i].SetY(y); EditSizes[i].SetWidth(width); EditSizes[i].SetHeight(-1); acc += width; } // create new editboxes if neccessary if( EditSizes.size() > EditBoxes.size() ) { EditBoxes.resize( EditSizes.size(), NULL ); for( dword i=0; i<EditBoxes.size(); ++i ) { if( EditBoxes[i] == NULL ) { wxTextCtrl* box = new wxTextCtrl( EditPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); wxListItem item; List->GetColumn(i,item); wxString text = wxT("\""); text.Append( List->Table->GetHeader() AT(i).GetCaption().wx_str() ); text.Append( wxT("\" filter") ); box->SetToolTip( text ); //wxString text; //text.Printf("%d",i); //EditBoxes[i]->WriteText(text); EditBoxes[i] = box; } } } // stretch last box to right edge if( !EditSizes.empty() ) { wxRect lastbox = EditSizes.back(); int lastpos = lastbox.GetX() + lastbox.GetWidth(); //wxLogMessage("%d %d",lastpos, mysize.GetWidth()); if( lastpos < mysize.GetWidth() ) { EditSizes.back().SetWidth( lastbox.GetWidth() + (mysize.GetWidth() - lastpos) ); } } // update editbox coords for( dword i=0; i<EditBoxes.size(); ++i ) { //wxLogMessage("%d %d",itempos.x,ColumnX[i]); EditBoxes[i]->SetSize(EditSizes[i].GetSize()); EditBoxes[i]->Move(EditSizes[i].GetPosition()); } // set list size wxRect listsize( mysize ); wxRect panelsize( mysize ); if( !EditBoxes.empty() ) { wxRect boxsize( EditBoxes[0]->GetBestSize() ); panelsize.SetHeight( boxsize.GetHeight() ); listsize.SetY( panelsize.GetHeight() ); listsize.SetHeight( mysize.GetHeight()-panelsize.GetHeight() ); } List->SetSize(listsize.GetSize()); List->Move(listsize.GetPosition()); EditPanel->SetSize(panelsize.GetSize()); EditPanel->Move(panelsize.GetPosition()); // fix editbox flicker for( dword i=0; i<EditBoxes.size(); ++i ) { EditBoxes[i]->ClearBackground(); EditBoxes[i]->Refresh(); } }
OutOfWorldRaycastDemo::OutOfWorldRaycastDemo(hkDemoEnvironment* env) : hkDefaultPhysicsDemo(env), m_rand(747) { // // Setup the camera. // { hkVector4 from(30.0f, 8.0f, 25.0f); hkVector4 to ( 4.0f, 0.0f, -3.0f); hkVector4 up ( 0.0f, 1.0f, 0.0f); setupDefaultCameras(env, from, to, up); } hkError::getInstance().setEnabled(0xad367291, false); // Warning for linear cast going outside the broadphase. // // Create the world. // { hkpWorldCinfo info; info.setupSolverInfo(hkpWorldCinfo::SOLVER_TYPE_4ITERS_MEDIUM); // Set gravity to zero so body floats. info.m_gravity.set(0.0f, 0.0f, 0.0f); info.setBroadPhaseWorldSize( 10.0f ); info.m_broadPhaseBorderBehaviour = hkpWorldCinfo::BROADPHASE_BORDER_DO_NOTHING; m_world = new hkpWorld(info); m_world->lock(); // for drawing purposes hkpBroadPhaseBorder* border = new hkpBroadPhaseBorder( m_world, hkpWorldCinfo::BROADPHASE_BORDER_DO_NOTHING ); m_world->setBroadPhaseBorder(border); border->removeReference(); setupGraphics(); } // register all agents(however, we put all objects into the some group, // so no collision will be detected hkpAgentRegisterUtil::registerAllAgents( m_world->getCollisionDispatcher() ); // // Create some bodies // hkVector4 boxsize(.5f, .5f, .5f); hkpBoxShape* boxshape = new hkpBoxShape(boxsize); hkpRigidBodyCinfo info; info.m_shape = boxshape; info.m_mass = 1.0f; info.m_linearDamping = 5.0f; info.m_motionType = hkpMotion::MOTION_BOX_INERTIA; // These values will crash in linear casting if HVK-3495 isn't fixed hkVector4 startPos[2]; startPos[0].set(-6.4253216f, -5.0469332f,-3.4372473f); startPos[1].set(-3.8643494f, -8.8486900f, 0.48582274f); for (int i=0; i<2; i++) { info.m_position = startPos[i]; m_boxes[i] = new hkpRigidBody(info); m_world->addEntity(m_boxes[i]); } boxshape->removeReference(); m_world->unlock(); }