Create ui labels through element factory
This commit is contained in:
parent
3a8e79df1b
commit
673fc70a47
2 changed files with 10 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <psemek/ui/style.hpp>
|
#include <psemek/ui/style.hpp>
|
||||||
#include <psemek/ui/button.hpp>
|
#include <psemek/ui/button.hpp>
|
||||||
|
#include <psemek/ui/label.hpp>
|
||||||
#include <psemek/ui/screen.hpp>
|
#include <psemek/ui/screen.hpp>
|
||||||
|
|
||||||
#include <psemek/util/pimpl.hpp>
|
#include <psemek/util/pimpl.hpp>
|
||||||
|
|
@ -18,6 +19,7 @@ namespace psemek::ui
|
||||||
std::shared_ptr<struct style> style() const;
|
std::shared_ptr<struct style> style() const;
|
||||||
|
|
||||||
std::shared_ptr<button> make_button(std::string text);
|
std::shared_ptr<button> make_button(std::string text);
|
||||||
|
std::shared_ptr<label> make_label(std::string text);
|
||||||
std::shared_ptr<screen> make_screen();
|
std::shared_ptr<screen> make_screen();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -117,9 +117,16 @@ namespace psemek::ui
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<label> default_element_factory::make_label(std::string text)
|
||||||
|
{
|
||||||
|
auto r = impl().create<label>();
|
||||||
|
r->set_text(text);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<screen> default_element_factory::make_screen()
|
std::shared_ptr<screen> default_element_factory::make_screen()
|
||||||
{
|
{
|
||||||
return std::make_shared<screen>();
|
return impl().create<screen>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue