tdesktop/Telegram/SourceFiles/ui/countryinput.h

56 lines
1.2 KiB
C
Raw Normal View History

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