From 437f10df4411a23cc04bff6cf62e442a6782a347 Mon Sep 17 00:00:00 2001 From: fearn-e Date: Thu, 5 Feb 2026 20:14:51 +0000 Subject: [PATCH 1/3] ofxToggle setSize override to correctly change checkbox size --- addons/ofxGui/src/ofxToggle.cpp | 6 ++++++ addons/ofxGui/src/ofxToggle.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/ofxGui/src/ofxToggle.cpp b/addons/ofxGui/src/ofxToggle.cpp index 8a351988c1f..1d1f0bf2859 100644 --- a/addons/ofxGui/src/ofxToggle.cpp +++ b/addons/ofxGui/src/ofxToggle.cpp @@ -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)){ diff --git a/addons/ofxGui/src/ofxToggle.h b/addons/ofxGui/src/ofxToggle.h index abacee0f077..6332f8ebfd6 100644 --- a/addons/ofxGui/src/ofxToggle.h +++ b/addons/ofxGui/src/ofxToggle.h @@ -11,7 +11,7 @@ class ofxToggle : public ofxBaseGui{ ofxToggle(ofParameter _bVal, float width = defaultWidth, float height = defaultHeight); ofxToggle * setup(ofParameter _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); From 06e312e4607a8d96e470470c1cb4643258da8bf1 Mon Sep 17 00:00:00 2001 From: fearn-e Date: Thu, 5 Feb 2026 20:14:57 +0000 Subject: [PATCH 2/3] ofxButton setSize override to correctly change checkbox size --- addons/ofxGui/src/ofxButton.cpp | 7 +++++++ addons/ofxGui/src/ofxButton.h | 1 + 2 files changed, 8 insertions(+) diff --git a/addons/ofxGui/src/ofxButton.cpp b/addons/ofxGui/src/ofxButton.cpp index 3e3ee871f5a..220f7cdaf8a 100644 --- a/addons/ofxGui/src/ofxButton.cpp +++ b/addons/ofxGui/src/ofxButton.cpp @@ -46,6 +46,13 @@ ofxButton* ofxButton::setup(const std::string& toggleName, float width, float he return this; } +void ofxToggle::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); diff --git a/addons/ofxGui/src/ofxButton.h b/addons/ofxGui/src/ofxButton.h index cc742abea11..5aaa93edf0b 100644 --- a/addons/ofxGui/src/ofxButton.h +++ b/addons/ofxGui/src/ofxButton.h @@ -12,6 +12,7 @@ class ofxButton : public ofxToggle{ ~ofxButton(); ofxButton* setup(ofParameter _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); From 491d05e079226031ac5544101d438e1e4ee5359c Mon Sep 17 00:00:00 2001 From: fearn-e Date: Fri, 6 Feb 2026 13:33:11 +0000 Subject: [PATCH 3/3] mistyped ofxToggle -> ofxButton --- addons/ofxGui/src/ofxButton.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/ofxGui/src/ofxButton.cpp b/addons/ofxGui/src/ofxButton.cpp index 220f7cdaf8a..de2dceeb329 100644 --- a/addons/ofxGui/src/ofxButton.cpp +++ b/addons/ofxGui/src/ofxButton.cpp @@ -46,7 +46,7 @@ ofxButton* ofxButton::setup(const std::string& toggleName, float width, float he return this; } -void ofxToggle::setSize(float width, float height){ +void ofxButton::setSize(float width, float height){ b.width = width; b.height = height; checkboxRect.set(1, 1, b.height - 2, b.height - 2);