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_MENU_BUTTON_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_VIEWS_MENU_BUTTON_IMPL_H_
|
|
|
|
#pragma once
|
|
|
|
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/include/views/cef_menu_button.h"
|
|
|
|
#include "cef/include/views/cef_menu_button_delegate.h"
|
|
|
|
#include "cef/libcef/browser/menu_model_impl.h"
|
|
|
|
#include "cef/libcef/browser/views/label_button_impl.h"
|
2016-01-19 21:09:01 +01:00
|
|
|
#include "ui/views/controls/button/menu_button.h"
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefMenuButtonImpl : public CefLabelButtonImpl<views::MenuButton,
|
|
|
|
CefMenuButton,
|
|
|
|
CefMenuButtonDelegate> {
|
2016-01-19 21:09:01 +01:00
|
|
|
public:
|
2021-12-06 21:40:25 +01:00
|
|
|
using ParentClass = CefLabelButtonImpl<views::MenuButton,
|
|
|
|
CefMenuButton,
|
|
|
|
CefMenuButtonDelegate>;
|
|
|
|
|
|
|
|
CefMenuButtonImpl(const CefMenuButtonImpl&) = delete;
|
|
|
|
CefMenuButtonImpl& operator=(const CefMenuButtonImpl&) = delete;
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
// Create a new CefMenuButton instance. |delegate| must not be nullptr.
|
|
|
|
static CefRefPtr<CefMenuButtonImpl> Create(
|
|
|
|
CefRefPtr<CefMenuButtonDelegate> delegate,
|
2019-07-16 19:59:21 +02:00
|
|
|
const CefString& text);
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
// CefMenuButton methods:
|
|
|
|
void ShowMenu(CefRefPtr<CefMenuModel> menu_model,
|
|
|
|
const CefPoint& screen_point,
|
|
|
|
cef_menu_anchor_position_t anchor_position) override;
|
2017-02-22 19:05:27 +01:00
|
|
|
void TriggerMenu() override;
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
// CefLabelButton methods:
|
|
|
|
CefRefPtr<CefMenuButton> AsMenuButton() override { return this; }
|
|
|
|
|
|
|
|
// CefViewAdapter methods:
|
|
|
|
std::string GetDebugType() override { return "MenuButton"; }
|
|
|
|
|
2017-02-23 21:24:45 +01:00
|
|
|
// CefView methods:
|
|
|
|
void SetFocusable(bool focusable) override;
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
private:
|
|
|
|
// Create a new implementation object.
|
|
|
|
// Always call Initialize() after creation.
|
|
|
|
// |delegate| must not be nullptr.
|
|
|
|
explicit CefMenuButtonImpl(CefRefPtr<CefMenuButtonDelegate> delegate);
|
|
|
|
|
|
|
|
// CefViewImpl methods:
|
|
|
|
views::MenuButton* CreateRootView() override;
|
2016-07-21 23:21:32 +02:00
|
|
|
void InitializeRootView() override;
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefMenuButtonImpl);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_VIEWS_MENU_BUTTON_IMPL_H_
|