text
stringlengths 0
2.2M
|
---|
if(bUpdateWidth){
|
child->setShapeNoNotification(x, y, width, child->getHeight());
|
}else{
|
child->setPosition(x, y);
|
}
|
auto c = dynamic_cast<ofxGuiGroup*>(child);
|
if(c){
|
c->updateChildrenPositions(bUpdateWidth);
|
}
|
}
|
}
|
void ofxGuiGroup::updateChildrenPositions(bool bUpdateWidth){
|
if(!bHeaderEnabled && minimized){
|
b.height = 0;
|
return;
|
}
|
b.height = (bHeaderEnabled?(defaultHeight):0) ;
|
headerRect.set(b.x, b.y , b.width, defaultHeight);
|
if(parent){
|
headerRect.y += elementSpacing;
|
b.height += elementSpacing;
|
}
|
if(parent){
|
headerRect.y += groupSpacing;
|
b.height += groupSpacing;
|
}
|
if(!minimized){
|
float y = b.getMaxY();
|
float x = b.x;
|
float w = b.width;
|
if(parent){//if the group has no parent dont indent the children. it just looks better
|
x += childrenLeftIndent;
|
w -= childrenLeftIndent + childrenRightIndent;
|
}
|
for(auto c: collection){
|
updateChild(c, x, y, w, bUpdateWidth);
|
y += c->getHeight() + elementSpacing;
|
}
|
// if(parent)y -= elementSpacing;
|
b.height = y - b.y;
|
}
|
}
|
void ofxGuiGroup::sizeChangedCB(){
|
updateChildrenPositions(true);
|
if(parent){
|
parent->sizeChangedCB();
|
}
|
setNeedsRedraw();
|
}
|
std::size_t ofxGuiGroup::getNumControls() const {
|
return collection.size();
|
}
|
ofxBaseGui * ofxGuiGroup::getControl(std::size_t num){
|
if(num < collection.size()){
|
return collection[num];
|
}else{
|
return nullptr;
|
}
|
}
|
ofAbstractParameter & ofxGuiGroup::getParameter(){
|
return parameters;
|
}
|
void ofxGuiGroup::setPosition(const glm::vec3& p){
|
b.setPosition(p);
|
updateChildrenPositions(false);
|
setNeedsRedraw();
|
}
|
void ofxGuiGroup::setPosition(float x, float y){
|
setPosition({x, y, 0});
|
}
|
void ofxGuiGroup::enableHeader(){
|
bHeaderEnabled = true;
|
sizeChangedCB();
|
}
|
void ofxGuiGroup::disableHeader(){
|
bHeaderEnabled = false;
|
sizeChangedCB();
|
}
|
bool ofxGuiGroup::isHeaderEnabled(){
|
return bHeaderEnabled;
|
}
|
/*
|
raii: A minimal library for generic RAII implementation
|
This file is part of the MiLi Minimalistic Library.
|
Copyright (C) Lucas Besso & Raul Striglio, FuDePAN 2011
|
Distributed under the Boost Software License, Version 1.0.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.