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
026f705d
Commit
026f705d
authored
Apr 15, 1999
by
Pascal Lessard
Committed by
Alexandre Julliard
Apr 15, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement the button with bitmaps.
parent
07e242f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
1 deletion
+66
-1
button.c
controls/button.c
+63
-1
button.h
include/button.h
+1
-0
winuser.h
include/winuser.h
+2
-0
No files found.
controls/button.c
View file @
026f705d
...
...
@@ -84,6 +84,7 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
WND
*
wndPtr
=
WIN_FindWndPtr
(
hWnd
);
BUTTONINFO
*
infoPtr
=
(
BUTTONINFO
*
)
wndPtr
->
wExtra
;
LONG
style
=
wndPtr
->
dwStyle
&
0x0f
;
HANDLE
oldHbitmap
;
switch
(
uMsg
)
{
...
...
@@ -118,6 +119,7 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
}
infoPtr
->
state
=
BUTTON_UNCHECKED
;
infoPtr
->
hFont
=
0
;
infoPtr
->
hImage
=
NULL
;
WIN_ReleaseWndPtr
(
wndPtr
);
return
0
;
...
...
@@ -229,6 +231,17 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
PAINT_BUTTON
(
wndPtr
,
style
,
ODA_DRAWENTIRE
);
break
;
case
BM_SETIMAGE
:
oldHbitmap
=
infoPtr
->
hImage
;
if
(
wndPtr
->
dwStyle
&
BS_BITMAP
)
infoPtr
->
hImage
=
(
HANDLE
)
lParam
;
WIN_ReleaseWndPtr
(
wndPtr
);
return
oldHbitmap
;
case
BM_GETIMAGE
:
WIN_ReleaseWndPtr
(
wndPtr
);
return
infoPtr
->
hImage
;
case
BM_GETCHECK16
:
case
BM_GETCHECK
:
retvalue
=
infoPtr
->
state
&
3
;
...
...
@@ -294,6 +307,8 @@ static void PB_Paint( WND *wndPtr, HDC hDC, WORD action )
HPEN
hOldPen
;
HBRUSH
hOldBrush
;
BUTTONINFO
*
infoPtr
=
(
BUTTONINFO
*
)
wndPtr
->
wExtra
;
int
xBorderOffset
,
yBorderOffset
;
xBorderOffset
=
yBorderOffset
=
0
;
GetClientRect
(
wndPtr
->
hwndSelf
,
&
rc
);
...
...
@@ -304,7 +319,7 @@ static void PB_Paint( WND *wndPtr, HDC hDC, WORD action )
hOldBrush
=
(
HBRUSH
)
SelectObject
(
hDC
,
GetSysColorBrush
(
COLOR_BTNFACE
));
SetBkMode
(
hDC
,
TRANSPARENT
);
Rectangle
(
hDC
,
rc
.
left
,
rc
.
top
,
rc
.
right
,
rc
.
bottom
);
if
(
action
==
ODA_DRAWENTIRE
)
/* if (action == ODA_DRAWENTIRE)*/
{
SetPixel
(
hDC
,
rc
.
left
,
rc
.
top
,
GetSysColor
(
COLOR_WINDOW
)
);
SetPixel
(
hDC
,
rc
.
left
,
rc
.
bottom
-
1
,
GetSysColor
(
COLOR_WINDOW
)
);
...
...
@@ -330,6 +345,11 @@ static void PB_Paint( WND *wndPtr, HDC hDC, WORD action )
}
else
{
rc
.
right
++
,
rc
.
bottom
++
;
DrawEdge
(
hDC
,
&
rc
,
EDGE_RAISED
,
BF_RECT
);
/* To place de bitmap correctly */
xBorderOffset
+=
GetSystemMetrics
(
SM_CXEDGE
);
yBorderOffset
+=
GetSystemMetrics
(
SM_CYEDGE
);
rc
.
right
--
,
rc
.
bottom
--
;
}
...
...
@@ -368,6 +388,47 @@ static void PB_Paint( WND *wndPtr, HDC hDC, WORD action )
}
}
if
((
wndPtr
->
dwStyle
&
BS_BITMAP
)
&&
(
infoPtr
->
hImage
!=
NULL
))
{
BITMAP
bm
;
HDC
hdcMem
;
int
yOffset
,
xOffset
,
imageWidth
,
imageHeight
;
GetObjectA
(
infoPtr
->
hImage
,
sizeof
(
BITMAP
),
&
bm
);
/* Center the bitmap */
xOffset
=
(((
rc
.
right
-
rc
.
left
)
-
2
*
xBorderOffset
)
-
bm
.
bmWidth
)
/
2
;
yOffset
=
(((
rc
.
bottom
-
rc
.
top
)
-
2
*
yBorderOffset
)
-
bm
.
bmHeight
)
/
2
;
imageWidth
=
bm
.
bmWidth
;
imageHeight
=
bm
.
bmHeight
;
/* If the image is to big for the button */
if
(
xOffset
<
0
)
{
imageWidth
=
rc
.
right
-
rc
.
left
-
2
*
xBorderOffset
-
1
;
xOffset
=
xBorderOffset
;
}
if
(
yOffset
<
0
)
{
imageHeight
=
rc
.
bottom
-
rc
.
top
-
2
*
yBorderOffset
-
1
;
yOffset
=
yBorderOffset
;
}
/* Let minimum 1 space from border */
xOffset
++
,
yOffset
++
;
hdcMem
=
CreateCompatibleDC
(
hDC
);
SelectObject
(
hdcMem
,
(
HBITMAP
)
infoPtr
->
hImage
);
BitBlt
(
hDC
,
rc
.
left
+
xOffset
,
rc
.
top
+
yOffset
,
imageWidth
,
imageHeight
,
hdcMem
,
0
,
0
,
SRCCOPY
);
DeleteDC
(
hdcMem
);
}
SelectObject
(
hDC
,
hOldPen
);
SelectObject
(
hDC
,
hOldBrush
);
}
...
...
@@ -644,3 +705,4 @@ static void OB_Paint( WND *wndPtr, HDC hDC, WORD action )
SendMessageA
(
GetParent
(
wndPtr
->
hwndSelf
),
WM_DRAWITEM
,
wndPtr
->
wIDmenu
,
(
LPARAM
)
&
dis
);
}
include/button.h
View file @
026f705d
...
...
@@ -17,6 +17,7 @@ typedef struct
{
WORD
state
;
/* Current state */
HFONT16
hFont
;
/* Button font (or 0 for system font) */
HANDLE
hImage
;
/* Handle to the image or the icon */
}
BUTTONINFO
;
/* Button state values */
...
...
include/winuser.h
View file @
026f705d
...
...
@@ -208,6 +208,8 @@ typedef struct
#define BS_AUTORADIOBUTTON 0x00000009L
#define BS_OWNERDRAW 0x0000000BL
#define BS_LEFTTEXT 0x00000020L
#define BS_ICON 0x00000040L
#define BS_BITMAP 0x00000080L
#define BS_LEFT 0x00000100L
#define BS_PUSHLIKE 0x00001000L
...
...
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