Esempio n. 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();

}
Esempio n. 2
0
//--------------------------------------------------------------
void ofxMuiColorPicker::init() {
    // super class init should have already been called in the constructor def list
    
    setObjectType("COLOR_PICKER");

    // override the superclass
    setBoxProperties(defaults->colorPickerBoxProperties);    
	
    setValue(1,0); // r
    setValue(1,1); // g
    setValue(1,2); // b
    setValue(1,3); // a

	// set default key binding
    //keyBind_toggleValue(' ');
    
	// custom, just for the button itself (i.e. no clicking on the label)
	setHitBox(0, 0, defaults->colorPickerWidth, defaults->colorPickerHeight);
    
    colorPickerPreview.height = defaults->colorPickerPreviewHeight;

    // get the little preview-r
    
    eyeDropperPreviewPixelWidth = defaults->colorPickerEyeDropperWidth / defaults->colorPickerEyeDropperZoom;
    eyeDropperPreviewPixelHeight = defaults->colorPickerEyeDropperWidth / defaults->colorPickerEyeDropperZoom;
    eyeDropperPreview.allocate(eyeDropperPreviewPixelWidth,eyeDropperPreviewPixelHeight,GL_RGB);
    
    showEyeDroperPreview = false;
    
    setNeedsLayoutUpdate(true);

}
Esempio n. 3
0
//--------------------------------------------------------------
void ofxMuiButton::init() {
    // super class init should have already been called in the constructor def list
    setObjectType("BUTTON");
    roundFrame = defaults->buttonRoundFrame;
    
    // override the superclass
    setBoxProperties(defaults->buttonBoxProperties);    
    buttonType = BUTTON_TYPE_TOGGLE;
    
    setButtonIcon(ICON_DEFAULT);
    
    setValue(false);

    // set default key binding
    keyBind_toggleValue(defaults->keyboardToggle);

    // custom, just for the button itself (i.e. no clicking on the label)
	setHitBox(0, 0, defaults->buttonWidth, defaults->buttonHeight);

//    label->setText(name);
//    label->enable();
    
  //  requestBoxLayout();
    
}
Esempio n. 4
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();
}