2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
2022-02-26 10:50:04 -07:00
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2020-01-18 09:38:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-02-10 11:07:13 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-02-16 09:17:49 +01:00
|
|
|
#include <LibGUI/Forward.h>
|
2020-02-06 20:33:02 +01:00
|
|
|
#include <LibGUI/Layout.h>
|
2020-02-16 09:17:49 +01:00
|
|
|
#include <LibGfx/Orientation.h>
|
2019-02-10 11:07:13 +01:00
|
|
|
|
2020-02-02 15:07:41 +01:00
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
|
|
class BoxLayout : public Layout {
|
2020-03-05 09:21:46 +01:00
|
|
|
C_OBJECT(BoxLayout);
|
2020-09-18 09:49:51 +02:00
|
|
|
|
2019-02-10 11:07:13 +01:00
|
|
|
public:
|
2022-02-26 10:50:04 -07:00
|
|
|
virtual ~BoxLayout() override = default;
|
2019-02-10 11:07:13 +01:00
|
|
|
|
2020-02-16 09:17:49 +01:00
|
|
|
Gfx::Orientation orientation() const { return m_orientation; }
|
2019-02-10 11:07:13 +01:00
|
|
|
|
2020-02-02 15:07:41 +01:00
|
|
|
virtual void run(Widget&) override;
|
2022-06-12 23:04:46 +02:00
|
|
|
virtual UISize preferred_size() const override;
|
2022-06-12 22:47:50 +02:00
|
|
|
virtual UISize min_size() const override;
|
2019-02-10 11:07:13 +01:00
|
|
|
|
2020-03-05 09:21:46 +01:00
|
|
|
protected:
|
|
|
|
|
explicit BoxLayout(Gfx::Orientation);
|
|
|
|
|
|
2019-02-10 11:07:13 +01:00
|
|
|
private:
|
2020-02-16 09:17:49 +01:00
|
|
|
Gfx::Orientation m_orientation;
|
2019-02-10 11:07:13 +01:00
|
|
|
};
|
2020-02-02 09:48:11 +01:00
|
|
|
|
2020-02-06 14:44:13 +01:00
|
|
|
class VerticalBoxLayout final : public BoxLayout {
|
2020-03-05 09:21:46 +01:00
|
|
|
C_OBJECT(VerticalBoxLayout);
|
2020-09-18 09:49:51 +02:00
|
|
|
|
2021-10-31 23:38:04 +01:00
|
|
|
private:
|
2020-02-06 14:44:13 +01:00
|
|
|
explicit VerticalBoxLayout()
|
2020-02-16 09:17:49 +01:00
|
|
|
: BoxLayout(Gfx::Orientation::Vertical)
|
2020-02-02 09:48:11 +01:00
|
|
|
{
|
|
|
|
|
}
|
2022-02-26 10:50:04 -07:00
|
|
|
virtual ~VerticalBoxLayout() override = default;
|
2020-02-02 09:48:11 +01:00
|
|
|
};
|
|
|
|
|
|
2020-02-06 14:44:13 +01:00
|
|
|
class HorizontalBoxLayout final : public BoxLayout {
|
2020-03-05 09:21:46 +01:00
|
|
|
C_OBJECT(HorizontalBoxLayout);
|
2020-09-18 09:49:51 +02:00
|
|
|
|
2021-10-31 23:38:04 +01:00
|
|
|
private:
|
2020-02-06 14:44:13 +01:00
|
|
|
explicit HorizontalBoxLayout()
|
2020-02-16 09:17:49 +01:00
|
|
|
: BoxLayout(Gfx::Orientation::Horizontal)
|
2020-02-02 09:48:11 +01:00
|
|
|
{
|
|
|
|
|
}
|
2022-02-26 10:50:04 -07:00
|
|
|
virtual ~HorizontalBoxLayout() override = default;
|
2020-02-02 09:48:11 +01:00
|
|
|
};
|
2020-02-02 15:07:41 +01:00
|
|
|
|
|
|
|
|
}
|