//-------------------------------
guiTypeButtonSlider * ofxControlPanel::addButtonSlider(string sliderName, string xmlName, float value , float min, float max, bool isInt )
{
    if( currentPanel < 0 || currentPanel >= (int) panels.size() )return NULL;

    //add a new slider to our list
    guiTypeButtonSlider * tmp = new guiTypeButtonSlider();

	setLayoutFlag(tmp);

    //setup and dimensions
    tmp->setup(sliderName, 210, 15, value, min, max, false);
    tmp->xmlName = xmlName;

    //we can say we want to an int or a float!
    if(isInt){
        tmp->setTypeInt();
    }else{
        tmp->setTypeFloat();
    }

    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 1) );
    guiObjects.push_back(tmp);

	if( bUseTTFFont ) {
        tmp->setFont(&guiTTFFont);
    }

    panels[currentPanel]->addElement( tmp );

    return tmp;
}
//---------------------------------------------
guiTypeTextDropDown * ofxControlPanel::addTextDropDown(string name, string xmlName, int defaultBox, vector <string> boxNames){
    if( currentPanel < 0 || currentPanel >= (int) panels.size() )return NULL;

    //add a new multi toggle to our list
    guiTypeTextDropDown * tmp = new guiTypeTextDropDown();

	setLayoutFlag(tmp);

    //setup and dimensions
    tmp->setDimensions(180, 60);
    tmp->setup(name, defaultBox, boxNames);
    tmp->xmlName = xmlName;

    //we can say we want to an int or a float!
    tmp->setTypeInt();

    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 1) );
    guiObjects.push_back(tmp);

    if( bUseTTFFont ){
        tmp->setFont(&guiTTFFont);
    }

    panels[currentPanel]->addElement( tmp );

    return tmp;
}
//-------------------------------
guiType2DSlider * ofxControlPanel::addSlider2D(string sliderName, string xmlName, float valueX, float valueY, float minX, float maxX, float minY, float maxY, bool isInt,BaseCallback* pCallback, int _callback_id )
{
    if( currentPanel < 0 || currentPanel >= (int) panels.size() )return NULL;

    //add a new slider to our list
    guiType2DSlider * tmp = new guiType2DSlider();

    //setup and dimensions
    tmp->setup(sliderName, valueX, minX, maxX, valueY, minY, maxY);
    tmp->setDimensions(200, 200);
    tmp->xmlName = xmlName;
    tmp->parameterCallback = pCallback;
    tmp->callback_id = _callback_id;

    //we can say we want to an int or a float!
    if(isInt) {
        tmp->setTypeInt();
    } else {
        tmp->setTypeFloat();
    }

    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 2) );
    guiObjects.push_back(tmp);

    if( bUseTTFFont ) {
        tmp->setFont(&guiTTFFont);
    }

    panels[currentPanel]->addElement( tmp );

    return tmp;
}
//---------------------------------------------
guiTypeToggle * ofxControlPanel::addToggle(string name, string xmlName, bool defaultValue)
{
    if( currentPanel < 0 || currentPanel >= (int) panels.size() )return NULL;

    //add a new toggle to our list
    guiTypeToggle * tmp = new guiTypeToggle();

	setLayoutFlag(tmp);

    //setup and dimensions
    tmp->setup(name, (bool)defaultValue);
    tmp->setDimensions(14, 14);
    tmp->setTypeBool();
	tmp->xmlName = xmlName;

    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 1) );
    guiObjects.push_back(tmp);

    if( bUseTTFFont ){
        tmp->setFont(&guiTTFFont);
    }

    panels[currentPanel]->addElement( tmp );

    return tmp;
}
示例#5
0
//---------------------------------------------
guiTypeText * ofxLabGui::addTextField(string name, string xmlName, string defaultValue, int drawW, int drawH){
	if( currentPanel < 0 || currentPanel >= panels.size() )return NULL;
    guiTypeText * guiTextField = new guiTypeText();

    guiTextField->setup(name, defaultValue);
    guiTextField->xmlName = xmlName;
    guiTextField->setDimensions(drawW, drawH);
    guiTextField->setTypeString();

	if (panels[currentPanel]->groups.size() > 0){
		guiTypeGroup * group = panels[currentPanel]->groups[currentGroup];
		guiTextField->fgColor = group->fgColor;
		guiTextField->bgColor = group->bgColor;
		group->addElement( guiTextField );
	} else {
		panels[currentPanel]->addElement( guiTextField );
	}

    guiObjects.push_back(guiTextField);
    xmlObjects.push_back( xmlAssociation(guiTextField, xmlName, 1) );

    if( bUseTTFFont ){
        guiTextField->setFont(&guiTTFFont);
    }

    return guiTextField;
};
//---------------------------------------------
guiTypeMultiToggle * ofxControlPanel::addMultiToggle(string name, string xmlName, int defaultBox, vector <string> boxNames, BaseCallback* pCallback, int _callback_id)
{
    if( currentPanel < 0 || currentPanel >= (int) panels.size() )return NULL;

    //add a new multi toggle to our list
    guiTypeMultiToggle * tmp = new guiTypeMultiToggle();

    //setup and dimensions
    tmp->setup(name, defaultBox, boxNames);
    tmp->setDimensions(180, boxNames.size()*(guiTypeMultiToggle::boxSize + guiTypeMultiToggle::boxSpacing) + 2);
    tmp->xmlName = xmlName;
    tmp->parameterCallback = pCallback;
    tmp->callback_id = _callback_id;

    //we can say we want to an int or a float!
    tmp->setTypeInt();

    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 1) );
    guiObjects.push_back(tmp);

    if( bUseTTFFont ) {
        tmp->setFont(&guiTTFFont);
    }

    panels[currentPanel]->addElement( tmp );

    return tmp;
}
示例#7
0
//---------------------------------------------
guiTypeMultiToggle * ofxLabGui::addMultiToggle(string name, string xmlName, int defaultBox, vector <string> boxNames){
    if( currentPanel < 0 || currentPanel >= panels.size() )return NULL;

    //add a new multi toggle to our list
    guiTypeMultiToggle * tmp = new guiTypeMultiToggle();

    //setup and dimensions
    tmp->setup(name, defaultBox, boxNames);
    tmp->setDimensions(180, 60);
    tmp->xmlName = xmlName;

    //we can say we want to an int or a float!
    tmp->setTypeInt();

    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 1) );
    guiObjects.push_back(tmp);

    if( bUseTTFFont ){
        tmp->setFont(&guiTTFFont);
    }

	//either add to panel or group (if there are groups)
	if (panels[currentPanel]->groups.size() > 0){
		guiTypeGroup * group = panels[currentPanel]->groups[currentGroup];
		tmp->fgColor = group->fgColor;
		tmp->bgColor = group->bgColor;
		group->addElement( tmp );
	} else {
		panels[currentPanel]->addElement( tmp );
	}

    return tmp;
}
示例#8
0
//---------------------------------------------
guiTypeToggle * ofxLabGui::addToggle(string name, string xmlName, bool defaultValue){
    if( currentPanel < 0 || currentPanel >= panels.size() )return NULL;

    //add a new slider to our list
    guiTypeToggle * tmp = new guiTypeToggle();

    //setup and dimensions
    tmp->setup(name, (bool)defaultValue);
    tmp->setDimensions(14, 14);
    tmp->setPosition(0,0);
    tmp->setTypeBool();
    tmp->xmlName = xmlName;

    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 1) );

	//either add to panel or group (if there are groups)
	if (panels[currentPanel]->groups.size() > 0){
		guiTypeGroup * group = panels[currentPanel]->groups[currentGroup];
		tmp->fgColor = group->fgColor;
		tmp->bgColor = group->bgColor;
		group->addElement( tmp );
	} else {
		panels[currentPanel]->addElement( tmp );
	}
    guiObjects.push_back(tmp);
    if( bUseTTFFont ){
        tmp->setFont(&guiTTFFont);
    }

    return tmp;
}
//---------------------------------------------
guiTypeText * ofxControlPanel::addText(string name, string xmlName)
{
	if( currentPanel < 0 || currentPanel >= panels.size() )return NULL;
	
    //add a new slider to our list
    guiTypeText * tmp = new guiTypeText();
	
    //setup and dimensions
    tmp->setup(name);
    
	//tmp->setDimensions(maxX, maxY);
    tmp->xmlName = xmlName;
    tmp->setTypeString();
	
	//if( bUseTTFFont ){
    //    tmp->setInputFont(&guiTTFFont);
    //}
	
    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 2) );
    guiObjects.push_back(tmp);
	
    if( bUseTTFFont ){
        tmp->setFont(&guiTTFFont);
    }
	
    panels[currentPanel]->addElement( tmp );
	
    return tmp;
}
	//-------------------------------
