Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
371cff48
Commit
371cff48
authored
Jun 27, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Don't redeclare button state macros.
parent
ed1788ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
43 deletions
+37
-43
button.c
dlls/user32/button.c
+37
-43
No files found.
dlls/user32/button.c
View file @
371cff48
...
...
@@ -85,14 +85,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(button);
#define HIMAGE_GWL_OFFSET (HFONT_GWL_OFFSET+sizeof(HFONT))
#define NB_EXTRA_BYTES (HIMAGE_GWL_OFFSET+sizeof(HANDLE))
/* Button state values */
#define BUTTON_UNCHECKED 0x00
#define BUTTON_CHECKED 0x01
#define BUTTON_3STATE 0x02
#define BUTTON_HIGHLIGHTED 0x04
#define BUTTON_HASFOCUS 0x08
/* undocumented flags */
#define BUTTON_NSTATES 0x0F
/* undocumented flags */
#define BUTTON_BTNPRESSED 0x40
#define BUTTON_UNKNOWN2 0x20
#define BUTTON_UNKNOWN3 0x10
...
...
@@ -117,18 +111,18 @@ static void BUTTON_CheckAutoRadioButton( HWND hwnd );
static
const
WORD
maxCheckState
[
MAX_BTN_TYPE
]
=
{
B
UTTON_UNCHECKED
,
/* BS_PUSHBUTTON */
B
UTTON_UNCHECKED
,
/* BS_DEFPUSHBUTTON */
B
UTTON_CHECKED
,
/* BS_CHECKBOX */
B
UTTON_CHECKED
,
/* BS_AUTOCHECKBOX */
B
UTTON_CHECKED
,
/* BS_RADIOBUTTON */
B
UTTON_3STATE
,
/* BS_3STATE */
B
UTTON_3STATE
,
/* BS_AUTO3STATE */
B
UTTON_UNCHECKED
,
/* BS_GROUPBOX */
B
UTTON_UNCHECKED
,
/* BS_USERBUTTON */
B
UTTON_CHECKED
,
/* BS_AUTORADIOBUTTON */
B
UTTON_UNCHECKED
,
/* BS_PUSHBOX */
B
UTTON_UNCHECKED
/* BS_OWNERDRAW */
B
ST_UNCHECKED
,
/* BS_PUSHBUTTON */
B
ST_UNCHECKED
,
/* BS_DEFPUSHBUTTON */
B
ST_CHECKED
,
/* BS_CHECKBOX */
B
ST_CHECKED
,
/* BS_AUTOCHECKBOX */
B
ST_CHECKED
,
/* BS_RADIOBUTTON */
B
ST_INDETERMINATE
,
/* BS_3STATE */
B
ST_INDETERMINATE
,
/* BS_AUTO3STATE */
B
ST_UNCHECKED
,
/* BS_GROUPBOX */
B
ST_UNCHECKED
,
/* BS_USERBUTTON */
B
ST_CHECKED
,
/* BS_AUTORADIOBUTTON */
B
ST_UNCHECKED
,
/* BS_PUSHBOX */
B
ST_UNCHECKED
/* BS_OWNERDRAW */
};
typedef
void
(
*
pfPaint
)(
HWND
hwnd
,
HDC
hdc
,
UINT
action
);
...
...
@@ -266,7 +260,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
style
=
(
style
&
~
BS_TYPEMASK
)
|
BS_PUSHBUTTON
;
WIN_SetStyle
(
hWnd
,
style
,
BS_TYPEMASK
&
~
style
);
}
set_button_state
(
hWnd
,
B
UTTON
_UNCHECKED
);
set_button_state
(
hWnd
,
B
ST
_UNCHECKED
);
return
0
;
case
WM_ERASEBKGND
:
...
...
@@ -334,7 +328,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
if
(
!
(
state
&
BUTTON_BTNPRESSED
))
break
;
state
&=
BUTTON_NSTATES
;
set_button_state
(
hWnd
,
state
);
if
(
!
(
state
&
B
UTTON_HIGHLIGHT
ED
))
if
(
!
(
state
&
B
ST_PUSH
ED
))
{
ReleaseCapture
();
break
;
...
...
@@ -348,14 +342,14 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
switch
(
btn_type
)
{
case
BS_AUTOCHECKBOX
:
SendMessageW
(
hWnd
,
BM_SETCHECK
,
!
(
state
&
B
UTTON
_CHECKED
),
0
);
SendMessageW
(
hWnd
,
BM_SETCHECK
,
!
(
state
&
B
ST
_CHECKED
),
0
);
break
;
case
BS_AUTORADIOBUTTON
:
SendMessageW
(
hWnd
,
BM_SETCHECK
,
TRUE
,
0
);
break
;
case
BS_AUTO3STATE
:
SendMessageW
(
hWnd
,
BM_SETCHECK
,
(
state
&
B
UTTON_3ST
ATE
)
?
0
:
((
state
&
3
)
+
1
),
0
);
(
state
&
B
ST_INDETERMIN
ATE
)
?
0
:
((
state
&
3
)
+
1
),
0
);
break
;
}
BUTTON_NOTIFY_PARENT
(
hWnd
,
BN_CLICKED
);
...
...
@@ -369,7 +363,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
{
state
&=
BUTTON_NSTATES
;
set_button_state
(
hWnd
,
state
);
if
(
state
&
B
UTTON_HIGHLIGHT
ED
)
SendMessageW
(
hWnd
,
BM_SETSTATE
,
FALSE
,
0
);
if
(
state
&
B
ST_PUSH
ED
)
SendMessageW
(
hWnd
,
BM_SETSTATE
,
FALSE
,
0
);
}
break
;
...
...
@@ -424,7 +418,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
case
WM_SETFOCUS
:
TRACE
(
"WM_SETFOCUS %p
\n
"
,
hWnd
);
set_button_state
(
hWnd
,
get_button_state
(
hWnd
)
|
B
UTTON_HAS
FOCUS
);
set_button_state
(
hWnd
,
get_button_state
(
hWnd
)
|
B
ST_
FOCUS
);
paint_button
(
hWnd
,
btn_type
,
ODA_FOCUS
);
if
(
style
&
BS_NOTIFY
)
BUTTON_NOTIFY_PARENT
(
hWnd
,
BN_SETFOCUS
);
...
...
@@ -433,7 +427,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
case
WM_KILLFOCUS
:
TRACE
(
"WM_KILLFOCUS %p
\n
"
,
hWnd
);
state
=
get_button_state
(
hWnd
);
set_button_state
(
hWnd
,
state
&
~
B
UTTON_HAS
FOCUS
);
set_button_state
(
hWnd
,
state
&
~
B
ST_
FOCUS
);
paint_button
(
hWnd
,
btn_type
,
ODA_FOCUS
);
if
((
state
&
BUTTON_BTNPRESSED
)
&&
GetCapture
()
==
hWnd
)
...
...
@@ -501,7 +495,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
set_button_state
(
hWnd
,
(
state
&
~
3
)
|
wParam
);
paint_button
(
hWnd
,
btn_type
,
ODA_SELECT
);
}
if
((
btn_type
==
BS_AUTORADIOBUTTON
)
&&
(
wParam
==
B
UTTON
_CHECKED
)
&&
(
style
&
WS_CHILD
))
if
((
btn_type
==
BS_AUTORADIOBUTTON
)
&&
(
wParam
==
B
ST
_CHECKED
)
&&
(
style
&
WS_CHILD
))
BUTTON_CheckAutoRadioButton
(
hWnd
);
break
;
...
...
@@ -511,9 +505,9 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
case
BM_SETSTATE
:
state
=
get_button_state
(
hWnd
);
if
(
wParam
)
set_button_state
(
hWnd
,
state
|
B
UTTON_HIGHLIGHT
ED
);
set_button_state
(
hWnd
,
state
|
B
ST_PUSH
ED
);
else
set_button_state
(
hWnd
,
state
&
~
B
UTTON_HIGHLIGHT
ED
);
set_button_state
(
hWnd
,
state
&
~
B
ST_PUSH
ED
);
paint_button
(
hWnd
,
btn_type
,
ODA_SELECT
);
break
;
...
...
@@ -713,7 +707,7 @@ static void BUTTON_DrawLabel(HWND hwnd, HDC hdc, UINT dtFlags, const RECT *rc)
* I don't have Win31 on hand to verify that, so I leave it as is.
*/
if
((
style
&
BS_PUSHLIKE
)
&&
(
state
&
B
UTTON_3ST
ATE
))
if
((
style
&
BS_PUSHLIKE
)
&&
(
state
&
B
ST_INDETERMIN
ATE
))
{
hbr
=
GetSysColorBrush
(
COLOR_GRAYTEXT
);
flags
|=
DSS_MONO
;
...
...
@@ -762,7 +756,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
HFONT
hFont
;
LONG
state
=
get_button_state
(
hwnd
);
LONG
style
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
BOOL
pushedState
=
(
state
&
B
UTTON_HIGHLIGHT
ED
);
BOOL
pushedState
=
(
state
&
B
ST_PUSH
ED
);
HWND
parent
;
HRGN
hrgn
;
...
...
@@ -802,7 +796,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
uState
|=
DFCS_PUSHED
;
}
if
(
state
&
(
B
UTTON_CHECKED
|
BUTTON_3ST
ATE
))
if
(
state
&
(
B
ST_CHECKED
|
BST_INDETERMIN
ATE
))
uState
|=
DFCS_CHECKED
;
DrawFrameControl
(
hDC
,
&
rc
,
DFC_BUTTON
,
uState
);
...
...
@@ -824,7 +818,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
SetTextColor
(
hDC
,
oldTxtColor
);
draw_focus:
if
(
action
==
ODA_FOCUS
||
(
state
&
B
UTTON_HAS
FOCUS
))
if
(
action
==
ODA_FOCUS
||
(
state
&
B
ST_
FOCUS
))
{
InflateRect
(
&
rc
,
-
2
,
-
2
);
DrawFocusRect
(
hDC
,
&
rc
);
...
...
@@ -909,11 +903,11 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
if
((
get_button_type
(
style
)
==
BS_RADIOBUTTON
)
||
(
get_button_type
(
style
)
==
BS_AUTORADIOBUTTON
))
flags
=
DFCS_BUTTONRADIO
;
else
if
(
state
&
B
UTTON_3ST
ATE
)
flags
=
DFCS_BUTTON3STATE
;
else
if
(
state
&
B
ST_INDETERMIN
ATE
)
flags
=
DFCS_BUTTON3STATE
;
else
flags
=
DFCS_BUTTONCHECK
;
if
(
state
&
(
B
UTTON_CHECKED
|
BUTTON_3ST
ATE
))
flags
|=
DFCS_CHECKED
;
if
(
state
&
B
UTTON_HIGHLIGHT
ED
)
flags
|=
DFCS_PUSHED
;
if
(
state
&
(
B
ST_CHECKED
|
BST_INDETERMIN
ATE
))
flags
|=
DFCS_CHECKED
;
if
(
state
&
B
ST_PUSH
ED
)
flags
|=
DFCS_PUSHED
;
if
(
style
&
WS_DISABLED
)
flags
|=
DFCS_INACTIVE
;
...
...
@@ -956,7 +950,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
BUTTON_DrawLabel
(
hwnd
,
hDC
,
dtFlags
,
&
rtext
);
/* ... and focus */
if
(
action
==
ODA_FOCUS
||
(
state
&
B
UTTON_HAS
FOCUS
))
if
(
action
==
ODA_FOCUS
||
(
state
&
B
ST_
FOCUS
))
{
rtext
.
left
--
;
rtext
.
right
++
;
...
...
@@ -985,7 +979,7 @@ static void BUTTON_CheckAutoRadioButton( HWND hwnd )
if
(
!
sibling
)
break
;
if
((
hwnd
!=
sibling
)
&&
((
GetWindowLongW
(
sibling
,
GWL_STYLE
)
&
BS_TYPEMASK
)
==
BS_AUTORADIOBUTTON
))
SendMessageW
(
sibling
,
BM_SETCHECK
,
B
UTTON
_UNCHECKED
,
0
);
SendMessageW
(
sibling
,
BM_SETCHECK
,
B
ST
_UNCHECKED
,
0
);
sibling
=
GetNextDlgGroupItem
(
parent
,
sibling
,
FALSE
);
}
while
(
sibling
!=
start
);
}
...
...
@@ -1068,17 +1062,17 @@ static void UB_Paint( HWND hwnd, HDC hDC, UINT action )
(
WPARAM
)
hDC
,
(
LPARAM
)
hwnd
);
FillRect
(
hDC
,
&
rc
,
hBrush
);
if
(
action
==
ODA_FOCUS
||
(
state
&
B
UTTON_HAS
FOCUS
))
if
(
action
==
ODA_FOCUS
||
(
state
&
B
ST_
FOCUS
))
DrawFocusRect
(
hDC
,
&
rc
);
switch
(
action
)
{
case
ODA_FOCUS
:
BUTTON_NOTIFY_PARENT
(
hwnd
,
(
state
&
B
UTTON_HAS
FOCUS
)
?
BN_SETFOCUS
:
BN_KILLFOCUS
);
BUTTON_NOTIFY_PARENT
(
hwnd
,
(
state
&
B
ST_
FOCUS
)
?
BN_SETFOCUS
:
BN_KILLFOCUS
);
break
;
case
ODA_SELECT
:
BUTTON_NOTIFY_PARENT
(
hwnd
,
(
state
&
B
UTTON_HIGHLIGHT
ED
)
?
BN_HILITE
:
BN_UNHILITE
);
BUTTON_NOTIFY_PARENT
(
hwnd
,
(
state
&
B
ST_PUSH
ED
)
?
BN_HILITE
:
BN_UNHILITE
);
break
;
default:
...
...
@@ -1105,8 +1099,8 @@ static void OB_Paint( HWND hwnd, HDC hDC, UINT action )
dis
.
CtlID
=
id
;
dis
.
itemID
=
0
;
dis
.
itemAction
=
action
;
dis
.
itemState
=
((
state
&
B
UTTON_HAS
FOCUS
)
?
ODS_FOCUS
:
0
)
|
((
state
&
B
UTTON_HIGHLIGHT
ED
)
?
ODS_SELECTED
:
0
)
|
dis
.
itemState
=
((
state
&
B
ST_
FOCUS
)
?
ODS_FOCUS
:
0
)
|
((
state
&
B
ST_PUSH
ED
)
?
ODS_SELECTED
:
0
)
|
(
IsWindowEnabled
(
hwnd
)
?
0
:
ODS_DISABLED
);
dis
.
hwndItem
=
hwnd
;
dis
.
hDC
=
hDC
;
...
...
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