diff options
22 files changed, 35 insertions, 451 deletions
diff --git a/Private/KernelKit/FileManager.hpp b/Private/KernelKit/FileManager.hpp index 142e1afd..7da08cbb 100644 --- a/Private/KernelKit/FileManager.hpp +++ b/Private/KernelKit/FileManager.hpp @@ -20,7 +20,6 @@ #include <CompilerKit/CompilerKit.hxx> #include <HintKit/CompilerHint.hxx> -#include <NewKit/ErrorID.hpp> #include <NewKit/Ref.hpp> #include <NewKit/Stream.hpp> @@ -159,7 +158,7 @@ namespace NewOS ErrorOr<Int64> WriteAll(const VoidPtr data) noexcept { if (data == nullptr) - return ErrorOr<Int64>(H_INVALID_DATA); + return ErrorOr<Int64>(kErrorInvalidData); auto man = FSClass::GetMounted(); @@ -169,7 +168,7 @@ namespace NewOS return ErrorOr<Int64>(0); } - return ErrorOr<Int64>(H_INVALID_DATA); + return ErrorOr<Int64>(kErrorInvalidData); } VoidPtr Read() noexcept diff --git a/Private/KernelKit/HError.hpp b/Private/KernelKit/HError.hpp index 5a4f49fb..50cc5522 100644 --- a/Private/KernelKit/HError.hpp +++ b/Private/KernelKit/HError.hpp @@ -7,7 +7,6 @@ #pragma once #include <NewKit/Defines.hpp> -#include <NewKit/ErrorID.hpp> namespace NewOS { @@ -37,6 +36,7 @@ namespace NewOS inline constexpr HError kErrorNoEntrypoint = 53; inline constexpr HError kErrorDiskIsCorrupted = 54; inline constexpr HError kErrorDisk = 55; + inline constexpr HError kErrorInvalidData = 56; inline constexpr HError kErrorUnimplemented = 0; Boolean ke_bug_check(void) noexcept; diff --git a/Private/KernelKit/Timer.hpp b/Private/KernelKit/Timer.hpp index fac1b11f..5f133dfe 100644 --- a/Private/KernelKit/Timer.hpp +++ b/Private/KernelKit/Timer.hpp @@ -8,8 +8,7 @@ #include <ArchKit/ArchKit.hpp> #include <CompilerKit/CompilerKit.hxx> - -#include <NewKit/ErrorID.hpp> +#include <KernelKit/HError.hpp> namespace NewOS { diff --git a/Private/NewKit/Application.hxx b/Private/NewKit/Application.hxx index 78ae20cd..aae97c6f 100644 --- a/Private/NewKit/Application.hxx +++ b/Private/NewKit/Application.hxx @@ -17,7 +17,7 @@ /// \brief Application Interface. /// \author Amlal El Mahrouss -typedef struct _Application final +typedef struct _ApplicationInterface final { /// @brief Releases the object exit the process on main object. NewOS::Void (*Release)(struct _Application* Self, NewOS::Int32 ExitCode); @@ -26,6 +26,6 @@ typedef struct _Application final /// @brief Query a new application object from a GUID. /// @note this doesn't query a process, it query a registered object withtin that app. NewOS::Void (*Query)(struct _Application* Self, NewOS::VoidPtr* Dst, NewOS::SizeT SzDst, NewOS::XRN::GUIDSequence GuidOf); -} Application, *ApplicationRef; +} ApplicationInterface, *ApplicationInterfaceRef; -#define app_cast reinterpret_cast<ApplicationRef> +#define app_cast reinterpret_cast<ApplicationInterfaceRef> diff --git a/Private/NewKit/ErrorID.hpp b/Private/NewKit/ErrorID.hpp deleted file mode 100644 index fcd574e2..00000000 --- a/Private/NewKit/ErrorID.hpp +++ /dev/null @@ -1,19 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -/// @brief Internal kernel errors. - -#include <NewKit/ErrorOr.hpp> -#include <NewKit/Defines.hpp> - -#define H_EXEC_ERROR 33 -#define H_FILE_NOT_FOUND 35 -#define H_DIR_NOT_FOUND 36 -#define H_FILE_EXISTS 46 -#define H_UNIMPLEMENTED 0 -#define H_INVALID_DATA 1 diff --git a/Private/Source/FileManager.cxx b/Private/Source/FileManager.cxx index 58330c9b..5f6ed174 100644 --- a/Private/Source/FileManager.cxx +++ b/Private/Source/FileManager.cxx @@ -5,7 +5,6 @@ ------------------------------------------- */ #include <KernelKit/FileManager.hpp> -#include <NewKit/ErrorID.hpp> #include <NewKit/Utils.hpp> /// BUGS: 0 diff --git a/Private/Source/PEFCodeManager.cxx b/Private/Source/PEFCodeManager.cxx index 356cd992..a3afbd52 100644 --- a/Private/Source/PEFCodeManager.cxx +++ b/Private/Source/PEFCodeManager.cxx @@ -10,7 +10,6 @@ #include <KernelKit/PEFCodeManager.hxx> #include <KernelKit/ProcessScheduler.hpp> #include <NewKit/Defines.hpp> -#include <NewKit/ErrorID.hpp> #include <NewKit/KernelCheck.hpp> #include <NewKit/OwnPtr.hpp> #include <NewKit/String.hpp> @@ -172,7 +171,7 @@ namespace NewOS if (auto sym = this->FindSymbol(kPefStart, kPefCode); sym) return ErrorOr<VoidPtr>(sym); - return ErrorOr<VoidPtr>(H_EXEC_ERROR); + return ErrorOr<VoidPtr>(kErrorExecutable); } /// @brief Tells if the executable is loaded or not. diff --git a/Private/Source/Timer.cxx b/Private/Source/Timer.cxx index da80db1e..962b3367 100644 --- a/Private/Source/Timer.cxx +++ b/Private/Source/Timer.cxx @@ -14,7 +14,7 @@ using namespace NewOS; /// @brief Unimplemented as it is an interface. Int32 HardwareTimerInterface::Wait() noexcept { - return H_UNIMPLEMENTED; + return kErrorUnimplemented; } /// @brief HardwareTimer class, meant to be generic. diff --git a/Public/Developer/CxxLib/.gitkeep b/Public/Developer/CxxRuntimeLib/.gitkeep index e69de29b..e69de29b 100644 --- a/Public/Developer/CxxLib/.gitkeep +++ b/Public/Developer/CxxRuntimeLib/.gitkeep diff --git a/Public/Developer/CxxLib/Sources/New+Delete.cxx b/Public/Developer/CxxRuntimeLib/Sources/New+Delete.cxx index 5ff3612f..5ff3612f 100644 --- a/Public/Developer/CxxLib/Sources/New+Delete.cxx +++ b/Public/Developer/CxxRuntimeLib/Sources/New+Delete.cxx diff --git a/Public/Developer/PDFLib/.gitkeep b/Public/Developer/PDFLib/.gitkeep deleted file mode 100644 index e69de29b..00000000 --- a/Public/Developer/PDFLib/.gitkeep +++ /dev/null diff --git a/Public/Developer/FragLib/.gitkeep b/Public/Developer/PEFRuntimeLib/.gitkeep index e69de29b..e69de29b 100644 --- a/Public/Developer/FragLib/.gitkeep +++ b/Public/Developer/PEFRuntimeLib/.gitkeep diff --git a/Public/Developer/FragLib/Sources/ImageStart.c b/Public/Developer/PEFRuntimeLib/Sources/PEFStart.c index 31b0d7bd..31b0d7bd 100644 --- a/Public/Developer/FragLib/Sources/ImageStart.c +++ b/Public/Developer/PEFRuntimeLib/Sources/PEFStart.c diff --git a/Public/Developer/SystemLib/Headers/2D.h b/Public/Developer/SystemLib/Headers/Alert.h index ad7ba9fe..443b6829 100644 --- a/Public/Developer/SystemLib/Headers/2D.h +++ b/Public/Developer/SystemLib/Headers/Alert.h @@ -4,16 +4,18 @@ ------------------------------------------- */ -#pragma once - -#include <Headers/Wm.h> - /************************************************************* * - * File: Draw.h - * Purpose: Xtrem Composer API for NewOS. + * File: Alert.h + * Purpose: New OS alert dialog. * Date: 3/26/24 * * Copyright Mahrouss Logic, all rights reserved. * *************************************************************/ + +#pragma once + +#include <Headers/Defines.h> + +CA_EXTERN_C VoidType Alert(const CharacterTypeUTF8* fmt, ...); diff --git a/Public/Developer/SystemLib/Headers/Defines.h b/Public/Developer/SystemLib/Headers/Defines.h index 8272213e..db2e1884 100644 --- a/Public/Developer/SystemLib/Headers/Defines.h +++ b/Public/Developer/SystemLib/Headers/Defines.h @@ -15,7 +15,7 @@ { \ if (!e) \ { \ - DlgMsgBox("Sorry, an assertion failed.\nFile: %s\nLine: %i", __FILE__, __LINE__) RtAssertTriggerInterrupt() \ + Alert("Sorry, an assertion failed.\nFile: %s\nLine: %i", __FILE__, __LINE__) RtAssertTriggerInterrupt() \ } \ } #else @@ -32,7 +32,7 @@ #endif -struct Application; +struct ApplicationInterface; struct GUID; CA_EXTERN_C void RtAssertTriggerInterrupt(void); @@ -45,6 +45,8 @@ CA_EXTERN_C void RtAssertTriggerInterrupt(void); #define CA_PASCAL CA_STDCALL +#include <Headers/Hint.h> + typedef __UINT8_TYPE__ ByteType; typedef __UINT16_TYPE__ WordType; typedef __UINT32_TYPE__ DWordType; @@ -127,7 +129,8 @@ enum RtProcessCall kCallSizePtr, kCallCheckPtr, kCallAllocStack, - /// @brief Open a specific handle (can be used as sel to call methods related to it.) + /// @brief Open a specific handle + /// (can be used as sel to call methods related to it.) kCallOpenFile, kCallCloseFile, kCallOpenDir, @@ -145,9 +148,6 @@ enum RtProcessCall kCallsCount, }; -#include <Headers/Hint.h> -#include <Headers/Dialog.h> - /** * @brief GUID type, something you can also find in CFKit. * @author Amlal El Mahrouss @@ -162,12 +162,12 @@ typedef struct GUID /// \brief Application Interface. /// \author Amlal El Mahrouss -typedef struct Application +typedef struct ApplicationInterface { - VoidType (*Release)(struct Application* Self, DWordType ExitCode); - IntPtrType (*Invoke)(struct Application* Self, DWordType Sel, ...); - VoidType (*Query)(struct Application* Self, PtrVoidType* Dst, SizeType SzDst, struct GUID* GuidOf); -} Application, *ApplicationRef; + VoidType (*Release)(struct ApplicationInterface* Self, DWordType ExitCode); + IntPtrType (*Invoke)(struct ApplicationInterface* Self, DWordType Sel, ...); + VoidType (*Query)(struct ApplicationInterface* Self, PtrVoidType* Dst, SizeType SzDst, struct GUID* GuidOf); +} ApplicationInterface, *ApplicationInterfaceRef; #ifdef __cplusplus @@ -187,21 +187,21 @@ typedef struct Application KLASS& operator=(KLASS&&) = default; \ KLASS(KLASS&&) = default; -#define app_cast reinterpret_cast<ApplicationRef> +#define app_cast reinterpret_cast<ApplicationInterfaceRef> template <SizeType N> using StrType = CharacterTypeUTF8[N]; #else -#define app_cast (ApplicationRef) +#define app_cast (ApplicationInterfaceRef) #endif // ifdef C++ /// @brief Get app singleton. /// @param /// @return -CA_EXTERN_C ApplicationRef RtGetAppPointer(VoidType); +CA_EXTERN_C ApplicationInterfaceRef RtGetAppPointer(VoidType); /// @brief Get argument count /// @param @@ -213,7 +213,7 @@ CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType); /// @return CA_EXTERN_C CharacterTypeUTF8** RtGetAppArgumentsPtr(VoidType); -CA_EXTERN_C ApplicationRef kSharedApplication; +CA_EXTERN_C ApplicationInterfaceRef kSharedApplication; typedef CharacterTypeUTF8 StrType255[255]; @@ -226,3 +226,5 @@ typedef CharacterTypeUTF8 StrType255[255]; #ifndef kInvalidRef #define kInvalidRef 0 #endif + +#include <Headers/Alert.h> diff --git a/Public/Developer/SystemLib/Headers/Dialog.h b/Public/Developer/SystemLib/Headers/Dialog.h deleted file mode 100644 index 14e3d3a7..00000000 --- a/Public/Developer/SystemLib/Headers/Dialog.h +++ /dev/null @@ -1,46 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Wm.h> - -struct _DialogPort; -struct _DialogPoint; - -/// @brief Dialog procedure type. -typedef VoidType (*WmDialogFn)(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 : 1; - BooleanType dlgMoving : 1; - DialogPoint dlgPosition; - WmDialogFn dlgProc; - struct _WmGFX* dlgGfx; - struct _WmWindowPort* 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 -/// @param va_list the va args, that goes along with it. -/// @return 0: the user clicked Ok -/// @return > 0: User clicked on specific button. -CA_EXTERN_C Int32Type DlgMsgBox(const CharacterTypeUTF8* title, const CharacterTypeUTF8* format, ...); diff --git a/Public/Developer/SystemLib/Headers/l18n.h b/Public/Developer/SystemLib/Headers/Intl.h index 1cd5ea64..1cd5ea64 100644 --- a/Public/Developer/SystemLib/Headers/l18n.h +++ b/Public/Developer/SystemLib/Headers/Intl.h diff --git a/Public/Developer/SystemLib/Headers/TrueType.h b/Public/Developer/SystemLib/Headers/TrueType.h deleted file mode 100644 index 49b111cc..00000000 --- a/Public/Developer/SystemLib/Headers/TrueType.h +++ /dev/null @@ -1,38 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Wm.h> - -/************************************************************* - * - * File: TrueType.h - * Purpose: TrueType font implementation for NewOS. - * Date: 3/26/24 - * - * Copyright Mahrouss Logic, all rights reserved. - * - *************************************************************/ - -typedef QWordType TTFFontRef; - -/// @brief Loads a new font into app's memory. -/// @param name -/// @return -CA_EXTERN_C TTFFontRef FnCreateFont(const CharacterTypeUTF8* name); - -/// @brief Dispose an allocated font. -/// @param fon -/// @return -CA_EXTERN_C VoidType FnDisposeFont(TTFFontRef fon); - -/// @brief Gets the font gylph for character. -/// @param fon -/// @return -CA_EXTERN_C PtrVoidType FnGetGlyph(TTFFontRef fon, UInt32Type utfCh); - -/// TODO: Get font metadata.
\ No newline at end of file diff --git a/Public/Developer/SystemLib/Headers/Wm.h b/Public/Developer/SystemLib/Headers/Wm.h deleted file mode 100644 index e0333310..00000000 --- a/Public/Developer/SystemLib/Headers/Wm.h +++ /dev/null @@ -1,171 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Defines.h> -#include <Headers/Dialog.h> - -/************************************************************* - * - * File: Wm.h - * Purpose: Window Manager API for NewOS. - * Date: 3/26/24 - * - * Copyright Mahrouss Logic, all rights reserved. - * - *************************************************************/ - -struct _WmPoint; -struct _WmWindowPort; -struct _WmGFX; -struct _WmControlPort; -struct _WmPoint; - -/// @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 _WmWindowPort* port, UInt32Type msg, UIntPtrType pParam, UIntPtrType iParam); - -/// @brief A point, can represent the size, position of a window. -typedef struct _WmPoint -{ - PositionType X, Y; -} WmPoint; - -/// @brief Window port type, can be used to control the window. -typedef struct _WmWindowPort -{ - WordType windowPort; - WordType windowKind; - BooleanType windowVisible : 1; - BooleanType windowMaximized : 1; - BooleanType windowMinimized : 1; - BooleanType windowMoving : 1; // Set if the window is moving. - BooleanType windowDisableClose : 1; // Set if user or app request a close action. - BooleanType windowDisableMinimize : 1; // Set if user request a minimize action. - BooleanType windowInvalidate : 1; // Set if invalidation action is done. - WmPoint windowPosition; - WmPoint windowSize; - WmGFXRef windowGfx; - WmWindowFn windowProc; - struct _WmWindowPort* windowMenuPort; ///! Attached menu to it. - struct _WmWindowPort* windowParentPort; -} WindowPort; - -/// @brief Control port type. -typedef struct _WmControlPort -{ - WordType controlPort; - WordType controlKind; - BooleanType controlVisible : 1; - BooleanType controlMoving : 1; - WmPoint controlPosition; - WmWindowFn controlProc; - WmGFXRef controlGfx; - WindowPort* parentPort; -} WmControlPort; - -enum -{ - kWmErrIncompatible = 0x74, - kWmErrOutOfMemory, - kWmErrInvalidArg, - kWmErrNotImplemented, -}; - -/// @brief Color reference. -typedef UInt32Type ColorRef; - -/***********************************************************************************/ -/// Color utils. -/***********************************************************************************/ - -CA_EXTERN_C const ColorRef kRgbRed; -CA_EXTERN_C const ColorRef kRgbGreen; -CA_EXTERN_C const ColorRef kRgbBlue; -CA_EXTERN_C const ColorRef kRgbBlack; -CA_EXTERN_C const ColorRef kRgbWhite; - -/***********************************************************************************/ -/// Color macro. -/***********************************************************************************/ - -#define WmMakeColorRef(R, G, B) (ColorRef)(0x##R##G##B) - -#define kControlKindWindow 0 -#define kControlKindDialog 1 -#define kControlKindMenu 2 -#define kControlKindButton 3 -#define kControlKindLabel 4 -#define kControlKindDropdownMenu 5 -#define kControlKindIcon 6 -#define kControlKindRadioBox 7 -#define kControlKindCheckBox 8 -#define kControlKindUserDefined 9 - -/// @brief Creates a new control -/// @param id the control rsrc fork. -/// @return -CA_EXTERN_C WmControlPort* WmCreateControl(DWordType id); - -/// @brief Releases the control -/// @param ctrlPort the control ref. -/// @return -CA_EXTERN_C VoidType WmReleaseControl(WmControlPort* ctrlPort); - -/// @brief Moves a control inside a WmControlPort. -/// @param ctrlPort the control ref. -/// @param where where to move at. -/// @return -CA_EXTERN_C Int32Type WmSetControlPosition(WmControlPort* ctrlPort, WmPoint where); - -/// @brief Enable control. -/// @param ctrlPort -/// @param enabled -/// @return -CA_EXTERN_C Int32Type WmSetControlEnabled(WmControlPort* ctrlPort, BooleanType enabled); - -/// @brief Make control visible. -/// @param ctrlPort -/// @param visible -/// @return -CA_EXTERN_C Int32Type WmSetControlVisible(WmControlPort* ctrlPort, BooleanType visible); - -/// @brief Creates a new window. -/// @param name the window name -/// @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 ctrlPort. -/// @return the menu graphics port. -CA_EXTERN_C WindowPort* WmCreateMenu(const CharacterTypeUTF8* name, const DWordType rsrcId); - -/// @brief Releases the window. -/// @param port the window port. -/// @return void -CA_EXTERN_C VoidType WmReleaseWindow(WindowPort* port); - -/// @brief Releases the menu -/// @param port the menu port. -/// @return void -CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* 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* wndPort, WmPoint where); diff --git a/Public/Developer/SystemLib/Sources/App.c b/Public/Developer/SystemLib/Sources/App.c index c85b2dd8..7778c064 100644 --- a/Public/Developer/SystemLib/Sources/App.c +++ b/Public/Developer/SystemLib/Sources/App.c @@ -7,7 +7,7 @@ #include <Headers/Defines.h> /// @brief Main Application object, retrieved from the RtGetAppPointer symbol. -ApplicationRef kSharedApplication = NullPtr; +ApplicationInterfaceRef kSharedApplication = NullPtr; /// @brief Gets the app arguments count. /// @param void no arguments. diff --git a/Public/Developer/SystemLib/Sources/TrueType.c b/Public/Developer/SystemLib/Sources/TrueType.c deleted file mode 100644 index 49b1c2e8..00000000 --- a/Public/Developer/SystemLib/Sources/TrueType.c +++ /dev/null @@ -1,42 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <Headers/Defines.h> -#include <Headers/TrueType.h> -#include <Headers/File.h> -#include <Headers/Heap.h> - -#define kTTFFork "fon " /* TrueType */ - -/// @brief TrueType container reader -typedef struct TTFReader -{ - FSForkRef fFork; - FSRef fFile; - PtrVoidType fBlob; // cached blob - SizeType fBlobSize; // cached blob size - VoidType (*__fReadBytes)(SizeType count); - VoidType (*__fSkipBytes)(SizeType count); -} TTFReader; - -/// @brief Grab a TTF reader reference. -/// @param fs filesystem reference. -/// @return TTFReader* the new TTFReader type. -CA_STATIC TTFReader* GrabTTFReader(FSRef fs) -{ - FSForkRef forkRef = FsGetFork(fs, kTTFFork); - - if (forkRef = kInvalidRef) - return NullPtr; - - TTFReader* reader = RtTlsAllocate(sizeof(TTFReader), kStandardAllocation); - - reader->fFile = fs; - reader->fFork = forkRef; - - return reader; -} -/// EOF. diff --git a/Public/Developer/SystemLib/Sources/Wm.c b/Public/Developer/SystemLib/Sources/Wm.c deleted file mode 100644 index 607e7dcf..00000000 --- a/Public/Developer/SystemLib/Sources/Wm.c +++ /dev/null @@ -1,100 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <Headers/Wm.h> -#include <Headers/Math.h> - -/// invalid resource handle, they always start from 1. -#define kInvalidRsrc (0U) - -/// @brief Color refs. - -const ColorRef kRgbRed = 0x000000FF; -const ColorRef kRgbGreen = 0x0000FF00; -const ColorRef kRgbBlue = 0x00FF0000; -const ColorRef kRgbBlack = 0x00000000; -const ColorRef kRgbWhite = 0xFFFFFFFF; - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C WindowPort* WmCreateWindow(const CharacterTypeUTF8* name, - const DWordType rsrcId) -{ - CA_MUST_PASS(name); - CA_MUST_PASS(rsrcId != kInvalidRsrc); - - if (!name) - return NullPtr; - if (rsrcId == kInvalidRsrc) - return NullPtr; - - return (WindowPort*)kSharedApplication->Invoke( - kSharedApplication, kCallCreateWindow, name, rsrcId); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C VoidType WmReleaseWindow(WindowPort* winPort) -{ - CA_MUST_PASS(winPort); - if (!winPort) - return; - - 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); - - if (!name) - return NullPtr; - if (rsrcId == kInvalidRsrc) - return NullPtr; - - return (WindowPort*)kSharedApplication->Invoke(kSharedApplication, - kCallCreateMenu, name, rsrcId); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* winPort) -{ - CA_MUST_PASS(winPort); - - if (!winPort) - return; - kSharedApplication->Invoke(kSharedApplication, kCallCloseMenu, winPort); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* wndPort, WmPoint where) -{ - if (!wndPort) - return kWmErrInvalidArg; - - wndPort->windowPosition.X = where.X; - wndPort->windowPosition.Y = where.Y; - wndPort->windowMoving = True; - - return 0; -} - -/// @brief Causes the window to invalidate and redraw. -/// @param wndPort The Window port. -/// @return nothing. -CA_EXTERN_C VoidType WmInvalidateGfx(WindowPort* wndPort) -{ - if (wndPort) - { - wndPort->windowInvalidate = Yes; - } -} |
