From 80b76666074aa94f165e3db7b3dda2145ca6efc0 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 21 Mar 2024 22:39:57 +0100 Subject: unstable, kernel+api: important breaking changes. Signed-off-by: Amlal El Mahrouss --- Public/Kits/System.Graphics/.gitkeep | 0 Public/Kits/System.Graphics/Core.cxx | 14 -- Public/Kits/System.Graphics/Core.hxx | 185 -------------------------- Public/Kits/System.Graphics/Dim2d.cxx | 20 --- Public/Kits/System.Graphics/Dim2d.hxx | 38 ------ Public/Kits/System.Graphics/Frame.cxx | 18 --- Public/Kits/System.Graphics/Frame.hxx | 60 --------- Public/Kits/System.Graphics/Makefile | 20 --- Public/Kits/System.Graphics/Stylesheet.hxx | 50 ------- Public/Kits/System.Graphics/compile_flags.txt | 4 - 10 files changed, 409 deletions(-) delete mode 100644 Public/Kits/System.Graphics/.gitkeep delete mode 100644 Public/Kits/System.Graphics/Core.cxx delete mode 100644 Public/Kits/System.Graphics/Core.hxx delete mode 100644 Public/Kits/System.Graphics/Dim2d.cxx delete mode 100644 Public/Kits/System.Graphics/Dim2d.hxx delete mode 100644 Public/Kits/System.Graphics/Frame.cxx delete mode 100644 Public/Kits/System.Graphics/Frame.hxx delete mode 100644 Public/Kits/System.Graphics/Makefile delete mode 100644 Public/Kits/System.Graphics/Stylesheet.hxx delete mode 100644 Public/Kits/System.Graphics/compile_flags.txt (limited to 'Public/Kits/System.Graphics') diff --git a/Public/Kits/System.Graphics/.gitkeep b/Public/Kits/System.Graphics/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/Public/Kits/System.Graphics/Core.cxx b/Public/Kits/System.Graphics/Core.cxx deleted file mode 100644 index 9a4ef7a7..00000000 --- a/Public/Kits/System.Graphics/Core.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: Core.cxx - Purpose: - - Revision History: - - 31/01/24: Added file (amlel) - -------------------------------------------- */ - -#include diff --git a/Public/Kits/System.Graphics/Core.hxx b/Public/Kits/System.Graphics/Core.hxx deleted file mode 100644 index a453e095..00000000 --- a/Public/Kits/System.Graphics/Core.hxx +++ /dev/null @@ -1,185 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: Core.hxx - Purpose: - - Revision History: - - 31/01/24: Added file (amlel) - 08/02/24: Update Form to GForm. (amlel) - -------------------------------------------- */ - -#pragma once - -#include -#include -#include -#include -#include - -#define $() HCore::GApplication::Shared()->Document() - -#ifndef __EXPORT_LIB -#define G_API __attribute__((pef_container(".IMPORT"))) -#else -#define G_API __attribute__((pef_container(".EXPORT"))) -#endif // ifdef __EXPORT_LIB - -namespace System::Graphics { -template -class GAction; - -class GString; -class GNumber; -class GVector2; -class GBoolean; -class GDocument; -class GApplication; -class GFrame; - -class G_API GBoolean { - private: - explicit GBoolean() : m_Value(false) {} - - HCore::Boolean m_Value; - - friend class GForm; - - public: - static const GBoolean Construct(HCore::StringView& sw, HCore::Boolean value) { - GBoolean boolean; - boolean.m_Value = value; - - return boolean; - } -}; - -template -class G_API GAction { - explicit GAction(HCore::StringView& sw) { m_Name = sw; } - - HCore::StringView m_Name; - void (*m_Action)(T&&... args); - - friend class GForm; - - public: - static const GAction Construct(HCore::StringView& sw, - void (*action)(T&&... args)) { - GAction actcls{sw}; - actcls.m_Action = action; - - return actcls; - } -}; - -class G_API GVector2 { - explicit GVector2(HCore::StringView& sw) : m_Vec2() {} - - HCore::Array m_Vec2; - - friend class GForm; - - public: - static const GVector2 Construct(HCore::StringView& sw, - HCore::Array& vec2) { - GVector2 vec{sw}; - vec.m_Vec2 = vec2; - - return vec; - } -}; - -class G_API GNumber { - HCore::Int m_Number{0}; - friend class GForm; - - public: - static const GNumber Construct(HCore::Int& number) { - GNumber num; - num.m_Number = number; - - return num; - } -}; - -class G_API GString { - explicit GString(HCore::StringView& content) { - m_Content = new HCore::StringView(); - *m_Content = content; - } - - HCore::StringView* m_Content; - - friend class GForm; - - public: - static const GString Construct(HCore::StringView& value) { - GString str{value}; - return str; - } -}; - -class G_API GApplication final { - public: - explicit GApplication() = default; - ~GApplication() = default; - - HCORE_COPY_DEFAULT(GApplication); - - GDocument* Document() noexcept { return nullptr; } - - static GApplication* Shared() noexcept { - STATIC GApplication* kApp = nullptr; - - if (!kApp) kApp = new GApplication(); - - return kApp; - } -}; - -class G_API GDocument final { - public: - explicit GDocument(HCore::StringView& sv) : mString(GString::Construct(sv)) {} - ~GDocument() = default; - - HCORE_COPY_DEFAULT(GDocument); - - GFrame** GetAddressOf() noexcept { return &mFrame; } - GFrame* Get() noexcept { return mFrame; } - - GString& Name() { return mString; } - - private: - GFrame* mFrame{nullptr}; - GString mString; -}; - -class GException final { - public: - explicit GException() = default; - ~GException() = default; - - public: - HCORE_COPY_DEFAULT(GException); - - public: - const char* Name() { return "User Interface error."; } - const char* Reason() { return mReason; } - - private: - const char* mReason{"System.Graphics: Graphics exception. Check HError."}; -}; - -template -inline GFrameType* frame_cast(GFrameBase* Frame) { - if (!dynamic_cast(Frame)) { - throw GException(); - } - - return dynamic_cast(Frame); -} -} // namespace System::Graphics diff --git a/Public/Kits/System.Graphics/Dim2d.cxx b/Public/Kits/System.Graphics/Dim2d.cxx deleted file mode 100644 index 5925660d..00000000 --- a/Public/Kits/System.Graphics/Dim2d.cxx +++ /dev/null @@ -1,20 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: Dim2d.cpp - Purpose: - - Revision History: - - 31/01/24: Added file (amlel) - -------------------------------------------- */ - -#include - -namespace System::Graphics { -HCore::UInt& Dim2d::X() { return m_X; } - -HCore::UInt& Dim2d::Y() { return m_Y; } -} // namespace System::Graphics diff --git a/Public/Kits/System.Graphics/Dim2d.hxx b/Public/Kits/System.Graphics/Dim2d.hxx deleted file mode 100644 index 77d42c90..00000000 --- a/Public/Kits/System.Graphics/Dim2d.hxx +++ /dev/null @@ -1,38 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: Dim2d.hpp - Purpose: - - Revision History: - - 31/01/24: Added file (amlel) - 3/10/24: Remname extension to .hxx - -------------------------------------------- */ - -#ifndef __DIM2D__ -#define __DIM2D__ - -#include - -namespace System::Graphics { -class G_API Dim2d final { - public: - explicit Dim2d() = delete; - explicit Dim2d(const HCore::UInt& x, const HCore::UInt& y) : m_X(x), m_Y(y) {} - - Dim2d& operator=(const Dim2d&) = default; - Dim2d(const Dim2d&) = default; - - HCore::UInt& X(); - HCore::UInt& Y(); - - private: - HCore::UInt m_X{0}; - HCore::UInt m_Y{0}; -}; -} // namespace System::Graphics - -#endif /* ifndef __DIM2D__ */ diff --git a/Public/Kits/System.Graphics/Frame.cxx b/Public/Kits/System.Graphics/Frame.cxx deleted file mode 100644 index ddb7b5ce..00000000 --- a/Public/Kits/System.Graphics/Frame.cxx +++ /dev/null @@ -1,18 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: Frame.cpp - Purpose: - - Revision History: - - 31/01/24: Added file (amlel) - -------------------------------------------- */ - -#include - -namespace System::Graphics { - -} // namespace System::Graphics diff --git a/Public/Kits/System.Graphics/Frame.hxx b/Public/Kits/System.Graphics/Frame.hxx deleted file mode 100644 index 318f01cd..00000000 --- a/Public/Kits/System.Graphics/Frame.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: Frame.hxx - Purpose: - - Revision History: - - 31/01/24: Added file (amlel) - -------------------------------------------- */ - -#pragma once - -#include -#include -#include -#include - -namespace System::Graphics { -class G_API GFrame { - public: - explicit GFrame(GFrame* parent = nullptr) : m_ParentFrame(parent) {} - ~GFrame() {} - - GFrame& operator=(const GFrame&) = default; - GFrame(const GFrame&) = default; - - virtual void Update() { - if (m_Frames.Count() == 0) return; - - for (DWORD x = 0; x < m_Frames.Count(); ++x) { - if (!m_Frames[x]->ShouldBeUpdated()) continue; - - m_Frames[x]->Update(); - } - - this->Paint(); - } - - virtual void UpdateInput() { - if (m_Frames.Count() == 0) return; - - for (DWORD x = 0; x < m_Frames.Count(); ++x) { - if (!m_Frames[x]->ShouldBeUpdated()) continue; - - m_Frames[x]->UpdateInput(); - } - } - - virtual bool ShouldBeUpdated() { return false; } - - virtual void Paint() {} - - private: - HCore::MutableArray m_Frames; - GFrame* m_ParentFrame{nullptr}; -}; -} // namespace System::Graphics diff --git a/Public/Kits/System.Graphics/Makefile b/Public/Kits/System.Graphics/Makefile deleted file mode 100644 index 1530f699..00000000 --- a/Public/Kits/System.Graphics/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -################################################## -# (C) Mahrouss Logic, 2024, all rights reserved. -# This is the System.Graphics Makefile. -################################################## - -CC=x86_64-w64-mingw32-g++ -CCFLAGS=-shared -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -OUTPUT=System.Graphics.dll - -.PHONY: build-gfx -build-gfx: - $(CC) -I../ -I$(HOME) -I../../../Private/ $(CCFLAGS) *.cxx -o $(OUTPUT) - -.PHONY: all -all: build-gfx - @echo "[System.Graphics.dll] Build done." - -.PHONY: clean -clean: - rm -f *.o diff --git a/Public/Kits/System.Graphics/Stylesheet.hxx b/Public/Kits/System.Graphics/Stylesheet.hxx deleted file mode 100644 index f4106a7b..00000000 --- a/Public/Kits/System.Graphics/Stylesheet.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: Stylesheet.hxx - Purpose: - - Revision History: - - 08/02/24: Added file (amlel) - -------------------------------------------- */ - -#pragma once - -/// TODO: Stylesheets for GUI. - -#include -#include -#include - -namespace HCore { -class G_API GStylesheet final { - public: - explicit GStylesheet() = default; - ~GStylesheet() = default; - - HCORE_COPY_DEFAULT(GStylesheet); - - MutableArray& Props() { return mProps; } - - private: - MutableArray mProps; -}; - -class StylesheetParser final { - public: - static MutableArray FromBlob(Char* Blob, SizeT BlobSz) { - MutableArray stylesheet; - - if (!Blob || BlobSz < 1) return stylesheet; - - for (auto BlobIndex = 0UL; BlobIndex < BlobSz; ++BlobIndex) { - - } - - return stylesheet; - } -}; -} // namespace HCore diff --git a/Public/Kits/System.Graphics/compile_flags.txt b/Public/Kits/System.Graphics/compile_flags.txt deleted file mode 100644 index 6e721e73..00000000 --- a/Public/Kits/System.Graphics/compile_flags.txt +++ /dev/null @@ -1,4 +0,0 @@ --I./ --I../ --I../../../Private --std=c++20 -- cgit v1.2.3