//-------------------------------------------------------------- void ofxMuiButton::doContentBoxLayout() { //cout << "0: ofxMuiButton::doContentBoxLayout=>" << endl << boxToString() << endl; /* // TODO: handle the case where the label is EMPTY // vertical ofxMuiLabelCaps if(label->getHeight() > getHitBoxHeight()) { setContentBoxHeight(label->getHeight()); setHitBoxY((label->getHeight() - getHitBoxHeight()) / 2.0f); label->setY(0); } else { setContentBoxHeight(getHitBoxHeight()); label->setY((getHitBoxHeight() - label->getHeight()) / 2.0f); setHitBoxY(0); } // label to the right label->setX(getHitBoxWidth()); // label to the right */ // setHitBoxX(0); // TODO: this doesn't account for auto widths ... setContentBoxHeight(getHitBoxHeight()); setContentBoxWidth(getHitBoxWidth());// + label->getWidth()); //cout << "1: ofxMuiButton::doContentBoxLayout=>" << endl << boxToString() << endl; }
//-------------------------------------------------------------- void ofxMuiKnob::doContentBoxLayout() { // TODO: handle the case where the label is EMPTY // vertical ofxMuiLabelCaps if(label->getHeight() > getHitBoxHeight()) { setContentBoxHeight(label->getHeight()); setHitBoxY((label->getHeight() - getHitBoxHeight())/2.0); label->setY(0); } else { setContentBoxHeight(getHitBoxHeight()); label->setY((getHitBoxHeight() - label->getHeight())/2.0); setHitBoxY(0); } // label to the right label->setX(getHitBoxWidth()); // label to the right setHitBoxX(0); // value label placement valueLabel->setX(getHitBoxX()); valueLabel->setY(getHitBoxY() + (getHitBoxHeight() - valueLabel->getHeight())/2.0); // TODO: this doesn't account for auto widths ... setContentBoxWidth(getHitBoxWidth() + label->getWidth()); }
//-------------------------------------------------------------- void ofxMuiWindow::doContentBoxLayout() { cout << "doing content box layout " << endl; int currentX = 0; int currentY = 0; int maxX = 0; int maxY = 0; // position the minmax/enable/disable buttons enableDisableButton->setPosition(0,0); currentX+=enableDisableButton->getWidth(); minMaxButton->setPosition(currentX,0); currentX+=minMaxButton->getWidth(); // position the label // TODO: center this // int labelY = (minMaxButton->getY() + minMaxButton->getHeight()) / 2.0 -label->getHeight() / 2.0 ; // label->setPosition(currentX, labelY); // // // maxX = MAX(maxX, label->getPosition().x + label->getWidth()); // // currentY+=MAX(MAX(enableDisableButton->getHeight(), // minMaxButton->getHeight()), // label->getHeight()); // // // currentX = 0; minimizedRect.x = 0; minimizedRect.y = 0; minimizedRect.width = maxX; minimizedRect.height = currentY; if(isMinimized) { } else { for(int i = 0; i < childObjects.size(); i++) { if(childObjects[i] != enableDisableButton && childObjects[i] != minMaxButton/*&& childObjects[i] != label && childObjects[i] != valueLabel*/) { currentX = 0; childObjects[i]->setPosition(currentX,currentY); currentY += childObjects[i]->getHeight(); maxX = MAX(maxX,childObjects[i]->getWidth()); } } } setHitBox(0,0,maxX,currentY); setContentBoxWidth(getHitBoxWidth()); setContentBoxHeight(getHitBoxHeight()); }