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_TEXTFIELD_VIEW_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_VIEWS_TEXTFIELD_VIEW_H_
|
|
|
|
#pragma once
|
|
|
|
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/include/views/cef_textfield.h"
|
|
|
|
#include "cef/include/views/cef_textfield_delegate.h"
|
|
|
|
#include "cef/libcef/browser/views/view_view.h"
|
2016-01-19 21:09:01 +01:00
|
|
|
#include "ui/views/controls/textfield/textfield.h"
|
|
|
|
#include "ui/views/controls/textfield/textfield_controller.h"
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefTextfieldView
|
|
|
|
: public CefViewView<views::Textfield, CefTextfieldDelegate>,
|
|
|
|
public views::TextfieldController {
|
2016-01-19 21:09:01 +01:00
|
|
|
public:
|
2021-12-06 21:40:25 +01:00
|
|
|
using ParentClass = CefViewView<views::Textfield, CefTextfieldDelegate>;
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
// |cef_delegate| may be nullptr.
|
|
|
|
explicit CefTextfieldView(CefTextfieldDelegate* cef_delegate);
|
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefTextfieldView(const CefTextfieldView&) = delete;
|
|
|
|
CefTextfieldView& operator=(const CefTextfieldView&) = delete;
|
|
|
|
|
2016-07-21 23:21:32 +02:00
|
|
|
void Initialize() override;
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// Returns the CefTextfield associated with this view. See comments on
|
|
|
|
// CefViewView::GetCefView.
|
|
|
|
CefRefPtr<CefTextfield> GetCefTextfield() const {
|
|
|
|
CefRefPtr<CefTextfield> textfield = GetCefView()->AsTextfield();
|
|
|
|
DCHECK(textfield);
|
|
|
|
return textfield;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TextfieldController methods:
|
|
|
|
bool HandleKeyEvent(views::Textfield* sender,
|
|
|
|
const ui::KeyEvent& key_event) override;
|
|
|
|
void OnAfterUserAction(views::Textfield* sender) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_VIEWS_TEXTFIELD_VIEW_H_
|