ElementLabel::ElementLabel (int element, Plasma::Applet *applet, QGraphicsWidget * parent) : Plasma::IconWidget (parent) { setContentsMargins (0,0,0,0); setMinimumSize(0,0); Plasma::DataEngine::Data thisElement = applet->dataEngine ("kalzium")->query (QString ("BlueObelisk:Element:") + QString::number (element)); setText (thisElement["symbol"].toString()); drawToolTip (thisElement); connect(this, SIGNAL(clicked()), this, SLOT(ElementPressed())); }
//-------------------------------------------------------------- void Renderer::draw() { // TODO: fix sorting, if z-order is same, undefined behaviour sort(controls.begin(), controls.end(), PointerCompare()); ofPushStyle(); // ofLogNotice() << "Renderer::draw :" << controls.size(); for(int i=0; i<controls.size(); i++) { Control& control = *controls[i]; if(control.intersects(ofGetWindowRect())) control._draw(); // ofLogNotice() << " " << control.getParameter().getPath() << " " << control.getParameter().getTypeName(); } // ofLogNotice() << "/Renderer::draw \n"; drawToolTip(); ofPopStyle(); }
void draw() { if (currentLocale_ && lines_.size() > 0) { float alpha(0.f); float time(timer::realFrameTime()*1.3f); switch (state_) { case WAITING: timer_ += time; if (timer_ > 1.f) { timer_ = 0.f; state_ = FADE_IN; } break; case FADE_IN: timer_ += time*5.f; alpha = timer_; if (timer_ > 1.f) { state_ = VISIBLE; } break; case VISIBLE: alpha = 1.f; break; case FADE_OUT: timer_ -= time*5; alpha = timer_; if (timer_ < 0.f) { state_ = INVISIBLE; } break; default:; } if (settings::C_showToolTips && alpha > 0) drawToolTip(alpha); } }