summaryrefslogtreecommitdiff
path: root/src/lib/ecore_cocoa
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>2015-10-08 11:58:46 +0200
committerChris Michael <cp.michael@samsung.com>2015-12-03 12:07:20 -0500
commit4623d57762094011c5155cbea9512ae6a2db8852 (patch)
treec2a95a013f4fd25e669091066ab4f33cba923994 /src/lib/ecore_cocoa
parent116a0abf9326b274671d233be6626a5d63e153ab (diff)
ecore_cocoa: add support for system cursors
- Ecore_Cocoa_Cursor enum which references system cursors; - API to show/hide cursor: ecore_cocoa_window_cursor_show(); - API to set system cursor: ecore_cocoa_window_cursor_set(); - Ecore_Evas interface to get Ecore_Cocoa_Window from Ecore_Evas. @feature Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/ecore_cocoa')
-rw-r--r--src/lib/ecore_cocoa/Ecore_Cocoa.h4
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_private.h2
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_window.m47
3 files changed, 51 insertions, 2 deletions
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h
index 2a20050c70..530f3a56c8 100644
--- a/src/lib/ecore_cocoa/Ecore_Cocoa.h
+++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h
@@ -285,6 +285,10 @@ EAPI void ecore_cocoa_selection_clipboard_clear(void);
285EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, Ecore_Cocoa_Cursor c); 285EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, Ecore_Cocoa_Cursor c);
286EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show); 286EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show);
287 287
288
289EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, Ecore_Cocoa_Cursor c);
290EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show);
291
288#ifdef __cplusplus 292#ifdef __cplusplus
289} 293}
290#endif 294#endif
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_private.h b/src/lib/ecore_cocoa/ecore_cocoa_private.h
index 535e08a7ed..db002886fa 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_private.h
+++ b/src/lib/ecore_cocoa/ecore_cocoa_private.h
@@ -67,6 +67,4 @@ Eina_Bool _ecore_cocoa_window_init(void);
67 67
68Eina_Bool _ecore_cocoa_feed_events(void *anEvent); 68Eina_Bool _ecore_cocoa_feed_events(void *anEvent);
69 69
70
71
72#endif 70#endif
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m
index 25a7c58c5a..508eb8a92e 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_window.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m
@@ -578,3 +578,50 @@ _ecore_cocoa_window_init(void)
578 return EINA_TRUE; 578 return EINA_TRUE;
579} 579}
580 580
581EAPI void
582ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win,
583 Ecore_Cocoa_Cursor c)
584{
585 EINA_SAFETY_ON_NULL_RETURN(win);
586 EINA_SAFETY_ON_FALSE_RETURN((c >= 0) && (c <= __ECORE_COCOA_CURSOR_LAST));
587
588 NSCursor *cursor = _cursors[c];
589
590 DBG("Setting cursor %i (%s)", c, [[cursor description] UTF8String]);
591 [cursor set];
592}
593
594EAPI void
595ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win,
596 Eina_Bool show)
597{
598 EINA_SAFETY_ON_NULL_RETURN(win);
599
600 if (show) [NSCursor unhide];
601 else [NSCursor hide];
602}
603
604Eina_Bool
605_ecore_cocoa_window_init(void)
606{
607 _cursors[ECORE_COCOA_CURSOR_ARROW] = [NSCursor arrowCursor];
608 _cursors[ECORE_COCOA_CURSOR_CONTEXTUAL_MENU] = [NSCursor contextualMenuCursor];
609 _cursors[ECORE_COCOA_CURSOR_CLOSED_HAND] = [NSCursor closedHandCursor];
610 _cursors[ECORE_COCOA_CURSOR_CROSSHAIR] = [NSCursor crosshairCursor];
611 _cursors[ECORE_COCOA_CURSOR_DISAPPEARING_ITEM] = [NSCursor disappearingItemCursor];
612 _cursors[ECORE_COCOA_CURSOR_DRAG_COPY] = [NSCursor dragCopyCursor];
613 _cursors[ECORE_COCOA_CURSOR_DRAG_LINK] = [NSCursor dragLinkCursor];
614 _cursors[ECORE_COCOA_CURSOR_IBEAM] = [NSCursor IBeamCursor];
615 _cursors[ECORE_COCOA_CURSOR_OPEN_HAND] = [NSCursor openHandCursor];
616 _cursors[ECORE_COCOA_CURSOR_OPERATION_NOT_ALLOWED] = [NSCursor operationNotAllowedCursor];
617 _cursors[ECORE_COCOA_CURSOR_POINTING_HAND] = [NSCursor pointingHandCursor];
618 _cursors[ECORE_COCOA_CURSOR_RESIZE_DOWN] = [NSCursor resizeDownCursor];
619 _cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT] = [NSCursor resizeLeftCursor];
620 _cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT_RIGHT] = [NSCursor resizeLeftRightCursor];
621 _cursors[ECORE_COCOA_CURSOR_RESIZE_RIGHT] = [NSCursor resizeRightCursor];
622 _cursors[ECORE_COCOA_CURSOR_RESIZE_UP] = [NSCursor resizeUpCursor];
623 _cursors[ECORE_COCOA_CURSOR_RESIZE_UP_DOWN] = [NSCursor resizeUpDownCursor];
624 _cursors[ECORE_COCOA_CURSOR_IBEAM_VERTICAL] = [NSCursor IBeamCursorForVerticalLayout];
625
626 return EINA_TRUE;
627}