summaryrefslogtreecommitdiffhomepage
path: root/Public/Developer/SystemLib/Headers
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-05 21:40:26 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-05 21:40:34 +0200
commit5152c2282a1a680a272322f0bd3275fdf43e1530 (patch)
tree9cb1272d1eb8e34212148408aba0bc2bc45c58d4 /Public/Developer/SystemLib/Headers
parent21fe8d0b7d48e92ba0d45c084bf868c94bb67cd7 (diff)
WiP: Bump.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Developer/SystemLib/Headers')
-rw-r--r--Public/Developer/SystemLib/Headers/Defines.h6
-rw-r--r--Public/Developer/SystemLib/Headers/Dialog.h26
-rw-r--r--Public/Developer/SystemLib/Headers/Draw.h20
-rw-r--r--Public/Developer/SystemLib/Headers/TrueType.h10
-rw-r--r--Public/Developer/SystemLib/Headers/Window.h31
5 files changed, 69 insertions, 24 deletions
diff --git a/Public/Developer/SystemLib/Headers/Defines.h b/Public/Developer/SystemLib/Headers/Defines.h
index d3b6b793..7bd40c76 100644
--- a/Public/Developer/SystemLib/Headers/Defines.h
+++ b/Public/Developer/SystemLib/Headers/Defines.h
@@ -51,6 +51,12 @@ typedef CharacterTypeUTF8* PtrCharacterType;
typedef void* PtrVoidType;
typedef void VoidType;
+#ifdef __SINGLE_PRECISION__
+typedef float PositionType;
+#else
+typedef double PositionType;
+#endif
+
typedef __UINTPTR_TYPE__ UIntPtrType;
typedef __INTPTR_TYPE__ IntPtrType;
typedef __UINT64_TYPE__ UInt64Type;
diff --git a/Public/Developer/SystemLib/Headers/Dialog.h b/Public/Developer/SystemLib/Headers/Dialog.h
index b2bc93a1..0c0e4dbc 100644
--- a/Public/Developer/SystemLib/Headers/Dialog.h
+++ b/Public/Developer/SystemLib/Headers/Dialog.h
@@ -8,6 +8,32 @@
#include <Headers/Window.h>
+struct _DialogPort;
+struct _DialogPoint;
+
+/// @brief Dialog procedure type.
+typedef VoidType(*WmDialogProc)(struct _DialogPort* port, UInt32Type msg, UIntPtrType pParam, UIntPtrType iParam);
+
+/// @brief A point, can represent the size, position of a window.
+typedef struct _DialogPoint {
+ PositionType X, Y;
+} DialogPoint;
+
+typedef struct _DialogPort {
+ WordType dlgPort;
+ WordType dlgKind;
+ BooleanType dlgVisible;
+ BooleanType dlgMoving;
+ DialogPoint dlgPosition;
+ WmDialogProc dlgProc;
+ struct _WindowPort* parentPort;
+} DialogPort;
+
+/// @brief Creates a new dialog from a rsrc fork id.
+/// @param rsrcId the resource id.
+/// @return the dialog port.
+CA_EXTERN_C DialogPort* DlgCreateFromRsrc(QWordType rsrcId);
+
/// @brief Shows an message box according to format.
/// @param title the message box title
/// @param format the format
diff --git a/Public/Developer/SystemLib/Headers/Draw.h b/Public/Developer/SystemLib/Headers/Draw.h
new file mode 100644
index 00000000..3060db9d
--- /dev/null
+++ b/Public/Developer/SystemLib/Headers/Draw.h
@@ -0,0 +1,20 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+#include <Headers/Window.h>
+
+/*************************************************************
+ *
+ * File: Draw.h
+ * Purpose: Draw Manager API for NewOS.
+ * Date: 3/26/24
+ *
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ *************************************************************/
+
diff --git a/Public/Developer/SystemLib/Headers/TrueType.h b/Public/Developer/SystemLib/Headers/TrueType.h
index fb68298a..7f1bed86 100644
--- a/Public/Developer/SystemLib/Headers/TrueType.h
+++ b/Public/Developer/SystemLib/Headers/TrueType.h
@@ -10,7 +10,7 @@
/*************************************************************
*
- * File: TrueType.hxx
+ * File: TrueType.h
* Purpose: TrueType font implementation for NewOS.
* Date: 3/26/24
*
@@ -35,10 +35,4 @@ CA_EXTERN_C VoidType FnDisposeFont(TTFFontRef fon);
/// @return
CA_EXTERN_C PtrVoidType FnGetGlyph(TTFFontRef fon, UInt32Type utfCh);
-/// @brief Write a character to the window.
-/// @param fon the font.
-/// @param port the window port.
-/// @param pos the position of where to put the character.
-/// @return
-CA_EXTERN_C VoidType FnWriteCharacter(TTFFontRef fon, WindowPort* port, PositionType pos);
-
+/// TODO: Get font metadata. \ No newline at end of file
diff --git a/Public/Developer/SystemLib/Headers/Window.h b/Public/Developer/SystemLib/Headers/Window.h
index 1fd9e9e3..58b10d8e 100644
--- a/Public/Developer/SystemLib/Headers/Window.h
+++ b/Public/Developer/SystemLib/Headers/Window.h
@@ -10,7 +10,7 @@
/*************************************************************
*
- * File: Window.hxx
+ * File: Window.h
* Purpose: Window Manager API for NewOS.
* Date: 3/26/24
*
@@ -21,18 +21,14 @@
struct _WmPoint;
struct _WindowPort;
-#ifdef __SINGLE_PRECISION__
-typedef float PositionType;
-#else
-typedef double PositionType;
-#endif
-
struct _ControlPort;
struct _WmPoint;
-struct _WindowPort;
typedef QWordType DCRef;
+/// @brief Window procedure type.
+typedef VoidType(*WmWindowProc)(struct _WindowPort* port, UInt32Type msg, UIntPtrType pParam, UIntPtrType iParam);
+
/// @brief A point, can represent the size, position of a window.
typedef struct _WmPoint {
PositionType X, Y;
@@ -52,6 +48,7 @@ typedef struct _WindowPort {
WmPoint windowSize;
BooleanType windowInvalidate;
DWordType windowClearColor;
+ WmWindowProc windowProc;
struct _WindowPort* windowMenuPort; ///! Attached menu to it.
struct _WindowPort* windowParentPort;
} WindowPort;
@@ -63,9 +60,17 @@ typedef struct _ControlPort {
BooleanType controlVisible;
BooleanType controlMoving;
WmPoint controlPosition;
+ WmWindowProc controlProc;
WindowPort* parentPort;
} ControlPort;
+enum {
+ kWmErrIncompatible = 0x74,
+ kWmErrOutOfMemory,
+ kWmErrInvalidArg,
+ kWmErrNotImplemented,
+};
+
/// @brief Color reference.
typedef UInt32Type ColorRef;
@@ -94,6 +99,7 @@ CA_EXTERN_C const ColorRef kRgbWhite;
#define kControlKindIcon 6
#define kControlKindRadioBox 7
#define kControlKindCheckBox 8
+#define kControlKindUserDefined 9
/// @brief Creates a new control
/// @param id the control rsrc fork.
@@ -121,7 +127,7 @@ CA_EXTERN_C Int32Type WmSetControlEnabled(ControlPort* id, BooleanType enabl
/// @param id
/// @param visible
/// @return
-CA_EXTERN_C Int32Type WmMakeControlVisible(ControlPort* id, BooleanType visible);
+CA_EXTERN_C Int32Type WmSetControlVisible(ControlPort* id, BooleanType visible);
/// @brief Creates a new window.
/// @param name the window name
@@ -164,10 +170,3 @@ CA_EXTERN_C VoidType WmTranslateMessage(WindowPort* port, Int64Type msg);
/// @param id
/// @return
CA_EXTERN_C Int32Type WmDispatchMessage(WindowPort* id);
-
-enum {
- kWmErrIncompatible = 0x74,
- kWmErrOutOfMemory,
- kWmErrInvalidArg,
- kWmErrNotImplemented,
-};