| 1 | #pragma once |
| 2 | |
| 3 | #include <FL/Fl_Box.H> |
| 4 | |
| 5 | #include <memory> |
| 6 | #include <string> |
| 7 | |
| 8 | #include "../uw/background.hh" |
| 9 | |
| 10 | namespace fe { |
| 11 | class ClickableBox : public Fl_Box { |
| 12 | public: |
| 13 | ClickableBox(int X, int Y, int W, int H, const char *L = 0) |
| 14 | : Fl_Box(X, Y, W, H, L), imagePath{ "" }, isSelected{ false } {} |
| 15 | |
| 16 | void setImagePath(const std::string &path) { imagePath = path; } |
| 17 | std::string getImagePath() const { return imagePath; } |
| 18 | |
| 19 | int handle(int event) override; |
| 20 | void draw() override; |
| 21 | |
| 22 | private: |
| 23 | std::string imagePath; |
| 24 | std::unique_ptr<uw::Background> background; |
| 25 | bool isSelected; |
| 26 | |
| 27 | static ClickableBox *lastSelected; |
| 28 | |
| 29 | void alterXinitrc(const std::string &npath); |
| 30 | }; |
| 31 | } |