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,12 +40,13 @@ enum lights {
|
||||
|
||||
class ResScroll;
|
||||
class GLObject;
|
||||
class BCursor;
|
||||
|
||||
struct TrackingInfo {
|
||||
float lastX;
|
||||
float lastY;
|
||||
float lastDx;
|
||||
float lastDy;
|
||||
float lastDy;
|
||||
bool isTracking;
|
||||
GLObject *pickedObject;
|
||||
uint32 buttons;
|
||||
@ -60,7 +61,7 @@ class ObjectView : public BGLView {
|
||||
virtual void MouseDown(BPoint point);
|
||||
virtual void MouseUp(BPoint point);
|
||||
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *msg);
|
||||
|
||||
|
||||
virtual void MessageReceived(BMessage* msg);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
@ -71,11 +72,11 @@ class ObjectView : public BGLView {
|
||||
virtual void Pulse();
|
||||
void EnforceState();
|
||||
bool RepositionView();
|
||||
|
||||
|
||||
sem_id drawEvent;
|
||||
sem_id quittingSem;
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
thread_id fDrawThread;
|
||||
ResScroll* fResScroll;
|
||||
BList fObjects;
|
||||
@ -89,7 +90,9 @@ class ObjectView : public BGLView {
|
||||
bool fLastFog, fFog, fForceRedraw;
|
||||
float fLastYXRatio, fYxRatio, fFpsHistory[HISTSIZE];
|
||||
float fObjectDistance, fLastObjectDistance;
|
||||
TrackingInfo fTrackingInfo;
|
||||
TrackingInfo fTrackingInfo;
|
||||
BCursor* fGrabCursor;
|
||||
BCursor* fGrabbingCursor;
|
||||
};
|
||||
|
||||
#endif // OBJECT_VIEW_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user