1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-03 03:30:06 +00:00

Minor clean-ups.

This commit is contained in:
Julian Storer 2010-04-29 16:30:38 +01:00
parent 9524149ce1
commit 27d1d9a9d9
14 changed files with 386 additions and 759 deletions

View file

@ -2960,7 +2960,7 @@ bool Desktop::isScreenSaverEnabled() throw()
}
//==============================================================================
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY)
void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY)
{
ScopedXLock xlock;
const unsigned int imageW = image.getWidth();
@ -3085,117 +3085,64 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
return result;
}
void juce_deleteMouseCursor (void* const cursorHandle, const bool)
void MouseCursor::deleteMouseCursor (void* const cursorHandle, const bool)
{
ScopedXLock xlock;
if (cursorHandle != 0)
XFreeCursor (display, (Cursor) cursorHandle);
}
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type)
void* MouseCursor::createStandardMouseCursor (MouseCursor::StandardCursorType type)
{
unsigned int shape;
switch (type)
{
case MouseCursor::NoCursor:
{
const Image im (Image::ARGB, 16, 16, true);
return juce_createMouseCursorFromImage (im, 0, 0);
}
case NormalCursor: return None; // Use parent cursor
case NoCursor: return createMouseCursorFromImage (Image (Image::ARGB, 16, 16, true), 0, 0);
case MouseCursor::NormalCursor:
return (void*) None; // Use parent cursor
case WaitCursor: shape = XC_watch; break;
case IBeamCursor: shape = XC_xterm; break;
case PointingHandCursor: shape = XC_hand2; break;
case LeftRightResizeCursor: shape = XC_sb_h_double_arrow; break;
case UpDownResizeCursor: shape = XC_sb_v_double_arrow; break;
case UpDownLeftRightResizeCursor: shape = XC_fleur; break;
case TopEdgeResizeCursor: shape = XC_top_side; break;
case BottomEdgeResizeCursor: shape = XC_bottom_side; break;
case LeftEdgeResizeCursor: shape = XC_left_side; break;
case RightEdgeResizeCursor: shape = XC_right_side; break;
case TopLeftCornerResizeCursor: shape = XC_top_left_corner; break;
case TopRightCornerResizeCursor: shape = XC_top_right_corner; break;
case BottomLeftCornerResizeCursor: shape = XC_bottom_left_corner; break;
case BottomRightCornerResizeCursor: shape = XC_bottom_right_corner; break;
case CrosshairCursor: shape = XC_crosshair; break;
case MouseCursor::DraggingHandCursor:
case DraggingHandCursor:
{
static unsigned char dragHandData[] = {71,73,70,56,57,97,16,0,16,0,145,2,0,0,0,0,255,255,255,0,
0,0,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0,
16,0,0,2,52,148,47,0,200,185,16,130,90,12,74,139,107,84,123,39,
132,117,151,116,132,146,248,60,209,138,98,22,203,114,34,236,37,52,77,217,
247,154,191,119,110,240,193,128,193,95,163,56,60,234,98,135,2,0,59 };
static unsigned char dragHandData[] = { 71,73,70,56,57,97,16,0,16,0,145,2,0,0,0,0,255,255,255,0,
0,0,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0, 16,0,0,2,52,148,47,0,200,185,16,130,90,12,74,139,107,84,123,39,
132,117,151,116,132,146,248,60,209,138,98,22,203,114,34,236,37,52,77,217, 247,154,191,119,110,240,193,128,193,95,163,56,60,234,98,135,2,0,59 };
const int dragHandDataSize = 99;
const ScopedPointer <Image> im (ImageFileFormat::loadFrom (dragHandData, dragHandDataSize));
return juce_createMouseCursorFromImage (*im, 8, 7);
return createMouseCursorFromImage (*im, 8, 7);
}
case MouseCursor::CopyingCursor:
case CopyingCursor:
{
static unsigned char copyCursorData[] = {71,73,70,56,57,97,21,0,21,0,145,0,0,0,0,0,255,255,255,0,
128,128,255,255,255,33,249,4,1,0,0,3,0,44,0,0,0,0,21,0,
21,0,0,2,72,4,134,169,171,16,199,98,11,79,90,71,161,93,56,111,
78,133,218,215,137,31,82,154,100,200,86,91,202,142,12,108,212,87,235,174,
15,54,214,126,237,226,37,96,59,141,16,37,18,201,142,157,230,204,51,112,
static unsigned char copyCursorData[] = { 71,73,70,56,57,97,21,0,21,0,145,0,0,0,0,0,255,255,255,0,
128,128,255,255,255,33,249,4,1,0,0,3,0,44,0,0,0,0,21,0, 21,0,0,2,72,4,134,169,171,16,199,98,11,79,90,71,161,93,56,111,
78,133,218,215,137,31,82,154,100,200,86,91,202,142,12,108,212,87,235,174, 15,54,214,126,237,226,37,96,59,141,16,37,18,201,142,157,230,204,51,112,
252,114,147,74,83,5,50,68,147,208,217,16,71,149,252,124,5,0,59,0,0 };
const int copyCursorSize = 119;
const ScopedPointer <Image> im (ImageFileFormat::loadFrom (copyCursorData, copyCursorSize));
return juce_createMouseCursorFromImage (*im, 1, 3);
return createMouseCursorFromImage (*im, 1, 3);
}
case MouseCursor::WaitCursor:
shape = XC_watch;
break;
case MouseCursor::IBeamCursor:
shape = XC_xterm;
break;
case MouseCursor::PointingHandCursor:
shape = XC_hand2;
break;
case MouseCursor::LeftRightResizeCursor:
shape = XC_sb_h_double_arrow;
break;
case MouseCursor::UpDownResizeCursor:
shape = XC_sb_v_double_arrow;
break;
case MouseCursor::UpDownLeftRightResizeCursor:
shape = XC_fleur;
break;
case MouseCursor::TopEdgeResizeCursor:
shape = XC_top_side;
break;
case MouseCursor::BottomEdgeResizeCursor:
shape = XC_bottom_side;
break;
case MouseCursor::LeftEdgeResizeCursor:
shape = XC_left_side;
break;
case MouseCursor::RightEdgeResizeCursor:
shape = XC_right_side;
break;
case MouseCursor::TopLeftCornerResizeCursor:
shape = XC_top_left_corner;
break;
case MouseCursor::TopRightCornerResizeCursor:
shape = XC_top_right_corner;
break;
case MouseCursor::BottomLeftCornerResizeCursor:
shape = XC_bottom_left_corner;
break;
case MouseCursor::BottomRightCornerResizeCursor:
shape = XC_bottom_right_corner;
break;
case MouseCursor::CrosshairCursor:
shape = XC_crosshair;
break;
default:
return (void*) None; // Use parent cursor
jassertfalse;
return None;
}
ScopedXLock xlock;