#pragma once

#include <FL/Fl_Box.H>

#include <memory>
#include <string>

#include "../uw/background.hh"

namespace fe {
  class ClickableBox : public Fl_Box {
    public:
      ClickableBox(int X, int Y, int W, int H, const char *L = 0)
        : Fl_Box(X, Y, W, H, L), imagePath{ "" }, isSelected{ false } {}

      void setImagePath(const std::string &path) { imagePath = path; }
      std::string getImagePath() const { return imagePath; }

      int handle(int event) override;
      void draw() override;

    private:
      std::string imagePath;
      std::unique_ptr<uw::Background> background;
      bool isSelected;

      static ClickableBox *lastSelected;

      void alterXinitrc(const std::string &npath);
  };
}
