rezaali / ofxUI

[DEPRECATED] UI Addon for openFrameworks
http://www.syedrezaali.com/#/ofxui-project-showcase/
518 stars 202 forks source link

Added missing assignment operator, fixed autoDraw and autoUpdate, added option to remove header widgets. #177

Closed mitchmindtree closed 10 years ago

mitchmindtree commented 10 years ago

where

ofxUISuperCanvas::setUseHeader(true);

will add the title back again.

rezaali commented 10 years ago

Hey @mitchmindtree thank you for pointing out that autoDraw and autoUpdate don't do anything, upon the numerous refactors those vars must have slipped through the cracks. I'm curious why you would want to keep those instead of just disabling the canvas or called the methods:

disableAppDrawCallback();
disableAppUpdateCallback();

As for the other commits, I think it might be easier to do what your doing with a normal canvas instead of a supercanvas, which is intended to always have a header widget so people can click on it to open it.

Maybe consider subclassing canvas and making another type of canvas that fits your application's needs? If your doing something that tons of people will likely be doing, then I'll reconsider modifying ofxUI to include the changes. Thoughts?

mitchmindtree commented 10 years ago

Thanks for the tips Reza! I must have missed those disable methods after first spotting those autoDraw/Update ones! Maybe we can just remove the two auto methods altogether then? Or perhaps they could just call their associated disableAppCallback method?

Also, you're totally right about using a normal canvas - for some reason I was under the impression that only SuperCanvas' position could be changed during runtime after setup! I now realise that a regular canvas does everything I want it to already! Cheers for the response, shall make those changes in my own code very soon :+1:

As for the assignment operator, that was just to handle the heap allocation of SuperCanvas' "canvasTitle" widget during assignment in the case that a situation like this occurred:

newSuperCanvas = otherSuperCanvas;
// otherSuperCanvas gets deleted before newSuperCanvas.

I'm trying to get into the habit of abiding by the Rule of Three when dealing with dynamic allocation, and this was just to complete the trio, so hopefully it's still handy! There are now also "move constructors" and "move assignment operators" to be considered in c++11, but I don't know enough about these to implement them yet. Will let you know if I learn anything handy!

Hope you're swell!