2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2019-10-02 21:24:29 +03:00
|
|
|
#pragma once
|
|
|
|
|
2020-02-06 22:33:02 +03:00
|
|
|
#include <LibGUI/Widget.h>
|
2019-10-02 21:24:29 +03:00
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
class LazyWidget : public Widget {
|
|
|
|
C_OBJECT(LazyWidget)
|
2019-10-02 21:24:29 +03:00
|
|
|
public:
|
2020-02-02 17:07:41 +03:00
|
|
|
virtual ~LazyWidget() override;
|
2019-10-02 21:24:29 +03:00
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
Function<void(LazyWidget&)> on_first_show;
|
2019-10-02 21:24:29 +03:00
|
|
|
|
|
|
|
protected:
|
2020-02-23 14:07:13 +03:00
|
|
|
LazyWidget();
|
2019-10-02 21:24:29 +03:00
|
|
|
|
|
|
|
private:
|
2020-02-02 17:07:41 +03:00
|
|
|
virtual void show_event(ShowEvent&) override;
|
2019-10-02 21:24:29 +03:00
|
|
|
|
|
|
|
bool m_has_been_shown { false };
|
|
|
|
};
|
2020-02-02 17:07:41 +03:00
|
|
|
}
|