Layouts (#189)
* Layout WIP * Widgets/BoxLayout: Fix layout algorithm * Widgets/BoxLayout: Fix box layout algorithm for good * SDK/Widgets: Remove padding * Sdk/Widgets: Make use of minimum/preferred size * Sdk/TextAreaWidget: Add Minimum/PreferredSize to TextArea * Sdk/Widgets: Add height/width variants of get/set fixed, maximum, minimum and preferred size methods * Sdk/BoxLayout: Remove useless code * Sdk/TextAreaWidget: Fix compilation * Widgets/TextAreaWidget: Fix cursor position
This commit is contained in:
48
SDK/include/NDK/Widgets/BoxLayout.hpp
Normal file
48
SDK/include/NDK/Widgets/BoxLayout.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_WIDGETS_BOXLAYOUT_HPP
|
||||
#define NDK_WIDGETS_BOXLAYOUT_HPP
|
||||
|
||||
#include <NDK/Prerequisites.hpp>
|
||||
#include <NDK/BaseWidget.hpp>
|
||||
#include <NDK/Widgets/Enums.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class NDK_API BoxLayout : public BaseWidget
|
||||
{
|
||||
public:
|
||||
inline BoxLayout(BaseWidget* parent, BoxLayoutOrientation orientation);
|
||||
BoxLayout(const BoxLayout&) = delete;
|
||||
BoxLayout(BoxLayout&&) = default;
|
||||
~BoxLayout() = default;
|
||||
|
||||
void Layout() override;
|
||||
|
||||
BoxLayout& operator=(const BoxLayout&) = delete;
|
||||
BoxLayout& operator=(BoxLayout&&) = default;
|
||||
|
||||
private:
|
||||
struct ChildInfo
|
||||
{
|
||||
BaseWidget* widget;
|
||||
bool isConstrained;
|
||||
float maximumSize;
|
||||
float minimumSize;
|
||||
float size;
|
||||
};
|
||||
|
||||
std::vector<ChildInfo> m_childInfos;
|
||||
BoxLayoutOrientation m_orientation;
|
||||
float m_spacing;
|
||||
};
|
||||
}
|
||||
|
||||
#include <NDK/Widgets/BoxLayout.inl>
|
||||
|
||||
#endif // NDK_WIDGETS_BOXLAYOUT_HPP
|
||||
Reference in New Issue
Block a user