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
07869ec4
Commit
07869ec4
authored
Feb 05, 2002
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Feb 05, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various cleanups:
- get rid of the static data member - pass the infoPtr around instead of the hwnd - fix indentatin/style a bit to make it consistent with the rest of the file.
parent
afe92e8e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
139 additions
and
167 deletions
+139
-167
updown.c
dlls/comctl32/updown.c
+139
-167
No files found.
dlls/comctl32/updown.c
View file @
07869ec4
...
@@ -39,8 +39,10 @@ DEFAULT_DEBUG_CHANNEL(updown);
...
@@ -39,8 +39,10 @@ DEFAULT_DEBUG_CHANNEL(updown);
typedef
struct
typedef
struct
{
{
HWND
Self
;
/* Handle to this up-down control */
UINT
AccelCount
;
/* Number of elements in AccelVect */
UINT
AccelCount
;
/* Number of elements in AccelVect */
UDACCEL
*
AccelVect
;
/* Vector containing AccelCount elements */
UDACCEL
*
AccelVect
;
/* Vector containing AccelCount elements */
INT
AccelIndex
;
/* Current accel index, -1 if not accelerating */
INT
Base
;
/* Base to display nr in the buddy window */
INT
Base
;
/* Base to display nr in the buddy window */
INT
CurVal
;
/* Current up-down value */
INT
CurVal
;
/* Current up-down value */
INT
MinVal
;
/* Minimum up-down value */
INT
MinVal
;
/* Minimum up-down value */
...
@@ -74,8 +76,6 @@ typedef struct
...
@@ -74,8 +76,6 @@ typedef struct
#define BUDDY_UPDOWN_HWND "buddyUpDownHWND"
#define BUDDY_UPDOWN_HWND "buddyUpDownHWND"
#define BUDDY_SUPERCLASS_WNDPROC "buddySupperClassWndProc"
#define BUDDY_SUPERCLASS_WNDPROC "buddySupperClassWndProc"
static
int
accelIndex
=
-
1
;
#define UNKNOWN_PARAM(msg, wParam, lParam) WARN(\
#define UNKNOWN_PARAM(msg, wParam, lParam) WARN(\
"Unknown parameter(s) for message " #msg \
"Unknown parameter(s) for message " #msg \
"(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam);
"(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam);
...
@@ -89,10 +89,8 @@ UPDOWN_Buddy_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
...
@@ -89,10 +89,8 @@ UPDOWN_Buddy_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
* UPDOWN_InBounds
* UPDOWN_InBounds
* Tests if a given value 'val' is between the Min&Max limits
* Tests if a given value 'val' is between the Min&Max limits
*/
*/
static
BOOL
UPDOWN_InBounds
(
HWND
hwnd
,
int
val
)
static
BOOL
UPDOWN_InBounds
(
UPDOWN_INFO
*
infoPtr
,
int
val
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
if
(
infoPtr
->
MaxVal
>
infoPtr
->
MinVal
)
if
(
infoPtr
->
MaxVal
>
infoPtr
->
MinVal
)
return
(
infoPtr
->
MinVal
<=
val
)
&&
(
val
<=
infoPtr
->
MaxVal
);
return
(
infoPtr
->
MinVal
<=
val
)
&&
(
val
<=
infoPtr
->
MaxVal
);
else
else
...
@@ -104,13 +102,11 @@ static BOOL UPDOWN_InBounds(HWND hwnd, int val)
...
@@ -104,13 +102,11 @@ static BOOL UPDOWN_InBounds(HWND hwnd, int val)
* Tests if we can change the current value by delta. If so, it changes
* Tests if we can change the current value by delta. If so, it changes
* it and returns TRUE. Else, it leaves it unchanged and returns FALSE.
* it and returns TRUE. Else, it leaves it unchanged and returns FALSE.
*/
*/
static
BOOL
UPDOWN_OffsetVal
(
HWND
hwnd
,
int
delta
)
static
BOOL
UPDOWN_OffsetVal
(
UPDOWN_INFO
*
infoPtr
,
int
delta
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
/* check if we can do the modification first */
/* check if we can do the modification first */
if
(
!
UPDOWN_InBounds
(
hwnd
,
infoPtr
->
CurVal
+
delta
)){
if
(
!
UPDOWN_InBounds
(
infoPtr
,
infoPtr
->
CurVal
+
delta
)){
if
(
GetWindowLong
A
(
hwnd
,
GWL_STYLE
)
&
UDS_WRAP
)
if
(
GetWindowLong
W
(
infoPtr
->
Self
,
GWL_STYLE
)
&
UDS_WRAP
)
{
{
delta
+=
(
delta
<
0
?
-
1
:
1
)
*
delta
+=
(
delta
<
0
?
-
1
:
1
)
*
(
infoPtr
->
MaxVal
<
infoPtr
->
MinVal
?
-
1
:
1
)
*
(
infoPtr
->
MaxVal
<
infoPtr
->
MinVal
?
-
1
:
1
)
*
...
@@ -131,13 +127,12 @@ static BOOL UPDOWN_OffsetVal(HWND hwnd, int delta)
...
@@ -131,13 +127,12 @@ static BOOL UPDOWN_OffsetVal(HWND hwnd, int delta)
* When we have a buddy set and that we are aligned on our buddy, we
* When we have a buddy set and that we are aligned on our buddy, we
* want to draw a sunken edge to make like we are part of that control.
* want to draw a sunken edge to make like we are part of that control.
*/
*/
static
BOOL
UPDOWN_HasBuddyBorder
(
HWND
hwnd
)
static
BOOL
UPDOWN_HasBuddyBorder
(
UPDOWN_INFO
*
infoPtr
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
DWORD
dwStyle
=
GetWindowLongW
(
infoPtr
->
Self
,
GWL_STYLE
);
DWORD
dwStyle
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
return
(
((
dwStyle
&
(
UDS_ALIGNLEFT
|
UDS_ALIGNRIGHT
))
!=
0
)
&&
return
(
((
dwStyle
&
(
UDS_ALIGNLEFT
|
UDS_ALIGNRIGHT
))
!=
0
)
&&
(
SendMessage
A
(
hwnd
,
UDM_GETBUDDY
,
0
,
0
)
!=
0
)
&&
(
SendMessage
W
(
infoPtr
->
Self
,
UDM_GETBUDDY
,
0
,
0
)
!=
0
)
&&
(
lstrcmpiA
(
infoPtr
->
szBuddyClass
,
"EDIT"
)
==
0
)
);
(
lstrcmpiA
(
infoPtr
->
szBuddyClass
,
"EDIT"
)
==
0
)
);
}
}
...
@@ -147,25 +142,23 @@ static BOOL UPDOWN_HasBuddyBorder(HWND hwnd)
...
@@ -147,25 +142,23 @@ static BOOL UPDOWN_HasBuddyBorder(HWND hwnd)
* rect - will hold the rectangle
* rect - will hold the rectangle
* incr - TRUE get the "increment" rect (up or right)
* incr - TRUE get the "increment" rect (up or right)
* FALSE get the "decrement" rect (down or left)
* FALSE get the "decrement" rect (down or left)
*
*/
*/
static
void
UPDOWN_GetArrowRect
(
HWND
hwnd
,
RECT
*
rect
,
BOOL
incr
)
static
void
UPDOWN_GetArrowRect
(
UPDOWN_INFO
*
infoPtr
,
RECT
*
rect
,
BOOL
incr
)
{
{
DWORD
dwStyle
=
GetWindowLong
A
(
hwnd
,
GWL_STYLE
);
DWORD
dwStyle
=
GetWindowLong
W
(
infoPtr
->
Self
,
GWL_STYLE
);
int
len
;
/* will hold the width or height */
int
len
;
/* will hold the width or height */
GetClientRect
(
hwnd
,
rect
);
GetClientRect
(
infoPtr
->
Self
,
rect
);
/*
/*
* Make sure we calculate the rectangle to fit even if we draw the
* Make sure we calculate the rectangle to fit even if we draw the
* border.
* border.
*/
*/
if
(
UPDOWN_HasBuddyBorder
(
hwnd
))
if
(
UPDOWN_HasBuddyBorder
(
infoPtr
))
{
{
if
(
dwStyle
&
UDS_ALIGNLEFT
)
if
(
dwStyle
&
UDS_ALIGNLEFT
)
rect
->
left
+=
DEFAULT_BUDDYBORDER
;
rect
->
left
+=
DEFAULT_BUDDYBORDER
;
else
else
rect
->
right
-=
DEFAULT_BUDDYBORDER
;
rect
->
right
-=
DEFAULT_BUDDYBORDER
;
InflateRect
(
rect
,
0
,
-
DEFAULT_BUDDYBORDER
);
InflateRect
(
rect
,
0
,
-
DEFAULT_BUDDYBORDER
);
}
}
...
@@ -181,8 +174,7 @@ static void UPDOWN_GetArrowRect (HWND hwnd, RECT *rect, BOOL incr)
...
@@ -181,8 +174,7 @@ static void UPDOWN_GetArrowRect (HWND hwnd, RECT *rect, BOOL incr)
rect
->
left
=
rect
->
left
+
len
/
2
;
rect
->
left
=
rect
->
left
+
len
/
2
;
else
else
rect
->
right
=
rect
->
left
+
len
/
2
;
rect
->
right
=
rect
->
left
+
len
/
2
;
}
}
else
{
else
{
len
=
rect
->
bottom
-
rect
->
top
+
1
;
/* compute the height */
len
=
rect
->
bottom
-
rect
->
top
+
1
;
/* compute the height */
if
(
incr
)
if
(
incr
)
rect
->
bottom
=
rect
->
top
+
len
/
2
;
rect
->
bottom
=
rect
->
top
+
len
/
2
;
...
@@ -197,14 +189,12 @@ static void UPDOWN_GetArrowRect (HWND hwnd, RECT *rect, BOOL incr)
...
@@ -197,14 +189,12 @@ static void UPDOWN_GetArrowRect (HWND hwnd, RECT *rect, BOOL incr)
* If it returns the up rect, it returns TRUE.
* If it returns the up rect, it returns TRUE.
* If it returns the down rect, it returns FALSE.
* If it returns the down rect, it returns FALSE.
*/
*/
static
BOOL
static
BOOL
UPDOWN_GetArrowFromPoint
(
UPDOWN_INFO
*
infoPtr
,
RECT
*
rect
,
POINT
pt
)
UPDOWN_GetArrowFromPoint
(
HWND
hwnd
,
RECT
*
rect
,
POINT
pt
)
{
{
UPDOWN_GetArrowRect
(
hwnd
,
rect
,
TRUE
);
UPDOWN_GetArrowRect
(
infoPtr
,
rect
,
TRUE
);
if
(
PtInRect
(
rect
,
pt
))
if
(
PtInRect
(
rect
,
pt
))
return
TRUE
;
return
TRUE
;
UPDOWN_GetArrowRect
(
hwnd
,
rect
,
FALSE
);
UPDOWN_GetArrowRect
(
infoPtr
,
rect
,
FALSE
);
return
FALSE
;
return
FALSE
;
}
}
...
@@ -213,12 +203,11 @@ UPDOWN_GetArrowFromPoint (HWND hwnd, RECT *rect, POINT pt)
...
@@ -213,12 +203,11 @@ UPDOWN_GetArrowFromPoint (HWND hwnd, RECT *rect, POINT pt)
* UPDOWN_GetThousandSep
* UPDOWN_GetThousandSep
* Returns the thousand sep. If an error occurs, it returns ','.
* Returns the thousand sep. If an error occurs, it returns ','.
*/
*/
static
char
UPDOWN_GetThousandSep
()
static
CHAR
UPDOWN_GetThousandSep
()
{
{
char
sep
[
2
];
CHAR
sep
[
2
];
if
(
GetLocaleInfoA
(
LOCALE_USER_DEFAULT
,
LOCALE_STHOUSAND
,
if
(
GetLocaleInfoA
(
LOCALE_USER_DEFAULT
,
LOCALE_STHOUSAND
,
sep
,
2
)
!=
1
)
sep
,
sizeof
(
sep
))
!=
1
)
return
','
;
return
','
;
return
sep
[
0
];
return
sep
[
0
];
...
@@ -232,9 +221,8 @@ static char UPDOWN_GetThousandSep()
...
@@ -232,9 +221,8 @@ static char UPDOWN_GetThousandSep()
* TRUE - if it read the integer from the buddy successfully
* TRUE - if it read the integer from the buddy successfully
* FALSE - if an error occured
* FALSE - if an error occured
*/
*/
static
BOOL
UPDOWN_GetBuddyInt
(
HWND
hwnd
)
static
BOOL
UPDOWN_GetBuddyInt
(
UPDOWN_INFO
*
infoPtr
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
char
txt
[
20
],
sep
,
*
src
,
*
dst
;
char
txt
[
20
],
sep
,
*
src
,
*
dst
;
int
newVal
;
int
newVal
;
...
@@ -256,17 +244,15 @@ static BOOL UPDOWN_GetBuddyInt (HWND hwnd)
...
@@ -256,17 +244,15 @@ static BOOL UPDOWN_GetBuddyInt (HWND hwnd)
/* now get rid of the separators */
/* now get rid of the separators */
for
(
src
=
dst
=
txt
;
*
src
;
src
++
)
for
(
src
=
dst
=
txt
;
*
src
;
src
++
)
if
(
*
src
!=
sep
)
if
(
*
src
!=
sep
)
*
dst
++
=
*
src
;
*
dst
++
=
*
src
;
*
dst
=
0
;
*
dst
=
0
;
/* try to convert the number and validate it */
/* try to convert the number and validate it */
newVal
=
strtol
(
txt
,
&
src
,
infoPtr
->
Base
);
newVal
=
strtol
(
txt
,
&
src
,
infoPtr
->
Base
);
if
(
*
src
||
!
UPDOWN_InBounds
(
hwnd
,
newVal
))
if
(
*
src
||
!
UPDOWN_InBounds
(
infoPtr
,
newVal
))
return
FALSE
;
return
FALSE
;
TRACE
(
"new value(%d) read from buddy (old=%d)
\n
"
,
TRACE
(
"new value(%d) from buddy (old=%d)
\n
"
,
newVal
,
infoPtr
->
CurVal
);
newVal
,
infoPtr
->
CurVal
);
}
}
infoPtr
->
CurVal
=
newVal
;
infoPtr
->
CurVal
=
newVal
;
...
@@ -281,17 +267,15 @@ static BOOL UPDOWN_GetBuddyInt (HWND hwnd)
...
@@ -281,17 +267,15 @@ static BOOL UPDOWN_GetBuddyInt (HWND hwnd)
* TRUE - if it set the caption of the buddy successfully
* TRUE - if it set the caption of the buddy successfully
* FALSE - if an error occured
* FALSE - if an error occured
*/
*/
static
BOOL
UPDOWN_SetBuddyInt
(
HWND
hwnd
)
static
BOOL
UPDOWN_SetBuddyInt
(
UPDOWN_INFO
*
infoPtr
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
char
txt1
[
20
],
sep
;
char
txt1
[
20
],
sep
;
int
len
;
int
len
;
if
(
!
IsWindow
(
infoPtr
->
Buddy
))
if
(
!
IsWindow
(
infoPtr
->
Buddy
))
return
FALSE
;
return
FALSE
;
TRACE
(
"set new value(%d) to buddy.
\n
"
,
TRACE
(
"set new value(%d) to buddy.
\n
"
,
infoPtr
->
CurVal
);
infoPtr
->
CurVal
);
/*if the buddy is a list window, we must set curr index */
/*if the buddy is a list window, we must set curr index */
if
(
!
lstrcmpA
(
infoPtr
->
szBuddyClass
,
"ListBox"
)){
if
(
!
lstrcmpA
(
infoPtr
->
szBuddyClass
,
"ListBox"
)){
...
@@ -303,16 +287,15 @@ static BOOL UPDOWN_SetBuddyInt (HWND hwnd)
...
@@ -303,16 +287,15 @@ static BOOL UPDOWN_SetBuddyInt (HWND hwnd)
sep
=
UPDOWN_GetThousandSep
();
sep
=
UPDOWN_GetThousandSep
();
/* Do thousands seperation if necessary */
/* Do thousands seperation if necessary */
if
(
!
(
GetWindowLongA
(
hwnd
,
GWL_STYLE
)
&
UDS_NOTHOUSANDS
)
&&
(
len
>
3
))
{
if
(
!
(
GetWindowLongA
(
infoPtr
->
Self
,
GWL_STYLE
)
&
UDS_NOTHOUSANDS
)
&&
(
len
>
3
))
{
char
txt2
[
20
],
*
src
=
txt1
,
*
dst
=
txt2
;
char
txt2
[
20
],
*
src
=
txt1
,
*
dst
=
txt2
;
if
(
len
%
3
>
0
)
{
if
(
len
%
3
>
0
)
{
lstrcpynA
(
dst
,
src
,
len
%
3
+
1
);
/* need to include the null */
lstrcpynA
(
dst
,
src
,
len
%
3
+
1
);
/* need to include the null */
dst
+=
len
%
3
;
dst
+=
len
%
3
;
src
+=
len
%
3
;
src
+=
len
%
3
;
}
}
for
(
len
=
0
;
*
src
;
len
++
){
for
(
len
=
0
;
*
src
;
len
++
)
{
if
(
len
%
3
==
0
)
if
(
len
%
3
==
0
)
*
dst
++
=
sep
;
*
dst
++
=
sep
;
*
dst
++
=
*
src
++
;
*
dst
++
=
*
src
++
;
}
}
*
dst
=
0
;
/* null terminate it */
*
dst
=
0
;
/* null terminate it */
...
@@ -330,12 +313,12 @@ static BOOL UPDOWN_SetBuddyInt (HWND hwnd)
...
@@ -330,12 +313,12 @@ static BOOL UPDOWN_SetBuddyInt (HWND hwnd)
* When we have a buddy set and that we are aligned on our buddy, we
* When we have a buddy set and that we are aligned on our buddy, we
* want to draw a sunken edge to make like we are part of that control.
* want to draw a sunken edge to make like we are part of that control.
*/
*/
static
void
UPDOWN_DrawBuddyBorder
(
HWND
hwnd
,
HDC
hdc
)
static
void
UPDOWN_DrawBuddyBorder
(
UPDOWN_INFO
*
infoPtr
,
HDC
hdc
)
{
{
DWORD
dwStyle
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
DWORD
dwStyle
=
GetWindowLongA
(
infoPtr
->
Self
,
GWL_STYLE
);
RECT
clientRect
;
RECT
clientRect
;
GetClientRect
(
hwnd
,
&
clientRect
);
GetClientRect
(
infoPtr
->
Self
,
&
clientRect
);
if
(
dwStyle
&
UDS_ALIGNLEFT
)
if
(
dwStyle
&
UDS_ALIGNLEFT
)
DrawEdge
(
hdc
,
&
clientRect
,
EDGE_SUNKEN
,
BF_BOTTOM
|
BF_LEFT
|
BF_TOP
);
DrawEdge
(
hdc
,
&
clientRect
,
EDGE_SUNKEN
,
BF_BOTTOM
|
BF_LEFT
|
BF_TOP
);
...
@@ -348,21 +331,20 @@ static void UPDOWN_DrawBuddyBorder (HWND hwnd, HDC hdc)
...
@@ -348,21 +331,20 @@ static void UPDOWN_DrawBuddyBorder (HWND hwnd, HDC hdc)
*
*
* Draw the arrows. The background need not be erased.
* Draw the arrows. The background need not be erased.
*/
*/
static
void
UPDOWN_Draw
(
HWND
hwnd
,
HDC
hdc
)
static
void
UPDOWN_Draw
(
UPDOWN_INFO
*
infoPtr
,
HDC
hdc
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
DWORD
dwStyle
=
GetWindowLongA
(
infoPtr
->
Self
,
GWL_STYLE
);
DWORD
dwStyle
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
BOOL
prssed
;
BOOL
prssed
;
RECT
rect
;
RECT
rect
;
/*
/*
* Draw the common border between ourselves and our buddy.
* Draw the common border between ourselves and our buddy.
*/
*/
if
(
UPDOWN_HasBuddyBorder
(
hwnd
))
if
(
UPDOWN_HasBuddyBorder
(
infoPtr
))
UPDOWN_DrawBuddyBorder
(
hwnd
,
hdc
);
UPDOWN_DrawBuddyBorder
(
infoPtr
,
hdc
);
/* Draw the incr button */
/* Draw the incr button */
UPDOWN_GetArrowRect
(
hwnd
,
&
rect
,
TRUE
);
UPDOWN_GetArrowRect
(
infoPtr
,
&
rect
,
TRUE
);
prssed
=
(
infoPtr
->
Flags
&
FLAG_INCR
)
&&
(
infoPtr
->
Flags
&
FLAG_MOUSEIN
);
prssed
=
(
infoPtr
->
Flags
&
FLAG_INCR
)
&&
(
infoPtr
->
Flags
&
FLAG_MOUSEIN
);
DrawFrameControl
(
hdc
,
&
rect
,
DFC_SCROLL
,
DrawFrameControl
(
hdc
,
&
rect
,
DFC_SCROLL
,
(
dwStyle
&
UDS_HORZ
?
DFCS_SCROLLRIGHT
:
DFCS_SCROLLUP
)
|
(
dwStyle
&
UDS_HORZ
?
DFCS_SCROLLRIGHT
:
DFCS_SCROLLUP
)
|
...
@@ -374,7 +356,7 @@ static void UPDOWN_Draw (HWND hwnd, HDC hdc)
...
@@ -374,7 +356,7 @@ static void UPDOWN_Draw (HWND hwnd, HDC hdc)
DrawEdge
(
hdc
,
&
rect
,
0
,
BF_MIDDLE
);
DrawEdge
(
hdc
,
&
rect
,
0
,
BF_MIDDLE
);
/* Draw the decr button */
/* Draw the decr button */
UPDOWN_GetArrowRect
(
hwnd
,
&
rect
,
FALSE
);
UPDOWN_GetArrowRect
(
infoPtr
,
&
rect
,
FALSE
);
prssed
=
(
infoPtr
->
Flags
&
FLAG_DECR
)
&&
(
infoPtr
->
Flags
&
FLAG_MOUSEIN
);
prssed
=
(
infoPtr
->
Flags
&
FLAG_DECR
)
&&
(
infoPtr
->
Flags
&
FLAG_MOUSEIN
);
DrawFrameControl
(
hdc
,
&
rect
,
DFC_SCROLL
,
DrawFrameControl
(
hdc
,
&
rect
,
DFC_SCROLL
,
(
dwStyle
&
UDS_HORZ
?
DFCS_SCROLLLEFT
:
DFCS_SCROLLDOWN
)
|
(
dwStyle
&
UDS_HORZ
?
DFCS_SCROLLLEFT
:
DFCS_SCROLLDOWN
)
|
...
@@ -388,13 +370,11 @@ static void UPDOWN_Draw (HWND hwnd, HDC hdc)
...
@@ -388,13 +370,11 @@ static void UPDOWN_Draw (HWND hwnd, HDC hdc)
* Synchronous drawing (must NOT be used in WM_PAINT).
* Synchronous drawing (must NOT be used in WM_PAINT).
* Calls UPDOWN_Draw.
* Calls UPDOWN_Draw.
*/
*/
static
void
UPDOWN_Refresh
(
HWND
hwnd
)
static
void
UPDOWN_Refresh
(
UPDOWN_INFO
*
infoPtr
)
{
{
HDC
hdc
;
HDC
hdc
=
GetDC
(
infoPtr
->
Self
);
UPDOWN_Draw
(
infoPtr
,
hdc
);
hdc
=
GetDC
(
hwnd
);
ReleaseDC
(
infoPtr
->
Self
,
hdc
);
UPDOWN_Draw
(
hwnd
,
hdc
);
ReleaseDC
(
hwnd
,
hdc
);
}
}
...
@@ -404,23 +384,22 @@ static void UPDOWN_Refresh (HWND hwnd)
...
@@ -404,23 +384,22 @@ static void UPDOWN_Refresh (HWND hwnd)
* Asynchronous drawing (must ONLY be used in WM_PAINT).
* Asynchronous drawing (must ONLY be used in WM_PAINT).
* Calls UPDOWN_Draw.
* Calls UPDOWN_Draw.
*/
*/
static
void
UPDOWN_Paint
(
HWND
hwnd
,
HDC
passedDC
)
static
void
UPDOWN_Paint
(
UPDOWN_INFO
*
infoPtr
,
HDC
hdc
)
{
{
PAINTSTRUCT
ps
;
if
(
hdc
)
{
HDC
hdc
=
passedDC
;
UPDOWN_Draw
(
infoPtr
,
hdc
);
}
else
{
if
(
passedDC
==
0
)
PAINTSTRUCT
ps
;
hdc
=
BeginPaint
(
hwnd
,
&
ps
);
hdc
=
BeginPaint
(
infoPtr
->
Self
,
&
ps
);
UPDOWN_Draw
(
hwnd
,
hdc
);
UPDOWN_Draw
(
infoPtr
,
hdc
);
EndPaint
(
infoPtr
->
Self
,
&
ps
);
if
(
passedDC
==
0
)
}
EndPaint
(
hwnd
,
&
ps
);
}
}
/***********************************************************************
/***********************************************************************
* UPDOWN_SetBuddy
* UPDOWN_SetBuddy
* Tests if '
hwndB
ud' is a valid window handle. If not, returns FALSE.
* Tests if '
b
ud' is a valid window handle. If not, returns FALSE.
* Else, sets it as a new Buddy.
* Else, sets it as a new Buddy.
* Then, it should subclass the buddy
* Then, it should subclass the buddy
* If window has the UDS_ARROWKEYS, it subcalsses the buddy window to
* If window has the UDS_ARROWKEYS, it subcalsses the buddy window to
...
@@ -428,45 +407,43 @@ static void UPDOWN_Paint (HWND hwnd, HDC passedDC)
...
@@ -428,45 +407,43 @@ static void UPDOWN_Paint (HWND hwnd, HDC passedDC)
* If window has the UDS_ALIGNLEFT or UDS_ALIGNRIGHT style
* If window has the UDS_ALIGNLEFT or UDS_ALIGNRIGHT style
* the size/pos of the buddy and the control are adjusted accordingly.
* the size/pos of the buddy and the control are adjusted accordingly.
*/
*/
static
BOOL
UPDOWN_SetBuddy
(
HWND
hwnd
,
HWND
hwndB
ud
)
static
BOOL
UPDOWN_SetBuddy
(
UPDOWN_INFO
*
infoPtr
,
HWND
b
ud
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
DWORD
dwStyle
=
GetWindowLongA
(
infoPtr
->
Self
,
GWL_STYLE
);
DWORD
dwStyle
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
RECT
budRect
;
/* new coord for the buddy */
RECT
budRect
;
/* new coord for the buddy */
int
x
,
width
;
/* new x position and width for the up-down */
int
x
,
width
;
/* new x position and width for the up-down */
WNDPROC
baseWndProc
,
currWndProc
;
WNDPROC
baseWndProc
,
currWndProc
;
/* Is it a valid bud? */
/* Is it a valid bud? */
if
(
!
IsWindow
(
hwndBud
))
if
(
!
IsWindow
(
bud
))
return
FALSE
;
return
FALSE
;
/* there is already a body assigned */
/* there is already a body assigned */
if
(
infoPtr
->
Buddy
)
if
(
infoPtr
->
Buddy
)
RemovePropA
(
infoPtr
->
Buddy
,
BUDDY_UPDOWN_HWND
);
RemovePropA
(
infoPtr
->
Buddy
,
BUDDY_UPDOWN_HWND
);
/* Store buddy window handle */
/* Store buddy window handle */
infoPtr
->
Buddy
=
hwndB
ud
;
infoPtr
->
Buddy
=
b
ud
;
/* keep upDown ctrl hwnd in a buddy property */
/* keep upDown ctrl hwnd in a buddy property */
SetPropA
(
hwndBud
,
BUDDY_UPDOWN_HWND
,
hwnd
);
SetPropA
(
bud
,
BUDDY_UPDOWN_HWND
,
infoPtr
->
Self
);
/* Store buddy window clas name */
/* Store buddy window clas name */
memset
(
infoPtr
->
szBuddyClass
,
0
,
UPDOWN_BUDDYCLASSNAMELEN
);
memset
(
infoPtr
->
szBuddyClass
,
0
,
UPDOWN_BUDDYCLASSNAMELEN
);
GetClassNameA
(
hwndB
ud
,
infoPtr
->
szBuddyClass
,
UPDOWN_BUDDYCLASSNAMELEN
-
1
);
GetClassNameA
(
b
ud
,
infoPtr
->
szBuddyClass
,
UPDOWN_BUDDYCLASSNAMELEN
-
1
);
if
(
dwStyle
&
UDS_ARROWKEYS
){
if
(
dwStyle
&
UDS_ARROWKEYS
){
/* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property
/* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property
when we reset the upDown ctrl buddy to another buddy because it is not
when we reset the upDown ctrl buddy to another buddy because it is not
good to break the window proc chain. */
good to break the window proc chain. */
currWndProc
=
(
WNDPROC
)
GetWindowLongA
(
hwndB
ud
,
GWL_WNDPROC
);
currWndProc
=
(
WNDPROC
)
GetWindowLongA
(
b
ud
,
GWL_WNDPROC
);
if
(
currWndProc
!=
UPDOWN_Buddy_SubclassProc
)
if
(
currWndProc
!=
UPDOWN_Buddy_SubclassProc
)
{
{
// replace the buddy's WndProc with ours
// replace the buddy's WndProc with ours
baseWndProc
=
(
WNDPROC
)
SetWindowLongA
(
hwndB
ud
,
GWL_WNDPROC
,
baseWndProc
=
(
WNDPROC
)
SetWindowLongA
(
b
ud
,
GWL_WNDPROC
,
(
LPARAM
)
UPDOWN_Buddy_SubclassProc
);
(
LPARAM
)
UPDOWN_Buddy_SubclassProc
);
// and save the base class' WndProc
// and save the base class' WndProc
SetPropA
(
hwndB
ud
,
BUDDY_SUPERCLASS_WNDPROC
,
(
HANDLE
)
baseWndProc
);
SetPropA
(
b
ud
,
BUDDY_SUPERCLASS_WNDPROC
,
(
HANDLE
)
baseWndProc
);
}
}
// else
// else
// its already been subclassed, don't overwrite BUDDY_SUPERCLASS_WNDPROC
// its already been subclassed, don't overwrite BUDDY_SUPERCLASS_WNDPROC
...
@@ -505,7 +482,7 @@ static BOOL UPDOWN_SetBuddy (HWND hwnd, HWND hwndBud)
...
@@ -505,7 +482,7 @@ static BOOL UPDOWN_SetBuddy (HWND hwnd, HWND hwndBud)
* to look as if it is integrated with the buddy control.
* to look as if it is integrated with the buddy control.
* We nudge the control or change it size to overlap.
* We nudge the control or change it size to overlap.
*/
*/
if
(
UPDOWN_HasBuddyBorder
(
hwnd
))
if
(
UPDOWN_HasBuddyBorder
(
infoPtr
))
{
{
if
(
dwStyle
&
UDS_ALIGNLEFT
)
if
(
dwStyle
&
UDS_ALIGNLEFT
)
width
+=
DEFAULT_BUDDYBORDER
;
width
+=
DEFAULT_BUDDYBORDER
;
...
@@ -513,7 +490,7 @@ static BOOL UPDOWN_SetBuddy (HWND hwnd, HWND hwndBud)
...
@@ -513,7 +490,7 @@ static BOOL UPDOWN_SetBuddy (HWND hwnd, HWND hwndBud)
x
-=
DEFAULT_BUDDYBORDER
;
x
-=
DEFAULT_BUDDYBORDER
;
}
}
SetWindowPos
(
hwnd
,
infoPtr
->
Buddy
,
SetWindowPos
(
infoPtr
->
Self
,
infoPtr
->
Buddy
,
x
,
budRect
.
top
-
DEFAULT_ADDTOP
,
x
,
budRect
.
top
-
DEFAULT_ADDTOP
,
width
,
(
budRect
.
bottom
-
budRect
.
top
)
+
DEFAULT_ADDTOP
+
DEFAULT_ADDBOT
,
width
,
(
budRect
.
bottom
-
budRect
.
top
)
+
DEFAULT_ADDTOP
+
DEFAULT_ADDBOT
,
SWP_NOACTIVATE
);
SWP_NOACTIVATE
);
...
@@ -530,10 +507,9 @@ static BOOL UPDOWN_SetBuddy (HWND hwnd, HWND hwndBud)
...
@@ -530,10 +507,9 @@ static BOOL UPDOWN_SetBuddy (HWND hwnd, HWND hwndBud)
* It handles wraping and non-wraping correctly.
* It handles wraping and non-wraping correctly.
* It is assumed that delta>0
* It is assumed that delta>0
*/
*/
static
void
UPDOWN_DoAction
(
HWND
hwnd
,
int
delta
,
BOOL
incr
)
static
void
UPDOWN_DoAction
(
UPDOWN_INFO
*
infoPtr
,
int
delta
,
BOOL
incr
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
DWORD
dwStyle
=
GetWindowLongA
(
infoPtr
->
Self
,
GWL_STYLE
);
DWORD
dwStyle
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
NM_UPDOWN
ni
;
NM_UPDOWN
ni
;
TRACE
(
"%s by %d
\n
"
,
incr
?
"inc"
:
"dec"
,
delta
);
TRACE
(
"%s by %d
\n
"
,
incr
?
"inc"
:
"dec"
,
delta
);
...
@@ -544,28 +520,28 @@ static void UPDOWN_DoAction (HWND hwnd, int delta, BOOL incr)
...
@@ -544,28 +520,28 @@ static void UPDOWN_DoAction (HWND hwnd, int delta, BOOL incr)
/* We must notify parent now to obtain permission */
/* We must notify parent now to obtain permission */
ni
.
iPos
=
infoPtr
->
CurVal
;
ni
.
iPos
=
infoPtr
->
CurVal
;
ni
.
iDelta
=
delta
;
ni
.
iDelta
=
delta
;
ni
.
hdr
.
hwndFrom
=
hwnd
;
ni
.
hdr
.
hwndFrom
=
infoPtr
->
Self
;
ni
.
hdr
.
idFrom
=
GetWindowLongA
(
hwnd
,
GWL_ID
);
ni
.
hdr
.
idFrom
=
GetWindowLongA
(
infoPtr
->
Self
,
GWL_ID
);
ni
.
hdr
.
code
=
UDN_DELTAPOS
;
ni
.
hdr
.
code
=
UDN_DELTAPOS
;
if
(
!
SendMessageA
(
GetParent
(
hwnd
),
WM_NOTIFY
,
if
(
!
SendMessageA
(
GetParent
(
infoPtr
->
Self
),
WM_NOTIFY
,
(
WPARAM
)
ni
.
hdr
.
idFrom
,
(
LPARAM
)
&
ni
))
(
WPARAM
)
ni
.
hdr
.
idFrom
,
(
LPARAM
)
&
ni
))
{
{
/* Parent said: OK to adjust */
/* Parent said: OK to adjust */
/* Now adjust value with (maybe new) delta */
/* Now adjust value with (maybe new) delta */
if
(
UPDOWN_OffsetVal
(
hwnd
,
ni
.
iDelta
))
if
(
UPDOWN_OffsetVal
(
infoPtr
,
ni
.
iDelta
))
{
{
/* Now take care about our buddy */
/* Now take care about our buddy */
if
(
infoPtr
->
Buddy
&&
IsWindow
(
infoPtr
->
Buddy
)
if
(
infoPtr
->
Buddy
&&
IsWindow
(
infoPtr
->
Buddy
)
&&
(
dwStyle
&
UDS_SETBUDDYINT
)
)
&&
(
dwStyle
&
UDS_SETBUDDYINT
)
)
UPDOWN_SetBuddyInt
(
hwnd
);
UPDOWN_SetBuddyInt
(
infoPtr
);
}
}
}
}
/* Also, notify it. This message is sent in any case. */
/* Also, notify it. This message is sent in any case. */
SendMessageA
(
GetParent
(
hwnd
),
SendMessageA
(
GetParent
(
infoPtr
->
Self
),
dwStyle
&
UDS_HORZ
?
WM_HSCROLL
:
WM_VSCROLL
,
dwStyle
&
UDS_HORZ
?
WM_HSCROLL
:
WM_VSCROLL
,
MAKELONG
(
SB_THUMBPOSITION
,
infoPtr
->
CurVal
),
hwnd
);
MAKELONG
(
SB_THUMBPOSITION
,
infoPtr
->
CurVal
),
infoPtr
->
Self
);
}
}
/***********************************************************************
/***********************************************************************
...
@@ -574,11 +550,9 @@ static void UPDOWN_DoAction (HWND hwnd, int delta, BOOL incr)
...
@@ -574,11 +550,9 @@ static void UPDOWN_DoAction (HWND hwnd, int delta, BOOL incr)
* Returns TRUE if it is enabled as well as its buddy (if any)
* Returns TRUE if it is enabled as well as its buddy (if any)
* FALSE otherwise
* FALSE otherwise
*/
*/
static
BOOL
UPDOWN_IsEnabled
(
HWND
hwnd
)
static
BOOL
UPDOWN_IsEnabled
(
UPDOWN_INFO
*
infoPtr
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
if
(
GetWindowLongA
(
infoPtr
->
Self
,
GWL_STYLE
)
&
WS_DISABLED
)
if
(
GetWindowLongA
(
hwnd
,
GWL_STYLE
)
&
WS_DISABLED
)
return
FALSE
;
return
FALSE
;
if
(
infoPtr
->
Buddy
)
if
(
infoPtr
->
Buddy
)
return
IsWindowEnabled
(
infoPtr
->
Buddy
);
return
IsWindowEnabled
(
infoPtr
->
Buddy
);
...
@@ -593,22 +567,20 @@ static BOOL UPDOWN_IsEnabled (HWND hwnd)
...
@@ -593,22 +567,20 @@ static BOOL UPDOWN_IsEnabled (HWND hwnd)
* If the control was not in cancel mode, it returns FALSE.
* If the control was not in cancel mode, it returns FALSE.
* If the control was in cancel mode, it returns TRUE.
* If the control was in cancel mode, it returns TRUE.
*/
*/
static
BOOL
UPDOWN_CancelMode
(
HWND
hwnd
)
static
BOOL
UPDOWN_CancelMode
(
UPDOWN_INFO
*
infoPtr
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
/* if not in 'capture' mode, do nothing */
/* if not in 'capture' mode, do nothing */
if
(
!
(
infoPtr
->
Flags
&
FLAG_CLICKED
))
if
(
!
(
infoPtr
->
Flags
&
FLAG_CLICKED
))
return
FALSE
;
return
FALSE
;
KillTimer
(
hwnd
,
TIMERID1
);
/* kill all possible timers */
KillTimer
(
infoPtr
->
Self
,
TIMERID1
);
/* kill all possible timers */
KillTimer
(
hwnd
,
TIMERID2
);
KillTimer
(
infoPtr
->
Self
,
TIMERID2
);
if
(
GetCapture
()
==
hwnd
)
/* let the mouse go */
if
(
GetCapture
()
==
infoPtr
->
Self
)
/* let the mouse go */
ReleaseCapture
();
/* if we still have it */
ReleaseCapture
();
/* if we still have it */
infoPtr
->
Flags
=
0
;
/* get rid of any flags */
infoPtr
->
Flags
=
0
;
/* get rid of any flags */
UPDOWN_Refresh
(
hwnd
);
/* redraw the control just in case */
UPDOWN_Refresh
(
infoPtr
);
/* redraw the control just in case */
return
TRUE
;
return
TRUE
;
}
}
...
@@ -620,10 +592,9 @@ static BOOL UPDOWN_CancelMode (HWND hwnd)
...
@@ -620,10 +592,9 @@ static BOOL UPDOWN_CancelMode (HWND hwnd)
* 'pt' is the location of the mouse event in client or
* 'pt' is the location of the mouse event in client or
* windows coordinates.
* windows coordinates.
*/
*/
static
void
UPDOWN_HandleMouseEvent
(
HWND
hwnd
,
UINT
msg
,
POINT
pt
)
static
void
UPDOWN_HandleMouseEvent
(
UPDOWN_INFO
*
infoPtr
,
UINT
msg
,
POINT
pt
)
{
{
UPDOWN_INFO
*
infoPtr
=
UPDOWN_GetInfoPtr
(
hwnd
);
DWORD
dwStyle
=
GetWindowLongA
(
infoPtr
->
Self
,
GWL_STYLE
);
DWORD
dwStyle
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
RECT
rect
;
RECT
rect
;
int
temp
;
int
temp
;
...
@@ -639,11 +610,11 @@ static void UPDOWN_HandleMouseEvent (HWND hwnd, UINT msg, POINT pt)
...
@@ -639,11 +610,11 @@ static void UPDOWN_HandleMouseEvent (HWND hwnd, UINT msg, POINT pt)
SetFocus
(
infoPtr
->
Buddy
);
SetFocus
(
infoPtr
->
Buddy
);
/* Now see which one is the 'active' arrow */
/* Now see which one is the 'active' arrow */
temp
=
UPDOWN_GetArrowFromPoint
(
hwnd
,
&
rect
,
pt
);
temp
=
UPDOWN_GetArrowFromPoint
(
infoPtr
,
&
rect
,
pt
);
/* Update the CurVal if necessary */
/* Update the CurVal if necessary */
if
(
dwStyle
&
UDS_SETBUDDYINT
)
if
(
dwStyle
&
UDS_SETBUDDYINT
)
UPDOWN_GetBuddyInt
(
hwnd
);
UPDOWN_GetBuddyInt
(
infoPtr
);
/* Set up the correct flags */
/* Set up the correct flags */
infoPtr
->
Flags
=
0
;
infoPtr
->
Flags
=
0
;
...
@@ -651,16 +622,16 @@ static void UPDOWN_HandleMouseEvent (HWND hwnd, UINT msg, POINT pt)
...
@@ -651,16 +622,16 @@ static void UPDOWN_HandleMouseEvent (HWND hwnd, UINT msg, POINT pt)
infoPtr
->
Flags
|=
FLAG_MOUSEIN
;
infoPtr
->
Flags
|=
FLAG_MOUSEIN
;
/* repaint the control */
/* repaint the control */
UPDOWN_Refresh
(
hwnd
);
UPDOWN_Refresh
(
infoPtr
);
/* process the click */
/* process the click */
UPDOWN_DoAction
(
hwnd
,
1
,
infoPtr
->
Flags
&
FLAG_INCR
);
UPDOWN_DoAction
(
infoPtr
,
1
,
infoPtr
->
Flags
&
FLAG_INCR
);
/* now capture all mouse messages */
/* now capture all mouse messages */
SetCapture
(
hwnd
);
SetCapture
(
infoPtr
->
Self
);
/* and startup the first timer */
/* and startup the first timer */
SetTimer
(
hwnd
,
TIMERID1
,
INITIAL_DELAY
,
0
);
SetTimer
(
infoPtr
->
Self
,
TIMERID1
,
INITIAL_DELAY
,
0
);
break
;
break
;
case
WM_MOUSEMOVE
:
case
WM_MOUSEMOVE
:
...
@@ -673,21 +644,21 @@ static void UPDOWN_HandleMouseEvent (HWND hwnd, UINT msg, POINT pt)
...
@@ -673,21 +644,21 @@ static void UPDOWN_HandleMouseEvent (HWND hwnd, UINT msg, POINT pt)
/* Now get the 'active' arrow rectangle */
/* Now get the 'active' arrow rectangle */
if
(
infoPtr
->
Flags
&
FLAG_INCR
)
if
(
infoPtr
->
Flags
&
FLAG_INCR
)
UPDOWN_GetArrowRect
(
hwnd
,
&
rect
,
TRUE
);
UPDOWN_GetArrowRect
(
infoPtr
,
&
rect
,
TRUE
);
else
else
UPDOWN_GetArrowRect
(
hwnd
,
&
rect
,
FALSE
);
UPDOWN_GetArrowRect
(
infoPtr
,
&
rect
,
FALSE
);
/* Update the flags if we are in/out */
/* Update the flags if we are in/out */
if
(
PtInRect
(
&
rect
,
pt
))
if
(
PtInRect
(
&
rect
,
pt
))
infoPtr
->
Flags
|=
FLAG_MOUSEIN
;
infoPtr
->
Flags
|=
FLAG_MOUSEIN
;
else
{
else
{
infoPtr
->
Flags
&=
~
FLAG_MOUSEIN
;
infoPtr
->
Flags
&=
~
FLAG_MOUSEIN
;
if
(
a
ccelIndex
!=
-
1
)
/* if we have accel info */
if
(
infoPtr
->
A
ccelIndex
!=
-
1
)
/* if we have accel info */
a
ccelIndex
=
0
;
/* reset it */
infoPtr
->
A
ccelIndex
=
0
;
/* reset it */
}
}
/* If state changed, redraw the control */
/* If state changed, redraw the control */
if
(
temp
!=
infoPtr
->
Flags
)
if
(
temp
!=
infoPtr
->
Flags
)
UPDOWN_Refresh
(
hwnd
);
UPDOWN_Refresh
(
infoPtr
);
break
;
break
;
default:
default:
...
@@ -719,15 +690,20 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -719,15 +690,20 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
SetWindowLongA
(
hwnd
,
0
,
(
DWORD
)
infoPtr
);
SetWindowLongA
(
hwnd
,
0
,
(
DWORD
)
infoPtr
);
/* initialize the info struct */
/* initialize the info struct */
infoPtr
->
AccelCount
=
0
;
infoPtr
->
AccelVect
=
0
;
infoPtr
->
Self
=
hwnd
;
infoPtr
->
CurVal
=
0
;
infoPtr
->
MinVal
=
0
;
infoPtr
->
MaxVal
=
9999
;
infoPtr
->
AccelCount
=
0
;
infoPtr
->
AccelVect
=
0
;
infoPtr
->
AccelIndex
=
-
1
;
infoPtr
->
CurVal
=
0
;
infoPtr
->
MinVal
=
0
;
infoPtr
->
MaxVal
=
9999
;
infoPtr
->
Base
=
10
;
/* Default to base 10 */
infoPtr
->
Base
=
10
;
/* Default to base 10 */
infoPtr
->
Buddy
=
0
;
/* No buddy window yet */
infoPtr
->
Buddy
=
0
;
/* No buddy window yet */
infoPtr
->
Flags
=
0
;
/* And no flags */
infoPtr
->
Flags
=
0
;
/* And no flags */
/* Do we pick the buddy win ourselves? */
/* Do we pick the buddy win ourselves? */
if
(
dwStyle
&
UDS_AUTOBUDDY
)
if
(
dwStyle
&
UDS_AUTOBUDDY
)
UPDOWN_SetBuddy
(
hwnd
,
GetWindow
(
hwnd
,
GW_HWNDPREV
));
UPDOWN_SetBuddy
(
infoPtr
,
GetWindow
(
hwnd
,
GW_HWNDPREV
));
TRACE
(
"UpDown Ctrl creation, hwnd=%04x
\n
"
,
hwnd
);
TRACE
(
"UpDown Ctrl creation, hwnd=%04x
\n
"
,
hwnd
);
break
;
break
;
...
@@ -746,9 +722,9 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -746,9 +722,9 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
case
WM_ENABLE
:
case
WM_ENABLE
:
if
(
dwStyle
&
WS_DISABLED
)
if
(
dwStyle
&
WS_DISABLED
)
UPDOWN_CancelMode
(
hwnd
);
UPDOWN_CancelMode
(
infoPtr
);
UPDOWN_Refresh
(
hwnd
);
UPDOWN_Refresh
(
infoPtr
);
break
;
break
;
case
WM_TIMER
:
case
WM_TIMER
:
...
@@ -757,25 +733,25 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -757,25 +733,25 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
KillTimer
(
hwnd
,
TIMERID1
);
KillTimer
(
hwnd
,
TIMERID1
);
/* if no accel info given, used default timer */
/* if no accel info given, used default timer */
if
(
infoPtr
->
AccelCount
==
0
||
infoPtr
->
AccelVect
==
0
){
if
(
infoPtr
->
AccelCount
==
0
||
infoPtr
->
AccelVect
==
0
){
a
ccelIndex
=
-
1
;
infoPtr
->
A
ccelIndex
=
-
1
;
temp
=
REPEAT_DELAY
;
temp
=
REPEAT_DELAY
;
}
}
else
{
else
{
a
ccelIndex
=
0
;
/* otherwise, use it */
infoPtr
->
A
ccelIndex
=
0
;
/* otherwise, use it */
temp
=
infoPtr
->
AccelVect
[
a
ccelIndex
].
nSec
*
1000
+
1
;
temp
=
infoPtr
->
AccelVect
[
infoPtr
->
A
ccelIndex
].
nSec
*
1000
+
1
;
}
}
SetTimer
(
hwnd
,
TIMERID2
,
temp
,
0
);
SetTimer
(
hwnd
,
TIMERID2
,
temp
,
0
);
}
}
/* now, if the mouse is above us, do the thing...*/
/* now, if the mouse is above us, do the thing...*/
if
(
infoPtr
->
Flags
&
FLAG_MOUSEIN
){
if
(
infoPtr
->
Flags
&
FLAG_MOUSEIN
){
temp
=
accelIndex
==-
1
?
1
:
infoPtr
->
AccelVect
[
a
ccelIndex
].
nInc
;
temp
=
infoPtr
->
AccelIndex
==
-
1
?
1
:
infoPtr
->
AccelVect
[
infoPtr
->
A
ccelIndex
].
nInc
;
UPDOWN_DoAction
(
hwnd
,
temp
,
infoPtr
->
Flags
&
FLAG_INCR
);
UPDOWN_DoAction
(
infoPtr
,
temp
,
infoPtr
->
Flags
&
FLAG_INCR
);
if
(
accelIndex
!=-
1
&&
a
ccelIndex
<
infoPtr
->
AccelCount
-
1
){
if
(
infoPtr
->
AccelIndex
!=
-
1
&&
infoPtr
->
A
ccelIndex
<
infoPtr
->
AccelCount
-
1
){
KillTimer
(
hwnd
,
TIMERID2
);
KillTimer
(
hwnd
,
TIMERID2
);
a
ccelIndex
++
;
/* move to the next accel info */
infoPtr
->
A
ccelIndex
++
;
/* move to the next accel info */
temp
=
infoPtr
->
AccelVect
[
a
ccelIndex
].
nSec
*
1000
+
1
;
temp
=
infoPtr
->
AccelVect
[
infoPtr
->
A
ccelIndex
].
nSec
*
1000
+
1
;
/* make sure we have at least 1ms intervals */
/* make sure we have at least 1ms intervals */
SetTimer
(
hwnd
,
TIMERID2
,
temp
,
0
);
SetTimer
(
hwnd
,
TIMERID2
,
temp
,
0
);
}
}
...
@@ -783,11 +759,11 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -783,11 +759,11 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
break
;
break
;
case
WM_CANCELMODE
:
case
WM_CANCELMODE
:
UPDOWN_CancelMode
(
hwnd
);
UPDOWN_CancelMode
(
infoPtr
);
break
;
break
;
case
WM_LBUTTONUP
:
case
WM_LBUTTONUP
:
if
(
!
UPDOWN_CancelMode
(
hwnd
))
if
(
!
UPDOWN_CancelMode
(
infoPtr
))
break
;
break
;
SendMessageA
(
GetParent
(
hwnd
),
dwStyle
&
UDS_HORZ
?
WM_HSCROLL
:
WM_VSCROLL
,
SendMessageA
(
GetParent
(
hwnd
),
dwStyle
&
UDS_HORZ
?
WM_HSCROLL
:
WM_VSCROLL
,
...
@@ -801,29 +777,29 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -801,29 +777,29 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
case
WM_LBUTTONDOWN
:
case
WM_LBUTTONDOWN
:
case
WM_MOUSEMOVE
:
case
WM_MOUSEMOVE
:
if
(
UPDOWN_IsEnabled
(
hwnd
)){
if
(
UPDOWN_IsEnabled
(
infoPtr
)){
POINT
pt
;
POINT
pt
;
pt
.
x
=
SLOWORD
(
lParam
);
pt
.
x
=
SLOWORD
(
lParam
);
pt
.
y
=
SHIWORD
(
lParam
);
pt
.
y
=
SHIWORD
(
lParam
);
UPDOWN_HandleMouseEvent
(
hwnd
,
message
,
pt
);
UPDOWN_HandleMouseEvent
(
infoPtr
,
message
,
pt
);
}
}
break
;
break
;
case
WM_KEYDOWN
:
case
WM_KEYDOWN
:
if
((
dwStyle
&
UDS_ARROWKEYS
)
&&
UPDOWN_IsEnabled
(
hwnd
)){
if
((
dwStyle
&
UDS_ARROWKEYS
)
&&
UPDOWN_IsEnabled
(
infoPtr
)){
switch
(
wParam
){
switch
(
wParam
){
case
VK_UP
:
case
VK_UP
:
case
VK_DOWN
:
case
VK_DOWN
:
UPDOWN_GetBuddyInt
(
hwnd
);
UPDOWN_GetBuddyInt
(
infoPtr
);
/* FIXME: Paint the according button pressed for some time, like win95 does*/
/* FIXME: Paint the according button pressed for some time, like win95 does*/
UPDOWN_DoAction
(
hwnd
,
1
,
wParam
==
VK_UP
);
UPDOWN_DoAction
(
infoPtr
,
1
,
wParam
==
VK_UP
);
break
;
break
;
}
}
}
}
break
;
break
;
case
WM_PAINT
:
case
WM_PAINT
:
UPDOWN_Paint
(
hwnd
,
(
HDC
)
wParam
);
UPDOWN_Paint
(
infoPtr
,
(
HDC
)
wParam
);
break
;
break
;
case
UDM_GETACCEL
:
case
UDM_GETACCEL
:
...
@@ -858,8 +834,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -858,8 +834,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
return
infoPtr
->
Base
;
return
infoPtr
->
Base
;
case
UDM_SETBASE
:
case
UDM_SETBASE
:
TRACE
(
"UpDown Ctrl new base(%d), hwnd=%04x
\n
"
,
TRACE
(
"UpDown Ctrl new base(%d), hwnd=%04x
\n
"
,
wParam
,
hwnd
);
wParam
,
hwnd
);
if
(
!
(
wParam
==
10
||
wParam
==
16
)
||
lParam
)
if
(
!
(
wParam
==
10
||
wParam
==
16
)
||
lParam
)
UNKNOWN_PARAM
(
UDM_SETBASE
,
wParam
,
lParam
);
UNKNOWN_PARAM
(
UDM_SETBASE
,
wParam
,
lParam
);
if
(
wParam
==
10
||
wParam
==
16
){
if
(
wParam
==
10
||
wParam
==
16
){
...
@@ -878,24 +853,22 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -878,24 +853,22 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
if
(
lParam
)
if
(
lParam
)
UNKNOWN_PARAM
(
UDM_SETBUDDY
,
wParam
,
lParam
);
UNKNOWN_PARAM
(
UDM_SETBUDDY
,
wParam
,
lParam
);
temp
=
infoPtr
->
Buddy
;
temp
=
infoPtr
->
Buddy
;
UPDOWN_SetBuddy
(
hwnd
,
wParam
);
UPDOWN_SetBuddy
(
infoPtr
,
wParam
);
TRACE
(
"UpDown Ctrl new buddy(%04x), hwnd=%04x
\n
"
,
TRACE
(
"UpDown Ctrl new buddy(%04x), hwnd=%04x
\n
"
,
infoPtr
->
Buddy
,
hwnd
);
infoPtr
->
Buddy
,
hwnd
);
return
temp
;
return
temp
;
case
UDM_GETPOS
:
case
UDM_GETPOS
:
if
(
wParam
||
lParam
)
if
(
wParam
||
lParam
)
UNKNOWN_PARAM
(
UDM_GETPOS
,
wParam
,
lParam
);
UNKNOWN_PARAM
(
UDM_GETPOS
,
wParam
,
lParam
);
temp
=
UPDOWN_GetBuddyInt
(
hwnd
);
temp
=
UPDOWN_GetBuddyInt
(
infoPtr
);
return
MAKELONG
(
infoPtr
->
CurVal
,
temp
?
0
:
1
);
return
MAKELONG
(
infoPtr
->
CurVal
,
temp
?
0
:
1
);
case
UDM_SETPOS
:
case
UDM_SETPOS
:
if
(
wParam
||
HIWORD
(
lParam
))
if
(
wParam
||
HIWORD
(
lParam
))
UNKNOWN_PARAM
(
UDM_GETPOS
,
wParam
,
lParam
);
UNKNOWN_PARAM
(
UDM_GETPOS
,
wParam
,
lParam
);
temp
=
SLOWORD
(
lParam
);
temp
=
SLOWORD
(
lParam
);
TRACE
(
"UpDown Ctrl new value(%d), hwnd=%04x
\n
"
,
TRACE
(
"UpDown Ctrl new value(%d), hwnd=%04x
\n
"
,
temp
,
hwnd
);
temp
,
hwnd
);
if
(
!
UPDOWN_InBounds
(
infoPtr
,
temp
)){
if
(
!
UPDOWN_InBounds
(
hwnd
,
temp
)){
if
(
temp
<
infoPtr
->
MinVal
)
if
(
temp
<
infoPtr
->
MinVal
)
temp
=
infoPtr
->
MinVal
;
temp
=
infoPtr
->
MinVal
;
if
(
temp
>
infoPtr
->
MaxVal
)
if
(
temp
>
infoPtr
->
MaxVal
)
...
@@ -904,7 +877,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -904,7 +877,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
wParam
=
infoPtr
->
CurVal
;
/* save prev value */
wParam
=
infoPtr
->
CurVal
;
/* save prev value */
infoPtr
->
CurVal
=
temp
;
/* set the new value */
infoPtr
->
CurVal
=
temp
;
/* set the new value */
if
(
dwStyle
&
UDS_SETBUDDYINT
)
if
(
dwStyle
&
UDS_SETBUDDYINT
)
UPDOWN_SetBuddyInt
(
hwnd
);
UPDOWN_SetBuddyInt
(
infoPtr
);
return
wParam
;
/* return prev value */
return
wParam
;
/* return prev value */
case
UDM_GETRANGE
:
case
UDM_GETRANGE
:
...
@@ -919,7 +892,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -919,7 +892,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
infoPtr
->
MinVal
=
SHIWORD
(
lParam
);
/* UD_MINVAL <= Min <= UD_MAXVAL */
infoPtr
->
MinVal
=
SHIWORD
(
lParam
);
/* UD_MINVAL <= Min <= UD_MAXVAL */
/* |Max-Min| <= UD_MAXVAL */
/* |Max-Min| <= UD_MAXVAL */
TRACE
(
"UpDown Ctrl new range(%d to %d), hwnd=%04x
\n
"
,
TRACE
(
"UpDown Ctrl new range(%d to %d), hwnd=%04x
\n
"
,
infoPtr
->
MinVal
,
infoPtr
->
MaxVal
,
hwnd
);
infoPtr
->
MinVal
,
infoPtr
->
MaxVal
,
hwnd
);
break
;
break
;
case
UDM_GETRANGE32
:
case
UDM_GETRANGE32
:
...
@@ -935,7 +908,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -935,7 +908,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
if
(
infoPtr
->
MaxVal
<=
infoPtr
->
MinVal
)
if
(
infoPtr
->
MaxVal
<=
infoPtr
->
MinVal
)
infoPtr
->
MaxVal
=
infoPtr
->
MinVal
+
1
;
infoPtr
->
MaxVal
=
infoPtr
->
MinVal
+
1
;
TRACE
(
"UpDown Ctrl new range(%d to %d), hwnd=%04x
\n
"
,
TRACE
(
"UpDown Ctrl new range(%d to %d), hwnd=%04x
\n
"
,
infoPtr
->
MinVal
,
infoPtr
->
MaxVal
,
hwnd
);
infoPtr
->
MinVal
,
infoPtr
->
MaxVal
,
hwnd
);
break
;
break
;
case
UDM_GETPOS32
:
case
UDM_GETPOS32
:
...
@@ -944,7 +917,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -944,7 +917,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
return
infoPtr
->
CurVal
;
return
infoPtr
->
CurVal
;
case
UDM_SETPOS32
:
case
UDM_SETPOS32
:
if
(
!
UPDOWN_InBounds
(
hwnd
,
(
int
)
lParam
)){
if
(
!
UPDOWN_InBounds
(
infoPtr
,
(
int
)
lParam
)){
if
((
int
)
lParam
<
infoPtr
->
MinVal
)
if
((
int
)
lParam
<
infoPtr
->
MinVal
)
lParam
=
infoPtr
->
MinVal
;
lParam
=
infoPtr
->
MinVal
;
if
((
int
)
lParam
>
infoPtr
->
MaxVal
)
if
((
int
)
lParam
>
infoPtr
->
MaxVal
)
...
@@ -953,13 +926,12 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
...
@@ -953,13 +926,12 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
temp
=
infoPtr
->
CurVal
;
/* save prev value */
temp
=
infoPtr
->
CurVal
;
/* save prev value */
infoPtr
->
CurVal
=
(
int
)
lParam
;
/* set the new value */
infoPtr
->
CurVal
=
(
int
)
lParam
;
/* set the new value */
if
(
dwStyle
&
UDS_SETBUDDYINT
)
if
(
dwStyle
&
UDS_SETBUDDYINT
)
UPDOWN_SetBuddyInt
(
hwnd
);
UPDOWN_SetBuddyInt
(
infoPtr
);
return
temp
;
/* return prev value */
return
temp
;
/* return prev value */
default:
default:
if
(
message
>=
WM_USER
)
if
(
message
>=
WM_USER
)
ERR
(
"unknown msg %04x wp=%04x lp=%08lx
\n
"
,
ERR
(
"unknown msg %04x wp=%04x lp=%08lx
\n
"
,
message
,
wParam
,
lParam
);
message
,
wParam
,
lParam
);
return
DefWindowProcA
(
hwnd
,
message
,
wParam
,
lParam
);
return
DefWindowProcA
(
hwnd
,
message
,
wParam
,
lParam
);
}
}
...
@@ -998,8 +970,8 @@ UPDOWN_Buddy_SubclassProc (
...
@@ -998,8 +970,8 @@ UPDOWN_Buddy_SubclassProc (
}
}
else
else
{
{
UPDOWN_GetBuddyInt
(
upDownHwnd
);
UPDOWN_GetBuddyInt
(
infoPtr
);
UPDOWN_DoAction
(
upDownHwnd
,
1
,
wParam
==
VK_UP
);
UPDOWN_DoAction
(
infoPtr
,
1
,
wParam
==
VK_UP
);
}
}
break
;
break
;
...
...
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