projects/wms-framework/src/lib/baseframework/Cursor.ts
Class to represent the cursor.
Properties |
|
Methods |
constructor(cursorType: CursorType)
|
||||||
Creates an instance of Cursor.
Parameters :
|
Private CursorType |
Type : CursorType
|
Property to save the Cursor Type. |
Public toString |
toString()
|
Returns the string representation of the Cursor.
Returns :
string
{string} |
Public ToString |
ToString()
|
Returns the string representation of the Cursor.
Returns :
string
{string} |
export enum CursorType {
Default,
Arrow,
Eraser,
Hand,
IBeam,
None,
SizeNESW,
SizeNS,
SizeNWSE,
SizeWE,
Stylus,
Wait,
}
/**
* Class to represent the cursor.
*
* @export
* @class Cursor
* @wType System.Windows.Input.Cursor
*/
export class Cursor {
/**
* Property to save the Cursor Type.
*
* @private
* @type {CursorType}
* @memberof Cursor
*/
private CursorType: CursorType;
/**
* Creates an instance of Cursor.
*
* @param {CursorType} [cursorType=CursorType.Default]
* @memberof Cursor
*/
constructor(cursorType: CursorType = CursorType.Default) {
this.CursorType = cursorType;
}
/**
* Returns the string representation of the Cursor.
*
* @return {*} {string}
* @memberof Cursor
*/
public ToString(): string {
return CursorType[this.CursorType];
}
/**
* Returns the string representation of the Cursor.
*
* @return {*} {string}
* @memberof Cursor
*/
public toString(): string {
return this.ToString();
}
}
/**
* Defines default Cursors that can be used in the controls.
*
* @export
* @class Cursors
* @wType System.Windows.Input.Cursors
*/
export class Cursors {
/**
* Represents an Arrow Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static Arrow: Cursor = new Cursor(CursorType.Arrow);
/**
* Represents an Eraser Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static Eraser: Cursor = new Cursor(CursorType.Eraser);
/**
* Represents a Hand Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static Hand: Cursor = new Cursor(CursorType.Hand);
/**
* Represents an IBeam Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static IBeam: Cursor = new Cursor(CursorType.IBeam);
/**
* Represents a Cursor that is not visible.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static None: Cursor = new Cursor(CursorType.None);
/**
* Represents a SizeNESW Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static SizeNESW: Cursor = new Cursor(CursorType.SizeNESW);
/**
* Represents a SizeNS Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static SizeNS: Cursor = new Cursor(CursorType.SizeNS);
/**
* Represents a SizeNWSE Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static SizeNWSE: Cursor = new Cursor(CursorType.SizeNWSE);
/**
* Represetns a SizeWE Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static SizeWE: Cursor = new Cursor(CursorType.SizeWE);
/**
* Represents a Stylus Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static Stylus: Cursor = new Cursor(CursorType.Stylus);
/**
* Represents a Wait Cursor.
*
* @static
* @type {Cursor}
* @memberof Cursors
*/
public static Wait: Cursor = new Cursor(CursorType.Wait);
/**
* Custom function to get the Cursor using the string name.
*
* @static
* @param {string} value
* @return {*} {Cursor}
* @memberof Cursors
*/
public static parse(value: string): Cursor {
let property: Cursor = null;
const found = Object.keys(Cursors).find(
(c) => c.toLowerCase() === value?.toLowerCase()
);
if (found) property = Cursors[found.toString()];
return property;
}
}