// // Created by Даниил Виноградов on 23.01.2025. // #pragma once #include #include #include namespace NXKit { enum class UIButtonStyle { plain, gray, tinted, filled }; class UIButton: public UIControl { public: static std::shared_ptr init() { return new_shared(); } explicit UIButton(UIButtonStyle style = UIButtonStyle::plain); void tintColorDidChange() override; std::string text() { return _titleLabel->text(); } void setText(const std::string& text); std::shared_ptr image() { return _imageView->image(); } void setImage(const std::shared_ptr& image); std::shared_ptr titleLabel() { return _titleLabel; } std::shared_ptr imageView() { return _imageView; } void baseScaleMultiplierDidChange() override; // void willGainFocus() override; // void willLoseFocus() override; void applyStyle(UIButtonStyle style); bool applyXMLAttribute(const std::string& name, const std::string& value) override; private: std::shared_ptr _titleLabel; std::shared_ptr _imageView; }; }