Esempio n. 1
0
//Recursively Count the number of nodes in a tree
int BinaryTree::rSize(TreeNode*& that) {

	//Base Case
	if (that == NULL) return 0;

	//Alternative case
	return (rSize(that->left) + rSize(that->rght) + 1);
}
Esempio n. 2
0
rSize ruiAbsoluteLayout::Layout(rRect& rect){
	if (m_layoutItems.size() == 0) return rSize(0, 0);

	rPoint ptmin(INT32_MAX, INT32_MAX);
	rPoint ptmax(INT32_MIN, INT32_MIN);

	for (size_t i = 0; i < m_layoutItems.size(); i++){	
		ruiWidget* widget = m_layoutItems[i];
		int margins[4] = { 0, 0, 0, 0 };

		int top = 0;
		int left = 0;
		int bottom = 0;
		int right = 0;

		ruiStyle* properties = widget->ComputedStyle();

		bool hasTop = properties->GetInt("top", top);
		bool hasLeft = properties->GetInt("left", left);
		bool hasBottom = properties->GetInt("bottom", bottom);
		bool hasRight = properties->GetInt("right", right);

		rSize itemSize = widget->Size();
		
		rPoint position;

		if (hasTop)
			position.y = top;

		else if (hasBottom)
			position.y = rect.Bottom() - bottom - itemSize.y;
		else
			position.y = 0;
			

		if (hasLeft)
			position.x = left;
		else if (hasRight)
			position.x = rect.Right() - right - itemSize.x;
		else
			position.x = 0;
			
		widget->SetPosition(position);

		UpdatePoints(ptmin, ptmax, position);
		UpdatePoints(ptmin, ptmax, rPoint(position.x + itemSize.x, position.y + itemSize.y));
	}

	rPoint difference = ptmax - ptmin;
	return rSize(difference.x, difference.y);
}
void Mesh::AddDamageFX(const Vector & pnt, const Vector &norm,  const float damage, const GFXColor &col) {
  
  Vector loc(pnt+norm);
  /*if (!(norm.i||norm.j||norm.k)) */{
    loc = pnt;
    loc.Normalize();
    loc*=(1+rSize());
  }

  GFXColor tmp (col.r,col.g,col.b,col.a);
  float numsec = flickertime*(damage < mindamage)?mindamage:damage;;
  MeshFX newFX (numsec, (startpotency-endpotency)/(numsec*rSize()*rSize()) ,true,GFXColor(loc.i,loc.j,loc.k,1),tmp,GFXColor (0,0,0,1),tmp,GFXColor (1,0,startpotency/(rSize()*rSize())));
  if (LocalFX.size()>=MAXLOCALFX) {
    LocalFX[(rand()%(LocalFX.size()))].MergeLights (newFX);
  } else {
    LocalFX.push_back (newFX);
  }
}
Esempio n. 4
0
afx_msg LRESULT CInPlaceFrame::OnResizeChild(WPARAM wParam, LPARAM lParam)
{
	CRect rSize((LPRECT)lParam);
	CServerDoc *pDoc = (CServerDoc*)GetActiveDocument();

	// change our extents
	pDoc->m_sizeDoc.cx = MulDiv(pDoc->m_ZoomDenom.cx, rSize.Width(),
		pDoc->m_ZoomNum.cx);
	pDoc->m_sizeDoc.cy = MulDiv(pDoc->m_ZoomDenom.cy, rSize.Height(),
		pDoc->m_ZoomNum.cy);

	// Notify the container that we have changed
	pDoc->NotifyChanged();
	return COleIPFrameWnd::OnResizeChild(wParam,lParam);
}
void PropertySelectionTreeDialog::initDialog() {
    std::string title = std::string("Property Selection");
    setWindowTitle(tr(title.c_str()));
    QSize rSize(384,512);
    setFixedSize(rSize);
    QVBoxLayout* mainLayout = new QVBoxLayout(this);
    selectionTree_ = new PropertySelectionTreeWidget();
    mainLayout->addWidget(selectionTree_);
    QHBoxLayout* okayCancelButtonLayout = new QHBoxLayout;
    okayCancelButtonLayout->setAlignment(Qt::AlignRight);
    QDialogButtonBox* okayCancelbuttonBox_ = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
    connect(okayCancelbuttonBox_, SIGNAL(accepted()), this, SLOT(clickedOkayButton()));
    connect(okayCancelbuttonBox_, SIGNAL(rejected()), this, SLOT(clickedCancelButton()));
    okayCancelButtonLayout->addWidget(okayCancelbuttonBox_);
    mainLayout->addLayout(okayCancelButtonLayout);
}
Esempio n. 6
0
rSize ruiSlider::ComputeSize(){
	//temporary
	return rSize(130,35);
}
Esempio n. 7
0
//Count the number of nodes in a tree
int BinaryTree::size() { return rSize(root); }