refactor layout.h into single file per Node* classes
This commit is contained in:
41
engine/node_dialog_open.cpp
Normal file
41
engine/node_dialog_open.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "pch.h"
|
||||
#include "log.h"
|
||||
#include "node_dialog_open.h"
|
||||
#include "canvas.h"
|
||||
#include "node_image_texture.h"
|
||||
|
||||
Node* NodeDialogOpen::clone_instantiate() const
|
||||
{
|
||||
return new NodeDialogOpen();
|
||||
}
|
||||
|
||||
void NodeDialogOpen::clone_finalize(Node* dest) const
|
||||
{
|
||||
NodeDialogOpen* n = static_cast<NodeDialogOpen*>(dest);
|
||||
n->init_controls();
|
||||
}
|
||||
|
||||
void NodeDialogOpen::init()
|
||||
{
|
||||
auto tpl = static_cast<const NodeBorder*>(init_template("dialog-open"));
|
||||
m_color = tpl->m_color;
|
||||
m_border_color = tpl->m_border_color;;
|
||||
m_thinkness = tpl->m_thinkness;;
|
||||
init_controls();
|
||||
}
|
||||
|
||||
void NodeDialogOpen::init_controls()
|
||||
{
|
||||
btn_ok = find<NodeButton>("btn-ok");
|
||||
btn_cancel = find<NodeButton>("btn-cancel");
|
||||
btn_cancel->on_click = [this](Node*) {
|
||||
destroy();
|
||||
};
|
||||
}
|
||||
|
||||
void NodeDialogOpen::loaded()
|
||||
{
|
||||
ui::Image thumb = ui::Canvas::I->thumbnail_read(data_path);
|
||||
auto image_tex = find<NodeImageTexture>("thumb-tex");
|
||||
image_tex->tex.create(thumb);
|
||||
}
|
||||
Reference in New Issue
Block a user