Пример #1
0
void ofxUINumberDialer::update()
{
    if(useReference)
    {
        setTextString(numToString(abs(*value), precision, numOfPrecisionZones, '0'));
    }
}
Пример #2
0
void ofxUITextInput::setParent(ofxUIWidget *_parent)
{
    parent = _parent;
    if(rect->getHeight() == 0 || rect->getHeight() < label->getPaddingRect()->getHeight()+padding*2.0)
    {
        rect->setHeight(label->getPaddingRect()->getHeight()+padding*2.0);
    }
    label->setLabel(textstring);
    ofxUIRectangle *labelrect = label->getRect();
    float h = labelrect->getHeight();
    float ph = rect->getHeight();
    
    labelrect->setY(ph/2.0 - h/2.0);
    labelrect->setX(padding*2.0);
    defaultY = labelrect->getY(false)+labelrect->getHeight();
    defaultX = labelrect->getX(false);
    
    cursorWidth = label->getStringWidth(".");
    while(label->getStringWidth(textstring) > rect->getWidth()-padding*2.0)
    {
        string::iterator it;
        it=textstring.begin();
        textstring.erase (it);
    }
    
    defaultstring = textstring;
    displaystring = textstring;
    setTextString(textstring);
    calculatePaddingRect();
}
Пример #3
0
void ofxUINumberDialer::setValue(float _value)
{
    if(_value > max)
    {
        _value = max;             
    }
    else if(_value < min)
    {
        _value = min; 
    }            
    value = _value; 
    setTextString(ofToString(value, precision));         
}
Пример #4
0
void ofxUINumberDialer::setValue(float _value)
{
    if(_value > max)
    {
        _value = max;
    }
    else if(_value < min)
    {
        _value = min;
    }
    *value = _value;
    setTextString(numToString(abs(*value), precision, numOfPrecisionZones, '0'));
}
Пример #5
0
void ofxUINumberDialer::setParent(ofxUIWidget *_parent)
{
    parent = _parent; 
    rect->height = label->getPaddingRect()->height+padding*2.0; 
    rect->width = label->getPaddingRect()->width+padding*2.0; 
    ofxUIRectangle *labelrect = label->getRect(); 
    float h = labelrect->getHeight(); 
    float ph = rect->getHeight(); 	
    
    labelrect->y = ph/2.0 - h/2.0; 
    
    paddedRect->height = rect->height+padding*2.0; 
    paddedRect->width = rect->width+padding*2.0;         
    setTextString(ofToString(value, precision));                     
}	
Пример #6
0
TextAnnotation::TextAnnotation(Component *pParent)
  : ShapeAnnotation(pParent), mpComponent(pParent)
{
  // set the default values
  GraphicItem::setDefaults();
  FilledShape::setDefaults();
  ShapeAnnotation::setDefaults();
  // give a reasonable size to default component text
  mExtents.replace(0, QPointF(-50, -50));
  mExtents.replace(1, QPointF(50, 50));
  setTextString("%name");
  initUpdateTextString();
  setPos(mOrigin);
  setRotation(mRotation);
}
Пример #7
0
void ofxUINumberDialer::setParent(ofxUIWidget *_parent)
{
    parent = _parent;
    rect->height = label->getPaddingRect()->height+padding*2.0;
    rect->width = label->getPaddingRect()->width+padding*3.0;
    ofxUIRectangle *labelrect = label->getRect();
    labelrect->setX(padding*2.0);
    float h = labelrect->getHeight();
    float ph = rect->getHeight();
    
    labelrect->y = ph/2.0 - h/2.0;
    
    paddedRect->height = rect->height+padding*2.0;
    paddedRect->width = rect->width+padding*2.0;
    setTextString(numToString(abs(*value), precision, numOfPrecisionZones, '0'));
}
Пример #8
0
void ofxUINumberDialer::mouseDragged(int x, int y, int button) 
{
    if(hit)
    {            
        value += zoneMultiplier*(hitPoint.y-y); 
        if(value > max)
        {
            value = max;             
        }
        else if(value < min)
        {
            value = min; 
        }            
        hitPoint = ofPoint(x,y); 
        setTextString(ofToString(value, precision));     
        triggerEvent(this);             
        state = OFX_UI_STATE_DOWN;         
    }    
    else
    {
        state = OFX_UI_STATE_NORMAL;               
    }
    stateChange();     
}
Пример #9
0
void ofxUITextInput::loadState(ofxXmlSettings *XML)
{
    setTextString(XML->getValue("Value", getTextString(), 0));
    setInputTriggerType(OFX_UI_TEXTINPUT_ON_LOAD);
}
void CollectionTreeItem::setGenre(QString value)
{
    p->genre = value;
    setTextString(value);
    QTreeWidgetItem::setIcon(0, QIcon(style()->standardIcon(QStyle::SP_DirIcon).pixmap(12)));
}
void CollectionTreeItem::setYear(QString value)
{
    p->year = value;
    setTextString(value);
    QTreeWidgetItem::setIcon(0, QIcon(style()->standardIcon(QStyle::SP_FileIcon).pixmap(12)));
}
void CollectionTreeItem::setAlbum(QString value)
{
    p->album = value;
    setTextString(value);
    QTreeWidgetItem::setIcon(0, QIcon(style()->standardIcon(QStyle::SP_DriveCDIcon).pixmap(12)));
}
void CollectionTreeItem::setArtist(QString value)
{
    p->artist = value;
    setTextString(value);
    QTreeWidgetItem::setIcon(0, QIcon(style()->standardIcon(QStyle::SP_DirHomeIcon).pixmap(12)));
}
Пример #14
0
void ofxUINumberDialer::keyPressed(int key)
{
    if(state == OFX_UI_STATE_OVER)
    {
        switch (key)
        {
            case OF_KEY_RIGHT:
                *value += zoneMultiplier;
                if(*value > max)
                {
                    *value = max;
                }
                else if(*value < min)
                {
                    *value = min;
                }
                
                setTextString(numToString(abs(*value), precision, numOfPrecisionZones, '0'));
                triggerEvent(this);
                break;
                
            case OF_KEY_UP:
                *value += zoneMultiplier;
                if(*value > max)
                {
                    *value = max;
                }
                else if(*value < min)
                {
                    *value = min;
                }
                
                setTextString(numToString(abs(*value), precision, numOfPrecisionZones, '0'));
                triggerEvent(this);
                break;
                
            case OF_KEY_LEFT:
                *value -= zoneMultiplier;
                if(*value > max)
                {
                    *value = max;
                }
                else if(*value < min)
                {
                    *value = min;
                }
                
                setTextString(numToString(abs(*value), precision, numOfPrecisionZones, '0'));
                triggerEvent(this);
                break;
                
            case OF_KEY_DOWN:
                *value -= zoneMultiplier;
                if(*value > max)
                {
                    *value = max;
                }
                else if(*value < min)
                {
                    *value = min;
                }
                
                setTextString(numToString(abs(*value), precision, numOfPrecisionZones, '0'));
                triggerEvent(this);
                break;
                
            default:
                break;
        }
    }
}