// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Widgets module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_WIDGETS_CHECKBOXWIDGET_HPP #define NAZARA_WIDGETS_CHECKBOXWIDGET_HPP #include #include #include #include #include #include namespace Nz { class NAZARA_WIDGETS_API CheckboxWidget : public BaseWidget { public: CheckboxWidget(BaseWidget* parent); CheckboxWidget(const CheckboxWidget&) = delete; CheckboxWidget(CheckboxWidget&&) = delete; ~CheckboxWidget() = default; inline void EnableTristate(bool enabled); inline bool IsTristateEnabled() const; inline void SetState(bool checkboxState); void SetState(CheckboxState checkboxState); inline void SwitchToNextState(); CheckboxWidget& operator=(const CheckboxWidget&) = delete; CheckboxWidget& operator=(CheckboxWidget&&) = delete; NazaraSignal(OnCheckboxStateUpdate, const CheckboxWidget* /*button*/, CheckboxState /*newState*/); private: void Layout() override; void OnMouseEnter() override; bool OnMouseButtonPress(int x, int y, Mouse::Button button) override; bool OnMouseButtonRelease(int x, int y, Mouse::Button button) override; void OnMouseExit() override; void OnRenderLayerUpdated(int baseRenderLayer) override; std::unique_ptr m_style; CheckboxState m_state; bool m_isTristateEnabled; }; } #include #endif // NAZARA_WIDGETS_CHECKBOXWIDGET_HPP