#pragma once
#include "menu.hpp"
//! строка режима растягивания
class item_resize_mode: public MenuItem {
  nocopy(item_resize_mode);
protected:
  utf32 str = {};
  ResizeMode* pResizeMode = nullptr;
  void_callback pFunc = nullptr;
public:
  explicit item_resize_mode(CN(utf32) s, ResizeMode* p, void_callback f=nullptr)
  : str(s), pResizeMode(p), pFunc(f) {
    IFERROR(!pResizeMode, "menu -> pResizeMode is null");
  }
  void print(Font* pFont, Image& dst, int XPos=0, int YPos=0) const override {
    utf32 str_item;
    // TODO localization
    switch (*pResizeMode) {
      case ResizeMode::MULTYPLY: str_item=U"1:1"; break; 
      case ResizeMode::Y_ONLY : str_item=U"Y only"; break; 
      case ResizeMode::ALL: str_item=U"any"; break;
      default: str_item=U"UNK";
    }
    pFont->print(dst, XPos, YPos, str + str_item);
  }
  bool accept() override {
	  *pResizeMode = ResizeMode((int(*pResizeMode) + 1) % int(ResizeMode::MAX));
    if (pFunc)
      return pFunc();
    return true;
  }
}; // item_resize_mode