mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-05 09:05:14 +00:00
initial commit for 0.4.18 version of Telegram Desktop
This commit is contained in:
87
Telegram/SourceFiles/gui/flatinput.h
Normal file
87
Telegram/SourceFiles/gui/flatinput.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include "style.h"
|
||||
#include "animation.h"
|
||||
|
||||
class FlatInput : public QLineEdit, public Animated {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
FlatInput(QWidget *parent, const style::flatInput &st, const QString &ph = QString(), const QString &val = QString());
|
||||
QString val() const;
|
||||
|
||||
bool event(QEvent *e);
|
||||
void touchEvent(QTouchEvent *e);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void focusInEvent(QFocusEvent *e);
|
||||
void focusOutEvent(QFocusEvent *e);
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
|
||||
void notaBene();
|
||||
|
||||
void updatePlaceholder();
|
||||
|
||||
QRect getTextRect() const;
|
||||
|
||||
bool animStep(float64 ms);
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
public slots:
|
||||
|
||||
void onTextChange(const QString &text);
|
||||
void onTextEdited();
|
||||
|
||||
void onTouchTimer();
|
||||
|
||||
signals:
|
||||
|
||||
void changed();
|
||||
void cancelled();
|
||||
void accepted();
|
||||
void focused();
|
||||
void blurred();
|
||||
|
||||
protected:
|
||||
|
||||
virtual void correctValue(QKeyEvent *e, const QString &was);
|
||||
|
||||
private:
|
||||
|
||||
QString _ph, _oldtext;
|
||||
QKeyEvent *_kev;
|
||||
|
||||
bool _phVisible;
|
||||
anim::ivalue a_phLeft;
|
||||
anim::fvalue a_phAlpha;
|
||||
anim::cvalue a_phColor, a_borderColor, a_bgColor;
|
||||
|
||||
int _notingBene;
|
||||
style::flatInput _st;
|
||||
|
||||
style::font _font;
|
||||
|
||||
QTimer _touchTimer;
|
||||
bool _touchPress, _touchRightButton, _touchMove;
|
||||
QPoint _touchStart;
|
||||
};
|
Reference in New Issue
Block a user