Multipage: made add_page return the grid of the newly added page

This commit is contained in:
Charles Dang 2017-04-11 02:59:09 +11:00
parent bbd9463b17
commit 142ced01e1
2 changed files with 14 additions and 7 deletions

View file

@ -39,17 +39,21 @@ multi_page::multi_page()
{
}
void multi_page::add_page(const string_map& item)
grid& multi_page::add_page(const string_map& item)
{
assert(generator_);
generator_->create_item(-1, page_builder_, item, nullptr);
grid& page = generator_->create_item(-1, page_builder_, item, nullptr);
return page;
}
void multi_page::add_page(
grid& multi_page::add_page(
const std::map<std::string /* widget id */, string_map>& data)
{
assert(generator_);
generator_->create_item(-1, page_builder_, data, nullptr);
grid& page = generator_->create_item(-1, page_builder_, data, nullptr);
return page;
}
void multi_page::remove_page(const unsigned page, unsigned count)

View file

@ -51,8 +51,10 @@ public:
*
* @param item The data to send to the set_members of the
* widget.
*
* @returns The grid of the newly added page.
*/
void add_page(const string_map& item);
grid& add_page(const string_map& item);
/**
* Adds single page to the grid.
@ -68,9 +70,10 @@ public:
* id is an empty string, it is send to all
* members. Having both empty and non-empty
* id's gives undefined behavior.
*
* @returns The grid of the newly added page.
*/
void
add_page(const std::map<std::string /* widget id */, string_map>& data);
grid& add_page(const std::map<std::string /* widget id */, string_map>& data);
/**
* Removes a page in the multi page.