blob: 54282b5095c6efd9a079b0175a7810dba8dbaa9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#pragma once
#include <gtkmm.h>
// loads an image only when the widget is drawn for the first time
class LazyImage : public Gtk::Image {
public:
LazyImage(int w, int h, bool use_placeholder = true);
LazyImage(const std::string &url, int w, int h, bool use_placeholder = true);
void SetURL(const std::string &url);
private:
bool OnDraw(const Cairo::RefPtr<Cairo::Context> &context);
bool m_needs_request = true;
int m_idx;
std::string m_url;
int m_width;
int m_height;
};
|