MCPcopy Create free account
hub / github.com/christophhart/HISE / drawComboBox

Method drawComboBox

hi_scripting/scripting/api/ScriptingGraphics.cpp:4133–4168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4131}
4132
4133void ScriptingObjects::ScriptedLookAndFeel::Laf::drawComboBox(Graphics& g_, int width, int height, bool isButtonDown, int buttonX, int buttonY, int buttonW, int buttonH, ComboBox& cb)
4134{
4135 if (functionDefined("drawComboBox"))
4136 {
4137 auto obj = new DynamicObject();
4138 writeId(obj, &cb);
4139 obj->setProperty("area", ApiHelpers::getVarRectangle(cb.getLocalBounds().toFloat()));
4140
4141 auto text = cb.getText();
4142
4143 if (text.isEmpty())
4144 {
4145 if (cb.getNumItems() == 0)
4146 text = cb.getTextWhenNoChoicesAvailable();
4147 else
4148 text = cb.getTextWhenNothingSelected();
4149 }
4150
4151 obj->setProperty("text", text);
4152 obj->setProperty("active", cb.getSelectedId() != 0);
4153 obj->setProperty("enabled", cb.isEnabled() && cb.getNumItems() > 0);
4154 obj->setProperty("hover", cb.isMouseOver(true) || cb.isMouseButtonDown(true) || cb.isPopupActive());
4155
4156 setColourOrBlack(obj, "bgColour", cb, HiseColourScheme::ComponentOutlineColourId);
4157 setColourOrBlack(obj, "itemColour1", cb, HiseColourScheme::ComponentFillTopColourId);
4158 setColourOrBlack(obj, "itemColour2", cb, HiseColourScheme::ComponentFillBottomColourId);
4159 setColourOrBlack(obj, "textColour", cb, HiseColourScheme::ComponentTextColourId);
4160
4161 addParentFloatingTile(cb, obj);
4162
4163 if (get()->callWithGraphics(g_, "drawComboBox", var(obj), &cb))
4164 return;
4165 }
4166
4167 GlobalHiseLookAndFeel::drawComboBox(g_, width, height, isButtonDown, buttonX, buttonY, buttonW, buttonH, cb);
4168}
4169
4170void ScriptingObjects::ScriptedLookAndFeel::Laf::positionComboBoxText(ComboBox &c, Label &labelToPosition)
4171{

Callers

nothing calls this directly

Calls 15

setColourOrBlackFunction · 0.85
varFunction · 0.85
getLocalBoundsMethod · 0.80
getSelectedIdMethod · 0.80
isMouseOverMethod · 0.80
isMouseButtonDownMethod · 0.80
callWithGraphicsMethod · 0.80
getFunction · 0.50
setPropertyMethod · 0.45
toFloatMethod · 0.45

Tested by

no test coverage detected