You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
4.4 KiB
167 lines
4.4 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2006 The Karbon Developers
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#include "vcursor.h"
|
||
14 years ago
|
#include <tqbitmap.h>
|
||
15 years ago
|
|
||
|
static const char* const cminus[] = {
|
||
|
"16 16 6 1",
|
||
|
" c Gray0",
|
||
|
". c #939393",
|
||
|
"X c Gray63",
|
||
|
"o c #aeaeae",
|
||
|
"O c None",
|
||
|
"+ c Gray100",
|
||
|
"OOOOo XXoOOOO",
|
||
|
"OOo ++++ XoOOO",
|
||
|
"OO ++++++++ XoOO",
|
||
|
"Oo ++++++++ XXoO",
|
||
|
"O ++++++++++ XoO",
|
||
|
"O ++ ++ XoO",
|
||
|
"O ++ ++ XoO",
|
||
|
"O ++++++++++ XoO",
|
||
|
"Oo ++++++++ .oOO",
|
||
|
"OO ++++++++ .oOO",
|
||
|
"OOo ++++ .oOO",
|
||
|
"OOOOo O XoO",
|
||
|
"OOOOOOOOOOO Xo",
|
||
|
"OOOOOOOOOOOO X",
|
||
|
"OOOOOOOOOOOOO ",
|
||
|
"OOOOOOOOOOOOOO "
|
||
|
};
|
||
|
|
||
|
static const char* const cplus[] = {
|
||
|
"16 16 6 1",
|
||
|
" c Gray0",
|
||
|
". c #939393",
|
||
|
"X c Gray63",
|
||
|
"o c #aeaeae",
|
||
|
"O c None",
|
||
|
"+ c Gray100",
|
||
|
"OOOo XXoOOOOO",
|
||
|
"Oo ++++ XoOOOO",
|
||
|
"O ++++++++ XoOOO",
|
||
|
"o +++ +++ XXoOO",
|
||
|
" ++++ ++++ XoOO",
|
||
|
" ++ ++ XoOO",
|
||
|
" ++ ++ XoOO",
|
||
|
" ++++ ++++ XoOO",
|
||
|
"o +++ +++ .oOOO",
|
||
|
"O ++++++++ .oOOO",
|
||
|
"Oo ++++ .oOOO",
|
||
|
"OOOo O XoOO",
|
||
|
"OOOOOOOOOO XoO",
|
||
|
"OOOOOOOOOOO XO",
|
||
|
"OOOOOOOOOOOO O",
|
||
|
"OOOOOOOOOOOOO O"
|
||
|
};
|
||
|
|
||
14 years ago
|
TQCursor VCursor::createCursor( CursorType type )
|
||
15 years ago
|
{
|
||
|
switch( type )
|
||
|
{
|
||
|
case CrossHair:
|
||
|
return crossHair();
|
||
|
break;
|
||
|
case ZoomPlus:
|
||
14 years ago
|
return TQCursor( TQPixmap( ( const char**) cplus ), -1, -1 );
|
||
15 years ago
|
break;
|
||
|
case ZoomMinus:
|
||
14 years ago
|
return TQCursor( TQPixmap( ( const char**) cminus ), -1, -1 );
|
||
15 years ago
|
break;
|
||
|
case NeedleArrow:
|
||
|
return needleArrow();
|
||
|
break;
|
||
14 years ago
|
default: return TQCursor( TQt::arrowCursor );
|
||
15 years ago
|
}
|
||
|
}
|
||
|
|
||
13 years ago
|
TQCursor VCursor::createCursor( const char * bitmap[], const char * mask[], int hotX, int hotY )
|
||
15 years ago
|
{
|
||
13 years ago
|
// the cursor bitmap and mask
|
||
14 years ago
|
TQBitmap b, m;
|
||
15 years ago
|
|
||
14 years ago
|
b = TQPixmap( (const char**) bitmap );
|
||
13 years ago
|
m = TQPixmap( (const char**) mask );
|
||
15 years ago
|
|
||
14 years ago
|
return TQCursor( b, m, hotX, hotY );
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
TQCursor VCursor::crossHair()
|
||
15 years ago
|
{
|
||
|
static unsigned char cross_bits[] = {
|
||
|
0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
|
||
|
0x80, 0x00, 0xff, 0x7f, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
|
||
|
0x80, 0x00, 0x80, 0x00, 0x80, 0x00};
|
||
|
|
||
14 years ago
|
TQBitmap b = TQBitmap( 15, 15, cross_bits, true );
|
||
|
TQBitmap m = b.createHeuristicMask( false );
|
||
15 years ago
|
|
||
14 years ago
|
return TQCursor( b, m, 7, 7 );
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
TQCursor VCursor::needleArrow()
|
||
15 years ago
|
{
|
||
|
static unsigned char needle_bits[] = {
|
||
|
0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x60, 0x00, 0xc0, 0x00, 0xc0, 0x01,
|
||
|
0x80, 0x03, 0x80, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3e, 0x00, 0x7e,
|
||
|
0x00, 0x7c, 0x00, 0x1c, 0x00, 0x18, 0x00, 0x00};
|
||
|
|
||
14 years ago
|
TQBitmap b = TQBitmap( 16, 16, needle_bits, true );
|
||
|
TQBitmap m = b.createHeuristicMask( false );
|
||
15 years ago
|
|
||
14 years ago
|
return TQCursor( b, m, 2, 0 );
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
TQCursor VCursor::needleMoveArrow()
|
||
15 years ago
|
{
|
||
|
static unsigned char needle_move_bits[] = {
|
||
|
0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x60, 0x00, 0xc0, 0x00, 0xc0, 0x01,
|
||
|
0x80, 0x03, 0x80, 0x07, 0x10, 0x0f, 0x38, 0x1f, 0x54, 0x3e, 0xfe, 0x7e,
|
||
|
0x54, 0x7c, 0x38, 0x1c, 0x10, 0x18, 0x00, 0x00};
|
||
|
|
||
14 years ago
|
TQBitmap b = TQBitmap( 16, 16, needle_move_bits, true );
|
||
|
TQBitmap m = b.createHeuristicMask( false );
|
||
15 years ago
|
|
||
14 years ago
|
return TQCursor( b, m, 2, 0 );
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
TQCursor VCursor::horzMove()
|
||
15 years ago
|
{
|
||
|
/*
|
||
|
#define horzMove_width 15
|
||
|
#define horzMove_height 15
|
||
|
static unsigned char horzMove_bits[] = {
|
||
|
0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x90, 0x04,
|
||
|
0x98, 0x0c, 0xfc, 0x1f, 0x98, 0x0c, 0x90, 0x04, 0x80, 0x00, 0x80, 0x00,
|
||
|
0x80, 0x00, 0x80, 0x00, 0x00, 0x00};
|
||
|
*/
|
||
|
#define horzMove_width 15
|
||
|
#define horzMove_height 15
|
||
|
static unsigned char horzMove_bits[] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08,
|
||
|
0x0c, 0x18, 0xfe, 0x3f, 0x0c, 0x18, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||
|
|
||
14 years ago
|
TQBitmap b = TQBitmap( 15, 15, horzMove_bits, true );
|
||
|
TQBitmap m = b.createHeuristicMask( false );
|
||
15 years ago
|
|
||
14 years ago
|
return TQCursor( b, m, 7, 7 );
|
||
15 years ago
|
}
|