* Removed #ifdefs around cursor code (ie activate it).

* Replaced non-stylish/conform looking cursor shapes with cool looking
  cursor shapes. (I am always delighted by WonderBrush's cursor code output...)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24076 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-02-23 11:54:34 +00:00
parent ab7c45e727
commit 9553296aee

View File

@ -50,9 +50,7 @@ All rights reserved.
#include <Application.h>
#include <Bitmap.h>
#if _INCLUDES_CLASS_CURSOR
#include <Cursor.h>
#endif
#include <Debug.h>
#include <GraphicsDefs.h>
#include <MenuItem.h>
@ -80,34 +78,54 @@ namespace BPrivate {
static const unsigned char kResizeCursorData[] = {
16, 1, 8, 8,
0, 0, 1, 0x80, 1, 0x80, 1, 0x80, 9, 0x90, 0x19, 0x98, 0x39, 0x09c, 0x79, 0x9e,
0x79, 0x9e, 0x39, 0x9c, 0x19, 0x98, 0x9, 0x90, 1, 0x80, 1, 0x80, 1, 0x80, 0, 0,
3, 0xc0, 3, 0xc0, 3, 0xc0, 0xf, 0xf0, 0x1f, 0xf8, 0x3f, 0xfa, 0x7f, 0xfe, 0xff, 0xff,
0xff, 0xff, 0x7f, 0xfe, 0x3f, 0xfa, 0x1f, 0xf8, 0xf, 0xf0, 3, 0xc0, 3, 0xc0, 3, 0xc0
0x03, 0xc0, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,
0x1a, 0x58, 0x2a, 0x54, 0x4a, 0x52, 0x8a, 0x51,
0x8a, 0x51, 0x4a, 0x52, 0x2a, 0x54, 0x1a, 0x58,
0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x03, 0xc0,
0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0,
0x1b, 0xd8, 0x3b, 0xdc, 0x7b, 0xde, 0xfb, 0xdf,
0xfb, 0xdf, 0x7b, 0xde, 0x3b, 0xdc, 0x1b, 0xd8,
0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0
};
static const unsigned char kMaxResizeCursorData[] = {
16, 1, 8, 8,
0, 0, 1, 0x80, 1, 0x80, 1, 0x80, 9, 0x80, 0x19, 0x80, 0x39, 0x80, 0x79, 0x80,
0x79, 0x80, 0x39, 0x80, 0x19, 0x80, 0x9, 0x80, 1, 0x80, 1, 0x80, 1, 0x80, 0, 0,
3, 0xc0, 3, 0xc0, 3, 0xc0, 0xf, 0xc0, 0x1f, 0xc0, 0x3f, 0xc0, 0x7f, 0xc0, 0xff, 0xc0,
0xff, 0xc0, 0x7f, 0xc0, 0x3f, 0xc0, 0x1f, 0xc0, 0xf, 0xc0, 3, 0xc0, 3, 0xc0, 3, 0xc0
0x03, 0xc0, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,
0x1a, 0x40, 0x2a, 0x40, 0x4a, 0x40, 0x8a, 0x40,
0x8a, 0x40, 0x4a, 0x40, 0x2a, 0x40, 0x1a, 0x40,
0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x03, 0xc0,
0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0,
0x1b, 0xc0, 0x3b, 0xc0, 0x7b, 0xc0, 0xfb, 0xc0,
0xfb, 0xc0, 0x7b, 0xc0, 0x3b, 0xc0, 0x1b, 0xc0,
0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0
};
static const unsigned char kMinResizeCursorData[] = {
16, 1, 8, 8,
0, 0, 1, 0x80, 1, 0x80, 1, 0x80, 1, 0x90, 1, 0x98, 1, 0x09c, 1, 0x9e,
1, 0x9e, 1, 0x9c, 1, 0x98, 1, 0x90, 1, 0x80, 1, 0x80, 1, 0x80, 0, 0,
3, 0xc0, 3, 0xc0, 3, 0xc0, 3, 0xf0, 3, 0xf8, 3, 0xfa, 3, 0xfe, 3, 0xff,
3, 0xff, 3, 0xfe, 3, 0xfa, 3, 0xf8, 3, 0xf0, 3, 0xc0, 3, 0xc0, 3, 0xc0
0x03, 0xc0, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,
0x02, 0x58, 0x02, 0x54, 0x02, 0x52, 0x02, 0x51,
0x02, 0x51, 0x02, 0x52, 0x02, 0x54, 0x02, 0x58,
0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x03, 0xc0,
0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0,
0x03, 0xd8, 0x03, 0xdc, 0x03, 0xde, 0x03, 0xdf,
0x03, 0xdf, 0x03, 0xde, 0x03, 0xdc, 0x03, 0xd8,
0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0
};
static const unsigned char kColumnMoveCursorData[] = {
16, 1, 8, 8,
1, 0x80, 3, 0xc0, 7, 0xe0, 0, 0, 0, 0, 0x20, 4, 0x61, 0x86, 0xe3, 0xc7,
0xe3, 0xc7, 0x61, 0x86, 0x20, 4, 0, 0, 0, 0, 7, 0xe0, 3, 0xc0, 1, 0x80,
1, 0x80, 3, 0xc0, 7, 0xe0, 0, 0, 0, 0, 0x20, 4, 0x61, 0x86, 0xe3, 0xc7,
0xe3, 0xc7, 0x61, 0x86, 0x20, 4, 0, 0, 0, 0, 7, 0xe0, 3, 0xc0, 1, 0x80
0x01, 0x80, 0x02, 0x40, 0x04, 0x20, 0x08, 0x10,
0x1e, 0x78, 0x2a, 0x54, 0x4e, 0x72, 0x80, 0x01,
0x80, 0x01, 0x4e, 0x72, 0x2a, 0x54, 0x1e, 0x78,
0x08, 0x10, 0x04, 0x20, 0x02, 0x40, 0x01, 0x80,
0x01, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0,
0x1f, 0xf8, 0x3b, 0xdc, 0x7f, 0xfe, 0xff, 0xff,
0xff, 0xff, 0x7f, 0xfe, 0x3b, 0xdc, 0x1f, 0xf8,
0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80
};
static const unsigned char kUpSortArrow8x8[] = {
@ -259,13 +277,11 @@ private:
BBitmap *fUpSortArrow;
BBitmap *fDownSortArrow;
#if _INCLUDES_CLASS_CURSOR
BCursor *fResizeCursor;
BCursor *fMinResizeCursor;
BCursor *fMaxResizeCursor;
BCursor *fColumnMoveCursor;
#endif
typedef BView _inherited;
};
@ -1610,12 +1626,11 @@ TitleView::TitleView(BRect rect, OutlineView *horizontalSlave, BList *visibleCol
fUpSortArrow->SetBits((const void*) kUpSortArrow8x8, 64, 0, B_CMAP8);
fDownSortArrow->SetBits((const void*) kDownSortArrow8x8, 64, 0, B_CMAP8);
#if _INCLUDES_CLASS_CURSOR
fResizeCursor = new BCursor(kResizeCursorData);
fMinResizeCursor = new BCursor(kMinResizeCursorData);
fMaxResizeCursor = new BCursor(kMaxResizeCursorData);
fColumnMoveCursor = new BCursor(kColumnMoveCursorData);
#endif
FixScrollBar(true);
}
@ -1632,12 +1647,10 @@ TitleView::~TitleView()
delete fUpSortArrow;
delete fDownSortArrow;
#if _INCLUDES_CLASS_CURSOR
delete fResizeCursor;
delete fMaxResizeCursor;
delete fMinResizeCursor;
delete fColumnMoveCursor;
#endif
}
void TitleView::ColumnAdded(BColumn *column)
@ -1839,14 +1852,12 @@ void TitleView::ResizeSelectedColumn(BPoint position)
fColumnsWidth += dX;
// Update the cursor
#if _INCLUDES_CLASS_CURSOR
if (fSelectedColumn->Width() == minWidth)
SetViewCursor(fMinResizeCursor, false);
SetViewCursor(fMinResizeCursor, true);
else if (fSelectedColumn->Width() == maxWidth)
SetViewCursor(fMaxResizeCursor, false);
SetViewCursor(fMaxResizeCursor, true);
else
SetViewCursor(fResizeCursor, false);
#endif
SetViewCursor(fResizeCursor, true);
}
}
@ -2177,9 +2188,7 @@ void TitleView::MouseMoved(BPoint position, uint32 transit, const BMessage *)
if(fColumnFlags & B_ALLOW_COLUMN_MOVE) {
fCurrentState = DRAG_COLUMN_INSIDE_TITLE;
ComputeDragBoundries(fSelectedColumn, position);
#if _INCLUDES_CLASS_CURSOR
SetViewCursor(fColumnMoveCursor, false);
#endif
SetViewCursor(fColumnMoveCursor, true);
#if DRAG_TITLE_OUTLINE
BRect invalidRect(fSelectedColumnRect);
invalidRect.OffsetTo(position.x - fClickPoint.x, 0);
@ -2281,17 +2290,15 @@ void TitleView::MouseMoved(BPoint position, uint32 transit, const BMessage *)
}
// Update the cursor
#if _INCLUDES_CLASS_CURSOR
if (resizeColumn) {
if (resizeColumn->Width() == resizeColumn->MinWidth())
SetViewCursor(fMinResizeCursor, false);
SetViewCursor(fMinResizeCursor, true);
else if (resizeColumn->Width() == resizeColumn->MaxWidth())
SetViewCursor(fMaxResizeCursor, false);
SetViewCursor(fMaxResizeCursor, true);
else
SetViewCursor(fResizeCursor, false);
SetViewCursor(fResizeCursor, true);
} else
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT, false);
#endif
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT, true);
break;
}
}
@ -2306,9 +2313,7 @@ void TitleView::MouseUp(BPoint position)
ResizeSelectedColumn(position);
fCurrentState = INACTIVE;
FixScrollBar(false);
#if _INCLUDES_CLASS_CURSOR
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT, false);
#endif
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT, true);
break;
case PRESSING_COLUMN: {
@ -2344,17 +2349,13 @@ void TitleView::MouseUp(BPoint position)
#else
Invalidate(fSelectedColumnRect);
#endif
#if _INCLUDES_CLASS_CURSOR
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT, false);
#endif
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT, true);
break;
case DRAG_COLUMN_OUTSIDE_TITLE:
fCurrentState = INACTIVE;
EndRectTracking();
#if _INCLUDES_CLASS_CURSOR
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT, false);
#endif
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT, true);
break;
default:
@ -3684,6 +3685,7 @@ void OutlineView::FrameResized(float width, float height)
void OutlineView::ScrollTo(BPoint position)
{
printf("OutlineView::ScrollTo(BPoint(%.1f, %.1f))\n", position.x, position.y);
fVisibleRect.OffsetTo(position.x, position.y);
// In FixScrollBar, we might not have been able to change the size of
@ -3697,6 +3699,7 @@ void OutlineView::ScrollTo(BPoint position)
FixScrollBar(true);
_inherited::ScrollTo(position);
printf(" scrolled to BPoint(%.1f, %.1f)\n", Bounds().left, Bounds().top);
}
const BRect& OutlineView::VisibleRect() const