Support retrieving caption label from ui::window
This commit is contained in:
parent
0434a7d904
commit
11e46ba1c6
2 changed files with 5 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/ui/element.hpp>
|
||||
#include <psemek/ui/label.hpp>
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ namespace psemek::ui
|
|||
{
|
||||
using on_close_callback = std::function<void()>;
|
||||
|
||||
virtual void set_caption(std::string caption) = 0;
|
||||
virtual label * caption() = 0;
|
||||
virtual std::shared_ptr<element> set_child(std::shared_ptr<element> c) = 0;
|
||||
virtual void on_close(on_close_callback callback) = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -259,9 +259,9 @@ namespace psemek::ui
|
|||
});
|
||||
}
|
||||
|
||||
void set_caption(std::string caption) override
|
||||
label * caption() override
|
||||
{
|
||||
caption_->set_text(caption);
|
||||
return caption_.get();
|
||||
}
|
||||
|
||||
std::shared_ptr<element> set_child(std::shared_ptr<element> c) override
|
||||
|
|
@ -771,7 +771,7 @@ namespace psemek::ui
|
|||
{
|
||||
auto r = std::make_shared<window_impl>(impl().cross_red_16x16);
|
||||
r->setup_close();
|
||||
r->set_caption(std::move(caption));
|
||||
r->caption()->set_text(std::move(caption));
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue