Change cursor to hint user an object can be dragged...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38557 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d29fcc50b8
commit
91998e8078
@ -21,6 +21,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Cursor.h>
|
||||
#include <InterfaceKit.h>
|
||||
#include <FindDirectory.h>
|
||||
|
||||
@ -165,6 +166,9 @@ ObjectView::ObjectView(BRect rect, const char *name, ulong resizingMode,
|
||||
quittingSem = create_sem(1, "quitting sem");
|
||||
drawEvent = create_sem(0, "draw event");
|
||||
|
||||
fGrabbingCursor = new BCursor(B_CURSOR_ID_GRABBING);
|
||||
fGrabCursor = new BCursor(B_CURSOR_ID_GRAB);
|
||||
|
||||
char findDir[PATH_MAX];
|
||||
find_directory(B_SYSTEM_DATA_DIRECTORY, -1, true, findDir, PATH_MAX);
|
||||
sprintf(teapotPath, "%s/%s", findDir, teapotData);
|
||||
@ -178,6 +182,8 @@ ObjectView::~ObjectView()
|
||||
{
|
||||
delete_sem(quittingSem);
|
||||
delete_sem(drawEvent);
|
||||
delete fGrabCursor;
|
||||
delete fGrabbingCursor;
|
||||
}
|
||||
|
||||
|
||||
@ -433,6 +439,7 @@ ObjectView::MouseDown(BPoint point)
|
||||
|
||||
SetMouseEventMask(B_POINTER_EVENTS,
|
||||
B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
|
||||
SetViewCursor(fGrabbingCursor);
|
||||
} else {
|
||||
ConvertToScreen(&point);
|
||||
object->MenuInvoked(point);
|
||||
@ -465,6 +472,8 @@ ObjectView::MouseUp(BPoint point)
|
||||
fTrackingInfo.lastY = 0.0f;
|
||||
fTrackingInfo.lastDx = 0.0f;
|
||||
fTrackingInfo.lastDy = 0.0f;
|
||||
|
||||
SetViewCursor(fGrabCursor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,6 +518,9 @@ ObjectView::MouseMoved(BPoint point, uint32 transit, const BMessage *msg)
|
||||
fForceRedraw = true;
|
||||
setEvent(drawEvent);
|
||||
}
|
||||
} else {
|
||||
GLObject* object = reinterpret_cast<GLObject*>(fObjects.ItemAt(ObjectAtPoint(point)));
|
||||
SetViewCursor(object != NULL ? fGrabCursor : B_CURSOR_SYSTEM_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ enum lights {
|
||||
|
||||
class ResScroll;
|
||||
class GLObject;
|
||||
class BCursor;
|
||||
|
||||
struct TrackingInfo {
|
||||
float lastX;
|
||||
@ -90,6 +91,8 @@ class ObjectView : public BGLView {
|
||||
float fLastYXRatio, fYxRatio, fFpsHistory[HISTSIZE];
|
||||
float fObjectDistance, fLastObjectDistance;
|
||||
TrackingInfo fTrackingInfo;
|
||||
BCursor* fGrabCursor;
|
||||
BCursor* fGrabbingCursor;
|
||||
};
|
||||
|
||||
#endif // OBJECT_VIEW_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user