-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Control panel for simulations #443
base: master
Are you sure you want to change the base?
Conversation
lemniscate8
commented
Aug 4, 2021
•
edited
Loading
edited
- Add a Button group from Bootstrap
- Add a toggle button group that is double click safe
- Can configure as a cassette style or play/pause style button
- Can gray out inactive state for stronger visual indication
- Add a control panel
- Interface for adding buttons
- Support different call rates to an simulation (function to run) and viewports (components to redraw)
Codecov Report
@@ Coverage Diff @@
## master #443 +/- ##
==========================================
+ Coverage 82.96% 82.97% +0.01%
==========================================
Files 304 306 +2
Lines 37341 37393 +52
==========================================
+ Hits 30979 31028 +49
- Misses 6362 6365 +3
Continue to review full report at Codecov.
|
include/emp/prefab/ButtonGroup.hpp
Outdated
* button group group. | ||
* @param btn_group a button group | ||
*/ | ||
ButtonGroup & TakeChildren(ButtonGroup & btn_group) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're destroying it, maybe take as an R-value reference?
include/emp/prefab/ButtonGroup.hpp
Outdated
|
||
protected: | ||
/** | ||
* The protected contructor for a ButtonGroup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention the README.md or somewhere else where the design pattern is explained
include/emp/prefab/ButtonGroup.hpp
Outdated
}; | ||
} | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// #ifndef EMP_BUTTON_GROUP_HPP
(here and all the other files)
} | ||
|
||
/** | ||
* Get the function to be called when the component toggles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do end users need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point :D
|
||
/** | ||
* Set the function to be called when the component toggles | ||
* @param cb a callback function that accepts a boolean indicating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a void callback function
@@ -52,6 +57,8 @@ namespace web { | |||
class TableInfo; | |||
class DivInfo : public internal::WidgetInfo { | |||
friend Element; friend Div; friend TableInfo; | |||
friend prefab::ButtonGroup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do ButtonGroup and ControlPanel need to be friends? What are they needing to access inside of Div???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They need to be able to construct a DivInfo
instance but the constructor is protected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did we get around this with other prefab components? It would be best to try to preserve levilization if possible (although these predeclares aren’t a /huge/ issue).
@@ -305,6 +312,7 @@ namespace web { | |||
// Get a properly cast version of info. | |||
internal::DivInfo * Info() { return (internal::DivInfo *) info; } | |||
const internal::DivInfo * Info() const { return (internal::DivInfo *) info; } | |||
Div(internal::DivInfo * in_info) : WidgetFacet(in_info) { ; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some space, an explanatory comment, and info about where design pattern is explained.
struct Test_Control_Panel : emp::web::BaseTest { | ||
/* | ||
* Creates extra div + the following control panel structure | ||
* +------------------+------+-----+-------------------+ +---+---+---+ +--+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D | A | B ??? XD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, C?
Can just add legend below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not sure what D, A, B and C are
This reverts commit b150900.