MenuItem: Misc const and constructor consistency adjustments.

Also moved add_items() body to .cpp file.
This commit is contained in:
Jared Boone 2016-09-05 15:30:45 -07:00
parent 9a01d59822
commit 722f9b6886
2 changed files with 10 additions and 9 deletions

View File

@ -69,10 +69,16 @@ MenuView::~MenuView() {
}
}
void MenuView::add_item(const MenuItem item) {
void MenuView::add_item(MenuItem item) {
add_child(new MenuItemView { item });
}
void MenuView::add_items(std::initializer_list<MenuItem> items) {
for(auto item : items) {
add_item(item);
}
}
void MenuView::set_parent_rect(const Rect new_parent_rect) {
View::set_parent_rect(new_parent_rect);

View File

@ -45,7 +45,7 @@ class MenuItemView : public Widget {
public:
MenuItemView(
MenuItem item
) : item(item)
) : item { item }
{
}
@ -69,13 +69,8 @@ public:
~MenuView();
void add_item(const MenuItem item);
void add_items(const std::initializer_list<MenuItem> items) {
for(const auto& item : items) {
add_item(item);
}
}
void add_item(MenuItem item);
void add_items(std::initializer_list<MenuItem> items);
void set_parent_rect(const Rect new_parent_rect) override;