Add LayoutManager/BoxLayout APIs
This commit is contained in:
parent
b3edfd7d89
commit
322bde526c
14 changed files with 310 additions and 18 deletions
|
@ -23,6 +23,13 @@ View::~View() {
|
|||
delete view_;
|
||||
}
|
||||
|
||||
void View::SetLayoutManager(mate::Handle<LayoutManager> layout_manager) {
|
||||
layout_manager_.Reset(isolate(), layout_manager->GetWrapper());
|
||||
// TODO(zcbenz): New versions of Chrome takes std::unique_ptr instead of raw
|
||||
// pointer, remove the "release()" call when we upgraded to it.
|
||||
view()->SetLayoutManager(layout_manager->TakeOver().release());
|
||||
}
|
||||
|
||||
// static
|
||||
mate::WrappableBase* View::New(mate::Arguments* args) {
|
||||
auto* view = new View();
|
||||
|
@ -32,7 +39,11 @@ mate::WrappableBase* View::New(mate::Arguments* args) {
|
|||
|
||||
// static
|
||||
void View::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {}
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(mate::StringToV8(isolate, "View"));
|
||||
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
.SetMethod("setLayoutManager", &View::SetLayoutManager);
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue