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
2b4be4be
Commit
2b4be4be
authored
Nov 28, 2000
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 28, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made button control fully unicode aware.
parent
c568d470
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
44 deletions
+75
-44
button.c
controls/button.c
+30
-31
widgets.c
controls/widgets.c
+45
-13
No files found.
controls/button.c
View file @
2b4be4be
...
...
@@ -66,7 +66,7 @@ static const pfPaint btnPaintFunc[MAX_BTN_TYPE] =
ReleaseDC( (wndPtr)->hwndSelf, hdc ); }
#define BUTTON_SEND_CTLCOLOR(wndPtr,hdc) \
SendMessage
A
( GetParent((wndPtr)->hwndSelf), WM_CTLCOLORBTN, \
SendMessage
W
( GetParent((wndPtr)->hwndSelf), WM_CTLCOLORBTN, \
(hdc), (wndPtr)->hwndSelf )
static
HBITMAP
hbitmapCheckBoxes
=
0
;
...
...
@@ -111,8 +111,8 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
if
(
!
hbitmapCheckBoxes
)
{
BITMAP
bmp
;
hbitmapCheckBoxes
=
LoadBitmap
A
(
0
,
MAKEINTRESOURCEA
(
OBM_CHECKBOXES
));
GetObject
A
(
hbitmapCheckBoxes
,
sizeof
(
bmp
),
&
bmp
);
hbitmapCheckBoxes
=
LoadBitmap
W
(
0
,
MAKEINTRESOURCEW
(
OBM_CHECKBOXES
));
GetObject
W
(
hbitmapCheckBoxes
,
sizeof
(
bmp
),
&
bmp
);
checkBoxWidth
=
bmp
.
bmWidth
/
4
;
checkBoxHeight
=
bmp
.
bmHeight
/
3
;
}
...
...
@@ -141,7 +141,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
case
WM_KEYDOWN
:
if
(
wParam
==
VK_SPACE
)
{
SendMessage
A
(
hWnd
,
BM_SETSTATE
,
TRUE
,
0
);
SendMessage
W
(
hWnd
,
BM_SETSTATE
,
TRUE
,
0
);
infoPtr
->
state
|=
BUTTON_BTNPRESSED
;
}
break
;
...
...
@@ -151,7 +151,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
style
==
BS_RADIOBUTTON
||
style
==
BS_USERBUTTON
||
style
==
BS_OWNERDRAW
)
{
SendMessage
A
(
GetParent
(
hWnd
),
WM_COMMAND
,
SendMessage
W
(
GetParent
(
hWnd
),
WM_COMMAND
,
MAKEWPARAM
(
wndPtr
->
wIDmenu
,
BN_DOUBLECLICKED
),
hWnd
);
break
;
}
...
...
@@ -159,7 +159,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
case
WM_LBUTTONDOWN
:
SetCapture
(
hWnd
);
SetFocus
(
hWnd
);
SendMessage
A
(
hWnd
,
BM_SETSTATE
,
TRUE
,
0
);
SendMessage
W
(
hWnd
,
BM_SETSTATE
,
TRUE
,
0
);
infoPtr
->
state
|=
BUTTON_BTNPRESSED
;
break
;
...
...
@@ -174,7 +174,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
ReleaseCapture
();
break
;
}
SendMessage
A
(
hWnd
,
BM_SETSTATE
,
FALSE
,
0
);
SendMessage
W
(
hWnd
,
BM_SETSTATE
,
FALSE
,
0
);
ReleaseCapture
();
GetClientRect
(
hWnd
,
&
rect
);
if
(
uMsg
==
WM_KEYUP
||
PtInRect
(
&
rect
,
pt
))
...
...
@@ -182,19 +182,19 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
switch
(
style
)
{
case
BS_AUTOCHECKBOX
:
SendMessage
A
(
hWnd
,
BM_SETCHECK
,
SendMessage
W
(
hWnd
,
BM_SETCHECK
,
!
(
infoPtr
->
state
&
BUTTON_CHECKED
),
0
);
break
;
case
BS_AUTORADIOBUTTON
:
SendMessage
A
(
hWnd
,
BM_SETCHECK
,
TRUE
,
0
);
SendMessage
W
(
hWnd
,
BM_SETCHECK
,
TRUE
,
0
);
break
;
case
BS_AUTO3STATE
:
SendMessage
A
(
hWnd
,
BM_SETCHECK
,
SendMessage
W
(
hWnd
,
BM_SETCHECK
,
(
infoPtr
->
state
&
BUTTON_3STATE
)
?
0
:
((
infoPtr
->
state
&
3
)
+
1
),
0
);
break
;
}
SendMessage
A
(
GetParent
(
hWnd
),
WM_COMMAND
,
SendMessage
W
(
GetParent
(
hWnd
),
WM_COMMAND
,
MAKEWPARAM
(
wndPtr
->
wIDmenu
,
BN_CLICKED
),
hWnd
);
}
break
;
...
...
@@ -203,7 +203,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
if
(
infoPtr
->
state
&
BUTTON_BTNPRESSED
)
{
infoPtr
->
state
&=
BUTTON_NSTATES
;
if
(
infoPtr
->
state
&
BUTTON_HIGHLIGHTED
)
SendMessage
A
(
hWnd
,
BM_SETSTATE
,
FALSE
,
0
);
SendMessage
W
(
hWnd
,
BM_SETSTATE
,
FALSE
,
0
);
}
break
;
...
...
@@ -211,19 +211,19 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
if
(
GetCapture
()
==
hWnd
)
{
GetClientRect
(
hWnd
,
&
rect
);
SendMessage
A
(
hWnd
,
BM_SETSTATE
,
PtInRect
(
&
rect
,
pt
),
0
);
SendMessage
W
(
hWnd
,
BM_SETSTATE
,
PtInRect
(
&
rect
,
pt
),
0
);
}
break
;
case
WM_NCHITTEST
:
if
(
style
==
BS_GROUPBOX
)
return
HTTRANSPARENT
;
return
DefWindowProc
A
(
hWnd
,
uMsg
,
wParam
,
lParam
);
return
DefWindowProc
W
(
hWnd
,
uMsg
,
wParam
,
lParam
);
case
WM_SETTEXT
:
DEFWND_SetText
A
(
wndPtr
,
(
LPC
STR
)
lParam
);
DEFWND_SetText
W
(
wndPtr
,
(
LPCW
STR
)
lParam
);
if
(
wndPtr
->
dwStyle
&
WS_VISIBLE
)
PAINT_BUTTON
(
wndPtr
,
style
,
ODA_DRAWENTIRE
);
return
0
;
return
1
;
/* success. FIXME: check text length */
case
WM_SETFONT
:
infoPtr
->
hFont
=
(
HFONT16
)
wParam
;
...
...
@@ -236,13 +236,13 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
case
WM_SETFOCUS
:
if
((
style
==
BS_RADIOBUTTON
||
style
==
BS_AUTORADIOBUTTON
)
&&
(
GetCapture
()
!=
hWnd
)
&&
!
(
SendMessage
A
(
hWnd
,
BM_GETCHECK
,
0
,
0
)
&
BST_CHECKED
))
!
(
SendMessage
W
(
hWnd
,
BM_GETCHECK
,
0
,
0
)
&
BST_CHECKED
))
{
/* The notification is sent when the button (BS_AUTORADIOBUTTON)
is unchecked and the focus was not given by a mouse click. */
if
(
style
==
BS_AUTORADIOBUTTON
)
SendMessage
A
(
hWnd
,
BM_SETCHECK
,
BUTTON_CHECKED
,
0
);
SendMessageA
(
GetParent
(
hWnd
),
WM_COMMAND
,
SendMessage
W
(
hWnd
,
BM_SETCHECK
,
BUTTON_CHECKED
,
0
);
SendMessageW
(
GetParent
(
hWnd
),
WM_COMMAND
,
MAKEWPARAM
(
wndPtr
->
wIDmenu
,
BN_CLICKED
),
hWnd
);
}
infoPtr
->
state
|=
BUTTON_HASFOCUS
;
...
...
@@ -273,8 +273,8 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
break
;
case
BM_CLICK
:
SendMessage
A
(
hWnd
,
WM_LBUTTONDOWN
,
0
,
0
);
SendMessage
A
(
hWnd
,
WM_LBUTTONUP
,
0
,
0
);
SendMessage
W
(
hWnd
,
WM_LBUTTONDOWN
,
0
,
0
);
SendMessage
W
(
hWnd
,
WM_LBUTTONUP
,
0
,
0
);
break
;
case
BM_SETIMAGE
:
...
...
@@ -353,7 +353,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
break
;
default:
return
DefWindowProc
A
(
hWnd
,
uMsg
,
wParam
,
lParam
);
return
DefWindowProc
W
(
hWnd
,
uMsg
,
wParam
,
lParam
);
}
return
0
;
}
...
...
@@ -476,7 +476,7 @@ static UINT BUTTON_CalcLabelRect(WND *wndPtr, HDC hdc, RECT *rc)
if
(
!
GetIconInfo
((
HICON
)
infoPtr
->
hImage
,
&
iconInfo
))
goto
empty_rect
;
GetObject
A
(
iconInfo
.
hbmColor
,
sizeof
(
BITMAP
),
&
bm
);
GetObject
W
(
iconInfo
.
hbmColor
,
sizeof
(
BITMAP
),
&
bm
);
r
.
right
=
r
.
left
+
bm
.
bmWidth
;
r
.
bottom
=
r
.
top
+
bm
.
bmHeight
;
...
...
@@ -486,7 +486,7 @@ static UINT BUTTON_CalcLabelRect(WND *wndPtr, HDC hdc, RECT *rc)
break
;
case
BS_BITMAP
:
if
(
!
GetObject
A
(
infoPtr
->
hImage
,
sizeof
(
BITMAP
),
&
bm
))
if
(
!
GetObject
W
(
infoPtr
->
hImage
,
sizeof
(
BITMAP
),
&
bm
))
goto
empty_rect
;
r
.
right
=
r
.
left
+
bm
.
bmWidth
;
...
...
@@ -537,7 +537,7 @@ static UINT BUTTON_CalcLabelRect(WND *wndPtr, HDC hdc, RECT *rc)
/**********************************************************************
* BUTTON_DrawTextCallback
*
* Callback function used b
e DrawStateA
function.
* Callback function used b
y DrawStateW
function.
*/
static
BOOL
CALLBACK
BUTTON_DrawTextCallback
(
HDC
hdc
,
LPARAM
lp
,
WPARAM
wp
,
int
cx
,
int
cy
)
{
...
...
@@ -557,8 +557,7 @@ static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int
*
* Common function for drawing button label.
*/
static
void
BUTTON_DrawLabel
(
WND
*
wndPtr
,
HDC
hdc
,
UINT
dtFlags
,
RECT
*
rc
)
static
void
BUTTON_DrawLabel
(
WND
*
wndPtr
,
HDC
hdc
,
UINT
dtFlags
,
RECT
*
rc
)
{
BUTTONINFO
*
infoPtr
=
(
BUTTONINFO
*
)
wndPtr
->
wExtra
;
DRAWSTATEPROC
lpOutputProc
=
NULL
;
...
...
@@ -885,7 +884,7 @@ static void BUTTON_CheckAutoRadioButton( WND *wndPtr )
tmpWnd
=
WIN_FindWndPtr
(
sibling
);
if
((
wndPtr
->
hwndSelf
!=
sibling
)
&&
((
tmpWnd
->
dwStyle
&
0x0f
)
==
BS_AUTORADIOBUTTON
))
SendMessage
A
(
sibling
,
BM_SETCHECK
,
BUTTON_UNCHECKED
,
0
);
SendMessage
W
(
sibling
,
BM_SETCHECK
,
BUTTON_UNCHECKED
,
0
);
sibling
=
GetNextDlgGroupItem
(
parent
,
sibling
,
FALSE
);
WIN_ReleaseWndPtr
(
tmpWnd
);
}
while
(
sibling
!=
start
);
...
...
@@ -922,10 +921,10 @@ static void GB_Paint( WND *wndPtr, HDC hDC, WORD action )
SelectObject
(
hDC
,
hPrevBrush
);
SelectObject
(
hDC
,
hPrevPen
);
}
else
{
TEXTMETRIC
A
tm
;
TEXTMETRIC
W
tm
;
rcFrame
=
rc
;
GetTextMetrics
A
(
hDC
,
&
tm
);
GetTextMetrics
W
(
hDC
,
&
tm
);
rcFrame
.
top
+=
(
tm
.
tmHeight
/
2
)
-
1
;
DrawEdge
(
hDC
,
&
rcFrame
,
EDGE_ETCHED
,
BF_RECT
|
((
wndPtr
->
dwStyle
&
BS_FLAT
)
?
BF_FLAT
:
0
));
...
...
@@ -1010,7 +1009,7 @@ static void OB_Paint( WND *wndPtr, HDC hDC, WORD action )
SetBkColor
(
hDC
,
GetSysColor
(
COLOR_BTNFACE
)
);
SendMessage
A
(
GetParent
(
wndPtr
->
hwndSelf
),
WM_DRAWITEM
,
SendMessage
W
(
GetParent
(
wndPtr
->
hwndSelf
),
WM_DRAWITEM
,
wndPtr
->
wIDmenu
,
(
LPARAM
)
&
dis
);
SelectClipRgn
(
hDC
,
clipRegion
);
...
...
controls/widgets.c
View file @
2b4be4be
...
...
@@ -21,6 +21,38 @@
/* Built-in classes */
static
const
char
bi_class_nameA
[
BIC32_NB_CLASSES
][
10
]
=
{
"Button"
,
"Edit"
,
"ListBox"
,
"ComboBox"
,
"ComboLBox"
,
POPUPMENU_CLASS_NAME
,
"Static"
,
"ScrollBar"
,
"MDIClient"
,
DESKTOP_CLASS_NAME
,
DIALOG_CLASS_NAME
,
ICONTITLE_CLASS_NAME
};
static
const
WCHAR
bi_class_nameW
[
BIC32_NB_CLASSES
][
10
]
=
{
{
'B'
,
'u'
,
't'
,
't'
,
'o'
,
'n'
,
0
},
{
'E'
,
'd'
,
'i'
,
't'
,
0
},
{
'L'
,
'i'
,
's'
,
't'
,
'B'
,
'o'
,
'x'
,
0
},
{
'C'
,
'o'
,
'm'
,
'b'
,
'o'
,
'B'
,
'o'
,
'x'
,
0
},
{
'C'
,
'o'
,
'm'
,
'b'
,
'o'
,
'L'
,
'B'
,
'o'
,
'x'
,
0
},
{
'#'
,
'3'
,
'2'
,
'7'
,
'6'
,
'8'
,
0
},
{
'S'
,
't'
,
'a'
,
't'
,
'i'
,
'c'
,
0
},
{
'S'
,
'c'
,
'r'
,
'o'
,
'l'
,
'l'
,
'B'
,
'a'
,
'r'
,
0
},
{
'M'
,
'D'
,
'I'
,
'C'
,
'l'
,
'i'
,
'e'
,
'n'
,
't'
,
0
},
{
'#'
,
'3'
,
'2'
,
'7'
,
'6'
,
'9'
,
0
},
{
'#'
,
'3'
,
'2'
,
'7'
,
'7'
,
'0'
,
0
},
{
'#'
,
'3'
,
'2'
,
'7'
,
'7'
,
'2'
,
0
}
};
typedef
struct
{
BOOL
unicode
;
union
{
...
...
@@ -32,58 +64,58 @@ typedef struct {
static
BUILTINCLASS
WIDGETS_BuiltinClasses
[
BIC32_NB_CLASSES
]
=
{
/* BIC32_BUTTON */
{
FALS
E
,
{
{
TRU
E
,
{
{
CS_GLOBALCLASS
|
CS_DBLCLKS
|
CS_VREDRAW
|
CS_HREDRAW
|
CS_PARENTDC
,
ButtonWndProc
,
0
,
sizeof
(
BUTTONINFO
),
0
,
0
,
(
HCURSOR
)
IDC_ARROW
A
,
0
,
0
,
"Button"
}}},
(
HCURSOR
)
IDC_ARROW
W
,
0
,
0
,
(
LPCSTR
)
bi_class_nameW
[
0
]
}}},
/* BIC32_EDIT */
{
FALSE
,
{
{
CS_GLOBALCLASS
|
CS_DBLCLKS
/*| CS_PARENTDC*/
,
EditWndProc
,
0
,
sizeof
(
void
*
),
0
,
0
,
(
HCURSOR
)
IDC_IBEAMA
,
0
,
0
,
"Edit"
}}},
(
HCURSOR
)
IDC_IBEAMA
,
0
,
0
,
bi_class_nameA
[
1
]
}}},
/* BIC32_LISTBOX */
{
FALSE
,
{
{
CS_GLOBALCLASS
|
CS_DBLCLKS
/*| CS_PARENTDC*/
,
ListBoxWndProc
,
0
,
sizeof
(
void
*
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
"ListBox"
}}},
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
bi_class_nameA
[
2
]
}}},
/* BIC32_COMBO */
{
FALSE
,
{
{
CS_GLOBALCLASS
|
CS_PARENTDC
|
CS_DBLCLKS
,
ComboWndProc
,
0
,
sizeof
(
void
*
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
"ComboBox"
}}},
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
bi_class_nameA
[
3
]
}}},
/* BIC32_COMBOLB */
{
FALSE
,
{
{
CS_GLOBALCLASS
|
CS_DBLCLKS
|
CS_SAVEBITS
,
ComboLBWndProc
,
0
,
sizeof
(
void
*
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
"ComboLBox"
}}},
0
,
sizeof
(
void
*
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
bi_class_nameA
[
4
]
}}},
/* BIC32_POPUPMENU */
{
FALSE
,
{
{
CS_GLOBALCLASS
|
CS_SAVEBITS
,
PopupMenuWndProc
,
0
,
sizeof
(
HMENU
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
NULL_BRUSH
,
0
,
POPUPMENU_CLASS_NAME
}}},
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
NULL_BRUSH
,
0
,
bi_class_nameA
[
5
]
}}},
/* BIC32_STATIC */
{
FALSE
,
{
{
CS_GLOBALCLASS
|
CS_DBLCLKS
|
CS_PARENTDC
,
StaticWndProc
,
0
,
sizeof
(
STATICINFO
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
"Static"
}}},
0
,
sizeof
(
STATICINFO
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
bi_class_nameA
[
6
]
}}},
/* BIC32_SCROLL */
{
FALSE
,
{
{
CS_GLOBALCLASS
|
CS_DBLCLKS
|
CS_VREDRAW
|
CS_HREDRAW
|
CS_PARENTDC
,
ScrollBarWndProc
,
0
,
sizeof
(
SCROLLBAR_INFO
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
"ScrollBar"
}}},
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
bi_class_nameA
[
7
]
}}},
/* BIC32_MDICLIENT */
{
FALSE
,
{
{
CS_GLOBALCLASS
,
MDIClientWndProc
,
0
,
sizeof
(
MDICLIENTINFO
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
STOCK_LTGRAY_BRUSH
,
0
,
"MDIClient"
}}},
0
,
sizeof
(
MDICLIENTINFO
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
STOCK_LTGRAY_BRUSH
,
0
,
bi_class_nameA
[
8
]
}}},
/* BIC32_DESKTOP */
{
FALSE
,
{
{
CS_GLOBALCLASS
,
DesktopWndProc
,
0
,
sizeof
(
DESKTOP
),
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
DESKTOP_CLASS_NAME
}}},
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
bi_class_nameA
[
9
]
}}},
/* BIC32_DIALOG */
{
FALSE
,
{
{
CS_GLOBALCLASS
|
CS_SAVEBITS
,
DefDlgProcA
,
0
,
DLGWINDOWEXTRA
,
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
DIALOG_CLASS_NAME
}}},
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
bi_class_nameA
[
10
]
}}},
/* BIC32_ICONTITLE */
{
FALSE
,
{
{
CS_GLOBALCLASS
,
IconTitleWndProc
,
0
,
0
,
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
ICONTITLE_CLASS_NAME
}}}
0
,
0
,
(
HCURSOR
)
IDC_ARROWA
,
0
,
0
,
bi_class_nameA
[
11
]
}}}
};
static
ATOM
bicAtomTable
[
BIC32_NB_CLASSES
];
...
...
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