2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2021-03-23 16:06:59 +00:00
|
|
|
#include "ui/rp_widget.h"
|
2016-11-24 19:28:23 +00:00
|
|
|
#include "styles/style_widgets.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-06-22 12:01:54 +00:00
|
|
|
namespace Data {
|
|
|
|
struct CountryInfo;
|
|
|
|
} // namespace Data
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-10-20 16:32:15 +00:00
|
|
|
namespace Ui {
|
2016-10-22 13:03:20 +00:00
|
|
|
class MultiSelect;
|
2018-01-11 19:33:26 +00:00
|
|
|
class RippleAnimation;
|
2016-10-20 16:32:15 +00:00
|
|
|
} // namespace Ui
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2021-03-23 16:06:59 +00:00
|
|
|
class CountryInput : public Ui::RpWidget {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-11-24 19:28:23 +00:00
|
|
|
CountryInput(QWidget *parent, const style::InputField &st);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2021-03-23 16:06:59 +00:00
|
|
|
[[nodiscard]] QString iso() const {
|
2018-05-30 15:08:12 +00:00
|
|
|
return _chosenIso;
|
|
|
|
}
|
2021-03-23 16:06:59 +00:00
|
|
|
bool chooseCountry(const QString &country);
|
2018-05-30 15:08:12 +00:00
|
|
|
|
2021-03-03 18:22:42 +00:00
|
|
|
public Q_SLOTS:
|
2014-05-30 08:53:19 +00:00
|
|
|
void onChooseCode(const QString &code);
|
|
|
|
|
2021-03-03 18:22:42 +00:00
|
|
|
Q_SIGNALS:
|
2014-05-30 08:53:19 +00:00
|
|
|
void codeChanged(const QString &code);
|
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
2017-02-11 11:24:37 +00:00
|
|
|
void enterEventHook(QEvent *e) override;
|
|
|
|
void leaveEventHook(QEvent *e) override;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
private:
|
2014-05-30 08:53:19 +00:00
|
|
|
void setText(const QString &newText);
|
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
const style::InputField &_st;
|
|
|
|
bool _active = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
QString _text;
|
2018-05-30 15:08:12 +00:00
|
|
|
QString _chosenIso;
|
2016-12-09 18:56:01 +00:00
|
|
|
QPainterPath _placeholderPath;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
};
|