guiType2DSliderPixelChooser * ofxControlPanel::addSlider2DPixelChooser(string sliderName, string xmlName, float valueX, float valueY, float minX, float maxX, float minY, float maxY, bool isInt)
{
    if( currentPanel < 0 || currentPanel >= (int) panels.size() )return NULL;
	
		//add a new slider to our list
    guiType2DSliderPixelChooser * tmp = new guiType2DSliderPixelChooser();
	
	setLayoutFlag(tmp);
	
		//setup and dimensions
    tmp->setup(sliderName, valueX, minX, maxX, valueY, minY, maxY);
    tmp->setDimensions(180, 80);
    tmp->xmlName = xmlName;
	
		//we can say we want to an int or a float!
    if(isInt){
        tmp->setTypeInt();
    }else{
        tmp->setTypeFloat();
    }
	
    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 5) );
    guiObjects.push_back(tmp);
	
    if( bUseTTFFont ){
        tmp->setFont(&guiTTFFont);
    }
	
    panels[currentPanel]->addElement( tmp );
	
    return tmp;
}
示例#11
0
//---------------------------------------------
void ofxControlPanel::addXmlAssociation( guiBaseObject* object, string xmlName, int paramCount ){
	// check for already-existing xml name
	for( int i=0; i<xmlObjects.size(); i++ ){
		if( xmlObjects[i].xmlName == xmlName ){
			ofLog(OF_LOG_ERROR, "ofxControlPanel::add*: duplicate xmlName '%s', not adding\n", xmlName.c_str() );
			return;
		}
	}
	xmlObjects.push_back( xmlAssociation(object, xmlName, paramCount ) );
}
//---------------------------------------------
guiTypeSpace* ofxControlPanel::addSpace(string name, string xmlName, int defaultValue){
    if( currentPanel < 0 || currentPanel >= panels.size() )return NULL;
	
    //add a new slider to our list
    guiTypeSpace * tmp = new guiTypeSpace();
	
    //setup and dimensions
    tmp->setup(name);
    tmp->setDimensions(panels[currentPanel]->getWidth()-40,10);
   // tmp->setTypeBool();
    tmp->xmlName = xmlName;
	//tmp->boundingBox.height = 0;
	
    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 1) );
    panels[currentPanel]->addElement( tmp, 0 );
	
    guiObjects.push_back(tmp);
	
    return tmp;
}
示例#13
0
//-------------------------------
guiType2DSlider * ofxLabGui::addSlider2D(string sliderName, string xmlName, float valueX, float valueY, float minX, float maxX, float minY, float maxY, bool isInt){
    if( currentPanel < 0 || currentPanel >= panels.size() )return NULL;

    //add a new slider to our list
    guiType2DSlider * tmp = new guiType2DSlider();

    //setup and dimensions
    tmp->setup(sliderName, valueX, minX, maxX, valueY, minY, maxY);
    tmp->setDimensions(180, 80);
    tmp->xmlName = xmlName;

    //we can say we want to an int or a float!
    if(isInt){
        tmp->setTypeInt();
    }else{
        tmp->setTypeFloat();
    }

    xmlObjects.push_back( xmlAssociation(tmp, xmlName, 2) );
    guiObjects.push_back(tmp);

    if( bUseTTFFont ){
        tmp->setFont(&guiTTFFont);
    }

	//either add to panel or group (if there are groups)
	if (panels[currentPanel]->groups.size() > 0){
		guiTypeGroup * group = panels[currentPanel]->groups[currentGroup];
		tmp->fgColor = group->fgColor;
		tmp->bgColor = group->bgColor;
		group->addElement( tmp );
	} else {
		panels[currentPanel]->addElement( tmp );
	}

    return tmp;
}