From 7e5be1572c043484293ee0cdd840dd41f54e87ee Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 29 Mar 2024 17:01:55 +0100 Subject: Kernel and SystemLib: See below. What has been done: - Rename most System.Core to SystemLib. - Reworked it's API and the concept of ObjectRef to become the ApplicationRef object. - Remove unused ODF and XIFF file format from tree, ODF will be part of the text editing program. - Update Readme for SystemLib. - Add Support folder on NewFS partitions. What is next: - NewFS filesystem support. - Program loading. - Preemptive scheduler on non-SMP systems using timers. Signed-off-by: Amlal El Mahrouss --- Public/Developer/SystemLib/Sources/Window.c | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Public/Developer/SystemLib/Sources/Window.c (limited to 'Public/Developer/SystemLib/Sources/Window.c') diff --git a/Public/Developer/SystemLib/Sources/Window.c b/Public/Developer/SystemLib/Sources/Window.c new file mode 100644 index 00000000..2527e041 --- /dev/null +++ b/Public/Developer/SystemLib/Sources/Window.c @@ -0,0 +1,70 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include + +/// invalid resource handle, they always start from 1. +#define kInvalidRsrc (0U) + +///////////////////////////////////////////////////////////////////////// + +CA_EXTERN_C WindowPort* WmCreateWindow(const CharacterTypeUTF8* name, + const DWordType rsrcId) { + CA_MUST_PASS(name); + CA_MUST_PASS(rsrcId != kInvalidRsrc); + + return (WindowPort*)kSharedApplication->Invoke( + kSharedApplication, kCallCreateWindow, name, rsrcId); +} + +///////////////////////////////////////////////////////////////////////// + +CA_EXTERN_C VoidType WmReleaseWindow(WindowPort* winPort) { + CA_MUST_PASS(winPort); + + kSharedApplication->Invoke(kSharedApplication, kCallCloseWindow, winPort); +} + +///////////////////////////////////////////////////////////////////////// + +CA_EXTERN_C WindowPort* WmCreateMenu(const CharacterTypeUTF8* name, + const DWordType rsrcId) { + CA_MUST_PASS(name); + CA_MUST_PASS(rsrcId != kInvalidRsrc); + + return (WindowPort*)kSharedApplication->Invoke(kSharedApplication, + kCallCreateMenu, name, rsrcId); +} + +///////////////////////////////////////////////////////////////////////// + +CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* winPort) { + CA_MUST_PASS(winPort); + + kSharedApplication->Invoke(kSharedApplication, kCallCloseMenu, winPort); +} + +///////////////////////////////////////////////////////////////////////// + +CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* id, WmPoint where) { + if (!id) { + return kWmErrInvalidArg; + } + + id->windowPosition.X = where.X; + id->windowPosition.Y = where.Y; + id->windowMoving = True; + + return 0; +} + +/// @brief Color refs. + +const ColorRef kRgbRed = 0x000000FF; +const ColorRef kRgbGreen = 0x0000FF00; +const ColorRef kRgbBlue = 0x00FF0000; +const ColorRef kRgbBlack = 0x00000000; +const ColorRef kRgbWhite = 0xFFFFFFFF; -- cgit v1.2.3