예제 #1
0
//--------------------------------------------------------------
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();

}
예제 #2
0
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();
}
예제 #3
0
//--------------------------------------------------------------
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();
}
예제 #4
0
//--------------------------------------------------------------
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();
}
예제 #5
0
//--------------------------------------------------------------
void ofxMuiButton::setRoundFrame(bool _roundFrame) {
    roundFrame = _roundFrame;
    requestBoxLayout();
}
예제 #6
0
//--------------------------------------------------------------
void ofxMuiButton::setButtonType(const ofxMuiButtonType& _buttonType) {
    buttonType = _buttonType;
    requestBoxLayout();
}
예제 #7
0
//--------------------------------------------------------------
void ofxMuiButton::setButtonWidth(int _width) {
    setHitBoxWidth(_width);
    requestBoxLayout();
}
예제 #8
0
//--------------------------------------------------------------
void ofxMuiButton::setButtonHeight(int _height) {
    setHitBoxHeight(_height);
    requestBoxLayout();
}
예제 #9
0
// content alignment for fixt box situations
//--------------------------------------------------------------
void ofxMuiBox::setContentAlignHorz(const ofAlignHorz& _hAlign) {
    hContentAlign = _hAlign;
    requestBoxLayout();
}
예제 #10
0
//--------------------------------------------------------------
void ofxMuiBox::setContentAlignVert(const ofAlignVert& _vAlign) {
    vContentAlign = _vAlign;
    requestBoxLayout();
}
예제 #11
0
//--------------------------------------------------------------
void ofxMuiBox::setFixedHeight(bool _fixedHeight) {
    if(_fixedHeight == fixedHeight) return;
    fixedHeight = _fixedHeight;
    requestBoxLayout();
    //if(!fixedHeight) setParentNeedsLayoutUpdate(true);
}
예제 #12
0
//--------------------------------------------------------------
void ofxMuiBox::setFixedWidth(bool _fixedWidth) {
    if(_fixedWidth == fixedWidth) return;
    fixedWidth = _fixedWidth;
    requestBoxLayout();
    //if(!fixedWidth) setParentNeedsLayoutUpdate(true);
}
예제 #13
0
//--------------------------------------------------------------
void ofxMuiBox::setHeight(float _height) {
    box.setHeight(_height);
    box.standardize();
    fixedHeight = (box.height > 0);
    requestBoxLayout();
}
예제 #14
0
//--------------------------------------------------------------
void ofxMuiBox::setWidth(float _width) {
    box.setWidth(_width);
    box.standardize();
    fixedWidth = (box.width > 0);
    requestBoxLayout();
}
예제 #15
0
//--------------------------------------------------------------
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();
}