Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c5bc3ebc
Commit
c5bc3ebc
authored
Nov 06, 2001
by
Eric Pouech
Committed by
Alexandre Julliard
Nov 06, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
For drawing a caret, internally replaced the brush by a bitmap (this
allows caret of size > 8x8),
parent
4ae7195c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
11 deletions
+52
-11
caret.c
windows/caret.c
+52
-11
No files found.
windows/caret.c
View file @
c5bc3ebc
...
...
@@ -3,6 +3,7 @@
*
* Copyright 1993 David Metcalfe
* Copyright 1996 Frans van Dorsselaer
* Copyright 2001 Eric Pouech
*/
#include "windef.h"
...
...
@@ -25,7 +26,7 @@ typedef struct
INT
y
;
INT
width
;
INT
height
;
HB
RUSH
hBrush
;
HB
ITMAP
hBmp
;
UINT
timeout
;
UINT
timerid
;
}
CARET
;
...
...
@@ -62,7 +63,7 @@ void CARET_GetRect(LPRECT lprc)
static
void
CARET_DisplayCaret
(
DISPLAY_CARET
status
)
{
HDC
hdc
;
H
BRUSH
hPrevBrush
;
H
DC
hCompDC
;
if
(
Caret
.
on
&&
(
status
==
CARET_ON
))
return
;
if
(
!
Caret
.
on
&&
(
status
==
CARET_OFF
))
return
;
...
...
@@ -72,9 +73,16 @@ static void CARET_DisplayCaret( DISPLAY_CARET status )
Caret
.
on
=
!
Caret
.
on
;
/* do not use DCX_CACHE here, for x,y,width,height are in logical units */
if
(
!
(
hdc
=
GetDCEx
(
Caret
.
hwnd
,
0
,
DCX_USESTYLE
/*| DCX_CACHE*/
)))
return
;
hPrevBrush
=
SelectObject
(
hdc
,
Caret
.
hBrush
);
PatBlt
(
hdc
,
Caret
.
x
,
Caret
.
y
,
Caret
.
width
,
Caret
.
height
,
PATINVERT
);
SelectObject
(
hdc
,
hPrevBrush
);
hCompDC
=
CreateCompatibleDC
(
hdc
);
if
(
hCompDC
)
{
HBITMAP
hPrevBmp
;
hPrevBmp
=
SelectObject
(
hCompDC
,
Caret
.
hBmp
);
BitBlt
(
hdc
,
Caret
.
x
,
Caret
.
y
,
Caret
.
width
,
Caret
.
height
,
hCompDC
,
0
,
0
,
SRCINVERT
);
SelectObject
(
hCompDC
,
hPrevBmp
);
DeleteDC
(
hCompDC
);
}
ReleaseDC
(
Caret
.
hwnd
,
hdc
);
}
...
...
@@ -147,16 +155,49 @@ BOOL WINAPI CreateCaret( HWND hwnd, HBITMAP bitmap,
if
(
!
GetObjectA
(
bitmap
,
sizeof
(
bmp
),
&
bmp
))
return
FALSE
;
Caret
.
width
=
bmp
.
bmWidth
;
Caret
.
height
=
bmp
.
bmHeight
;
/* FIXME: we should make a copy of the bitmap instead of a brush */
Caret
.
hBrush
=
CreatePatternBrush
(
bitmap
);
bmp
.
bmBits
=
NULL
;
Caret
.
hBmp
=
CreateBitmapIndirect
(
&
bmp
);
if
(
Caret
.
hBmp
)
{
/* copy the bitmap */
LPBYTE
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
bmp
.
bmWidthBytes
*
bmp
.
bmHeight
);
GetBitmapBits
(
bitmap
,
bmp
.
bmWidthBytes
*
bmp
.
bmHeight
,
buf
);
SetBitmapBits
(
Caret
.
hBmp
,
bmp
.
bmWidthBytes
*
bmp
.
bmHeight
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
}
else
{
HDC
hdc
;
Caret
.
width
=
width
?
width
:
GetSystemMetrics
(
SM_CXBORDER
);
Caret
.
height
=
height
?
height
:
GetSystemMetrics
(
SM_CYBORDER
);
Caret
.
hBrush
=
CreateSolidBrush
(
bitmap
?
GetSysColor
(
COLOR_GRAYTEXT
)
:
GetSysColor
(
COLOR_WINDOW
)
);
Caret
.
hBmp
=
0
;
/* create the uniform bitmap on the fly */
hdc
=
GetDC
(
hwnd
);
if
(
hdc
)
{
HDC
hMemDC
=
CreateCompatibleDC
(
hdc
);
if
(
hMemDC
)
{
RECT
r
;
r
.
left
=
r
.
top
=
0
;
r
.
right
=
Caret
.
width
;
r
.
bottom
=
Caret
.
height
;
if
((
Caret
.
hBmp
=
CreateCompatibleBitmap
(
hMemDC
,
Caret
.
width
,
Caret
.
height
)))
{
HBITMAP
hPrevBmp
=
SelectObject
(
hMemDC
,
Caret
.
hBmp
);
FillRect
(
hMemDC
,
&
r
,
(
bitmap
?
COLOR_GRAYTEXT
:
COLOR_WINDOW
)
+
1
);
SelectObject
(
hMemDC
,
hPrevBmp
);
}
DeleteDC
(
hMemDC
);
}
ReleaseDC
(
hwnd
,
hdc
);
}
}
Caret
.
hwnd
=
WIN_GetFullHandle
(
hwnd
);
...
...
@@ -191,7 +232,7 @@ BOOL WINAPI DestroyCaret(void)
CARET_KillTimer
();
CARET_DisplayCaret
(
CARET_OFF
);
DeleteObject
(
Caret
.
hB
rush
);
DeleteObject
(
Caret
.
hB
mp
);
Caret
.
hwnd
=
0
;
return
TRUE
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment