summaryrefslogtreecommitdiffhomepage
path: root/Public/Developer/SystemLib/Headers
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-17 09:54:17 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-17 10:08:50 +0200
commitc0099ab36bf9606c5503ceb0fa0d5b64f71c7203 (patch)
tree1c310521280e3c995981a903895c7c2e124582ee /Public/Developer/SystemLib/Headers
parentf93fb4439aaa865d998a790348313a4c7163bb8b (diff)
Unrelated: These changes are important but related to nothing.
- Window now becomes Wm, as in Window manager. - Fix entrypoint for FragLib. - Remove CoreEvents to be replaced with Event Server, reworked Display Server. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Public/Developer/SystemLib/Headers')
-rw-r--r--Public/Developer/SystemLib/Headers/Defines.h2
-rw-r--r--Public/Developer/SystemLib/Headers/Dialog.h7
-rw-r--r--Public/Developer/SystemLib/Headers/Draw.h2
-rw-r--r--Public/Developer/SystemLib/Headers/File.h13
-rw-r--r--Public/Developer/SystemLib/Headers/Math.h11
-rw-r--r--Public/Developer/SystemLib/Headers/TrueType.h2
-rw-r--r--Public/Developer/SystemLib/Headers/Wm.h (renamed from Public/Developer/SystemLib/Headers/Window.h)61
7 files changed, 64 insertions, 34 deletions
diff --git a/Public/Developer/SystemLib/Headers/Defines.h b/Public/Developer/SystemLib/Headers/Defines.h
index 7bd40c76..3be7552f 100644
--- a/Public/Developer/SystemLib/Headers/Defines.h
+++ b/Public/Developer/SystemLib/Headers/Defines.h
@@ -193,7 +193,7 @@ using StrType = CharacterTypeUTF8[N];
/// @brief Get app singleton.
/// @param
/// @return
-CA_EXTERN_C ApplicationRef RtGetApp(VoidType);
+CA_EXTERN_C ApplicationRef RtGetAppPointer(VoidType);
/// @brief Get argument count
/// @param
diff --git a/Public/Developer/SystemLib/Headers/Dialog.h b/Public/Developer/SystemLib/Headers/Dialog.h
index 872eae5d..800f56db 100644
--- a/Public/Developer/SystemLib/Headers/Dialog.h
+++ b/Public/Developer/SystemLib/Headers/Dialog.h
@@ -6,7 +6,7 @@
#pragma once
-#include <Headers/Window.h>
+#include <Headers/Wm.h>
struct _DialogPort;
struct _DialogPoint;
@@ -22,10 +22,11 @@ typedef struct _DialogPoint {
typedef struct _DialogPort {
WordType dlgPort;
WordType dlgKind;
- BooleanType dlgVisible;
- BooleanType dlgMoving;
+ BooleanType dlgVisible : 1;
+ BooleanType dlgMoving : 1;
DialogPoint dlgPosition;
WmDialogFn dlgProc;
+ struct _WmGFX* dlgGfx;
struct _WindowPort* parentPort;
} DialogPort;
diff --git a/Public/Developer/SystemLib/Headers/Draw.h b/Public/Developer/SystemLib/Headers/Draw.h
index 3060db9d..38f99e7d 100644
--- a/Public/Developer/SystemLib/Headers/Draw.h
+++ b/Public/Developer/SystemLib/Headers/Draw.h
@@ -6,7 +6,7 @@
#pragma once
-#include <Headers/Window.h>
+#include <Headers/Wm.h>
/*************************************************************
*
diff --git a/Public/Developer/SystemLib/Headers/File.h b/Public/Developer/SystemLib/Headers/File.h
index 5e58d104..234c33da 100644
--- a/Public/Developer/SystemLib/Headers/File.h
+++ b/Public/Developer/SystemLib/Headers/File.h
@@ -14,8 +14,8 @@ typedef QWordType FSRef;
/// @brief Opens a new file.
/// @param path where to find it.
-/// @param r the restrict (rw, rwe, r+, w+, r, w)
-/// @return
+/// @param rest the restrict (rw, rwe, r+, w+, r, w)
+/// @return FSRef the file.
CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeUTF8* r);
/// @brief Closes the file and flushes it to the said file.
@@ -23,13 +23,15 @@ CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeU
/// @return
CA_EXTERN_C VoidType FsCloseFile(FSRef refFs);
+#define kMaxForkNameLength 256 /* long fork names. */
+
/// @brief A fork information header.
typedef struct _Fork {
PtrVoidType forkData;
SizeType forkSize;
Int32Type forkFlags;
Int32Type forkKind;
- CharacterTypeUTF8 forkName[256];
+ CharacterTypeUTF8 forkName[kMaxForkNameLength];
} ForkType;
typedef ForkType* FSForkRef;
@@ -40,5 +42,10 @@ typedef ForkType* FSForkRef;
/// @return the fork data.
CA_EXTERN_C FSForkRef FsGetFork(FSRef refFs, const CharacterTypeUTF8* forkName);
+/// @brief Check if the filesystem path is valid.
+/// @return if not return false, or true.
+CA_EXTERN_C BooleanType FsIsValidPath(const CharacterTypeUTF8* path);
+
+/// @note not only limited to, there is code forks, icon forks...
#define FsGetDataFork(refFs) FsGetFork(refFs, "data")
#define FsGetRsrcFork(refFs) FsGetFork(refFs, "rsrc")
diff --git a/Public/Developer/SystemLib/Headers/Math.h b/Public/Developer/SystemLib/Headers/Math.h
new file mode 100644
index 00000000..f6c8f216
--- /dev/null
+++ b/Public/Developer/SystemLib/Headers/Math.h
@@ -0,0 +1,11 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+#include <Headers/Defines.h>
+
+CA_EXTERN_C SizeType MathRand(VoidType);
diff --git a/Public/Developer/SystemLib/Headers/TrueType.h b/Public/Developer/SystemLib/Headers/TrueType.h
index 7f1bed86..6387e58f 100644
--- a/Public/Developer/SystemLib/Headers/TrueType.h
+++ b/Public/Developer/SystemLib/Headers/TrueType.h
@@ -6,7 +6,7 @@
#pragma once
-#include <Headers/Window.h>
+#include <Headers/Wm.h>
/*************************************************************
*
diff --git a/Public/Developer/SystemLib/Headers/Window.h b/Public/Developer/SystemLib/Headers/Wm.h
index ca0b942e..66ed96a3 100644
--- a/Public/Developer/SystemLib/Headers/Window.h
+++ b/Public/Developer/SystemLib/Headers/Wm.h
@@ -10,7 +10,7 @@
/*************************************************************
*
- * File: Window.h
+ * File: Wm.h
* Purpose: Window Manager API for NewOS.
* Date: 3/26/24
*
@@ -24,7 +24,13 @@ struct _WindowPort;
struct _ControlPort;
struct _WmPoint;
-typedef QWordType DCRef;
+/// @brief Window Graphics type.
+typedef struct _WmGFX {
+ UInt32Type Depth;
+ UInt32Type* DataFrame;
+ SizeType DataFrameWidth;
+ SizeType DataFrameHeight;
+} WmGFX, *WmGFXRef;
/// @brief Window procedure type.
typedef VoidType(*WmWindowFn)(struct _WindowPort* port, UInt32Type msg, UIntPtrType pParam, UIntPtrType iParam);
@@ -34,20 +40,21 @@ typedef struct _WmPoint {
PositionType X, Y;
} WmPoint;
+
/// @brief Window port type, can be used to control the window.
typedef struct _WindowPort {
WordType windowPort;
WordType windowKind;
- BooleanType windowVisible;
- BooleanType windowMaximized;
- BooleanType windowMinimized;
- BooleanType windowMoving;
- BooleanType windowDisableClose;
- BooleanType windowDisableMinimize;
+ BooleanType windowVisible : 1;
+ BooleanType windowMaximized : 1;
+ BooleanType windowMinimized : 1;
+ BooleanType windowMoving : 1;
+ BooleanType windowDisableClose : 1;
+ BooleanType windowDisableMinimize : 1;
+ BooleanType windowInvalidate : 1;
WmPoint windowPosition;
WmPoint windowSize;
- BooleanType windowInvalidate;
- DWordType windowClearColor;
+ WmGFXRef windowGfx;
WmWindowFn windowProc;
struct _WindowPort* windowMenuPort; ///! Attached menu to it.
struct _WindowPort* windowParentPort;
@@ -57,10 +64,11 @@ typedef struct _WindowPort {
typedef struct _ControlPort {
WordType controlPort;
WordType controlKind;
- BooleanType controlVisible;
- BooleanType controlMoving;
+ BooleanType controlVisible : 1;
+ BooleanType controlMoving : 1;
WmPoint controlPosition;
WmWindowFn controlProc;
+ WmGFXRef controlGfx;
WindowPort* parentPort;
} ControlPort;
@@ -107,37 +115,37 @@ CA_EXTERN_C const ColorRef kRgbWhite;
CA_EXTERN_C ControlPort* WmCreateControl(DWordType id);
/// @brief Releases the control
-/// @param id the control ref.
+/// @param ctrlPort the control ref.
/// @return
-CA_EXTERN_C VoidType WmReleaseControl(ControlPort* id);
+CA_EXTERN_C VoidType WmReleaseControl(ControlPort* ctrlPort);
/// @brief Moves a control inside a ControlPort.
-/// @param id the control ref.
+/// @param ctrlPort the control ref.
/// @param where where to move at.
/// @return
-CA_EXTERN_C Int32Type WmSetControlPosition(ControlPort* id, WmPoint where);
+CA_EXTERN_C Int32Type WmSetControlPosition(ControlPort* ctrlPort, WmPoint where);
/// @brief Enable control.
-/// @param id
+/// @param ctrlPort
/// @param enabled
/// @return
-CA_EXTERN_C Int32Type WmSetControlEnabled(ControlPort* id, BooleanType enabled);
+CA_EXTERN_C Int32Type WmSetControlEnabled(ControlPort* ctrlPort, BooleanType enabled);
/// @brief Make control visible.
-/// @param id
+/// @param ctrlPort
/// @param visible
/// @return
-CA_EXTERN_C Int32Type WmSetControlVisible(ControlPort* id, BooleanType visible);
+CA_EXTERN_C Int32Type WmSetControlVisible(ControlPort* ctrlPort, BooleanType visible);
/// @brief Creates a new window.
/// @param name the window name
-/// @param rsrcId the window fork rsrc id.
+/// @param rsrcId the window fork rsrc ctrlPort.
/// @return the window graphics port.
CA_EXTERN_C WindowPort* WmCreateWindow(const CharacterTypeUTF8* name, const DWordType rsrcId);
/// @brief Creates a new menu
/// @param name the menu's name
-/// @param rsrcId the menu fork rsrc id.
+/// @param rsrcId the menu fork rsrc ctrlPort.
/// @return the menu graphics port.
CA_EXTERN_C WindowPort* WmCreateMenu(const CharacterTypeUTF8* name, const DWordType rsrcId);
@@ -151,14 +159,17 @@ CA_EXTERN_C VoidType WmReleaseWindow(WindowPort* port);
/// @return void
CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* port);
-/// @brief Moves a window on the desktop. (menu arent movable, will return kErrIncompatible is menu is provided.)
-/// @param id the gfx port.
+/// @brief Moves a window on the desktop. (menu arent movable, will return kErrIncompatible if menu is provided.)
+/// @param wndPort the gfx port.
/// @param where to move.
/// @return error code.
-CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* id, WmPoint where);
+CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* wndPort, WmPoint where);
/// @brief Get the NewOS about window.
/// @return The window port of it.
/// @note The reason that this is not a window is for it to run without blocking the UI.
CA_EXTERN_C WindowPort* WmGetOSDlg(void);
+/// @brief Draws a blur effect on the window.
+/// @param wndPort the window port.
+CA_EXTERN_C VoidType WmBlur(WindowPort* wndPort); \ No newline at end of file