ResizeBorderState: Set a suitable mouse cursor.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39654 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8689fe066a
commit
97d623045e
@ -430,6 +430,16 @@ struct DefaultWindowBehaviour::ResizeBorderState : MouseTrackingState {
|
||||
{
|
||||
}
|
||||
|
||||
virtual void EnterState(State* previousState)
|
||||
{
|
||||
fBehavior._SetResizeCursor(fHorizontal, fVertical);
|
||||
}
|
||||
|
||||
virtual void ExitState(State* nextState)
|
||||
{
|
||||
fBehavior._ResetResizeCursor();
|
||||
}
|
||||
|
||||
virtual void MouseMovedAction(BPoint& delta, bigtime_t now)
|
||||
{
|
||||
if ((fWindow->Flags() & B_NOT_RESIZABLE) != 0) {
|
||||
@ -1108,3 +1118,48 @@ DefaultWindowBehaviour::_NextState(State* state)
|
||||
|
||||
delete oldState;
|
||||
}
|
||||
|
||||
|
||||
ServerCursor*
|
||||
DefaultWindowBehaviour::_ResizeCursorFor(int8 horizontal, int8 vertical)
|
||||
{
|
||||
// get the cursor ID corresponding to the border/corner
|
||||
BCursorID cursorID = B_CURSOR_ID_SYSTEM_DEFAULT;
|
||||
|
||||
if (horizontal == LEFT) {
|
||||
if (vertical == TOP)
|
||||
cursorID = B_CURSOR_ID_RESIZE_NORTH_WEST;
|
||||
else if (vertical == BOTTOM)
|
||||
cursorID = B_CURSOR_ID_RESIZE_SOUTH_WEST;
|
||||
else
|
||||
cursorID = B_CURSOR_ID_RESIZE_WEST;
|
||||
} else if (horizontal == RIGHT) {
|
||||
if (vertical == TOP)
|
||||
cursorID = B_CURSOR_ID_RESIZE_NORTH_EAST;
|
||||
else if (vertical == BOTTOM)
|
||||
cursorID = B_CURSOR_ID_RESIZE_SOUTH_EAST;
|
||||
else
|
||||
cursorID = B_CURSOR_ID_RESIZE_EAST;
|
||||
} else {
|
||||
if (vertical == TOP)
|
||||
cursorID = B_CURSOR_ID_RESIZE_NORTH;
|
||||
else if (vertical == BOTTOM)
|
||||
cursorID = B_CURSOR_ID_RESIZE_SOUTH;
|
||||
}
|
||||
|
||||
return fDesktop->GetCursorManager().GetCursor(cursorID);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DefaultWindowBehaviour::_SetResizeCursor(int8 horizontal, int8 vertical)
|
||||
{
|
||||
fDesktop->SetManagementCursor(_ResizeCursorFor(horizontal, vertical));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DefaultWindowBehaviour::_ResetResizeCursor()
|
||||
{
|
||||
fDesktop->SetManagementCursor(NULL);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "WindowBehaviour.h"
|
||||
|
||||
#include "ServerCursor.h"
|
||||
#include "Decorator.h"
|
||||
|
||||
|
||||
@ -88,6 +89,12 @@ private:
|
||||
void _SetBorderHighlights(int8 horizontal,
|
||||
int8 vertical, bool active);
|
||||
|
||||
ServerCursor* _ResizeCursorFor(int8 horizontal,
|
||||
int8 vertical);
|
||||
void _SetResizeCursor(int8 horizontal,
|
||||
int8 vertical);
|
||||
void _ResetResizeCursor();
|
||||
|
||||
void _NextState(State* state);
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user