2012-12-22 03:26:29 +04:00
|
|
|
/*
|
2019-09-02 08:58:44 +03:00
|
|
|
* Copyright 2012-2014, 2019 Haiku, Inc. All rights reserved.
|
2012-12-22 03:26:29 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* John Scipione, jscipione@gmail.com
|
|
|
|
*
|
|
|
|
* Corresponds to:
|
2014-06-12 00:25:57 +04:00
|
|
|
* headers/os/app/Cursor.h hrev47355
|
|
|
|
* src/kits/app/Cursor.cpp hrev47355
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\file Cursor.h
|
2013-02-07 06:05:00 +04:00
|
|
|
\ingroup app
|
2013-02-08 00:04:05 +04:00
|
|
|
\ingroup libbe
|
2012-12-22 03:26:29 +04:00
|
|
|
\brief Provides the BCursor class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\enum BCursorID
|
|
|
|
List of predefined cursor IDs
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_SYSTEM_DEFAULT
|
|
|
|
System default cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_CONTEXT_MENU
|
|
|
|
Context menu cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_COPY
|
|
|
|
Copy cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_CREATE_LINK
|
|
|
|
Symlink cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_CROSS_HAIR
|
|
|
|
Cross hairs cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_FOLLOW_LINK
|
|
|
|
Follow html link cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_GRAB
|
|
|
|
Grab cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_GRABBING
|
|
|
|
Grabbing cursor (mouse down)
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_HELP
|
|
|
|
Help cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_I_BEAM
|
|
|
|
I beam cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_I_BEAM_HORIZONTAL
|
|
|
|
Horizontal I beam cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_MOVE
|
|
|
|
Move cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_NO_CURSOR
|
|
|
|
No cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_NOT_ALLOWED
|
|
|
|
Not allowed cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_PROGRESS
|
|
|
|
Progress cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_NORTH
|
|
|
|
Resize north cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_EAST
|
|
|
|
Resize east cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_SOUTH
|
|
|
|
Resize south cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_WEST
|
|
|
|
Resize west cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_NORTH_EAST
|
|
|
|
Resize north east cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_NORTH_WEST
|
|
|
|
Resize north west cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_SOUTH_EAST
|
|
|
|
Resize south east cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_SOUTH_WEST
|
|
|
|
Resize south west cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_NORTH_SOUTH
|
|
|
|
Resize north south cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_EAST_WEST
|
|
|
|
Resize east west cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST
|
|
|
|
Resize north east south west cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST
|
|
|
|
Resize north west south east cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_ZOOM_IN
|
|
|
|
Zoom in cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var BCursorID B_CURSOR_ID_ZOOM_OUT
|
|
|
|
Zoom out cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class BCursor
|
|
|
|
\ingroup app
|
2013-02-08 00:04:05 +04:00
|
|
|
\ingroup libbe
|
2012-12-22 03:26:29 +04:00
|
|
|
\brief BCursor describes a view-wide or application-wide cursor.
|
|
|
|
|
|
|
|
\note As BeOS only supports 16x16 monochrome cursors, to see a nice
|
|
|
|
shadowed one we will need to extend this.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BCursor::BCursor(const void* cursorData)
|
|
|
|
\brief Initializes a new cursor object.
|
|
|
|
|
|
|
|
If the \a cursorData parameter is not \c NULL then the cursor is initialized
|
|
|
|
with the cursor data.
|
|
|
|
|
|
|
|
\param cursorData The cursor data.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BCursor::BCursor(BCursorID id)
|
|
|
|
\brief Initializes a new cursor object from a predefined cursor \a id.
|
|
|
|
|
|
|
|
\param id The predefined \a id to initialize to.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BCursor::BCursor(const BCursor& other)
|
|
|
|
\brief Initializes a new cursor object from another cursor object.
|
|
|
|
|
|
|
|
\param other The cursor object to initialize from.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BCursor::BCursor(BMessage* data)
|
|
|
|
\brief Initializes a new cursor object from a message archive.
|
|
|
|
|
|
|
|
\param data The message data to initialize from.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BCursor::~BCursor()
|
2017-11-10 00:14:19 +03:00
|
|
|
\brief Destroy the cursor and free its memory.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2019-09-02 08:58:44 +03:00
|
|
|
\fn status_t BCursor::Archive(BMessage *into, bool deep) const
|
2012-12-22 03:26:29 +04:00
|
|
|
\brief Archive the cursor. Not implemented.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2019-09-02 08:58:44 +03:00
|
|
|
\fn BArchivable* BCursor::Instantiate(BMessage *archive)
|
2012-12-22 03:26:29 +04:00
|
|
|
\brief Instantiate the cursor from a message. Not implemented.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2019-09-02 08:58:44 +03:00
|
|
|
\fn BCursor& BCursor::operator=(const BCursor &other)
|
2012-12-22 03:26:29 +04:00
|
|
|
\brief Set the cursor to another cursor object.
|
|
|
|
|
|
|
|
\param other The cursor object to copy from.
|
|
|
|
|
|
|
|
\returns the new cursor object.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2019-09-02 08:58:44 +03:00
|
|
|
\fn bool BCursor::operator==(const BCursor &other) const
|
2012-12-22 03:26:29 +04:00
|
|
|
\brief Compare a cursor object to another and return if they are equal.
|
|
|
|
|
|
|
|
\param other The cursor object to compare to.
|
|
|
|
|
|
|
|
\returns \c true if the cursor objects are equal, \c false if the cursor
|
2014-06-12 00:25:57 +04:00
|
|
|
objects are not equal.
|
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2019-09-02 08:58:44 +03:00
|
|
|
\fn bool BCursor::operator!=(const BCursor &other) const
|
2012-12-22 03:26:29 +04:00
|
|
|
\brief Compare a cursor object to another and return if they are not equal.
|
|
|
|
|
|
|
|
\param other The cursor object to compare to.
|
|
|
|
|
|
|
|
\returns \c true if the cursor objects are not equal, \c false if the cursor
|
|
|
|
objects are equal.
|
2014-06-12 00:25:57 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2012-12-22 03:26:29 +04:00
|
|
|
*/
|