wxCursor(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– NAME πŸ’–

wxCursor β€” bestie, it's a lil bitmap that shows where ur mouse pointer is at, and the picture can hint at what a click is gonna do πŸ‘†βœ¨


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, real talk: cursors in X and MS Windows get created in totally different ways. Same drama as icons, fr. So wxCursor makes separate cursors for each environment, and there are platform-specific methods for building a wxCursor object, which lowkey means you're probably gonna need conditional compilation (peep wxIcon for an example of that whole situation).

One single cursor object can serve a bunch of windows (any subwindow type, no gatekeeping 🌈). The wxWidgets convention is to set the cursor for a window, like X does β€” not globally like MS Windows β€” though there's also a global wx_misc:setCursor/1 function available for MS Windows use, iykyk.

πŸŽ€ Creating a Custom Cursor πŸŽ€

Here's an example of creating a cursor from 32x32 bitmap data (down_bits) plus a mask (down_mask), where for the bits 1 is black and 0 is white, and for the mask 1 is opaque and 0 is transparent. It works on Windows and GTK+, bestie ✨

Predefined objects (include wx.hrl), the way that they're just handed to you:

  • ?wxNullCursor πŸ’€
  • ?wxSTANDARD_CURSOR πŸ‘‘
  • ?wxHOURGLASS_CURSOR βŒ›
  • ?wxCROSS_CURSOR πŸ’…

See:

  • wxBitmap
  • wxIcon
  • wxWindow:setCursor/2
  • wx_misc:setCursor/1
  • ?wxStockCursor

This class is derived, and can use functions, from:

  • wxBitmap

wxWidgets docs: wxCursor


🌸 DATA TYPES 🌸

  • wxCursor() :: wx:wx_object(). β€” that's it, that's the whole type, periodt πŸ’–

✨ FUNCTIONS ✨

  • destroy(This :: wxCursor()) -> ok. β€” Destroys the object πŸ’€ bye bestie.
  • isOk(This) -> boolean() when This :: wxCursor(). β€” Returns true if cursor data is present. Vibe check on ur cursor fr fr.
  • new() -> wxCursor(). β€” Default constructor. The no-args classic πŸŽ€
  • new(CursorName) -> wxCursor() when CursorName :: unicode:chardata(); (Image) -> wxCursor() when Image :: wxImage:wxImage() | wxCursor:wxCursor(); (CursorId) -> wxCursor() when CursorId :: wx:wx_enum().

Constructs a cursor using a cursor identifier πŸ”₯

  • new(CursorName, [Option]) -> wxCursor() when
CursorName :: unicode:chardata(),
Option ::
    {type, wx:wx_enum()} |
    {hotSpotX, integer()} |
    {hotSpotY, integer()}.

Constructs a cursor by passing a string resource name or filename.

heads up bestie: the arguments hotSpotX and hotSpotY are only used when there's no hotspot info in the resource/image-file to load (e.g. when using wxBITMAP_TYPE_ICO under wxMSW or wxBITMAP_TYPE_XPM under wxGTK) πŸ™ˆ
  • ok(This) -> boolean() when This :: wxCursor(). β€” Equivalent to: isOk/1 πŸ’œ

and that's the whole page, bestie πŸ’… tysm for reading, mwah 🫢 β€” this iconic lil manual came from Ericsson AB, version wx 2.6, and the page is literally named wxCursor(3). slay, bye ✨

πŸ“¦ where this page comes from