Exemplo n.º 1
0
void ReportWindow::SetButton(int i, const char *label, int id)
{
	LogPos p = cancel.GetPos();
	Button& b = button.At(i);
	b.SetLabel(label);
	b.RightPos(p.x.GetA(), p.x.GetB()).BottomPos(p.y.GetA() + (p.y.GetB() + 6) * (i + 1), p.y.GetB());
	b <<= Breaker(id);
	for(int i = 0; i < button.GetCount(); i++)
		button[i].Remove();
	for(int i = 0; i < button.GetCount(); i++)
		AddChildBefore(&button[i], &cancel);
}
Exemplo n.º 2
0
std::shared_ptr<IBaseExprModel> CSystemControlModel::TryRemoveChild(int line)
{
  if (CanRemoveChild(line)) {
    children.erase(children.begin() + line);
    if (children.size() == 1) { // остался последний контрол -- убиваем систему, оставляем пустой контрол
      // перевешиваем ребенка
      auto exprParent = std::shared_ptr<CExprControlModel>(std::dynamic_pointer_cast<CExprControlModel>(GetParent().lock()));
      children[0]->SetParent(exprParent); 
      children[0]->UpdateDepth();
      exprParent->AddChildBefore(children[0], shared_from_this());
      
      // удаляем систему из детей своего родителя
      exprParent->RemoveChild(shared_from_this());
      return children[0];
    }
    return children[MAX(0, line - 1)];
  }

  return nullptr;
}