diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-26 05:16:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-26 05:16:48 +0100 |
| commit | 1cd930c0c72f215101300dfcc5860800a474362d (patch) | |
| tree | 78b3a29c8d9936baaa78b628e0862eb6546c56d8 /Public/Developer/System.Core/Headers | |
| parent | 4bac72356c29f6f92c0d0df40e1aef09a4216d56 (diff) | |
Kernel: Adding IPC support.
Kernel: Adding better framebuffer support.
Kernel: Expose part of CFKit' URL API.
System.Core: Rename most of API types to their <Prefix> with Ref at the end.
System.Core: Add API to Window.hxx
System.Driver: Add Driver SDK.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Developer/System.Core/Headers')
7 files changed, 112 insertions, 26 deletions
diff --git a/Public/Developer/System.Core/Headers/File.hxx b/Public/Developer/System.Core/Headers/File.hxx index 06c2a22e..f76dbb60 100644 --- a/Public/Developer/System.Core/Headers/File.hxx +++ b/Public/Developer/System.Core/Headers/File.hxx @@ -9,13 +9,13 @@ #include <System.Core/Headers/Defines.hxx> +#define kFileOpenInterface 10 +#define kFileAliasInterface 11 + namespace System { class FileInterface; class DirectoryInterface; -typedef IntPtrType SymlinkType; -typedef IntPtrType FileType; -typedef IntPtrType DirectoryType; typedef IntPtrType FSRef; enum { @@ -31,13 +31,17 @@ enum { class FileInterface final { public: explicit FileInterface(const char *path) { - mHandle = kApplicationObject->Invoke(kApplicationObject, kProcessCallOpenHandle, - 0, path); + CA_MUST_PASS(path); + + mHandle = kApplicationObject->Invoke( + kApplicationObject, kProcessCallOpenHandle, kFileOpenInterface, path); } ~FileInterface() { - kApplicationObject->Invoke(kApplicationObject, kProcessCallCloseHandle, 0, - mHandle); + CA_MUST_PASS(kApplicationObject); + + kApplicationObject->Invoke(kApplicationObject, kProcessCallCloseHandle, + kFileOpenInterface, mHandle); } public: @@ -45,17 +49,19 @@ class FileInterface final { public: PtrVoidType Read(UIntPtrType off, SizeType sz) { - return (PtrVoidType)kApplicationObject->Invoke(kApplicationObject, mHandle, 2, - off, sz); + return (PtrVoidType)kApplicationObject->Invoke(kApplicationObject, mHandle, + 2, off, sz); } + PtrVoidType Read(SizeType sz) { - return (PtrVoidType)kApplicationObject->Invoke(kApplicationObject, mHandle, 3, - sz); + return (PtrVoidType)kApplicationObject->Invoke(kApplicationObject, mHandle, + 3, sz); } void Write(PtrVoidType buf, UIntPtrType off, SizeType sz) { kApplicationObject->Invoke(kApplicationObject, mHandle, 4, buf, off, sz); } + void Write(PtrVoidType buf, SizeType sz) { kApplicationObject->Invoke(kApplicationObject, mHandle, 5, buf, sz); } @@ -63,14 +69,21 @@ class FileInterface final { void Seek(UIntPtrType off) { kApplicationObject->Invoke(kApplicationObject, mHandle, 5); } + void Rewind() { kApplicationObject->Invoke(kApplicationObject, mHandle, 6); } public: - const char *MIME(); - void MIME(const char *mime); + const char *MIME() { + return (const char *)kApplicationObject->Invoke(kApplicationObject, mHandle, + 7); + } + + void MIME(const char *mime) { + kApplicationObject->Invoke(kApplicationObject, mHandle, 8, mime); + } private: - FileType mHandle; + FSRef mHandle; }; typedef FileInterface *FilePtr; @@ -93,12 +106,12 @@ class FileException : public SystemException { const char *mReason{"System.Core: FileException: Catastrophic failure!"}; }; -inline IntPtrType MakeSymlink(const char *from, const char *outputWhere) { +inline IntPtrType FSMakeAlias(const char *from, const char *outputWhere) { CA_MUST_PASS(from); CA_MUST_PASS(outputWhere); - return kApplicationObject->Invoke(kApplicationObject, kProcessCallOpenHandle, 1, - from); + return kApplicationObject->Invoke(kApplicationObject, kProcessCallOpenHandle, + kFileAliasInterface, from); } } // namespace System diff --git a/Public/Developer/System.Core/Headers/Heap.hxx b/Public/Developer/System.Core/Headers/Heap.hxx index c134ca4e..8fea34d4 100644 --- a/Public/Developer/System.Core/Headers/Heap.hxx +++ b/Public/Developer/System.Core/Headers/Heap.hxx @@ -12,7 +12,7 @@ namespace System { class HeapException; class HeapInterface; -typedef PtrVoidType PtrHeapType; +typedef PtrVoidType HeapRef; enum { kHeapExpandable = 2, @@ -36,9 +36,9 @@ class HeapInterface final { static HeapInterface *Shared() noexcept; public: - void Delete(PtrHeapType me) noexcept; - SizeType Size(PtrHeapType me) noexcept; - PtrHeapType New(const SizeType &sz, + void Delete(HeapRef me) noexcept; + SizeType Size(HeapRef me) noexcept; + HeapRef New(const SizeType &sz, const DWordType flags = kHeapNoFlags); }; diff --git a/Public/Developer/System.Core/Headers/Window/Image.hxx b/Public/Developer/System.Core/Headers/Window/Image.hxx index 2a02b434..3e445532 100644 --- a/Public/Developer/System.Core/Headers/Window/Image.hxx +++ b/Public/Developer/System.Core/Headers/Window/Image.hxx @@ -6,3 +6,4 @@ #pragma once +#include <System.Core/Headers/Window/Window.hxx> diff --git a/Public/Developer/System.Core/Headers/Window/Menu.hxx b/Public/Developer/System.Core/Headers/Window/Menu.hxx index 2a02b434..3e445532 100644 --- a/Public/Developer/System.Core/Headers/Window/Menu.hxx +++ b/Public/Developer/System.Core/Headers/Window/Menu.hxx @@ -6,3 +6,4 @@ #pragma once +#include <System.Core/Headers/Window/Window.hxx> diff --git a/Public/Developer/System.Core/Headers/Window/Rsrc.hxx b/Public/Developer/System.Core/Headers/Window/Rsrc.hxx index 2a02b434..3e445532 100644 --- a/Public/Developer/System.Core/Headers/Window/Rsrc.hxx +++ b/Public/Developer/System.Core/Headers/Window/Rsrc.hxx @@ -6,3 +6,4 @@ #pragma once +#include <System.Core/Headers/Window/Window.hxx> diff --git a/Public/Developer/System.Core/Headers/Window/TrueType.hxx b/Public/Developer/System.Core/Headers/Window/TrueType.hxx index 62ed1255..3e445532 100644 --- a/Public/Developer/System.Core/Headers/Window/TrueType.hxx +++ b/Public/Developer/System.Core/Headers/Window/TrueType.hxx @@ -5,3 +5,5 @@ ------------------------------------------- */ #pragma once + +#include <System.Core/Headers/Window/Window.hxx> diff --git a/Public/Developer/System.Core/Headers/Window/Window.hxx b/Public/Developer/System.Core/Headers/Window/Window.hxx index 1a8c6cf6..5eb1b3ce 100644 --- a/Public/Developer/System.Core/Headers/Window/Window.hxx +++ b/Public/Developer/System.Core/Headers/Window/Window.hxx @@ -9,15 +9,15 @@ #include <System.Core/Headers/Defines.hxx> /// @file Window.hxx -/// @brief Tracker window manager. +/// @brief Tracker window protocol. /// @author Amlal El Mahrouss. typedef float PositionType; /// @brief A point, can represent the size, position of a window. -typedef struct _Point { +typedef struct _GraphicsPoint { PositionType X, Y; -} Point; +} GraphicsPoint; /// @brief Tracker Graphics port. typedef struct _GraphicsPort { @@ -29,10 +29,78 @@ typedef struct _GraphicsPort { BooleanType windowMoving; BooleanType windowDisableClose; BooleanType windowDisableMinimize; - Point windowPosition; - Point windowSize; + GraphicsPoint windowPosition; + GraphicsPoint windowSize; BooleanType windowInvalidate; DWordType windowClearColor; WordType menuPort; WordType parentPort; } GraphicsPort; + +typedef UInt32Type ColorRef; + +/***********************************************************************************/ +/// Color utils. +/***********************************************************************************/ + +const ColorRef kRgbRed = 0x000000FF; +const ColorRef kRgbGreen = 0x0000FF00; +const ColorRef kRgbBlue = 0x00FF0000; +const ColorRef kRgbBlack = 0x00000000; +const ColorRef kRgbWhite = 0xFFFFFFFF; + +/***********************************************************************************/ +/// Color macro. +/***********************************************************************************/ + +#define RGB32(R, G, B) (ColorRef)(0x##R##G##B) + +#define kGraphicsKindWindow 0 +#define kGraphicsKindDialog 1 +#define kGraphicsKindMenu 2 +#define kGraphicsKindButton 3 +#define kGraphicsKindLabel 4 +#define kGraphicsKindDropdown 5 +#define kGraphicsKindIcon 6 +#define kGraphicsKindRadio 7 +#define kGraphicsKindCheck 7 + +typedef QWordType ControlRef; + +/// @brief Creates a new control +/// @param id the control rsrc fork. +/// @return +CA_EXTERN_C ControlRef CreateControl(const DWordType id); + +/// @brief Releases the control +/// @param id the control ref. +/// @return +CA_EXTERN_C VoidType ReleaseControl(const ControlRef id); + +CA_EXTERN_C BooleanType MoveControl(const ControlRef id, GraphicsPoint where); + +CA_EXTERN_C BooleanType EnableControl(const ControlRef id, BooleanType visible); + +CA_EXTERN_C BooleanType VisibleControl(const ControlRef id, BooleanType visible); + +/// @brief Creates a new window. +/// @param name the window name +/// @param rsrcId the window fork rsrc id. +/// @return the window graphics port. +CA_EXTERN_C GraphicsPort* CreateWindow(const char* name, const DWordType rsrcId); + +/// @brief Creates a new menu +/// @param name the menu's name +/// @param rsrcId the menu fork rsrc id. +/// @return the menu graphics port. +CA_EXTERN_C GraphicsPort* CreateMenu(const char* name, const DWordType rsrcId); + +/// @brief Releases the window. +/// @param port the window port. +/// @return void +CA_EXTERN_C VoidType ReleaseWindow(GraphicsPort* port); + +/// @brief Releases the menu +/// @param port the menu port. +/// @return void +CA_EXTERN_C VoidType ReleaseMenu(GraphicsPort* port); |
