LazyWidget.h 531 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2022, the SerenityOS developers.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibGUI/Widget.h>
  9. namespace GUI {
  10. class LazyWidget : public Widget {
  11. C_OBJECT(LazyWidget)
  12. public:
  13. virtual ~LazyWidget() override = default;
  14. Function<void(LazyWidget&)> on_first_show;
  15. protected:
  16. LazyWidget() = default;
  17. private:
  18. virtual void show_event(ShowEvent&) override;
  19. bool m_has_been_shown { false };
  20. };
  21. }