//-------------------------------------------------------------- void ofxMuiWindow::init() { setObjectType("WINDOW"); isMinimized = false; _isDragMoveable = true; // setTooltip(""); setBoxProperties(defaults->windowBoxProperties); // draw the min max/ active inactive buttons enableDisableButton = new ofxMuiButton(); enableDisableButton->setButtonIcon(defaults->windowBoxEnableDisableIcon); enableDisableButton->keyBind_toggleValue(defaults->keyboardEnableDisable); // enableDisableButton->setTooltip("Enable/Disable (" + ofToString(defaults->keyboardEnableDisable) + ")"); // enableDisableButton->setTooltipEnabled(true); addChild(enableDisableButton); minMaxButton = new ofxMuiButton(); minMaxButton->setButtonIcon(defaults->windowBoxMinMaxIcon); minMaxButton->keyBind_toggleValue(defaults->keyboardMinMax); // minMaxButton->setTooltip("Minimize/Maximize (" + ofToString(defaults->keyboardMinMax) + ")"); // minMaxButton->setTooltipEnabled(true); addChild(minMaxButton); requestBoxLayout(); }
void ofxMuiWindow::maximize() { if(!isMinimized) return; isMinimized = false; for(int i = 0; i < childObjects.size(); i++) { if(childObjects[i] != enableDisableButton && childObjects[i] != minMaxButton /*&& childObjects[i] != label && childObjects[i] != valueLabel*/) { childObjects[i]->show(); } } requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiWindow::minimize() { if(isMinimized) return; isMinimized = true; // disallow mouse / keyboard input when hidden for(int i = 0; i < childObjects.size(); i++) { if(childObjects[i] != enableDisableButton && childObjects[i] != minMaxButton/*&& childObjects[i] != label && childObjects[i] != valueLabel*/) { childObjects[i]->hide(); } } requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiButton::setButtonIcon(const ofxMuiIconName& _buttonIcon) { buttonIconName = _buttonIcon; if(buttonIconName == ICON_NONE) { icon = NULL; useIcon = false; // assume that it has or will be set //hitBox.width = defaults->buttonWidth; //hitBox.height = icon->getHeight(); } else { icon = defaults->getIcon(buttonIconName); setHitBoxWidth(icon->getWidth()); setHitBoxHeight(icon->getHeight()); useIcon = true; } requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiButton::setRoundFrame(bool _roundFrame) { roundFrame = _roundFrame; requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiButton::setButtonType(const ofxMuiButtonType& _buttonType) { buttonType = _buttonType; requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiButton::setButtonWidth(int _width) { setHitBoxWidth(_width); requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiButton::setButtonHeight(int _height) { setHitBoxHeight(_height); requestBoxLayout(); }
// content alignment for fixt box situations //-------------------------------------------------------------- void ofxMuiBox::setContentAlignHorz(const ofAlignHorz& _hAlign) { hContentAlign = _hAlign; requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiBox::setContentAlignVert(const ofAlignVert& _vAlign) { vContentAlign = _vAlign; requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiBox::setFixedHeight(bool _fixedHeight) { if(_fixedHeight == fixedHeight) return; fixedHeight = _fixedHeight; requestBoxLayout(); //if(!fixedHeight) setParentNeedsLayoutUpdate(true); }
//-------------------------------------------------------------- void ofxMuiBox::setFixedWidth(bool _fixedWidth) { if(_fixedWidth == fixedWidth) return; fixedWidth = _fixedWidth; requestBoxLayout(); //if(!fixedWidth) setParentNeedsLayoutUpdate(true); }
//-------------------------------------------------------------- void ofxMuiBox::setHeight(float _height) { box.setHeight(_height); box.standardize(); fixedHeight = (box.height > 0); requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiBox::setWidth(float _width) { box.setWidth(_width); box.standardize(); fixedWidth = (box.width > 0); requestBoxLayout(); }
//-------------------------------------------------------------- void ofxMuiKnob::init() { setObjectType("KNOB"); setHitBoxWidth(defaults->knobWidth); setHitBoxHeight(defaults->knobHeight); // set default key binding keyBind_increaseValue('='); keyBind_decreaseValue('-'); setBoxProperties(defaults->knobBoxProperties); // set values setValue(0); //setBoundsMin(0.0f); //setBoundsMax(1.0f); //valueLabel->d(); label->enable(); lastKnobAngle = 0.0f; knobAngle = 0.0f; dKnobAngle = 0.0f; zeroAngle = HALF_PI; // up boundaryWedgeAngle = PI/4.0f; innerRadiusPct = 0.60f; outerRadiusPct = 1.00f; innerRadiusW = getHitBoxHalfWidth() * innerRadiusPct; outerRadiusW = getHitBoxHalfWidth() * outerRadiusPct; innerRadiusH = getHitBoxHalfHeight() * innerRadiusPct; outerRadiusH = getHitBoxHalfHeight() * outerRadiusPct; float b = innerRadiusW; float v = b / 6.0f; dialArrow.moveTo(0,-v); dialArrow.lineTo(b,0); dialArrow.lineTo(0,+v); dialArrow.close(); dialArrow.setFilled(false); dialShape.setArcResolution(360); dialRangeShape.setArcResolution(360); dialValueShape.setArcResolution(360); needsRedraw = true; normCtrlDragStartMin = 0.0f; normCtrlDragStartMax = 0.0f; totalDragDelta = ofPoint(0.0f,0.0f); dKnobScaler = 0.01f; smartRotate = false; smoothedCenter = getHitBoxCenter(); smoothedCenterAlpha = 0.95; requestBoxLayout(); }