MostlyHarmless 0.0.1
Loading...
Searching...
No Matches
mostly_harmless::gui::helpers::macos Namespace Reference

macOS specific gui helper functions More...

Functions

void * createView (std::uint32_t width, std::uint32_t height)
void removeFromParentView (void *viewHandle)
void setViewSize (void *viewHandle, std::uint32_t width, std::uint32_t height)
void getViewSize (void *viewHandle, std::uint32_t *width, std::uint32_t *height)
void reparentView (void *hostViewHandle, void *clientViewHandle, void *childViewHandle, Colour backgroundColour)
void showView (void *viewHandle)
void hideView (void *viewHandle)
void getMousePos (std::uint32_t *x, std::uint32_t *y)
void setMousePos (std::uint32_t newX, std::uint32_t newY)
void showCursor ()
void hideCursor ()

Detailed Description

macOS specific gui helper functions

Function Documentation

◆ createView()

void * mostly_harmless::gui::helpers::macos::createView ( std::uint32_t width,
std::uint32_t height )

◆ getMousePos()

void mostly_harmless::gui::helpers::macos::getMousePos ( std::uint32_t * x,
std::uint32_t * y )

Retrieves the current mouse position in screen coords, and stores them in x and y.

Parameters
xA pointer to your x variable - the result will be written here.
yA pointer to your y variable - the result will be written here.

◆ getViewSize()

void mostly_harmless::gui::helpers::macos::getViewSize ( void * viewHandle,
std::uint32_t * width,
std::uint32_t * height )

Retrieves an NSView's size.

Parameters
viewHandleA void* to the NSView to query.
widthA pointer to the width variable - the result will be written here.
heightA pointer to the height variable - the result will be written here.

◆ hideCursor()

void mostly_harmless::gui::helpers::macos::hideCursor ( )

Hides the cursor.

◆ hideView()

void mostly_harmless::gui::helpers::macos::hideView ( void * viewHandle)

Sets an NSView as hidden.

Parameters
viewHandleA void* to the NSView to set hidden.

◆ removeFromParentView()

void mostly_harmless::gui::helpers::macos::removeFromParentView ( void * viewHandle)

Removes an NSView from its parent NSView.

Parameters
viewHandleA void* to the NSView to remove.

◆ reparentView()

void mostly_harmless::gui::helpers::macos::reparentView ( void * hostViewHandle,
void * clientViewHandle,
void * childViewHandle,
Colour backgroundColour )

Adds an NSView as a subview of another NSView.

Parameters
parentViewHandleA void* to the NSView to add the child view to.
childViewHandleA void* to the NSView to add to the parent view.

◆ setMousePos()

void mostly_harmless::gui::helpers::macos::setMousePos ( std::uint32_t newX,
std::uint32_t newY )

Sets the mouse position to the provided position (in screen coords). Internally handles translating from screen coords to global space coords.

Parameters
newXThe x position to set the mouse position to (in screen space).
newYThe y position to set the mouse position to (in screen space).

◆ setViewSize()

void mostly_harmless::gui::helpers::macos::setViewSize ( void * viewHandle,
std::uint32_t width,
std::uint32_t height )

Sets an NSView's size.

Parameters
viewHandleA void* to the NSView* to resize.
widthThe new width.
heightThe new height.

◆ showCursor()

void mostly_harmless::gui::helpers::macos::showCursor ( )

Shows (or more accurately, "unhides") the cursor.

◆ showView()

void mostly_harmless::gui::helpers::macos::showView ( void * viewHandle)

Sets an NSView as visible.

Parameters
viewHandleA void* to the NSView to set visible.