2018-04-25 14:49:30 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "Channel.hpp"
|
|
|
|
#include "widgets/Split.hpp"
|
2018-04-25 14:49:30 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
|
|
|
|
|
|
|
class AttachedWindow : public QWidget
|
|
|
|
{
|
2018-05-30 17:17:27 +02:00
|
|
|
AttachedWindow(void *target_, int asdf);
|
2018-04-25 14:49:30 +02:00
|
|
|
|
|
|
|
public:
|
2018-05-28 18:25:19 +02:00
|
|
|
struct GetArgs {
|
|
|
|
QString winId;
|
|
|
|
int yOffset = -1;
|
|
|
|
int width = -1;
|
|
|
|
int height = -1;
|
|
|
|
};
|
|
|
|
|
2018-05-30 17:17:27 +02:00
|
|
|
virtual ~AttachedWindow() override;
|
2018-04-25 14:49:30 +02:00
|
|
|
|
2018-05-30 17:17:27 +02:00
|
|
|
static AttachedWindow *get(void *target_, const GetArgs &args);
|
2018-04-25 14:49:30 +02:00
|
|
|
static void detach(const QString &winId);
|
|
|
|
|
|
|
|
void setChannel(ChannelPtr channel);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void showEvent(QShowEvent *) override;
|
|
|
|
// virtual void nativeEvent(const QByteArray &eventType, void *message, long *result)
|
|
|
|
// override;
|
|
|
|
|
|
|
|
private:
|
2018-05-30 17:17:27 +02:00
|
|
|
void *target_;
|
|
|
|
int yOffset_;
|
|
|
|
int currentYOffset_;
|
|
|
|
int width_ = 360;
|
|
|
|
int height_ = -1;
|
|
|
|
bool validProcessName_ = false;
|
|
|
|
bool attached_ = false;
|
|
|
|
QTimer timer_;
|
2018-04-25 14:49:30 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
Split *split;
|
2018-05-30 17:17:27 +02:00
|
|
|
} ui_;
|
2018-04-25 14:49:30 +02:00
|
|
|
|
2018-05-30 17:17:27 +02:00
|
|
|
void attachToHwnd_(void *attached);
|
|
|
|
void updateWindowRect_(void *attached);
|
2018-04-25 14:49:30 +02:00
|
|
|
|
|
|
|
struct Item {
|
|
|
|
void *hwnd;
|
|
|
|
AttachedWindow *window;
|
|
|
|
QString winId;
|
|
|
|
};
|
|
|
|
|
|
|
|
static std::vector<Item> items;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|