add preset popup menu
This commit is contained in:
10
src/layout.h
10
src/layout.h
@@ -34,10 +34,16 @@ public:
|
||||
auto i = m_layouts.find(id);
|
||||
return i == m_layouts.end() ? nullptr : i->second.get();
|
||||
}
|
||||
class std::shared_ptr<Node> get_ref(const char* name)
|
||||
template<class T = Node> std::shared_ptr<T> get_ref(const char* name)
|
||||
{
|
||||
auto i = m_layouts.find(const_hash(name));
|
||||
return i == m_layouts.end() ? nullptr : i->second;
|
||||
return i == m_layouts.end() ? nullptr : std::dynamic_pointer_cast<T>(i->second);
|
||||
}
|
||||
template<class T = Node> std::shared_ptr<T> instantiate(const char* name)
|
||||
{
|
||||
if (auto layout = get_ref(name))
|
||||
return layout->m_children[0]->clone<T>();
|
||||
return nullptr;
|
||||
}
|
||||
void restore_context();
|
||||
void clear_context();
|
||||
|
||||
Reference in New Issue
Block a user