Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/components/ofxDatGuiColorPicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,21 @@ class ofxDatGuiColorPicker : public ofxDatGuiTextInput {
{
mColor = color;
setTextFieldInputColor();
gColors[2] = mColor;
gColors[0] = ofColor(mColor.r/2, mColor.g/2, mColor.b/2);
vbo.setColorData(&gColors[0], 6, GL_DYNAMIC_DRAW );
}

void setColor(int hex)
{
mColor = ofColor::fromHex(hex);
setTextFieldInputColor();
setColor(mColor);
}

void setColor(int r, int g, int b, int a = 255)
{
mColor = ofColor(r, g, b, a);
setTextFieldInputColor();
setColor(mColor);
}

ofColor getColor()
Expand Down
12 changes: 12 additions & 0 deletions src/components/ofxDatGuiGroups.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,18 @@ class ofxDatGuiDropdown : public ofxDatGuiGroup {
return children.size();
}

void setOptions(const vector<string>& options = vector<string>())
{
mOption = 0;
children.clear();
for(int i=0; i<options.size(); i++){
ofxDatGuiDropdownOption* opt = new ofxDatGuiDropdownOption(options[i]);
opt->setIndex(children.size());
opt->onButtonEvent(this, &ofxDatGuiDropdown::onOptionSelected);
children.push_back(opt);
}
}

ofxDatGuiDropdownOption* getChildAt(int index)
{
return static_cast<ofxDatGuiDropdownOption*>(children[index]);
Expand Down