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
76386564
Commit
76386564
authored
Nov 15, 2000
by
Eric Kohl
Committed by
Alexandre Julliard
Nov 15, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use internal unicode strings.
Added unicode messages.
parent
b7546b68
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
165 additions
and
32 deletions
+165
-32
tab.c
dlls/comctl32/tab.c
+165
-32
No files found.
dlls/comctl32/tab.c
View file @
76386564
...
...
@@ -7,7 +7,7 @@
*
* TODO:
* Image list support
* Unicode support
* Unicode support
(under construction)
*
* FIXME:
* UpDown control not displayed until after a tab is clicked on
...
...
@@ -17,6 +17,7 @@
#include "winbase.h"
#include "commctrl.h"
#include "comctl32.h"
#include "debugtools.h"
#include "cache.h"
#include <math.h>
...
...
@@ -27,8 +28,7 @@ typedef struct
{
UINT
mask
;
DWORD
dwState
;
LPSTR
pszText
;
INT
cchTextMax
;
LPWSTR
pszText
;
INT
iImage
;
LPARAM
lParam
;
RECT
rect
;
/* bounding rectangle of the item relative to the
...
...
@@ -49,7 +49,6 @@ typedef struct
HCURSOR
hcurArrow
;
/* handle to the current cursor */
HIMAGELIST
himl
;
/* handle to a image list (may be 0) */
HWND
hwndToolTip
;
/* handle to tab's tooltip */
UINT
cchTextMax
;
INT
leftmostVisible
;
/* Used for scrolling, this member contains
* the index of the first visible item */
INT
iSelected
;
/* the currently selected item */
...
...
@@ -1067,8 +1066,8 @@ static void TAB_SetItemBounds (HWND hwnd)
int
num
=
2
;
/* Calculate how wide the tab is depending on the text it contains */
GetTextExtentPoint32
A
(
hdc
,
infoPtr
->
items
[
curItem
].
pszText
,
strlen
(
infoPtr
->
items
[
curItem
].
pszText
),
&
size
);
GetTextExtentPoint32
W
(
hdc
,
infoPtr
->
items
[
curItem
].
pszText
,
lstrlenW
(
infoPtr
->
items
[
curItem
].
pszText
),
&
size
);
/* under Windows, there seems to be a minimum width of 2x the height
* for button style tabs */
...
...
@@ -1430,7 +1429,7 @@ TAB_DrawItemInterior
SetTextColor
(
hdc
,
GetSysColor
((
iItem
==
infoPtr
->
iHotTracked
)
?
COLOR_HIGHLIGHT
:
COLOR_BTNTEXT
));
/* get the rectangle that the text fits in */
DrawText
A
(
hdc
,
infoPtr
->
items
[
iItem
].
pszText
,
-
1
,
DrawText
W
(
hdc
,
infoPtr
->
items
[
iItem
].
pszText
,
-
1
,
&
rcText
,
DT_CALCRECT
);
/*
...
...
@@ -1537,13 +1536,13 @@ TAB_DrawItemInterior
hOldFont
=
SelectObject
(
hdc
,
hFont
);
}
ExtTextOut
A
(
hdc
,
ExtTextOut
W
(
hdc
,
((
lStyle
&
TCS_VERTICAL
)
&&
(
lStyle
&
TCS_BOTTOM
))
?
drawRect
->
right
:
drawRect
->
left
,
((
lStyle
&
TCS_VERTICAL
)
&&
!
(
lStyle
&
TCS_BOTTOM
))
?
drawRect
->
bottom
:
drawRect
->
top
,
0
,
0
,
infoPtr
->
items
[
iItem
].
pszText
,
strlen
(
infoPtr
->
items
[
iItem
].
pszText
),
lstrlenW
(
infoPtr
->
items
[
iItem
].
pszText
),
0
);
...
...
@@ -2168,11 +2167,11 @@ TAB_Paint (HWND hwnd, WPARAM wParam)
}
static
LRESULT
TAB_InsertItem
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
TAB_InsertItem
A
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
TAB_INFO
*
infoPtr
=
TAB_GetInfoPtr
(
hwnd
);
TCITEMA
*
pti
;
INT
iItem
,
len
;
INT
iItem
;
RECT
rect
;
GetClientRect
(
hwnd
,
&
rect
);
...
...
@@ -2217,13 +2216,78 @@ TAB_InsertItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
}
infoPtr
->
items
[
iItem
].
mask
=
pti
->
mask
;
if
(
pti
->
mask
&
TCIF_TEXT
)
{
len
=
strlen
(
pti
->
pszText
);
infoPtr
->
items
[
iItem
].
pszText
=
COMCTL32_Alloc
(
len
+
1
);
strcpy
(
infoPtr
->
items
[
iItem
].
pszText
,
pti
->
pszText
);
infoPtr
->
items
[
iItem
].
cchTextMax
=
pti
->
cchTextMax
;
if
(
pti
->
mask
&
TCIF_TEXT
)
Str_SetPtrAtoW
(
&
infoPtr
->
items
[
iItem
].
pszText
,
pti
->
pszText
);
if
(
pti
->
mask
&
TCIF_IMAGE
)
infoPtr
->
items
[
iItem
].
iImage
=
pti
->
iImage
;
if
(
pti
->
mask
&
TCIF_PARAM
)
infoPtr
->
items
[
iItem
].
lParam
=
pti
->
lParam
;
TAB_SetItemBounds
(
hwnd
);
TAB_InvalidateTabArea
(
hwnd
,
infoPtr
);
TRACE
(
"[%04x]: added item %d '%s'
\n
"
,
hwnd
,
iItem
,
debugstr_w
(
infoPtr
->
items
[
iItem
].
pszText
));
return
iItem
;
}
static
LRESULT
TAB_InsertItemW
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
TAB_INFO
*
infoPtr
=
TAB_GetInfoPtr
(
hwnd
);
TCITEMW
*
pti
;
INT
iItem
;
RECT
rect
;
GetClientRect
(
hwnd
,
&
rect
);
TRACE
(
"Rect: %x T %i, L %i, B %i, R %i
\n
"
,
hwnd
,
rect
.
top
,
rect
.
left
,
rect
.
bottom
,
rect
.
right
);
pti
=
(
TCITEMW
*
)
lParam
;
iItem
=
(
INT
)
wParam
;
if
(
iItem
<
0
)
return
-
1
;
if
(
iItem
>
infoPtr
->
uNumItem
)
iItem
=
infoPtr
->
uNumItem
;
if
(
infoPtr
->
uNumItem
==
0
)
{
infoPtr
->
items
=
COMCTL32_Alloc
(
sizeof
(
TAB_ITEM
));
infoPtr
->
uNumItem
++
;
infoPtr
->
iSelected
=
0
;
}
else
{
TAB_ITEM
*
oldItems
=
infoPtr
->
items
;
infoPtr
->
uNumItem
++
;
infoPtr
->
items
=
COMCTL32_Alloc
(
sizeof
(
TAB_ITEM
)
*
infoPtr
->
uNumItem
);
/* pre insert copy */
if
(
iItem
>
0
)
{
memcpy
(
&
infoPtr
->
items
[
0
],
&
oldItems
[
0
],
iItem
*
sizeof
(
TAB_ITEM
));
}
/* post insert copy */
if
(
iItem
<
infoPtr
->
uNumItem
-
1
)
{
memcpy
(
&
infoPtr
->
items
[
iItem
+
1
],
&
oldItems
[
iItem
],
(
infoPtr
->
uNumItem
-
iItem
-
1
)
*
sizeof
(
TAB_ITEM
));
}
if
(
iItem
<=
infoPtr
->
iSelected
)
infoPtr
->
iSelected
++
;
COMCTL32_Free
(
oldItems
);
}
infoPtr
->
items
[
iItem
].
mask
=
pti
->
mask
;
if
(
pti
->
mask
&
TCIF_TEXT
)
Str_SetPtrW
(
&
infoPtr
->
items
[
iItem
].
pszText
,
pti
->
pszText
);
if
(
pti
->
mask
&
TCIF_IMAGE
)
infoPtr
->
items
[
iItem
].
iImage
=
pti
->
iImage
;
...
...
@@ -2234,11 +2298,12 @@ TAB_InsertItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
TAB_InvalidateTabArea
(
hwnd
,
infoPtr
);
TRACE
(
"[%04x]: added item %d '%s'
\n
"
,
hwnd
,
iItem
,
infoPtr
->
items
[
iItem
].
pszText
);
hwnd
,
iItem
,
debugstr_w
(
infoPtr
->
items
[
iItem
].
pszText
)
);
return
iItem
;
}
static
LRESULT
TAB_SetItemSize
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
...
...
@@ -2263,7 +2328,7 @@ TAB_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
TAB_INFO
*
infoPtr
=
TAB_GetInfoPtr
(
hwnd
);
TCITEMA
*
tabItem
;
TAB_ITEM
*
wineItem
;
INT
iItem
,
len
;
INT
iItem
;
iItem
=
(
INT
)
wParam
;
tabItem
=
(
LPTCITEMA
)
lParam
;
...
...
@@ -2285,15 +2350,48 @@ TAB_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if
(
tabItem
->
mask
&
TCIF_STATE
)
wineItem
->
dwState
=
tabItem
->
dwState
;
if
(
tabItem
->
mask
&
TCIF_TEXT
)
{
len
=
strlen
(
tabItem
->
pszText
);
if
(
tabItem
->
mask
&
TCIF_TEXT
)
Str_SetPtrAtoW
(
&
wineItem
->
pszText
,
tabItem
->
pszText
);
if
(
len
>
wineItem
->
cchTextMax
)
wineItem
->
pszText
=
COMCTL32_ReAlloc
(
wineItem
->
pszText
,
len
+
1
);
/* Update and repaint tabs */
TAB_SetItemBounds
(
hwnd
);
TAB_InvalidateTabArea
(
hwnd
,
infoPtr
);
strcpy
(
wineItem
->
pszText
,
tabItem
->
pszText
)
;
return
TRUE
;
}
static
LRESULT
TAB_SetItemW
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
TAB_INFO
*
infoPtr
=
TAB_GetInfoPtr
(
hwnd
);
TCITEMW
*
tabItem
;
TAB_ITEM
*
wineItem
;
INT
iItem
;
iItem
=
(
INT
)
wParam
;
tabItem
=
(
LPTCITEMW
)
lParam
;
TRACE
(
"%d %p
\n
"
,
iItem
,
tabItem
);
if
((
iItem
<
0
)
||
(
iItem
>=
infoPtr
->
uNumItem
))
return
FALSE
;
wineItem
=
&
infoPtr
->
items
[
iItem
];
if
(
tabItem
->
mask
&
TCIF_IMAGE
)
wineItem
->
iImage
=
tabItem
->
iImage
;
if
(
tabItem
->
mask
&
TCIF_PARAM
)
wineItem
->
lParam
=
tabItem
->
lParam
;
if
(
tabItem
->
mask
&
TCIF_RTLREADING
)
FIXME
(
"TCIF_RTLREADING
\n
"
);
if
(
tabItem
->
mask
&
TCIF_STATE
)
wineItem
->
dwState
=
tabItem
->
dwState
;
if
(
tabItem
->
mask
&
TCIF_TEXT
)
Str_SetPtrW
(
&
wineItem
->
pszText
,
tabItem
->
pszText
);
/* Update and repaint tabs */
TAB_SetItemBounds
(
hwnd
);
TAB_InvalidateTabArea
(
hwnd
,
infoPtr
);
...
...
@@ -2301,6 +2399,7 @@ TAB_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
return
TRUE
;
}
static
LRESULT
TAB_GetItemCount
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
...
...
@@ -2321,7 +2420,8 @@ TAB_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
iItem
=
(
INT
)
wParam
;
tabItem
=
(
LPTCITEMA
)
lParam
;
TRACE
(
"
\n
"
);
if
((
iItem
<
0
)
||
(
iItem
>=
infoPtr
->
uNumItem
))
return
FALSE
;
if
((
iItem
<
0
)
||
(
iItem
>=
infoPtr
->
uNumItem
))
return
FALSE
;
wineItem
=&
infoPtr
->
items
[
iItem
];
...
...
@@ -2338,11 +2438,47 @@ TAB_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
tabItem
->
dwState
=
wineItem
->
dwState
;
if
(
tabItem
->
mask
&
TCIF_TEXT
)
lstrcpynA
(
tabItem
->
pszText
,
wine
Item
->
pszText
,
tabItem
->
cchTextMax
);
Str_GetPtrWtoA
(
wineItem
->
pszText
,
tab
Item
->
pszText
,
tabItem
->
cchTextMax
);
return
TRUE
;
}
static
LRESULT
TAB_GetItemW
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
TAB_INFO
*
infoPtr
=
TAB_GetInfoPtr
(
hwnd
);
TCITEMW
*
tabItem
;
TAB_ITEM
*
wineItem
;
INT
iItem
;
iItem
=
(
INT
)
wParam
;
tabItem
=
(
LPTCITEMW
)
lParam
;
TRACE
(
"
\n
"
);
if
((
iItem
<
0
)
||
(
iItem
>=
infoPtr
->
uNumItem
))
return
FALSE
;
wineItem
=&
infoPtr
->
items
[
iItem
];
if
(
tabItem
->
mask
&
TCIF_IMAGE
)
tabItem
->
iImage
=
wineItem
->
iImage
;
if
(
tabItem
->
mask
&
TCIF_PARAM
)
tabItem
->
lParam
=
wineItem
->
lParam
;
if
(
tabItem
->
mask
&
TCIF_RTLREADING
)
FIXME
(
"TCIF_RTLREADING
\n
"
);
if
(
tabItem
->
mask
&
TCIF_STATE
)
tabItem
->
dwState
=
wineItem
->
dwState
;
if
(
tabItem
->
mask
&
TCIF_TEXT
)
Str_GetPtrW
(
wineItem
->
pszText
,
tabItem
->
pszText
,
tabItem
->
cchTextMax
);
return
TRUE
;
}
static
LRESULT
TAB_DeleteItem
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
...
...
@@ -2629,15 +2765,13 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return
TAB_GetItemA
(
hwnd
,
wParam
,
lParam
);
case
TCM_GETITEMW
:
FIXME
(
"Unimplemented msg TCM_GETITEMW
\n
"
);
return
0
;
return
TAB_GetItemW
(
hwnd
,
wParam
,
lParam
);
case
TCM_SETITEMA
:
return
TAB_SetItemA
(
hwnd
,
wParam
,
lParam
);
case
TCM_SETITEMW
:
FIXME
(
"Unimplemented msg TCM_SETITEMW
\n
"
);
return
0
;
return
TAB_SetItemW
(
hwnd
,
wParam
,
lParam
);
case
TCM_DELETEITEM
:
return
TAB_DeleteItem
(
hwnd
,
wParam
,
lParam
);
...
...
@@ -2658,11 +2792,10 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return
TAB_SetCurSel
(
hwnd
,
wParam
);
case
TCM_INSERTITEMA
:
return
TAB_InsertItem
(
hwnd
,
wParam
,
lParam
);
return
TAB_InsertItem
A
(
hwnd
,
wParam
,
lParam
);
case
TCM_INSERTITEMW
:
FIXME
(
"Unimplemented msg TCM_INSERTITEMW
\n
"
);
return
0
;
return
TAB_InsertItemW
(
hwnd
,
wParam
,
lParam
);
case
TCM_SETITEMEXTRA
:
FIXME
(
"Unimplemented msg TCM_SETITEMEXTRA
\n
"
);
...
...
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