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.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_VIEWS_BASIC_LABEL_BUTTON_VIEW_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_VIEWS_BASIC_LABEL_BUTTON_VIEW_H_
|
|
|
|
#pragma once
|
|
|
|
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/include/views/cef_button_delegate.h"
|
|
|
|
#include "cef/libcef/browser/views/label_button_view.h"
|
2016-01-19 21:09:01 +01:00
|
|
|
#include "ui/views/controls/button/label_button.h"
|
|
|
|
|
|
|
|
// Extend views::LabelButton with a no-argument constructor as required by the
|
|
|
|
// CefViewView template and extend views::ButtonListener as required by the
|
|
|
|
// CefButtonView template.
|
2020-12-02 23:31:49 +01:00
|
|
|
class LabelButtonEx : public views::LabelButton {
|
2016-01-19 21:09:01 +01:00
|
|
|
public:
|
2020-12-02 23:31:49 +01:00
|
|
|
LabelButtonEx()
|
|
|
|
: views::LabelButton(base::BindRepeating(
|
|
|
|
[](LabelButtonEx* self, const ui::Event& event) {
|
|
|
|
self->ButtonPressed(event);
|
|
|
|
},
|
|
|
|
base::Unretained(this)),
|
2021-04-21 00:52:34 +02:00
|
|
|
std::u16string()) {}
|
2020-12-02 23:31:49 +01:00
|
|
|
|
|
|
|
virtual void ButtonPressed(const ui::Event& event) = 0;
|
2016-01-19 21:09:01 +01:00
|
|
|
};
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefBasicLabelButtonView
|
|
|
|
: public CefLabelButtonView<LabelButtonEx, CefButtonDelegate> {
|
2016-01-19 21:09:01 +01:00
|
|
|
public:
|
2021-12-06 21:40:25 +01:00
|
|
|
using ParentClass = CefLabelButtonView<LabelButtonEx, CefButtonDelegate>;
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
// |cef_delegate| may be nullptr.
|
|
|
|
explicit CefBasicLabelButtonView(CefButtonDelegate* cef_delegate);
|
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefBasicLabelButtonView(const CefBasicLabelButtonView&) = delete;
|
|
|
|
CefBasicLabelButtonView& operator=(const CefBasicLabelButtonView&) = delete;
|
2016-01-19 21:09:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_VIEWS_BASIC_LABEL_BUTTON_VIEW_H_
|