SDK/Widgets: Add buttons (not clickable atm)

Former-commit-id: b90e4ddc0fd7dd18efd480243639d4e7c76c719b [formerly 2ff8f6dc8bb21873734f6d7a3b4bba6fb6edf24d] [formerly 0268cc083e0a8c6285cf05eead7b1a375ae5466d [formerly a4bdefb8421a31c7c62c293f128253de0fa5c6da]]
Former-commit-id: 8788b5116384b23544d620c28105516d8c2eb6a1 [formerly 785d6986573cd5483a37697b3f13651fa9ffa5b2]
Former-commit-id: 2d424bb16eb5f01381b3a6b315bce258092542c1
This commit is contained in:
Lynix
2016-09-13 18:22:40 +02:00
parent b8955b3a58
commit 81e819567b
6 changed files with 122 additions and 7 deletions

View File

@@ -0,0 +1,49 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#pragma once
#ifndef NDK_WIDGETS_BUTTONWIDGET_HPP
#define NDK_WIDGETS_BUTTONWIDGET_HPP
#include <NDK/Prerequesites.hpp>
#include <NDK/BaseWidget.hpp>
#include <Nazara/Utility/AbstractTextDrawer.hpp>
#include <Nazara/Graphics/Sprite.hpp>
#include <Nazara/Graphics/TextSprite.hpp>
namespace Ndk
{
class World;
class NDK_API ButtonWidget : public BaseWidget
{
public:
ButtonWidget(const WorldHandle& world, BaseWidget* parent = nullptr);
ButtonWidget(const ButtonWidget&) = delete;
ButtonWidget(ButtonWidget&&) = default;
~ButtonWidget() = default;
//virtual ButtonWidget* Clone() const = 0;
void ResizeToContent();
inline void UpdateText(const Nz::AbstractTextDrawer& drawer);
ButtonWidget& operator=(const ButtonWidget&) = delete;
ButtonWidget& operator=(ButtonWidget&&) = default;
private:
void Layout() override;
EntityHandle m_textEntity;
EntityHandle m_gradientEntity;
Nz::SpriteRef m_gradientSprite;
Nz::TextSpriteRef m_textSprite;
};
}
#include <NDK/Widgets/ButtonWidget.inl>
#endif // NDK_WIDGETS_BUTTONWIDGET_HPP

View File

@@ -0,0 +1,13 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <NDK/Widgets/ButtonWidget.hpp>
namespace Ndk
{
inline void ButtonWidget::UpdateText(const Nz::AbstractTextDrawer& drawer)
{
m_textSprite->Update(drawer);
}
}