|
|
@@ -1,67 +1,56 @@
|
|
|
#include "common.h"
|
|
|
+#include "cursor.h"
|
|
|
+#include <map>
|
|
|
|
|
|
-class Cursor : public ComSingleObject<IAvnCursor, &IID_IAvnCursor>
|
|
|
+class CursorFactory : public ComSingleObject<IAvnCursorFactory, &IID_IAvnCursorFactory>
|
|
|
{
|
|
|
+ Cursor * arrowCursor = new Cursor([NSCursor arrowCursor]);
|
|
|
+ Cursor * crossCursor = new Cursor([NSCursor crosshairCursor]);
|
|
|
+ Cursor * resizeUpCursor = new Cursor([NSCursor resizeUpCursor]);
|
|
|
+ Cursor * resizeDownCursor = new Cursor([NSCursor resizeDownCursor]);
|
|
|
+ Cursor * dragCopyCursor = new Cursor([NSCursor dragCopyCursor]);
|
|
|
+ Cursor * dragLinkCursor = new Cursor([NSCursor dragLinkCursor]);
|
|
|
+ Cursor * pointingHandCursor = new Cursor([NSCursor pointingHandCursor]);
|
|
|
+ Cursor * contextualMenuCursor = new Cursor([NSCursor contextualMenuCursor]);
|
|
|
+ Cursor * IBeamCursor = new Cursor([NSCursor IBeamCursor]);
|
|
|
+ Cursor * resizeLeftCursor = new Cursor([NSCursor resizeLeftCursor]);
|
|
|
+ Cursor * resizeRightCursor = new Cursor([NSCursor resizeRightCursor]);
|
|
|
+ Cursor * operationNotAllowedCursor = new Cursor([NSCursor operationNotAllowedCursor]);
|
|
|
+
|
|
|
+ std::map<AvnStandardCursorType, Cursor*> s_cursorMap =
|
|
|
+ {
|
|
|
+ { CursorArrow, arrowCursor },
|
|
|
+ { CursorAppStarting, arrowCursor },
|
|
|
+ { CursorWait, arrowCursor },
|
|
|
+ { CursorTopLeftCorner, crossCursor },
|
|
|
+ { CursorTopRightCorner, crossCursor },
|
|
|
+ { CursorBottomLeftCorner, crossCursor },
|
|
|
+ { CursorBottomRightCorner, crossCursor },
|
|
|
+ { CursorCross, crossCursor },
|
|
|
+ { CursorSizeAll, crossCursor },
|
|
|
+ { CursorTopSide, resizeUpCursor },
|
|
|
+ { CursorUpArrow, resizeUpCursor },
|
|
|
+ { CursorBottomSize, resizeDownCursor },
|
|
|
+ { CursorDragCopy, dragCopyCursor },
|
|
|
+ { CursorDragMove, dragCopyCursor },
|
|
|
+ { CursorDragLink, dragLinkCursor },
|
|
|
+ { CursorHand, pointingHandCursor },
|
|
|
+ { CursorHelp, contextualMenuCursor },
|
|
|
+ { CursorIbeam, IBeamCursor },
|
|
|
+ { CursorLeftSide, resizeLeftCursor },
|
|
|
+ { CursorRightSide, resizeRightCursor },
|
|
|
+ { CursorNo, operationNotAllowedCursor }
|
|
|
+ };
|
|
|
+
|
|
|
public:
|
|
|
- virtual HRESULT GetCursor (AvnStandardCursorType cursorType, void** ptr)
|
|
|
+ virtual HRESULT GetCursor (AvnStandardCursorType cursorType, IAvnCursor** retOut)
|
|
|
{
|
|
|
- NSCursor * cursor;
|
|
|
- switch (cursorType) {
|
|
|
- case CursorArrow:
|
|
|
- case CursorAppStarting:
|
|
|
- case CursorWait:
|
|
|
- cursor = [NSCursor arrowCursor];
|
|
|
- break;
|
|
|
- case CursorTopLeftCorner:
|
|
|
- case CursorTopRightCorner:
|
|
|
- case CursorBottomLeftCorner :
|
|
|
- case CursorBottomRightCorner:
|
|
|
- case CursorCross:
|
|
|
- case CursorSizeAll:
|
|
|
- cursor = [NSCursor crosshairCursor];
|
|
|
- break;
|
|
|
- case CursorTopSide:
|
|
|
- case CursorUpArrow:
|
|
|
- cursor = [NSCursor resizeUpCursor];
|
|
|
- break;
|
|
|
- case CursorBottomSize:
|
|
|
- cursor = [NSCursor resizeDownCursor];
|
|
|
- break;
|
|
|
- case CursorDragCopy:
|
|
|
- case CursorDragMove:
|
|
|
- cursor = [NSCursor dragCopyCursor];
|
|
|
- break;
|
|
|
- case CursorDragLink:
|
|
|
- cursor = [NSCursor dragLinkCursor];
|
|
|
- break;
|
|
|
- case CursorHand:
|
|
|
- cursor = [NSCursor pointingHandCursor];
|
|
|
- break;
|
|
|
- case CursorHelp:
|
|
|
- cursor = [NSCursor contextualMenuCursor];
|
|
|
- break;
|
|
|
- case CursorIbeam:
|
|
|
- cursor = [NSCursor IBeamCursor];
|
|
|
- break;
|
|
|
- case CursorLeftSide:
|
|
|
- cursor = [NSCursor resizeLeftCursor];
|
|
|
- break;
|
|
|
- case CursorRightSide:
|
|
|
- cursor = [NSCursor resizeRightCursor];
|
|
|
- break;
|
|
|
- case CursorNo:
|
|
|
- cursor = [NSCursor operationNotAllowedCursor];
|
|
|
- break;
|
|
|
- default:
|
|
|
- cursor = [NSCursor operationNotAllowedCursor];
|
|
|
- break;
|
|
|
- }
|
|
|
- *ptr = (__bridge void*)cursor;
|
|
|
+ *retOut = s_cursorMap[cursorType];
|
|
|
return S_OK;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-extern IAvnCursor* CreateCursor()
|
|
|
+extern IAvnCursorFactory* CreateCursorFactory()
|
|
|
{
|
|
|
- return new Cursor();
|
|
|
+ return new CursorFactory();
|
|
|
}
|