2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 15:45:12 +00:00

ITextLink moved to ClickHandler, TextLinkPtr > ClickHandlerPtr.

Global methods textlnkOver/Down/DrawOver were replaced by
static members of ClickHandler, now global state consists
of the handler pointer + host pointer, who declares callbacks
for the active and pressed handler changed events.

This will allow to use ClickHandler from different hosts
simultaneously (like HistoryItem / BotDescription / BotKeyboard).

Not yet tested.
This commit is contained in:
John Preston
2016-03-29 20:17:00 +03:00
parent 2c6f74f923
commit 7f6cf32cdd
40 changed files with 1976 additions and 1446 deletions

View File

@@ -28,20 +28,19 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "intro/introcode.h"
namespace {
class SignUpLink : public ITextLink {
TEXT_LINK_CLASS(SignUpLink)
class SignUpClickHandler : public LeftButtonClickHandler {
public:
SignUpLink(IntroPhone *widget) : _widget(widget) {
SignUpClickHandler(IntroPhone *widget) : _widget(widget) {
}
void onClick(Qt::MouseButton) const {
protected:
void onClickImpl() const override {
_widget->toSignUp();
}
private:
IntroPhone *_widget;
};
}
@@ -71,7 +70,7 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStep(parent)
connect(intro(), SIGNAL(countryChanged()), this, SLOT(countryChanged()));
connect(&checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
_signup.setLink(1, TextLinkPtr(new SignUpLink(this)));
_signup.setLink(1, MakeShared<SignUpClickHandler>(this));
_signup.hide();
_signupCache = myGrab(&_signup);