Skip to content
Merged
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
7 changes: 7 additions & 0 deletions addons/ofxGui/src/ofxButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ ofxButton* ofxButton::setup(const std::string& toggleName, float width, float he
return this;
}

void ofxButton::setSize(float width, float height){
b.width = width;
b.height = height;
checkboxRect.set(1, 1, b.height - 2, b.height - 2);
sizeChangedCB();
}

void ofxButton::generateDraw(){
bg.clear();
bg.setFillColor(thisBackgroundColor);
Expand Down
1 change: 1 addition & 0 deletions addons/ofxGui/src/ofxButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ofxButton : public ofxToggle{
~ofxButton();
ofxButton* setup(ofParameter<void> _bVal, float width = defaultWidth, float height = defaultHeight);
ofxButton* setup(const std::string& toggleName, float width = defaultWidth, float height = defaultHeight);
virtual void setSize(float width, float height);
void generateDraw();

virtual bool mouseReleased(ofMouseEventArgs & args);
Expand Down
6 changes: 6 additions & 0 deletions addons/ofxGui/src/ofxToggle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ ofxToggle * ofxToggle::setup(const std::string& toggleName, bool _bVal, float wi
return setup(value,width,height);
}

void ofxToggle::setSize(float width, float height){
b.width = width;
b.height = height;
checkboxRect.set(1, 1, b.height - 2, b.height - 2);
sizeChangedCB();
}

bool ofxToggle::mouseMoved(ofMouseEventArgs & args){
if(isGuiDrawing() && b.inside(args)){
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxGui/src/ofxToggle.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ofxToggle : public ofxBaseGui{
ofxToggle(ofParameter<bool> _bVal, float width = defaultWidth, float height = defaultHeight);
ofxToggle * setup(ofParameter<bool> _bVal, float width = defaultWidth, float height = defaultHeight);
ofxToggle * setup(const std::string& toggleName, bool _bVal, float width = defaultWidth, float height = defaultHeight);

virtual void setSize(float width, float height);

virtual bool mouseMoved(ofMouseEventArgs & args);
virtual bool mousePressed(ofMouseEventArgs & args);
Expand Down
Loading