2023-01-18 14:12:13 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-05-31 01:44:16 +00:00
|
|
|
#include "AutoComplete.h"
|
|
|
|
#include <AK/OwnPtr.h>
|
2023-01-18 14:12:13 +00:00
|
|
|
#include <QLineEdit>
|
|
|
|
|
2023-08-02 17:52:59 +00:00
|
|
|
namespace Ladybird {
|
|
|
|
|
2023-01-18 14:12:13 +00:00
|
|
|
class LocationEdit final : public QLineEdit {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2023-01-23 03:11:01 +00:00
|
|
|
explicit LocationEdit(QWidget*);
|
|
|
|
|
2024-06-10 09:33:35 +00:00
|
|
|
URL::URL url() const { return m_url; }
|
|
|
|
void set_url(URL::URL const&);
|
|
|
|
|
|
|
|
bool url_is_hidden() const { return m_url_is_hidden; }
|
|
|
|
void set_url_is_hidden(bool url_is_hidden) { m_url_is_hidden = url_is_hidden; }
|
|
|
|
|
2023-01-23 03:11:01 +00:00
|
|
|
private:
|
|
|
|
virtual void focusInEvent(QFocusEvent* event) override;
|
|
|
|
virtual void focusOutEvent(QFocusEvent* event) override;
|
|
|
|
|
2024-06-12 02:24:39 +00:00
|
|
|
void update_placeholder();
|
2023-01-23 03:11:01 +00:00
|
|
|
void highlight_location();
|
2023-05-31 01:44:16 +00:00
|
|
|
AK::OwnPtr<AutoComplete> m_autocomplete;
|
2024-06-10 09:33:35 +00:00
|
|
|
|
|
|
|
URL::URL m_url;
|
|
|
|
bool m_url_is_hidden { false };
|
2023-01-18 14:12:13 +00:00
|
|
|
};
|
2023-08-02 17:52:59 +00:00
|
|
|
|
|
|
|
}
|