2016-01-19 21:09:01 +01:00
|
|
|
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be found
|
|
|
|
// in the LICENSE file.
|
|
|
|
|
|
|
|
#include "libcef/browser/views/basic_label_button_impl.h"
|
|
|
|
|
|
|
|
#include "libcef/browser/views/basic_label_button_view.h"
|
|
|
|
|
|
|
|
// static
|
|
|
|
CefRefPtr<CefLabelButton> CefLabelButton::CreateLabelButton(
|
|
|
|
CefRefPtr<CefButtonDelegate> delegate,
|
2019-07-16 19:59:21 +02:00
|
|
|
const CefString& text) {
|
|
|
|
return CefBasicLabelButtonImpl::Create(delegate, text);
|
2016-01-19 21:09:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
CefRefPtr<CefBasicLabelButtonImpl> CefBasicLabelButtonImpl::Create(
|
|
|
|
CefRefPtr<CefButtonDelegate> delegate,
|
2019-07-16 19:59:21 +02:00
|
|
|
const CefString& text) {
|
2016-01-19 21:09:01 +01:00
|
|
|
CEF_REQUIRE_UIT_RETURN(nullptr);
|
|
|
|
CefRefPtr<CefBasicLabelButtonImpl> label_button =
|
|
|
|
new CefBasicLabelButtonImpl(delegate);
|
|
|
|
label_button->Initialize();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!text.empty()) {
|
2016-01-19 21:09:01 +01:00
|
|
|
label_button->SetText(text);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-01-19 21:09:01 +01:00
|
|
|
return label_button;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
CefBasicLabelButtonImpl::CefBasicLabelButtonImpl(
|
|
|
|
CefRefPtr<CefButtonDelegate> delegate)
|
|
|
|
: ParentClass(delegate) {}
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
views::LabelButton* CefBasicLabelButtonImpl::CreateRootView() {
|
|
|
|
return new CefBasicLabelButtonView(delegate());
|
|
|
|
}
|
2016-07-21 23:21:32 +02:00
|
|
|
|
|
|
|
void CefBasicLabelButtonImpl::InitializeRootView() {
|
|
|
|
static_cast<CefBasicLabelButtonView*>(root_view())->Initialize();
|
|
|
|
}
|