mirror of https://github.com/buggins/dlangui.git
cursor changing for editors - working ok on SDL
This commit is contained in:
parent
e16d1cacbc
commit
faeac55f4b
|
@ -150,19 +150,29 @@ version(USE_SDL) {
|
||||||
override protected void setCursorType(uint cursorType) {
|
override protected void setCursorType(uint cursorType) {
|
||||||
// override to support different mouse cursors
|
// override to support different mouse cursors
|
||||||
if (_lastCursorType != cursorType) {
|
if (_lastCursorType != cursorType) {
|
||||||
_lastCursorType = cursorType;
|
if (cursorType == CursorType.None) {
|
||||||
if (cursorType in _cursorMap) {
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
Log.d("changing cursor to ", cursorType);
|
|
||||||
SDL_SetCursor(_cursorMap[cursorType]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (_lastCursorType == CursorType.None)
|
||||||
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
|
_lastCursorType = cursorType;
|
||||||
SDL_Cursor * cursor;
|
SDL_Cursor * cursor;
|
||||||
|
// check for existing cursor in map
|
||||||
|
if (cursorType in _cursorMap) {
|
||||||
|
//Log.d("changing cursor to ", cursorType);
|
||||||
|
cursor = _cursorMap[cursorType];
|
||||||
|
if (cursor)
|
||||||
|
SDL_SetCursor(cursor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// create new cursor
|
||||||
switch (cursorType) {
|
switch (cursorType) {
|
||||||
case CursorType.Arrow:
|
case CursorType.Arrow:
|
||||||
cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
||||||
break;
|
break;
|
||||||
case CursorType.IBeam:
|
case CursorType.IBeam:
|
||||||
cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
|
||||||
break;
|
break;
|
||||||
case CursorType.Wait:
|
case CursorType.Wait:
|
||||||
cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT);
|
cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT);
|
||||||
|
@ -199,9 +209,9 @@ version(USE_SDL) {
|
||||||
cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
_cursorMap[cursorType] = cursor;
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
Log.d("changing cursor to ", cursorType);
|
Log.d("changing cursor to ", cursorType);
|
||||||
_cursorMap[cursorType] = cursor;
|
|
||||||
SDL_SetCursor(cursor);
|
SDL_SetCursor(cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue