Merge pull request #812 from redtide/gui-components-update
UI: components update
This commit is contained in:
commit
6bddda53f6
3 changed files with 30 additions and 9 deletions
|
|
@ -249,18 +249,18 @@ public:
|
|||
void setHue(float hue);
|
||||
SStyledKnob* getControl() const { return knob_; }
|
||||
|
||||
void setNameLabelText(const UTF8String& name) { label_->setText(name); }
|
||||
void setNameLabelText(const UTF8String& name) { label_->setText(name); label_->invalid(); }
|
||||
void setNameLabelFont(CFontRef font);
|
||||
void setNameLabelFontColor(CColor color) { label_->setFontColor(color); }
|
||||
void setCCLabelText(const UTF8String& name) { ccLabel_->setText(name); }
|
||||
void setNameLabelFontColor(CColor color) { label_->setFontColor(color); label_->invalid(); }
|
||||
void setCCLabelText(const UTF8String& name) { ccLabel_->setText(name); ccLabel_->invalid(); }
|
||||
void setCCLabelFont(CFontRef font);
|
||||
void setCCLabelFontColor(CColor color) { ccLabel_->setFontColor(color); }
|
||||
void setKnobLineIndicatorColor(CColor color) { knob_->setLineIndicatorColor(color); }
|
||||
void setKnobFont(CFontRef font) { knob_->setFont(font); }
|
||||
void setKnobFontColor(CColor color) { knob_->setFontColor(color); }
|
||||
void setCCLabelFontColor(CColor color) { ccLabel_->setFontColor(color); ccLabel_->invalid(); }
|
||||
void setKnobLineIndicatorColor(CColor color) { knob_->setLineIndicatorColor(color); knob_->invalid(); }
|
||||
void setKnobFont(CFontRef font) { knob_->setFont(font); knob_->invalid(); }
|
||||
void setKnobFontColor(CColor color) { knob_->setFontColor(color); knob_->invalid(); }
|
||||
|
||||
using ValueToStringFunction = SStyledKnob::ValueToStringFunction;
|
||||
void setValueToStringFunction(ValueToStringFunction f) { knob_->setValueToStringFunction(std::move(f)); }
|
||||
void setValueToStringFunction(ValueToStringFunction f) { knob_->setValueToStringFunction(std::move(f)); knob_->invalid(); }
|
||||
|
||||
private:
|
||||
void updateViewSizes();
|
||||
|
|
|
|||
|
|
@ -141,6 +141,24 @@ int SPiano::getKeyRole(unsigned key)
|
|||
return role;
|
||||
}
|
||||
|
||||
void SPiano::setBackColor(const CColor &color)
|
||||
{
|
||||
Impl& impl = *impl_;
|
||||
if (impl.backgroundFill_ != color) {
|
||||
impl.backgroundFill_ = color;
|
||||
invalid();
|
||||
}
|
||||
}
|
||||
|
||||
void SPiano::setFontColor(const CColor &color)
|
||||
{
|
||||
Impl& impl = *impl_;
|
||||
if (impl.labelStroke_ != color) {
|
||||
impl.labelStroke_ = color;
|
||||
invalid();
|
||||
}
|
||||
}
|
||||
|
||||
void SPiano::draw(CDrawContext* dc)
|
||||
{
|
||||
Impl& impl = *impl_;
|
||||
|
|
@ -155,7 +173,7 @@ void SPiano::draw(CDrawContext* dc)
|
|||
SharedPointer<CGraphicsPath> path;
|
||||
path = owned(dc->createGraphicsPath());
|
||||
path->addRoundRect(dim.bounds, impl.backgroundRadius_);
|
||||
dc->setFillColor(CColor(0xca, 0xca, 0xca));
|
||||
dc->setFillColor(impl.backgroundFill_);
|
||||
dc->drawGraphicsPath(path, CDrawContext::kPathFilled);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ public:
|
|||
std::function<void(unsigned, float)> onKeyPressed;
|
||||
std::function<void(unsigned, float)> onKeyReleased;
|
||||
|
||||
void setBackColor(const CColor&);
|
||||
void setFontColor(const CColor&);
|
||||
|
||||
protected:
|
||||
void draw(CDrawContext* dc) override;
|
||||
CMouseEventResult onMouseDown(CPoint& where, const CButtonState& buttons) override;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue