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