18 modified files
reactos/lib/comctl32
diff -u -r1.4 -r1.5
--- .cvsignore 11 Mar 2004 11:34:51 -0000 1.4
+++ .cvsignore 15 Apr 2004 08:29:56 -0000 1.5
@@ -16,6 +16,7 @@
idc_copy.cur
idc_divider.cur
idc_divideropen.cur
+idc_movebutton.cur
idi_dragarrow.ico
idt_check.bmp
comctl32.spec.def
reactos/lib/comctl32
diff -u -r1.3 -r1.4
--- Makefile.in 11 Mar 2004 11:13:28 -0000 1.3
+++ Makefile.in 15 Apr 2004 08:29:56 -0000 1.4
@@ -49,6 +49,7 @@
idc_copy.cur \
idc_divider.cur \
idc_divideropen.cur \
+ idc_movebutton.cur \
idi_dragarrow.ico \
idt_check.bmp
reactos/lib/comctl32
diff -u -r1.4 -r1.5
--- animate.c 22 Jan 2004 18:45:19 -0000 1.4
+++ animate.c 15 Apr 2004 08:29:56 -0000 1.5
@@ -71,6 +71,7 @@
LPVOID outdata;
/* data for the background mechanism */
CRITICAL_SECTION cs;
+ HANDLE hStopEvent;
HANDLE hThread;
UINT uTimer;
/* data for playing the file */
@@ -145,9 +146,17 @@
/* should stop playing */
if (infoPtr->hThread)
{
- if (!TerminateThread(infoPtr->hThread,0))
- WARN("could not destroy animation thread!\n");
- infoPtr->hThread = 0;
+ HANDLE handle = infoPtr->hThread;
+
+ TRACE("stopping animation thread\n");
+ SetEvent( infoPtr->hStopEvent );
+ LeaveCriticalSection(&infoPtr->cs); /* leave it a chance to run */
+ WaitForSingleObject( handle, INFINITE );
+ TRACE("animation thread stopped\n");
+ EnterCriticalSection(&infoPtr->cs);
+ CloseHandle( infoPtr->hThread );
+ CloseHandle( infoPtr->hStopEvent );
+ infoPtr->hThread = 0;
}
if (infoPtr->uTimer) {
KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
@@ -378,33 +387,20 @@
static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
{
ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_;
- HDC hDC;
-
- if(!infoPtr)
- {
- WARN("animation structure undefined!\n");
- return FALSE;
- }
+ HANDLE event;
+ DWORD timeout;
while(1)
{
- if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
- {
- hDC = GetDC(infoPtr->hwndSelf);
- /* sometimes the animation window will be destroyed in between
- * by the main program, so a ReleaseDC() error msg is possible */
- infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
- WM_CTLCOLORSTATIC, (WPARAM)hDC,
- (LPARAM)infoPtr->hwndSelf);
- ReleaseDC(infoPtr->hwndSelf,hDC);
- }
-
EnterCriticalSection(&infoPtr->cs);
ANIMATE_DrawFrame(infoPtr);
+ timeout = infoPtr->mah.dwMicroSecPerFrame;
+ event = infoPtr->hStopEvent;
LeaveCriticalSection(&infoPtr->cs);
/* time is in microseconds, we should convert it to milliseconds */
- Sleep((infoPtr->mah.dwMicroSecPerFrame+500)/1000);
+ if (WaitForSingleObject( event, (timeout+500)/1000) == WAIT_OBJECT_0)
+ break;
}
return TRUE;
}
@@ -445,13 +441,22 @@
} else {
DWORD threadID;
+ if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
+ {
+ HDC hDC = GetDC(hWnd);
+ infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
+ WM_CTLCOLORSTATIC, 0, (LPARAM)hWnd);
+ ReleaseDC(hWnd,hDC);
+ }
+
TRACE("Using an animation thread\n");
+ infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL );
infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &threadID);
if(!infoPtr->hThread)
{
ERR("Could not create animation thread!\n");
return FALSE;
- }
+ }
}
reactos/lib/comctl32
diff -u -r1.3 -r1.4
--- comboex.c 17 Dec 2003 18:09:54 -0000 1.3
+++ comboex.c 15 Apr 2004 08:29:56 -0000 1.4
@@ -24,7 +24,7 @@
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 9, 2002, by Dimitrie O. Paun.
*
- * Unless otherwise noted, we belive this code to be complete, as per
+ * Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
reactos/lib/comctl32
diff -u -r1.5 -r1.6
--- comctl32.h 11 Mar 2004 11:13:28 -0000 1.5
+++ comctl32.h 15 Apr 2004 08:29:56 -0000 1.6
@@ -106,6 +106,7 @@
#define IDI_DRAGARROW 501
#define IDC_COPY 502
+#define IDC_MOVEBUTTON 1
/* HOTKEY internal strings */
#define HKY_NONE 2048
reactos/lib/comctl32
diff -u -r1.8 -r1.9
--- commctrl.c 11 Mar 2004 11:13:28 -0000 1.8
+++ commctrl.c 15 Apr 2004 08:29:56 -0000 1.9
@@ -23,7 +23,7 @@
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 21, 2002, by Christian Neumair.
*
- * Unless otherwise noted, we belive this code to be complete, as per
+ * Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
@@ -114,6 +114,7 @@
extern void UPDOWN_Register(void);
extern void UPDOWN_Unregister(void);
+static LRESULT WINAPI SubclassWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LPSTR COMCTL32_aSubclass = NULL;
HMODULE COMCTL32_hModule = 0;
@@ -1108,10 +1109,10 @@
/* set window procedure to our own and save the current one */
if (IsWindowUnicode (hWnd))
stack->origproc = (WNDPROC)SetWindowLongW (hWnd, GWL_WNDPROC,
- (LONG)DefSubclassProc);
+ (LONG)SubclassWndProc);
else
stack->origproc = (WNDPROC)SetWindowLongA (hWnd, GWL_WNDPROC,
- (LONG)DefSubclassProc);
+ (LONG)SubclassWndProc);
} else {
WNDPROC current;
if (IsWindowUnicode (hWnd))
@@ -1119,7 +1120,7 @@
else
current = (WNDPROC)GetWindowLongA (hWnd, GWL_WNDPROC);
- if (current != DefSubclassProc) {
+ if (current != SubclassWndProc) {
ERR ("Application has subclassed with our procedure, then manually, then with us again. The current implementation can't handle this.\n");
return FALSE;
}
@@ -1263,6 +1264,33 @@
/***********************************************************************
+ * SubclassWndProc (internal)
+ *
+ * Window procedure for all subclassed windows.
+ * Saves the current subclassing stack position to support nested messages
+ */
+
+static LRESULT WINAPI SubclassWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ LPSUBCLASS_INFO stack;
+ int stackpos;
+ LRESULT ret;
+
+ /* retrieve our little stack from the Properties */
+ stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
+ if (!stack) {
+ ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd);
+ return 0;
+ }
+ stackpos = stack->stackpos;
+ stack->stackpos = stack->stacknum;
+ ret = DefSubclassProc(hWnd,uMsg,wParam,lParam);
+ stack->stackpos = stackpos;
+ return ret;
+}
+
+
+/***********************************************************************
* DefSubclassProc [COMCTL32.413]
*
* Calls the next window procedure (ie. the one before this subclass)
reactos/lib/comctl32
diff -u -r1.3 -r1.4
--- draglist.c 11 Mar 2004 11:13:28 -0000 1.3
+++ draglist.c 15 Apr 2004 08:29:56 -0000 1.4
@@ -18,6 +18,15 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
+ * NOTES
+ *
+ * This code was audited for completeness against the documented features
+ * of Comctl32.dll version 6.0 on Mar. 10, 2004, by Robert Shearman.
+ *
+ * Unless otherwise noted, we believe this code to be complete, as per
+ * the specification mentioned above.
+ * If you discover missing features or bugs please note them below.
+ *
*/
#include <stdarg.h>
@@ -27,16 +36,15 @@
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
-#include "winnt.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
-#ifndef TEXT
-# define TEXT(string) string
-#endif
+/* for compiler compatibility we only accept literal ASCII strings */
+#undef TEXT
+#define TEXT(string) string
#define DRAGLIST_SUBCLASSID 0
#define DRAGLIST_SCROLLPERIOD 200
@@ -50,17 +58,18 @@
/* internal Wine specific data for the drag list control */
typedef struct _DRAGLISTDATA
{
- /* are we currently in dragging mode? */
- BOOL dragging;
+ /* are we currently in dragging mode? */
+ BOOL dragging;
- /* cursor to use as determined by DL_DRAGGING notification.
+ /* cursor to use as determined by DL_DRAGGING notification.
* NOTE: as we use LoadCursor we don't have to use DeleteCursor
* when we are finished with it */
- HCURSOR cursor;
+ HCURSOR cursor;
/* optimisation so that we don't have to load the cursor
* all of the time whilst dragging */
- LRESULT last_dragging_response;
+ LRESULT last_dragging_response;
+
/* prevents flicker with drawing drag arrow */
RECT last_drag_icon_rect;
} DRAGLISTDATA;
@@ -259,6 +268,9 @@
if (!GetWindowSubclass(hwndLB, DragList_SubclassWindowProc, DRAGLIST_SUBCLASSID, (DWORD_PTR*)&data))
return;
+ if (nItem < 0)
+ SetRectEmpty(&rcDragIcon);
+
/* prevent flicker by only redrawing when necessary */
if (!EqualRect(&rcDragIcon, &data->last_drag_icon_rect))
{
@@ -266,6 +278,8 @@
RedrawWindow(hwndParent, &data->last_drag_icon_rect, NULL,
RDW_INTERNALPAINT | RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
+ CopyRect(&data->last_drag_icon_rect, &rcDragIcon);
+
if (nItem >= 0)
{
hdc = GetDC(hwndParent);
@@ -275,7 +289,6 @@
ReleaseDC(hwndParent, hdc);
}
}
- CopyRect(&data->last_drag_icon_rect, &rcDragIcon);
}
/***********************************************************************
reactos/lib/comctl32
diff -u -r1.9 -r1.10
--- imagelist.c 5 Apr 2004 21:29:28 -0000 1.9
+++ imagelist.c 15 Apr 2004 08:29:56 -0000 1.10
@@ -1153,7 +1153,7 @@
BitBlt(hBlendMaskDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, NOTSRCCOPY);
}
#endif
-
+
/* now apply blend to the current image given the BlendMask */
if (clrBlend == CLR_DEFAULT) clrBlend = GetSysColor (COLOR_HIGHLIGHT);
else if (clrBlend == CLR_NONE) clrBlend = GetTextColor (pimldp->hdcDst);
reactos/lib/comctl32
diff -u -r1.3 -r1.4
--- ipaddress.c 17 Dec 2003 18:09:54 -0000 1.3
+++ ipaddress.c 15 Apr 2004 08:29:56 -0000 1.4
@@ -26,7 +26,7 @@
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 9, 2002, by Dimitrie O. Paun.
*
- * Unless otherwise noted, we belive this code to be complete, as per
+ * Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
reactos/lib/comctl32
diff -u -r1.8 -r1.9
--- listview.c 14 Mar 2004 08:51:16 -0000 1.8
+++ listview.c 15 Apr 2004 08:29:56 -0000 1.9
@@ -26,7 +26,7 @@
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 21, 2002, by Dimitrie O. Paun.
*
- * Unless otherwise noted, we belive this code to be complete, as per
+ * Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
reactos/lib/comctl32
diff -u -r1.4 -r1.5
--- progress.c 5 Apr 2004 09:16:49 -0000 1.4
+++ progress.c 15 Apr 2004 08:29:56 -0000 1.5
@@ -23,7 +23,7 @@
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 9, 2002, by Dimitrie O. Paun.
*
- * Unless otherwise noted, we belive this code to be complete, as per
+ * Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
reactos/lib/comctl32
diff -u -r1.5 -r1.6
--- propsheet.c 11 Mar 2004 11:13:28 -0000 1.5
+++ propsheet.c 15 Apr 2004 08:29:56 -0000 1.6
@@ -1175,7 +1175,7 @@
hwndControl = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE);
GetWindowRect(hwndControl, &rc);
- ptLine.x = 0;
+ ptLine.x = rc.left;
ptLine.y = rc.bottom;
ScreenToClient(hwndDlg, &ptLine);
@@ -1217,6 +1217,7 @@
SendMessageW(hwndTabCtrl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
}
+ SendMessageW(GetDlgItem(hwndTabCtrl, IDC_TABCONTROL), WM_SETREDRAW, 0, 0);
for (i = 0; i < nTabs; i++)
{
if ( psInfo->proppage[i].hasIcon )
@@ -1232,6 +1233,7 @@
item.pszText = (LPWSTR) psInfo->proppage[i].pszText;
SendMessageW(hwndTabCtrl, TCM_INSERTITEMW, (WPARAM)i, (LPARAM)&item);
}
+ SendMessageW(GetDlgItem(hwndTabCtrl, IDC_TABCONTROL), WM_SETREDRAW, 1, 0);
return TRUE;
}
@@ -2830,6 +2832,9 @@
LPCPROPSHEETPAGEW ppshpage;
int idx;
+ /* Using PropSheetInfoStr to store extra data doesn't match the native
+ * common control: native uses TCM_[GS]ETITEM
+ */
SetPropW(hwnd, PropSheetInfoStr, (HANDLE)psInfo);
/*
reactos/lib/comctl32
diff -u -r1.8 -r1.9
--- rebar.c 11 Mar 2004 11:13:28 -0000 1.8
+++ rebar.c 15 Apr 2004 08:29:56 -0000 1.9
@@ -213,17 +213,12 @@
#define DRAW_BOTTOMSEP 0x00000020
#define DRAW_CHEVRONHOT 0x00000040
#define DRAW_CHEVRONPUSHED 0x00000080
+#define DRAW_LAST_IN_ROW 0x00000100
+#define DRAW_FIRST_IN_ROW 0x00000200
#define NTF_INVALIDATE 0x01000000
typedef struct
{
- INT istartband; /* index of first band in row */
- INT iendband; /* index of last band in row */
-} REBAR_ROW;
-
-
-typedef struct
-{
COLORREF clrBk; /* background color */
COLORREF clrText; /* text color */
COLORREF clrBtnText; /* system color for BTNTEXT */
@@ -257,7 +252,6 @@
INT ichevronhotBand; /* last band that had a hot chevron */
INT iGrabbedBand;/* band number of band whose gripper was grabbed */
- REBAR_ROW *rows; /* pointer to row indexes */
REBAR_BAND *bands; /* pointer to the array of rebar bands */
} REBAR_INFO;
@@ -305,6 +299,10 @@
/* either top or bottom */
#define REBAR_DIVIDER 2
+/* minimium vertical height of a normal bar */
+/* or minimum width of a CCS_VERT bar - from experiment on Win2k */
+#define REBAR_MINSIZE 23
+
/* This is the increment that is used over the band height */
#define REBARSPACE(a) ((a->fStyle & RBBS_CHILDEDGE) ? 2*REBAR_DIVIDER : 0)
@@ -675,11 +673,10 @@
REBAR_Refresh (REBAR_INFO *infoPtr, HDC hdc)
{
REBAR_BAND *lpBand;
- UINT i, oldrow;
+ UINT i;
if (!infoPtr->DoRedraw) return;
- oldrow = infoPtr->bands[0].iRow;
for (i = 0; i < infoPtr->uNumBands; i++) {
lpBand = &infoPtr->bands[i];
@@ -1674,7 +1671,7 @@
#if PROBLEM2
(x < adjcx) : (y < adjcy)
#else
- (adjcx - x > 4) : (adjcy - y > 4)
+ (adjcx - x > 5) : (adjcy - y > 4)
#endif
) &&
(infoPtr->uNumBands > 1)) {
@@ -1762,39 +1759,29 @@
/* ******* End Phase 2 - split rows till adjustment height full ******* */
- /* ******* Start Phase 2a - create array of start and end ******* */
- /* indexes by row */
+ /* ******* Start Phase 2a - mark first and last band in each ******* */
- if (infoPtr->uNumRows != origrows) {
- if (infoPtr->rows) Free (infoPtr->rows);
- infoPtr->rows = Alloc (sizeof (REBAR_ROW) * infoPtr->uNumRows);
- }
-
- row = 0;
- for (i = 0; i < infoPtr->uNumBands; i++) {
- lpBand = &infoPtr->bands[i];
- if (HIDDENBAND(lpBand)) continue;
-
- if (lpBand->iRow > row) {
- row++;
- infoPtr->rows[row-1].istartband = i;
- }
- if (row == 0) {
- ERR("P2a bug!!!!!!\n");
- }
- infoPtr->rows[row-1].iendband = i;
- }
-
- for (i = 0; i < infoPtr->uNumRows; i++) {
- REBAR_ROW *p;
-
- p = &infoPtr->rows[i];
- TRACE("P2a row %d, starts %d, ends %d\n",
- i+1, p->istartband, p->iendband);
+ prevBand = NULL;
+ for (i = 0; i < infoPtr->uNumBands; i++) {
+ lpBand = &infoPtr->bands[i];
+ if (HIDDENBAND(lpBand))
+ continue;
+ if( !prevBand ) {
+ lpBand->fDraw |= DRAW_FIRST_IN_ROW;
+ prevBand = lpBand;
+ }
+ else if( prevBand->iRow == lpBand->iRow )
+ prevBand = lpBand;
+ else {
+ prevBand->fDraw |= DRAW_LAST_IN_ROW;
+ lpBand->fDraw |= DRAW_FIRST_IN_ROW;
+ prevBand = lpBand;
+ }
}
+ if( prevBand )
+ prevBand->fDraw |= DRAW_LAST_IN_ROW;
- /* ******* End Phase 2a - create array of start and end ******* */
- /* indexes by row */
+ /* ******* End Phase 2a - mark first and last band in each ******* */
/* ******* Start Phase 2b - adjust all bands for height full ******* */
@@ -1804,24 +1791,28 @@
if (((infoPtr->dwStyle & CCS_VERT) ? clientcx > x : clientcy > y) &&
infoPtr->uNumBands) {
- INT diff, i, iband;
+ INT diff, i;
UINT j;
diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y;
- for (i = infoPtr->uNumRows; i >= 1; i--) {
- /* if row has more than 1 band, ignore row */
- if (infoPtr->rows[i-1].istartband != infoPtr->rows[i-1].iendband)
- continue;
- /* point to only band in row */
- iband = infoPtr->rows[i-1].istartband;
- lpBand = &infoPtr->bands[iband];
+
+ /* iterate backwards thru the rows */
+ for (i = infoPtr->uNumBands-1; i>=0; i--) {
+ lpBand = &infoPtr->bands[i];
if(HIDDENBAND(lpBand)) continue;
+
+ /* if row has more than 1 band, ignore it */
+ if( !(lpBand->fDraw&DRAW_FIRST_IN_ROW) )
+ continue;
+ if( !(lpBand->fDraw&DRAW_LAST_IN_ROW) )
+ continue;
+
if (lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;
if (((INT)lpBand->cyMaxChild < 1) ||
((INT)lpBand->cyIntegral < 1)) {
if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue;
ERR("P2b band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n",
- iband, lpBand->cyMaxChild, lpBand->cyIntegral);
+ i, lpBand->cyMaxChild, lpBand->cyIntegral);
continue;
}
/* j is now the maximum height/width in the client area */
@@ -1835,7 +1826,7 @@
else
lpBand->rcBand.bottom = lpBand->rcBand.top + j;
TRACE("P2b band %d, row %d changed to (%ld,%ld)-(%ld,%ld)\n",
- iband, lpBand->iRow,
+ i, lpBand->iRow,
lpBand->rcBand.left, lpBand->rcBand.top,
lpBand->rcBand.right, lpBand->rcBand.bottom);
if (diff <= 0) break;
@@ -1856,7 +1847,7 @@
/* ******* Start Phase 3 - adjust all bands for width full ******* */
if (infoPtr->uNumBands) {
- REBAR_ROW *p;
+ int startband;
/* If RBS_BANDBORDERS set then indicate to draw bottom separator */
/* on all bands in all rows but last row. */
@@ -1864,39 +1855,49 @@
/* each row but the rightmost band. */
if (infoPtr->dwStyle & RBS_BANDBORDERS) {
- for(i = 0; i < infoPtr->uNumRows; i++) {
- p = &infoPtr->rows[i];
- for (j = p->istartband; j <= p->iendband; j++) {
- lpBand = &infoPtr->bands[j];
- if (HIDDENBAND(lpBand)) continue;
- if (j != p->iendband)
- lpBand->fDraw |= DRAW_RIGHTSEP;
- if (i != infoPtr->uNumRows-1)
- lpBand->fDraw |= DRAW_BOTTOMSEP;
- }
+ for (i=0; i<infoPtr->uNumBands; i++) {
+ lpBand = &infoPtr->bands[i];
+ if (HIDDENBAND(lpBand))
+ continue;
+
+ /* not righthand bands */
+ if( !(lpBand->fDraw & DRAW_LAST_IN_ROW) )
+ lpBand->fDraw |= DRAW_RIGHTSEP;
+
+ /* not the last row */
+ if( lpBand->iRow != infoPtr->uNumRows )
+ lpBand->fDraw |= DRAW_BOTTOMSEP;
}
}
/* Distribute the extra space on the horizontal and adjust */
/* all bands in row to same height. */
- for (i=1; i<=infoPtr->uNumRows; i++) {
- p = &infoPtr->rows[i-1];
- mcy = 0;
+ mcy = 0;
+ startband = -1;
+ for (i=0; i<infoPtr->uNumBands; i++) {
- TRACE("P3 processing row %d, starting band %d, ending band %d\n",
- i, p->istartband, p->iendband);
+ lpBand = &infoPtr->bands[i];
- /* Find the largest height of the bands in the row */
- for (j = p->istartband; j <= p->iendband; j++) {
- lpBand = &infoPtr->bands[j];
- if (HIDDENBAND(lpBand)) continue;
- if (mcy < ircBw(lpBand))
- mcy = ircBw(lpBand);
- }
+ if( lpBand->fDraw & DRAW_FIRST_IN_ROW )
+ {
+ startband = i;
+ mcy = 0;
+ }
+
+ if ( (mcy < ircBw(lpBand)) && !HIDDENBAND(lpBand) )
+ mcy = ircBw(lpBand);
+
+ if( lpBand->fDraw & DRAW_LAST_IN_ROW )
+ {
+ TRACE("P3 processing row %d, starting band %d, ending band %d\n",
+ lpBand->iRow, startband, i);
+ if( startband < 0 )
+ ERR("Last band %d with no first, row %d\n", i, lpBand->iRow);
- REBAR_AdjustBands (infoPtr, p->istartband, p->iendband,
+ REBAR_AdjustBands (infoPtr, startband, i,
(infoPtr->dwStyle & CCS_VERT) ?
clientcy : clientcx, mcy);
+ }
}
/* Calculate the other rectangles in each band */
@@ -1920,6 +1921,8 @@
y = clientcy;
}
if (infoPtr->dwStyle & CCS_VERT) {
+ if( x < REBAR_MINSIZE )
+ x = REBAR_MINSIZE;
infoPtr->calcSize.cx = x;
infoPtr->calcSize.cy = clientcy;
TRACE("vert, notify=%d, x=%d, origheight=%d\n",
@@ -1927,6 +1930,8 @@
if (notify && (x != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;
}
else {
+ if( y < REBAR_MINSIZE )
+ y = REBAR_MINSIZE;
infoPtr->calcSize.cx = clientcx;
infoPtr->calcSize.cy = y;
TRACE("horz, notify=%d, y=%d, origheight=%d\n",
@@ -2511,13 +2516,13 @@
}
}
- if (RHeaderSum) RHeaderSum -= SEP_WIDTH; /* no separator afterlast band */
+ if (RHeaderSum) RHeaderSum -= SEP_WIDTH; /* no separator after last band */
mindBand = &infoPtr->bands[imindBand];
maxdBand = &infoPtr->bands[imaxdBand];
- if (imindBand == imaxdBand) return; /* nothing to drag agains */
- if (imindBand == ihitBand) return; /* first band in row, cant drag */
+ if (imindBand == imaxdBand) return; /* nothing to drag against */
+ if (imindBand == ihitBand) return; /* first band in row, can't drag */
/* limit movement to inside adjustable bands - Left */
if ( (ptsmove->x < mindBand->rcBand.left) ||
@@ -3205,9 +3210,9 @@
}
/* post copy */
- if (uIndex < infoPtr->uNumBands - 1) {
+ if (uIndex <= infoPtr->uNumBands - 1) {
memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
- (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
+ (infoPtr->uNumBands - uIndex) * sizeof(REBAR_BAND));
}
Free (oldBands);
@@ -3239,7 +3244,7 @@
REBAR_ValidateBand (infoPtr, lpBand);
/* On insert of second band, revalidate band 1 to possible add gripper */
if (infoPtr->uNumBands == 2)
- REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);
+ REBAR_ValidateBand (infoPtr, &infoPtr->bands[uIndex ? 0 : 1]);
REBAR_DumpBand (infoPtr);
reactos/lib/comctl32
diff -u -r1.2 -r1.3
--- rsrc.rc 11 Mar 2004 11:13:28 -0000 1.2
+++ rsrc.rc 15 Apr 2004 08:29:56 -0000 1.3
@@ -1052,6 +1052,33 @@
} */
+/* BINRES idc_movebutton.cur */
+IDC_MOVEBUTTON CURSOR LOADONCALL DISCARDABLE idc_movebutton.cur
+/* {
+ '00 00 02 00 01 00 20 20 00 00 10 00 10 00 30 01'
+ '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
+ '00 00 01 00 01 00 00 00 00 00 00 01 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 0F F8 00 00 0F'
+ 'F8 00 00 1F FC 00 00 1F FC 00 00 3F FC 00 00 3F'
+ 'FE 00 00 7F FE 00 00 5F FE 00 00 DF FE 00 01 DF'
+ 'FE 00 01 9F FE 00 00 1D B6 00 00 1D B4 00 00 0D'
+ 'B0 00 00 01 80 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 FF FF FF FF FF FF FF FF D2 49'
+ '24 93 DF FF FF FF FF FF FF FB DF FF FF FB DF FF'
+ 'FF FF FF FF FF FB DF E0 03 FB DF E0 03 FF FF E0'
+ '03 FB DF C0 01 FB DF C0 01 FF FF 80 01 FB DF 80'
+ '00 FB DF 00 00 FF FF 00 00 FB DE 00 00 FB DC 00'
+ '00 FF FC 00 00 FB DC 40 00 FB DF C0 01 FF FF E0'
+ '03 FB DF F0 0F FB DF FE 7F FF FF FF FF FB DF FF'
+ 'FF FB DF FF FF FF FF FF FF FB C9 24 92 4B FF FF'
+ 'FF FF FF FF FF FF'
+} */
+
+
/* BINRES idi_dragarrow.ico */
IDI_DRAGARROW ICON LOADONCALL DISCARDABLE idi_dragarrow.ico
/* {
reactos/lib/comctl32
diff -u -r1.11 -r1.12
--- toolbar.c 12 Mar 2004 20:30:44 -0000 1.11
+++ toolbar.c 15 Apr 2004 08:29:56 -0000 1.12
@@ -3,6 +3,7 @@
*
* Copyright 1998,1999 Eric Kohl
* Copyright 2000 Eric Kohl for CodeWeavers
+ * Copyright 2004 Robert Shearman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,6 +19,8 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
+ * NOTES
+ *
* Differences between MSDN and actual native control operation:
* 1. MSDN says: "TBSTYLE_LIST: Creates a flat toolbar with button text
* to the right of the bitmap. Otherwise, this style is
@@ -27,30 +30,40 @@
* is non-flat non-transparent buttons. Therefore TBSTYLE_LIST does
* *not* imply TBSTYLE_FLAT as documented. (GA 8/2001)
*
- *
+ * This code was audited for completeness against the documented features
+ * of Comctl32.dll version 6.0 on Mar. 14, 2004, by Robert Shearman.
+ *
+ * Unless otherwise noted, we believe this code to be complete, as per
+ * the specification mentioned above.
+ * If you discover missing features or bugs please note them below.
+ *
* TODO:
- * - Button wrapping (under construction).
- * - Messages.
- * - Notifications
+ * - Styles:
+ * - TBSTYLE_REGISTERDROP
+ * - TBSTYLE_EX_DOUBLEBUFFER
+ * - Messages:
+ * - TB_GETINSERTMARK
+ * - TB_GETINSERTMARKCOLOR
+ * - TB_GETMETRICS
+ * - TB_GETOBJECT
+ * - TB_INSERTMARKHITTEST
+ * - TB_SETINSERTMARK
+ * - TB_SETMETRICS
+ * - Notifications:
* - NM_CHAR
* - NM_KEYDOWN
- * - NM_LDOWN
* - NM_RCLICK
* - NM_RDBLCLICK
- * - TBN_DELETINGBUTTON
* - TBN_DRAGOUT
* - TBN_GETOBJECT
* - TBN_RESTORE
* - TBN_SAVE
- * - TBN_TOOLBARCHANGE
+ * - Button wrapping (under construction).
* - Fix TB_SETROWS.
- * - Tooltip support (almost complete).
- * - Fix TOOLBAR_SetButtonInfo32A/W.
- * - iString of -1 is undocumented
+ * - iListGap custom draw support.
* - Customization dialog:
- * - Add flat look.
* - Minor buglet in 'available buttons' list:
- * Buttons are not listed in M$-like order. M$ seems to use a single
+ * Buttons are not listed in MS-like order. MS seems to use a single
* internal list to store the button information of both listboxes.
* - Drag list support.
*
@@ -75,12 +88,13 @@
#include "wine/unicode.h"
#include "winnls.h"
#include "commctrl.h"
-#include "imagelist.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(toolbar);
+static HCURSOR hCursorDrag = NULL;
+
typedef struct
{
INT iBitmap;
@@ -89,10 +103,10 @@
BYTE fsStyle;
DWORD dwData;
INT iString;
-
BOOL bHot;
INT nRow;
RECT rect;
+ INT cx; /* manually set size */
} TBUTTON_INFO;
typedef struct
@@ -129,13 +143,15 @@
INT nNumBitmapInfos;
BOOL bUnicode; /* ASCII (FALSE) or Unicode (TRUE)? */
BOOL bCaptured; /* mouse captured? */
- INT nButtonDown;
+ INT nButtonDown; /* toolbar button being pressed or -1 if none */
+ INT nButtonDrag; /* toolbar button being dragged or -1 if none */
INT nOldHit;
INT nHotItem; /* index of the "hot" item */
DWORD dwBaseCustDraw; /* CDRF_ response (w/o TBCDRF_) from PREPAINT */
DWORD dwItemCustDraw; /* CDRF_ response (w/o TBCDRF_) from ITEMPREP */
DWORD dwItemCDFlag; /* TBCDRF_ flags from last ITEMPREPAINT */
SIZE szPadding; /* padding values around button */
+ INT iListGap; /* default gap between text and image for toolbar with list style */
HFONT hDefaultFont;
HFONT hFont; /* text font */
HIMAGELIST himlInt; /* image list created internally */
@@ -162,7 +178,8 @@
COLORREF clrBtnShadow; /* color for Flag Separator */
RECT rcBound; /* bounding rectangle */
INT iVersion;
-
+ LPWSTR pszTooltipText; /* temporary store for a string > 80 characters
+ * for TTN_GETDISPINFOW notification */
TBUTTON_INFO *buttons; /* pointer to button array */
LPWSTR *strings; /* pointer to string array */
TBITMAP_INFO *bitmaps;
@@ -197,10 +214,9 @@
#define DDARROW_WIDTH 11
#define ARROW_HEIGHT 3
-/* gap between edge of button and image with TBSTYLE_LIST */
-#define LIST_IMAGE_OFFSET 3
-/* gap between bitmap and text (always present) */
-#define LIST_TEXT_OFFSET 2
+/* gap between border of button and text/image */
+#define OFFSET_X 1
+#define OFFSET_Y 1
/* how wide to treat the bitmap if it isn't present */
#define LIST_IMAGE_ABSENT_WIDTH 2
@@ -208,6 +224,11 @@
#define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE)
#define TOOLBAR_HasDropDownArrows(exStyle) ((exStyle & TBSTYLE_EX_DRAWDDARROWS) ? TRUE : FALSE)
+static inline int TOOLBAR_GetListTextOffset(TOOLBAR_INFO *infoPtr, INT iListGap)
+{
+ return GetSystemMetrics(SM_CXEDGE) + iListGap - infoPtr->szPadding.cx/2;
+}
+
/* Used to find undocumented extended styles */
#define TBSTYLE_EX_ALL (TBSTYLE_EX_DRAWDDARROWS | \
TBSTYLE_EX_UNDOC1 | \
@@ -226,6 +247,7 @@
static PIMLENTRY TOOLBAR_GetImageListEntry(PIMLENTRY *pies, INT cies, INT id);
static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies);
static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id);
+static LRESULT TOOLBAR_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam);
static LRESULT
TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
@@ -236,7 +258,7 @@
{
LPWSTR lpText = NULL;
- /* FIXME: iString == -1 is undocumented */
+ /* NOTE: iString == -1 is undocumented */
if ((HIWORD(btnPtr->iString) != 0) && (btnPtr->iString != -1))
lpText = (LPWSTR)btnPtr->iString;
else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings))
@@ -296,8 +318,6 @@
static void
TOOLBAR_CheckStyle (HWND hwnd, DWORD dwStyle)
{
- if (dwStyle & TBSTYLE_ALTDRAG)
- FIXME("[%p] TBSTYLE_ALTDRAG not implemented\n", hwnd);
if (dwStyle & TBSTYLE_REGISTERDROP)
FIXME("[%p] TBSTYLE_REGISTERDROP not implemented\n", hwnd);
}
@@ -350,7 +370,7 @@
btnPtr->iBitmap = nmgd.iImage;
}
ret = nmgd.iImage;
- TRACE("TBN_GETDISPINFOA returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n",
+ TRACE("TBN_GETDISPINFO returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n",
ret, nmgd.dwMask, infoPtr->nNumBitmaps);
}
@@ -378,32 +398,29 @@
/***********************************************************************
-* TOOLBAR_DrawImageList
+* TOOLBAR_GetImageListForDrawing
*
* This function validates the bitmap index (including I_IMAGECALLBACK
-* functionality). It then draws the image via the ImageList_Draw
-* function. It returns TRUE if the image was drawn, FALSE otherwise.
+* functionality) and returns the corresponding image list.
*/
-static BOOL
-TOOLBAR_DrawImageList (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMAGE_LIST_TYPE imagelist,
- HDC hdc, UINT left, UINT top, UINT draw_flags)
+static HIMAGELIST
+TOOLBAR_GetImageListForDrawing (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMAGE_LIST_TYPE imagelist, INT * index)
{
- INT index;
HIMAGELIST himl;
if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
- if (btnPtr->iBitmap == I_IMAGENONE) return FALSE;
+ if (btnPtr->iBitmap == I_IMAGENONE) return NULL;
ERR("index %d,%d is not valid, max %d\n",
HIWORD(btnPtr->iBitmap), LOWORD(btnPtr->iBitmap), infoPtr->nNumBitmaps);
- return FALSE;
+ return NULL;
}
- if ((index = TOOLBAR_GetBitmapIndex(infoPtr, btnPtr)) < 0) {
- if ((index == I_IMAGECALLBACK) ||
- (index == I_IMAGENONE)) return FALSE;
+ if ((*index = TOOLBAR_GetBitmapIndex(infoPtr, btnPtr)) < 0) {
+ if ((*index == I_IMAGECALLBACK) ||
+ (*index == I_IMAGENONE)) return NULL;
ERR("TBN_GETDISPINFO returned invalid index %d\n",
- index);
- return FALSE;
+ *index);
+ return NULL;
}
switch(imagelist)
@@ -423,24 +440,17 @@
}
if (!himl)
- {
- TRACE("no image list, returning FALSE\n");
- return FALSE;
- }
+ TRACE("no image list\n");
- TRACE("drawing index=%d, himl=%p, left=%d, top=%d, flags=%08x\n",
- index, himl, left, top, draw_flags);
-
- ImageList_Draw (himl, index, hdc, left, top, draw_flags);
- return TRUE;
+ return himl;
}
/***********************************************************************
* TOOLBAR_TestImageExist
*
-* This function is similar to TOOLBAR_DrawImageList, except it does not
-* draw the image. The I_IMAGECALLBACK functionality is implemented.
+* This function is similar to TOOLBAR_GetImageListForDrawing, except it does not
+* return the image list. The I_IMAGECALLBACK functionality is implemented.
*/
static BOOL
TOOLBAR_TestImageExist (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HIMAGELIST himl)
@@ -540,12 +550,12 @@
static void
-TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, INT colorRef)
+TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, COLORREF clr)
{
INT x, y;
HPEN hPen, hOldPen;
- if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return;
+ if (!(hPen = CreatePen( PS_SOLID, 1, clr))) return;
hOldPen = SelectObject ( hdc, hPen );
x = left + 2;
y = top;
@@ -569,10 +579,12 @@
TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, RECT *rcText, LPWSTR lpText,
NMTBCUSTOMDRAW *tbcd)
{
+ HDC hdc = tbcd->nmcd.hdc;
HFONT hOldFont = 0;
COLORREF clrOld = 0;
+ COLORREF clrOldBk = 0;
+ int oldBkMode = 0;
UINT state = tbcd->nmcd.uItemState;
- HDC hdc = tbcd->nmcd.hdc;
/* draw text */
if (lpText) {
@@ -593,12 +605,22 @@
else if (state & CDIS_INDETERMINATE) {
clrOld = SetTextColor (hdc, comctl32_color.clr3dShadow);
}
+ else if ((state & CDIS_MARKED) && !(infoPtr->dwItemCDFlag & TBCDRF_NOMARK)) {
+ clrOld = SetTextColor (hdc, tbcd->clrTextHighlight);
+ clrOldBk = SetBkColor (hdc, tbcd->clrMark);
+ oldBkMode = SetBkMode (hdc, OPAQUE); /* FIXME: should this be in the NMTBCUSTOMDRAW structure? */
+ }
else {
clrOld = SetTextColor (hdc, tbcd->clrText);
}
DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
SetTextColor (hdc, clrOld);
+ if ((state & CDIS_MARKED) && !(infoPtr->dwItemCDFlag & TBCDRF_NOMARK))
+ {
+ SetBkColor (hdc, clrOldBk);
+ SetBkMode (hdc, oldBkMode);
+ }
SelectObject (hdc, hOldFont);
}
}
@@ -608,12 +630,16 @@
TOOLBAR_DrawPattern (LPRECT lpRect, NMTBCUSTOMDRAW *tbcd)
{
HDC hdc = tbcd->nmcd.hdc;
- HBRUSH hbr = SelectObject (hdc, COMCTL32_hPattern55AABrush);
+ HBRUSH hbr = SelectObject (hdc, tbcd->hbrMonoDither);
+ COLORREF clrTextOld;
+ COLORREF clrBkOld;
INT cx = lpRect->right - lpRect->left;
INT cy = lpRect->bottom - lpRect->top;
- SetTextColor(hdc, tbcd->clrBtnHighlight);
- SetBkColor(hdc, tbcd->clrBtnFace);
+ clrTextOld = SetTextColor(hdc, tbcd->clrBtnHighlight);
+ clrBkOld = SetBkColor(hdc, tbcd->clrBtnFace);
PatBlt (hdc, lpRect->left, lpRect->top, cx, cy, PATCOPY);
+ SetBkColor(hdc, clrBkOld);
+ SetTextColor(hdc, clrTextOld);
SelectObject (hdc, hbr);
}
@@ -621,7 +647,9 @@
static void TOOLBAR_DrawMasked(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
HDC hdc, INT x, INT y)
{
- HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, 0);
+ int index;
+ HIMAGELIST himl =
+ TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
if (himl)
{
@@ -636,7 +664,7 @@
hbmImage = CreateBitmap(cx, cy, GetDeviceCaps(hdc,PLANES),
GetDeviceCaps(hdc,BITSPIXEL), NULL);
SelectObject(hdcImage, hbmImage);
- ImageList_DrawEx(himl, btnPtr->iBitmap, hdcImage, 0, 0, cx, cy,
+ ImageList_DrawEx(himl, index, hdcImage, 0, 0, cx, cy,
RGB(0xff, 0xff, 0xff), RGB(0,0,0), ILD_NORMAL);
/* Create Mask */
@@ -653,6 +681,7 @@
/* draw the new mask 'etched' to hdc */
SetBkColor(hdc, RGB(255, 255, 255));
SelectObject(hdc, GetSysColorBrush(COLOR_3DHILIGHT));
+ /* E20746 op code is (Dst ^ (Src & (Pat ^ Dst))) */
BitBlt(hdc, x + 1, y + 1, cx, cy, hdcMask, 0, 0, 0xE20746);
SelectObject(hdc, GetSysColorBrush(COLOR_3DSHADOW));
BitBlt(hdc, x, y, cx, cy, hdcMask, 0, 0, 0xE20746);
@@ -677,12 +706,126 @@
retstate |= (btnPtr->fsState & TBSTATE_MARKED ) ? CDIS_MARKED : 0;
retstate |= (btnPtr->bHot ) ? CDIS_HOT : 0;
retstate |= (btnPtr->fsState & TBSTATE_INDETERMINATE) ? CDIS_INDETERMINATE : 0;
- /* FIXME: don't set CDIS_GRAYED, CDIS_FOCUS, CDIS_DEFAULT */
- /* don't test TBSTATE_HIDDEN */
+ /* NOTE: we don't set CDIS_GRAYED, CDIS_FOCUS, CDIS_DEFAULT */
return retstate;
}
+/* draws the image on a toolbar button */
+static void
+TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top, const NMTBCUSTOMDRAW *tbcd)
+{
+ HIMAGELIST himl = NULL;
+ BOOL draw_masked = FALSE;
+ INT index;
+ INT offset = 0;
+ UINT draw_flags = ILD_NORMAL;
+
+ if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE))
+ {
+ himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DISABLED, &index);
+ if (!himl)
+ draw_masked = TRUE;
+ }
+ else if ((tbcd->nmcd.uItemState & CDIS_HOT) && (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & TBSTYLE_FLAT))
+ {
+ /* if hot, attempt to draw with hot image list, if fails,
+ use default image list */
+ himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_HOT, &index);
+ if (!himl)
+ himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
+ }
+ else
+ himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
+
+ if (!(infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) &&
+ (tbcd->nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED)))
+ offset = 1;
+
+ if (!(infoPtr->dwItemCDFlag & TBCDRF_NOMARK) &&
+ (tbcd->nmcd.uItemState & CDIS_MARKED))
+ draw_flags |= ILD_BLEND50;
+
+ TRACE("drawing index=%d, himl=%p, left=%d, top=%d, offset=%d\n",
+ index, himl, left, top, offset);
+
+ if (draw_masked)
+ TOOLBAR_DrawMasked (infoPtr, btnPtr, tbcd->nmcd.hdc, left + offset, top + offset);
+ else if (himl)
+ ImageList_Draw (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
+}
+
+/* draws a blank frame for a toolbar button */
+static void
+TOOLBAR_DrawFrame(const TOOLBAR_INFO *infoPtr, BOOL flat, const NMTBCUSTOMDRAW *tbcd)
+{
+ HDC hdc = tbcd->nmcd.hdc;
+ RECT rc = tbcd->nmcd.rc;
+ /* if the state is disabled or indeterminate then the button
+ * cannot have an interactive look like pressed or hot */
+ BOOL non_interactive_state = (tbcd->nmcd.uItemState & CDIS_DISABLED) ||
+ (tbcd->nmcd.uItemState & CDIS_INDETERMINATE);
+ BOOL pressed_look = !non_interactive_state &&
+ ((tbcd->nmcd.uItemState & CDIS_SELECTED) ||
+ (tbcd->nmcd.uItemState & CDIS_CHECKED));
+
+ /* app don't want us to draw any edges */
+ if (infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)
+ return;
+
+ if (flat)
+ {
+ if (pressed_look)
+ DrawEdge (hdc, &rc, BDR_SUNKENOUTER, BF_RECT);
+ else if ((tbcd->nmcd.uItemState & CDIS_HOT) && !non_interactive_state)
+ DrawEdge (hdc, &rc, BDR_RAISEDINNER, BF_RECT);
+ }
+ else
+ {
+ if (pressed_look)
+ DrawEdge (hdc, &rc, EDGE_SUNKEN, BF_RECT | BF_MIDDLE);
+ else
+ DrawEdge (hdc, &rc, EDGE_RAISED,
+ BF_SOFT | BF_RECT | BF_MIDDLE);
+ }
+}
+
+static void
+TOOLBAR_DrawSepDDArrow(const TOOLBAR_INFO *infoPtr, BOOL flat, const NMTBCUSTOMDRAW *tbcd, RECT *rcArrow)
+{
+ HDC hdc = tbcd->nmcd.hdc;
+ int offset = 0;
+
+ if (flat)
+ {
+ if ((tbcd->nmcd.uItemState & CDIS_SELECTED) || (tbcd->nmcd.uItemState & CDIS_CHECKED))
+ DrawEdge (hdc, rcArrow, BDR_SUNKENOUTER, BF_RECT);
+ else if ( (tbcd->nmcd.uItemState & CDIS_HOT) &&
+ !(tbcd->nmcd.uItemState & CDIS_DISABLED) &&
+ !(tbcd->nmcd.uItemState & CDIS_INDETERMINATE))
+ DrawEdge (hdc, rcArrow, BDR_RAISEDINNER, BF_RECT);
+ }
+ else
+ {
+ if ((tbcd->nmcd.uItemState & CDIS_SELECTED) || (tbcd->nmcd.uItemState & CDIS_CHECKED))
+ DrawEdge (hdc, rcArrow, EDGE_SUNKEN, BF_RECT | BF_MIDDLE);
+ else
+ DrawEdge (hdc, rcArrow, EDGE_RAISED,
+ BF_SOFT | BF_RECT | BF_MIDDLE);
+ }
+
+ if (tbcd->nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED))
+ offset = (infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
+
+ if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE))
+ {
+ TOOLBAR_DrawArrow(hdc, rcArrow->left+1, rcArrow->top+1 + (rcArrow->bottom - rcArrow->top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnHighlight);
+ TOOLBAR_DrawArrow(hdc, rcArrow->left, rcArrow->top + (rcArrow->bottom - rcArrow->top - ARROW_HEIGHT) / 2, comctl32_color.clr3dShadow);
+ }
+ else
+ TOOLBAR_DrawArrow(hdc, rcArrow->left + offset, rcArrow->top + offset + (rcArrow->bottom - rcArrow->top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnText);
+}
+/* draws a complete toolbar button */
static void
TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
{
@@ -692,18 +835,14 @@
(btnPtr->fsStyle & BTNS_DROPDOWN)) ||
(btnPtr->fsStyle & BTNS_WHOLEDROPDOWN);
BOOL drawSepDropDownArrow = hasDropDownArrow &&
- (~btnPtr->fsStyle & BTNS_WHOLEDROPDOWN);
- RECT rc, rcArrow, rcBitmap, rcText, rcFill;
+ (~btnPtr->fsStyle & BTNS_WHOLEDROPDOWN);
+ RECT rc, rcArrow, rcBitmap, rcText;
LPWSTR lpText = NULL;
NMTBCUSTOMDRAW tbcd;
DWORD ntfret;
INT offset;
- if (btnPtr->fsState & TBSTATE_HIDDEN)
- return;
-
rc = btnPtr->rect;
- CopyRect (&rcFill, &rc);
CopyRect (&rcArrow, &rc);
CopyRect(&rcBitmap, &rc);
@@ -714,15 +853,15 @@
{
int right;
- if (dwStyle & TBSTYLE_FLAT)
+ if (dwStyle & TBSTYLE_FLAT)
right = max(rc.left, rc.right - DDARROW_WIDTH);
- else
+ else
right = max(rc.left, rc.right - DDARROW_WIDTH - 2);
if (drawSepDropDownArrow)
rc.right = right;
- rcArrow.left = right;
+ rcArrow.left = right;
}
/* copy text rect after adjusting for drop-down arrow
@@ -732,57 +871,44 @@
/* Center the bitmap horizontally and vertically */
if (dwStyle & TBSTYLE_LIST)
- rcBitmap.left += LIST_IMAGE_OFFSET;
+ rcBitmap.left += GetSystemMetrics(SM_CXEDGE) + OFFSET_X;
else
- rcBitmap.left+=(infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2;
+ rcBitmap.left+=(infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2;
if(lpText)
- rcBitmap.top+=2; /* this looks to be the correct value from vmware comparison - cmm */
+ rcBitmap.top+= GetSystemMetrics(SM_CYEDGE) + OFFSET_Y;
else
rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2;
TRACE("iBitmap: %d, start=(%ld,%ld) w=%d, h=%d\n",
- btnPtr->iBitmap, rcBitmap.left, rcBitmap.top,
- infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
+ btnPtr->iBitmap, rcBitmap.left, rcBitmap.top,
+ infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
TRACE ("iString: %x\n", btnPtr->iString);
TRACE ("Stringtext: %s\n", debugstr_w(lpText));
/* draw text */
if (lpText) {
+ rcText.left += GetSystemMetrics(SM_CXEDGE) + OFFSET_X;
+ rcText.right -= GetSystemMetrics(SM_CXEDGE) + OFFSET_X;
+ if (GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr,btnPtr->iBitmap)) &&
+ TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap))
+ {
+ if (dwStyle & TBSTYLE_LIST)
+ rcText.left += infoPtr->nBitmapWidth + TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap);
+ else
+ rcText.top += GetSystemMetrics(SM_CYEDGE) + OFFSET_Y + infoPtr->nBitmapHeight + infoPtr->szPadding.cy/2;
+ }
+ else
+ if (dwStyle & TBSTYLE_LIST)
+ rcText.left += LIST_IMAGE_ABSENT_WIDTH + TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap);
- InflateRect (&rcText, -3, -3);
-
- if (GETDEFIMAGELIST(infoPtr, 0) &&
- TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
- /* The following test looked like this before
- * I changed it. IE4 "Links" toolbar would not
- * draw correctly with the original code. - GA 8/01
- * ((dwStyle & TBSTYLE_LIST) &&
- * ((btnPtr->fsStyle & BTNS_AUTOSIZE) == 0) &&
- * (btnPtr->iBitmap != I_IMAGENONE))
- */
- if (dwStyle & TBSTYLE_LIST) {
- /* LIST style w/ ICON offset is by matching native. */
- /* Matches IE4 "Links" bar. - GA 8/01 */
- rcText.left += (infoPtr->nBitmapWidth + LIST_TEXT_OFFSET);
- }
- else {
- rcText.top += infoPtr->nBitmapHeight + 1;
- }
- }
- else {
- if (dwStyle & TBSTYLE_LIST) {
- /* LIST style w/o ICON offset is by matching native. */
- /* Matches IE4 "menu" bar. - GA 8/01 */
- rcText.left += LIST_IMAGE_ABSENT_WIDTH + LIST_TEXT_OFFSET;
- }
- }
-
- if (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED))
- OffsetRect (&rcText, 1, 1);
+ if (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED))
+ OffsetRect (&rcText, 1, 1);
}
- /* Initialize fields in all cases, because we use these later */
+ /* Initialize fields in all cases, because we use these later
+ * NOTE: applications can and do alter these to customize their
+ * toolbars */
ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
tbcd.clrText = comctl32_color.clrBtnText;
tbcd.clrTextHighlight = comctl32_color.clrHighlightText;
@@ -792,23 +918,21 @@
tbcd.clrHighlightHotTrack = 0;
tbcd.nStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE;
tbcd.nHLStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE;
- /* MSDN says that this is the text rectangle. */
- /* But (why always a but) tracing of v5.7 of native shows */
- /* that this is really a *relative* rectangle based on the */
- /* the nmcd.rc. Also the left and top are always 0 ignoring*/
- /* any bitmap that might be present. */
+ /* MSDN says that this is the text rectangle.
+ * But (why always a but) tracing of v5.7 of native shows
+ * that this is really a *relative* rectangle based on the
+ * the nmcd.rc. Also the left and top are always 0 ignoring
+ * any bitmap that might be present. */
tbcd.rcText.left = 0;
tbcd.rcText.top = 0;
tbcd.rcText.right = rcText.right - rc.left;
tbcd.rcText.bottom = rcText.bottom - rc.top;
- /* we use this state later on to decide how to draw the buttons */
- /* NOTE: applications can and do alter this to customize their */
- /* toolbars */
tbcd.nmcd.uItemState = TOOLBAR_TranslateState(btnPtr);
tbcd.nmcd.hdc = hdc;
+ tbcd.nmcd.rc = rc;
tbcd.hbrMonoDither = COMCTL32_hPattern55AABrush;
- /* FIXME: what should these be set to ????? */
+ /* FIXME: what are these used for? */
tbcd.hbrLines = 0;
tbcd.hpenLines = 0;
@@ -818,10 +942,13 @@
if (infoPtr->dwBaseCustDraw & CDRF_NOTIFYITEMDRAW)
{
tbcd.nmcd.dwDrawStage = CDDS_ITEMPREPAINT;
- tbcd.nmcd.rc = rc;
tbcd.nmcd.dwItemSpec = btnPtr->idCommand;
tbcd.nmcd.lItemlParam = btnPtr->dwData;
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
+ /* reset these fields so the user can't alter the behaviour like native */
+ tbcd.nmcd.hdc = hdc;
+ tbcd.nmcd.rc = rc;
+
infoPtr->dwItemCustDraw = ntfret & 0xffff;
infoPtr->dwItemCDFlag = ntfret & 0xffff0000;
if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT)
@@ -831,9 +958,6 @@
rcText.bottom = tbcd.rcText.bottom + rc.top;
}
- if (!infoPtr->bBtnTranspnt)
- FillRect( hdc, &rcFill, GetSysColorBrush(COLOR_BTNFACE));
-
/* separator */
if (btnPtr->fsStyle & BTNS_SEP) {
/* with the FLAT style, iBitmap is the width and has already */
@@ -854,10 +978,14 @@
goto FINALNOTIFY;
}
+ if (!(tbcd.nmcd.uItemState & CDIS_HOT) &&
+ ((tbcd.nmcd.uItemState & CDIS_CHECKED) || (tbcd.nmcd.uItemState & CDIS_INDETERMINATE)))
+ TOOLBAR_DrawPattern (&rc, &tbcd);
+
if ((dwStyle & TBSTYLE_FLAT) && (tbcd.nmcd.uItemState & CDIS_HOT))
{
- if ( infoPtr->dwItemCDFlag & TBCDRF_HILITEHOTTRACK )
- {
+ if ( infoPtr->dwItemCDFlag & TBCDRF_HILITEHOTTRACK )
+ {
COLORREF oldclr;
oldclr = SetBkColor(hdc, tbcd.clrHighlightHotTrack);
@@ -865,159 +993,36 @@
if (hasDropDownArrow)
ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0);
SetBkColor(hdc, oldclr);
- }
- else
- {
- if (!(tbcd.nmcd.uItemState & CDIS_DISABLED) && !(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
- {
- DrawEdge (hdc, &rc, BDR_RAISEDINNER, BF_RECT);
- if (hasDropDownArrow)
- DrawEdge (hdc, &rcArrow, BDR_RAISEDINNER, BF_RECT);
- }
}
}
- /* disabled */
- if (tbcd.nmcd.uItemState & CDIS_DISABLED) {
- if (!(dwStyle & TBSTYLE_FLAT) && !(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
- {
- DrawEdge (hdc, &rc, EDGE_RAISED,
- BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
- if (drawSepDropDownArrow)
- DrawEdge (hdc, &rcArrow, EDGE_RAISED,
- BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
- }
-
- if (hasDropDownArrow)
- {
- TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1 + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_3DHIGHLIGHT);
- TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_3DSHADOW);
- }
-
- if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DISABLED,
- hdc, rcBitmap.left, rcBitmap.top,
- ILD_NORMAL))
- TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
-
- if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
- TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
- goto FINALNOTIFY;
- }
-
- /* pressed BTNS_BUTTON */
- if (tbcd.nmcd.uItemState & CDIS_SELECTED) {
- offset = (infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
- if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
- {
- if (dwStyle & TBSTYLE_FLAT)
- {
- DrawEdge (hdc, &rc, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);
- if (drawSepDropDownArrow)
- DrawEdge (hdc, &rcArrow, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);
- }
- else
- {
- DrawEdge (hdc, &rc, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST);
- if (drawSepDropDownArrow)
- DrawEdge (hdc, &rcArrow, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST);
- }
- }
-
- if (hasDropDownArrow)
- TOOLBAR_DrawArrow(hdc, rcArrow.left + offset, rcArrow.top + offset + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
-
- TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
- hdc, rcBitmap.left+offset, rcBitmap.top+offset,
- ILD_NORMAL);
-
- if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
- TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
- goto FINALNOTIFY;
- }
-
- /* checked BTNS_CHECK */
- if ((tbcd.nmcd.uItemState & CDIS_CHECKED) &&
- (btnPtr->fsStyle & BTNS_CHECK)) {
- if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
- {
- if (dwStyle & TBSTYLE_FLAT)
- DrawEdge (hdc, &rc, BDR_SUNKENOUTER,
- BF_RECT | BF_ADJUST);
- else
- DrawEdge (hdc, &rc, EDGE_SUNKEN,
- BF_RECT | BF_MIDDLE | BF_ADJUST);
- }
+ TOOLBAR_DrawFrame(infoPtr, dwStyle & TBSTYLE_FLAT, &tbcd);
- TOOLBAR_DrawPattern (&rc, &tbcd);
+ if (drawSepDropDownArrow)
+ TOOLBAR_DrawSepDDArrow(infoPtr, dwStyle & TBSTYLE_FLAT, &tbcd, &rcArrow);
- TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
- hdc, rcBitmap.left+1, rcBitmap.top+1,
- ILD_NORMAL);
-
- if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
- TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
- goto FINALNOTIFY;
- }
-
- /* indeterminate */
- if (tbcd.nmcd.uItemState & CDIS_INDETERMINATE) {
- if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
- DrawEdge (hdc, &rc, EDGE_RAISED,
- BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
-
- TOOLBAR_DrawPattern (&rc, &tbcd);
- TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
- if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
- TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
- goto FINALNOTIFY;
- }
+ if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
+ TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
- /* normal state */
- if (dwStyle & TBSTYLE_FLAT)
- {
- if (hasDropDownArrow)
- TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
+ TOOLBAR_DrawImage(infoPtr, btnPtr, rcBitmap.left, rcBitmap.top, &tbcd);
- if (tbcd.nmcd.uItemState & CDIS_HOT) {
- /* if hot, attempt to draw with hot image list, if fails,
- use default image list */
- if (!TOOLBAR_DrawImageList (infoPtr, btnPtr,
- IMAGE_LIST_HOT,
- hdc, rcBitmap.left,
- rcBitmap.top, ILD_NORMAL))
- TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
- hdc, rcBitmap.left, rcBitmap.top,
- ILD_NORMAL);
- }
- else
- TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
- hdc, rcBitmap.left, rcBitmap.top,
- ILD_NORMAL);
- }
- else
+ if (hasDropDownArrow && !drawSepDropDownArrow)
{
- if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
- DrawEdge (hdc, &rc, EDGE_RAISED,
- BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
-
- if (hasDropDownArrow)
- {
- if (drawSepDropDownArrow && !(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
- DrawEdge (hdc, &rcArrow, EDGE_RAISED,
- BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
- TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
- }
-
- TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
- hdc, rcBitmap.left, rcBitmap.top,
- ILD_NORMAL);
+ if (tbcd.nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE))
+ {
+ TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1 + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnHighlight);
+ TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clr3dShadow);
+ }
+ else if (tbcd.nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED))
+ {
+ offset = (infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
+ TOOLBAR_DrawArrow(hdc, rcArrow.left + offset, rcArrow.top + offset + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnText);
+ }
+ else
+ TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnText);
}
-
- if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
- TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
-
- FINALNOTIFY:
+FINALNOTIFY:
if (infoPtr->dwItemCustDraw & CDRF_NOTIFYPOSTPAINT)
{
tbcd.nmcd.dwDrawStage = CDDS_ITEMPOSTPAINT;
@@ -1045,6 +1050,10 @@
NMTBCUSTOMDRAW tbcd;
DWORD ntfret;
+ /* the app has told us not to redraw the toolbar */
+ if (!infoPtr->bDoRedraw)
+ return;
+
/* if imagelist belongs to the app, it can be changed
by the app after setting it */
if (GETDEFIMAGELIST(infoPtr, 0) != infoPtr->himlInt)
@@ -1082,6 +1091,7 @@
else
bDraw = TRUE;
bDraw &= IntersectRect(&rcTemp, &(ps->rcPaint), &(btnPtr->rect));
+ bDraw = (btnPtr->fsState & TBSTATE_HIDDEN) ? FALSE : bDraw;
if (bDraw)
TOOLBAR_DrawButton (hwnd, btnPtr, hdc);
}
@@ -1397,6 +1407,8 @@
TOOLBAR_CalcStrings (hwnd, &sizeString);
+ TOOLBAR_DumpToolbar (infoPtr, __LINE__);
+
for (i = 0; i < infoPtr->nNumButtons && !usesBitmaps; i++)
{
if (TOOLBAR_IsValidBitmapIndex(infoPtr,infoPtr->buttons[i].iBitmap))
@@ -1407,29 +1419,30 @@
infoPtr->nButtonHeight = max((usesBitmaps) ? infoPtr->nBitmapHeight :
0, sizeString.cy) + infoPtr->szPadding.cy;
infoPtr->nButtonWidth = ((usesBitmaps) ? infoPtr->nBitmapWidth :
- 0) + sizeString.cx + 6;
+ LIST_IMAGE_ABSENT_WIDTH) + sizeString.cx + infoPtr->szPadding.cx;
+ if (sizeString.cx > 0)
+ infoPtr->nButtonWidth += TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap) + infoPtr->szPadding.cx/2;
TRACE("LIST style, But w=%d h=%d, useBitmaps=%d, Bit w=%d h=%d\n",
infoPtr->nButtonWidth, infoPtr->nButtonHeight, usesBitmaps,
infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
- TOOLBAR_DumpToolbar (infoPtr, __LINE__);
}
else {
if (sizeString.cy > 0)
{
if (usesBitmaps)
infoPtr->nButtonHeight = sizeString.cy +
- 2 + /* this is the space to separate text from bitmap */
- infoPtr->nBitmapHeight + 6;
+ infoPtr->szPadding.cy/2 + /* this is the space to separate text from bitmap */
+ infoPtr->nBitmapHeight + infoPtr->szPadding.cy;
else
- infoPtr->nButtonHeight = sizeString.cy + 6;
+ infoPtr->nButtonHeight = sizeString.cy + infoPtr->szPadding.cy;
}
else
- infoPtr->nButtonHeight = infoPtr->nBitmapHeight + 6;
+ infoPtr->nButtonHeight = infoPtr->nBitmapHeight + infoPtr->szPadding.cy;
if (sizeString.cx > infoPtr->nBitmapWidth)
- infoPtr->nButtonWidth = sizeString.cx + 6;
+ infoPtr->nButtonWidth = sizeString.cx + infoPtr->szPadding.cx;
else
- infoPtr->nButtonWidth = infoPtr->nBitmapWidth + 6;
+ infoPtr->nButtonWidth = infoPtr->nBitmapWidth + infoPtr->szPadding.cx;
}
if ( infoPtr->cxMin >= 0 && infoPtr->nButtonWidth < infoPtr->cxMin )
@@ -1442,17 +1455,6 @@
x = infoPtr->nIndent;
y = 0;
- /*
- * We will set the height below, and we set the width on entry
- * so we do not reset them here..
- */
-#if 0
- GetClientRect( hwnd, &rc );
- /* get initial values for toolbar */
- infoPtr->nWidth = rc.right - rc.left;
- infoPtr->nHeight = rc.bottom - rc.top;
-#endif
-
/* from above, minimum is a button, and possible text */
cx = infoPtr->nButtonWidth;
@@ -1471,12 +1473,6 @@
btnPtr = infoPtr->buttons;
- /* do not base height/width on parent, if the parent is a */
- /* rebar control it could have multiple rows of toolbars */
-/* GetClientRect( GetParent(hwnd), &rc ); */
-/* cx = rc.right - rc.left; */
-/* cy = rc.bottom - rc.top; */
-
TRACE("cy=%d\n", cy);
for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++ )
@@ -1505,7 +1501,9 @@
}
else
{
- if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
+ if (btnPtr->cx)
+ cx = btnPtr->cx;
+ else if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
(btnPtr->fsStyle & BTNS_AUTOSIZE))
{
SIZE sz;
@@ -1520,15 +1518,19 @@
SelectObject (hdc, hOldFont);
ReleaseDC (hwnd, hdc);
- if (sz.cx > 0)
- sz.cx += 2*LIST_TEXT_OFFSET;
- cx = sz.cx + 2*LIST_IMAGE_OFFSET;
+ /* add space on for button frame, etc */
+ cx = sz.cx + infoPtr->szPadding.cx;
+
+ /* add list padding */
+ if ((dwStyle & TBSTYLE_LIST) && sz.cx > 0)
+ cx += TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap) + infoPtr->szPadding.cx/2;
+
if (TOOLBAR_TestImageExist (infoPtr, btnPtr, GETDEFIMAGELIST(infoPtr,0)))
{
if (dwStyle & TBSTYLE_LIST)
cx += infoPtr->nBitmapWidth;
- else if (cx < (infoPtr->nBitmapWidth+7))
- cx = infoPtr->nBitmapWidth+7;
+ else if (cx < (infoPtr->nBitmapWidth+infoPtr->szPadding.cx))
+ cx = infoPtr->nBitmapWidth+infoPtr->szPadding.cx;
}
else if (dwStyle & TBSTYLE_LIST)
cx += LIST_IMAGE_ABSENT_WIDTH;
@@ -1536,7 +1538,10 @@
else
[truncated at 1000 lines; 1443 more skipped]
reactos/lib/comctl32
diff -u -r1.4 -r1.5
--- tooltips.c 11 Mar 2004 11:13:28 -0000 1.4
+++ tooltips.c 15 Apr 2004 08:29:57 -0000 1.5
@@ -18,8 +18,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* TODO:
- * - Unicode support (started).
* - Custom draw support.
+ * - Balloon tips.
+ * - Messages.
*
* Testing:
* - Run tests using Waite Group Windows95 API Bible Volume 2.
@@ -90,6 +91,7 @@
{
UINT uFlags;
HWND hwnd;
+ BOOL bNotifyUnicode;
UINT uId;
RECT rect;
HINSTANCE hinst;
@@ -110,14 +112,13 @@
INT xTrackPos;
INT yTrackPos;
INT nMaxTipWidth;
- INT nTool;
+ INT nTool; /* tool that mouse was on on last relayed mouse move */
INT nCurrentTool;
INT nTrackTool;
INT nReshowTime;
INT nAutoPopTime;
INT nInitialTime;
RECT rcMargin;
- BOOL bNotifyUnicode;
TTTOOL_INFO *tools;
} TOOLTIPS_INFO;
@@ -171,6 +172,100 @@
SetBkMode (hdc, oldBkMode);
}
+static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr)
+{
+ NMTTDISPINFOA ttnmdi;
+
+ /* fill NMHDR struct */
+ ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOA));
+ ttnmdi.hdr.hwndFrom = hwnd;
+ ttnmdi.hdr.idFrom = toolPtr->uId;
+ ttnmdi.hdr.code = TTN_GETDISPINFOA;
+ ttnmdi.lpszText = (LPSTR)&ttnmdi.szText;
+ ttnmdi.uFlags = toolPtr->uFlags;
+ ttnmdi.lParam = toolPtr->lParam;
+
+ TRACE("hdr.idFrom = %x\n", ttnmdi.hdr.idFrom);
+ SendMessageA(toolPtr->hwnd, WM_NOTIFY,
+ (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi);
+
+ if (HIWORD((UINT)ttnmdi.lpszText) == 0) {
+ LoadStringW(ttnmdi.hinst, (UINT)ttnmdi.lpszText,
+ infoPtr->szTipText, INFOTIPSIZE);
+ if (ttnmdi.uFlags & TTF_DI_SETITEM) {
+ toolPtr->hinst = ttnmdi.hinst;
+ toolPtr->lpszText = (LPWSTR)ttnmdi.lpszText;
+ }
+ }
+ else if (ttnmdi.lpszText == 0) {
+ /* no text available */
+ infoPtr->szTipText[0] = '\0';
+ }
+ else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) {
+ INT max_len = (ttnmdi.lpszText == &ttnmdi.szText[0]) ?
+ sizeof(ttnmdi.szText)/sizeof(ttnmdi.szText[0]) : -1;
+ MultiByteToWideChar(CP_ACP, 0, ttnmdi.lpszText, max_len,
+ infoPtr->szTipText, INFOTIPSIZE);
+ if (ttnmdi.uFlags & TTF_DI_SETITEM) {
+ INT len = MultiByteToWideChar(CP_ACP, 0, ttnmdi.lpszText,
+ max_len, NULL, 0);
+ toolPtr->hinst = 0;
+ toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, ttnmdi.lpszText, -1,
+ toolPtr->lpszText, len);
+ }
+ }
+ else {
+ ERR("recursive text callback!\n");
+ infoPtr->szTipText[0] = '\0';
+ }
+}
+
+static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr)
+{
+ NMTTDISPINFOW ttnmdi;
+
+ /* fill NMHDR struct */
+ ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOW));
+ ttnmdi.hdr.hwndFrom = hwnd;
+ ttnmdi.hdr.idFrom = toolPtr->uId;
+ ttnmdi.hdr.code = TTN_GETDISPINFOW;
+ ttnmdi.lpszText = (LPWSTR)&ttnmdi.szText;
+ ttnmdi.uFlags = toolPtr->uFlags;
+ ttnmdi.lParam = toolPtr->lParam;
+
+ TRACE("hdr.idFrom = %x\n", ttnmdi.hdr.idFrom);
+ SendMessageW(toolPtr->hwnd, WM_NOTIFY,
+ (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi);
+
+ if (HIWORD((UINT)ttnmdi.lpszText) == 0) {
+ LoadStringW(ttnmdi.hinst, (UINT)ttnmdi.lpszText,
+ infoPtr->szTipText, INFOTIPSIZE);
+ if (ttnmdi.uFlags & TTF_DI_SETITEM) {
+ toolPtr->hinst = ttnmdi.hinst;
+ toolPtr->lpszText = ttnmdi.lpszText;
+ }
+ }
+ else if (ttnmdi.lpszText == 0) {
+ /* no text available */
+ infoPtr->szTipText[0] = '\0';
+ }
+ else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) {
+ INT max_len = (ttnmdi.lpszText == &ttnmdi.szText[0]) ?
+ sizeof(ttnmdi.szText)/sizeof(ttnmdi.szText[0]) : INFOTIPSIZE-1;
+ strncpyW(infoPtr->szTipText, ttnmdi.lpszText, max_len);
+ if (ttnmdi.uFlags & TTF_DI_SETITEM) {
+ INT len = max(strlenW(ttnmdi.lpszText), max_len);
+ toolPtr->hinst = 0;
+ toolPtr->lpszText = Alloc ((len+1) * sizeof(WCHAR));
+ memcpy(toolPtr->lpszText, ttnmdi.lpszText, (len+1) * sizeof(WCHAR));
+ }
+ }
+ else {
+ ERR("recursive text callback!\n");
+ infoPtr->szTipText[0] = '\0';
+ }
+}
static VOID
TOOLTIPS_GetTipText (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool)
@@ -186,61 +281,10 @@
}
else if (toolPtr->lpszText) {
if (toolPtr->lpszText == LPSTR_TEXTCALLBACKW) {
- NMTTDISPINFOA ttnmdi;
-
- /* fill NMHDR struct */
- ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOA));
- ttnmdi.hdr.hwndFrom = hwnd;
- ttnmdi.hdr.idFrom = toolPtr->uId;
- ttnmdi.hdr.code = TTN_GETDISPINFOA;
- ttnmdi.lpszText = (LPSTR)&ttnmdi.szText;
- ttnmdi.uFlags = toolPtr->uFlags;
- ttnmdi.lParam = toolPtr->lParam;
-
- TRACE("hdr.idFrom = %x\n", ttnmdi.hdr.idFrom);
- SendMessageA (toolPtr->hwnd, WM_NOTIFY,
- (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi);
-
- if (HIWORD((UINT)ttnmdi.lpszText) == 0) {
- LoadStringW (ttnmdi.hinst, (UINT)ttnmdi.lpszText,
- infoPtr->szTipText, INFOTIPSIZE);
- if (ttnmdi.uFlags & TTF_DI_SETITEM) {
- toolPtr->hinst = ttnmdi.hinst;
- toolPtr->lpszText = (LPWSTR)ttnmdi.lpszText;
- }
- }
- else if (ttnmdi.szText[0]) {
- MultiByteToWideChar(CP_ACP, 0, ttnmdi.szText, 80,
- infoPtr->szTipText, INFOTIPSIZE);
- if (ttnmdi.uFlags & TTF_DI_SETITEM) {
- INT len = MultiByteToWideChar(CP_ACP, 0, ttnmdi.szText,
- 80, NULL, 0);
- toolPtr->hinst = 0;
- toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, ttnmdi.szText, 80,
- toolPtr->lpszText, len);
- }
- }
- else if (ttnmdi.lpszText == 0) {
- /* no text available */
- infoPtr->szTipText[0] = L'\0';
- }
- else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) {
- MultiByteToWideChar(CP_ACP, 0, ttnmdi.lpszText, -1,
- infoPtr->szTipText, INFOTIPSIZE);
- if (ttnmdi.uFlags & TTF_DI_SETITEM) {
- INT len = MultiByteToWideChar(CP_ACP, 0, ttnmdi.lpszText,
- -1, NULL, 0);
- toolPtr->hinst = 0;
- toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, ttnmdi.lpszText, -1,
- toolPtr->lpszText, len);
- }
- }
- else {
- ERR("recursive text callback!\n");
- infoPtr->szTipText[0] = '\0';
- }
+ if (toolPtr->bNotifyUnicode)
+ TOOLTIPS_GetDispInfoW(hwnd, infoPtr, toolPtr);
+ else
+ TOOLTIPS_GetDispInfoA(hwnd, infoPtr, toolPtr);
}
else {
/* the item is a usual (unicode) text */
@@ -502,11 +546,12 @@
TTTOOL_INFO *toolPtr;
NMHDR hdr;
+ TRACE("hide tracking tooltip %d\n", infoPtr->nTrackTool);
+
if (infoPtr->nTrackTool == -1)
return;
toolPtr = &infoPtr->tools[infoPtr->nTrackTool];
- TRACE("hide tracking tooltip %d!\n", infoPtr->nTrackTool);
hdr.hwndFrom = hwnd;
hdr.idFrom = toolPtr->uId;
@@ -668,6 +713,7 @@
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
TTTOOL_INFO *toolPtr;
+ INT nResult;
if (lpToolInfo == NULL)
return FALSE;
@@ -736,6 +782,18 @@
TRACE("subclassing installed!\n");
}
+ nResult = (INT) SendMessageA (toolPtr->hwnd, WM_NOTIFYFORMAT,
+ (WPARAM)hwnd, (LPARAM)NF_QUERY);
+ if (nResult == NFR_ANSI) {
+ toolPtr->bNotifyUnicode = FALSE;
+ TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
+ } else if (nResult == NFR_UNICODE) {
+ toolPtr->bNotifyUnicode = TRUE;
+ TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
+ } else {
+ TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
+ }
+
return TRUE;
}
@@ -746,6 +804,7 @@
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
TTTOOL_INFO *toolPtr;
+ INT nResult;
if (lpToolInfo == NULL)
return FALSE;
@@ -813,30 +872,31 @@
TRACE("subclassing installed!\n");
}
+ nResult = (INT) SendMessageA (toolPtr->hwnd, WM_NOTIFYFORMAT,
+ (WPARAM)hwnd, (LPARAM)NF_QUERY);
+ if (nResult == NFR_ANSI) {
+ toolPtr->bNotifyUnicode = FALSE;
+ TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
+ } else if (nResult == NFR_UNICODE) {
+ toolPtr->bNotifyUnicode = TRUE;
+ TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
+ } else {
+ TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
+ }
+
return TRUE;
}
-static LRESULT
-TOOLTIPS_DelToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+static void TOOLTIPS_DelToolCommon (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool)
{
- TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
- LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
TTTOOL_INFO *toolPtr;
- INT nTool;
-
- if (lpToolInfo == NULL)
- return 0;
- if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
- return 0;
- if (infoPtr->uNumTools == 0)
- return 0;
-
- nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
- if (nTool == -1) return 0;
TRACE("tool %d\n", nTool);
+ if (nTool == -1)
+ return;
+
/* make sure the tooltip has disappeared before deleting it */
TOOLTIPS_Hide(hwnd, infoPtr);
@@ -879,14 +939,47 @@
Free (oldTools);
}
+ /* update any indices affected by delete */
+
/* destroying tool that mouse was on on last relayed mouse move */
if (infoPtr->nTool == nTool)
- {
- /* no current tool (0 means first tool) */
+ /* -1 means no current tool (0 means first tool) */
infoPtr->nTool = -1;
- }
+ else if (infoPtr->nTool > nTool)
+ infoPtr->nTool--;
+
+ if (infoPtr->nTrackTool == nTool)
+ /* -1 means no current tool (0 means first tool) */
+ infoPtr->nTrackTool = -1;
+ else if (infoPtr->nTrackTool > nTool)
+ infoPtr->nTrackTool--;
+
+ if (infoPtr->nCurrentTool == nTool)
+ /* -1 means no current tool (0 means first tool) */
+ infoPtr->nCurrentTool = -1;
+ else if (infoPtr->nCurrentTool > nTool)
+ infoPtr->nCurrentTool--;
infoPtr->uNumTools--;
+}
+
+static LRESULT
+TOOLTIPS_DelToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+ TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
+ LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
+ INT nTool;
+
+ if (lpToolInfo == NULL)
+ return 0;
+ if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
+ return 0;
+ if (infoPtr->uNumTools == 0)
+ return 0;
+
+ nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
+
+ TOOLTIPS_DelToolCommon (hwnd, infoPtr, nTool);
return 0;
}
@@ -897,7 +990,6 @@
{
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
- TTTOOL_INFO *toolPtr;
INT nTool;
if (lpToolInfo == NULL)
@@ -908,60 +1000,8 @@
return 0;
nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo);
- if (nTool == -1) return 0;
-
- TRACE("tool %d\n", nTool);
-
- /* make sure the tooltip has disappeared before deleting it */
- TOOLTIPS_Hide(hwnd, infoPtr);
-
- /* delete text string */
- toolPtr = &infoPtr->tools[nTool];
- if (toolPtr->lpszText) {
- if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
- (HIWORD((INT)toolPtr->lpszText) != 0) )
- Free (toolPtr->lpszText);
- }
-
- /* remove subclassing */
- if (toolPtr->uFlags & TTF_SUBCLASS) {
- if (toolPtr->uFlags & TTF_IDISHWND) {
- RemoveWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1);
- }
- else {
- RemoveWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1);
- }
- }
-
- /* delete tool from tool list */
- if (infoPtr->uNumTools == 1) {
- Free (infoPtr->tools);
- infoPtr->tools = NULL;
- }
- else {
- TTTOOL_INFO *oldTools = infoPtr->tools;
- infoPtr->tools =
- Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools - 1));
- if (nTool > 0)
- memcpy (&infoPtr->tools[0], &oldTools[0],
- nTool * sizeof(TTTOOL_INFO));
-
- if (nTool < infoPtr->uNumTools - 1)
- memcpy (&infoPtr->tools[nTool], &oldTools[nTool + 1],
- (infoPtr->uNumTools - nTool - 1) * sizeof(TTTOOL_INFO));
-
- Free (oldTools);
- }
-
- /* destroying tool that mouse was on on last relayed mouse move */
- if (infoPtr->nTool == nTool)
- {
- /* no current tool (0 means first tool) */
- infoPtr->nTool = -1;
- }
-
- infoPtr->uNumTools--;
+ TOOLTIPS_DelToolCommon (hwnd, infoPtr, nTool);
return 0;
}
@@ -1413,6 +1453,9 @@
return FALSE;
nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpti);
+
+ TRACE("nTool = %d, rect = %s\n", nTool, wine_dbgstr_rect(&lpti->rect));
+
if (nTool == -1) return 0;
infoPtr->tools[nTool].rect = lpti->rect;
@@ -1434,6 +1477,9 @@
return FALSE;
nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpti);
+
+ TRACE("nTool = %d, rect = %s\n", nTool, wine_dbgstr_rect(&lpti->rect));
+
if (nTool == -1) return 0;
infoPtr->tools[nTool].rect = lpti->rect;
@@ -1721,14 +1767,15 @@
TOOLTIPS_TrackActivate (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
- LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
-
- if (lpToolInfo == NULL)
- return 0;
- if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
- return FALSE;
if ((BOOL)wParam) {
+ LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
+
+ if (lpToolInfo == NULL)
+ return 0;
+ if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
+ return FALSE;
+
/* activate */
infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
if (infoPtr->nTrackTool != -1) {
@@ -1906,7 +1953,6 @@
{
TOOLTIPS_INFO *infoPtr;
NONCLIENTMETRICSA nclm;
- INT nResult;
/* allocate memory for info structure */
infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO));
@@ -1929,18 +1975,6 @@
TOOLTIPS_SetDelayTime(hwnd, TTDT_AUTOMATIC, 0L);
- nResult = (INT) SendMessageA (lpcs->hwndParent, WM_NOTIFYFORMAT,
- (WPARAM)hwnd, (LPARAM)NF_QUERY);
- if (nResult == NFR_ANSI) {
- infoPtr->bNotifyUnicode = FALSE;
- TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
- } else if (nResult == NFR_UNICODE) {
- infoPtr->bNotifyUnicode = TRUE;
- TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
- } else {
- TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
- }
-
SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
return 0;
reactos/lib/comctl32
diff -u -r1.3 -r1.4
--- updown.c 19 Dec 2003 16:41:02 -0000 1.3
+++ updown.c 15 Apr 2004 08:29:57 -0000 1.4
@@ -442,98 +442,109 @@
/***********************************************************************
* UPDOWN_SetBuddy
- * Tests if 'bud' is a valid window handle. If not, returns FALSE.
- * Else, sets it as a new Buddy.
+ *
+ * Sets bud as a new Buddy.
* Then, it should subclass the buddy
* If window has the UDS_ARROWKEYS, it subcalsses the buddy window to
* process the UP/DOWN arrow keys.
* If window has the UDS_ALIGNLEFT or UDS_ALIGNRIGHT style
* the size/pos of the buddy and the control are adjusted accordingly.
*/
-static BOOL UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
+static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
{
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
RECT budRect; /* new coord for the buddy */
int x, width; /* new x position and width for the up-down */
WNDPROC baseWndProc;
CHAR buddyClass[40];
-
- /* Is it a valid bud? */
- if(!IsWindow(bud)) return FALSE;
+ HWND ret;
TRACE("(hwnd=%p, bud=%p)\n", infoPtr->Self, bud);
+ ret = infoPtr->Buddy;
+
/* there is already a body assigned */
if (infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
+ if(!IsWindow(bud))
+ bud = 0;
+
/* Store buddy window handle */
infoPtr->Buddy = bud;
- /* keep upDown ctrl hwnd in a buddy property */
- SetPropA( bud, BUDDY_UPDOWN_HWND, infoPtr->Self);
+ if(bud) {
- /* Store buddy window class type */
- infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN;
- if (GetClassNameA(bud, buddyClass, COUNT_OF(buddyClass))) {
- if (lstrcmpiA(buddyClass, "Edit") == 0)
- infoPtr->BuddyType = BUDDY_TYPE_EDIT;
- else if (lstrcmpiA(buddyClass, "Listbox") == 0)
- infoPtr->BuddyType = BUDDY_TYPE_LISTBOX;
- }
+ /* keep upDown ctrl hwnd in a buddy property */
+ SetPropA( bud, BUDDY_UPDOWN_HWND, infoPtr->Self);
- if(dwStyle & UDS_ARROWKEYS){
- /* 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
- good to break the window proc chain. */
- if (!GetPropA(bud, BUDDY_SUPERCLASS_WNDPROC)) {
- baseWndProc = (WNDPROC)SetWindowLongW(bud, GWL_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc);
- SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc);
- }
- }
+ /* Store buddy window class type */
+ infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN;
+ if (GetClassNameA(bud, buddyClass, COUNT_OF(buddyClass))) {
+ if (lstrcmpiA(buddyClass, "Edit") == 0)
+ infoPtr->BuddyType = BUDDY_TYPE_EDIT;
+ else if (lstrcmpiA(buddyClass, "Listbox") == 0)
+ infoPtr->BuddyType = BUDDY_TYPE_LISTBOX;
+ }
- /* Get the rect of the buddy relative to its parent */
- GetWindowRect(infoPtr->Buddy, &budRect);
- MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Buddy), (POINT *)(&budRect.left), 2);
-
- /* now do the positioning */
- if (dwStyle & UDS_ALIGNLEFT) {
- x = budRect.left;
- budRect.left += DEFAULT_WIDTH + DEFAULT_XSEP;
- } else if (dwStyle & UDS_ALIGNRIGHT) {
- budRect.right -= DEFAULT_WIDTH + DEFAULT_XSEP;
- x = budRect.right+DEFAULT_XSEP;
- } else {
- x = budRect.right+DEFAULT_XSEP;
- }
+ if(dwStyle & UDS_ARROWKEYS){
+ /* 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
+ good to break the window proc chain. */
+ if (!GetPropA(bud, BUDDY_SUPERCLASS_WNDPROC)) {
+ baseWndProc = (WNDPROC)SetWindowLongW(bud, GWL_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc);
+ SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc);
+ }
+ }
- /* first adjust the buddy to accomodate the up/down */
- SetWindowPos(infoPtr->Buddy, 0, budRect.left, budRect.top,
- budRect.right - budRect.left, budRect.bottom - budRect.top,
- SWP_NOACTIVATE|SWP_NOZORDER);
-
- /* now position the up/down */
- /* Since the UDS_ALIGN* flags were used, */
- /* we will pick the position and size of the window. */
- width = DEFAULT_WIDTH;
-
- /*
- * If the updown has a buddy border, it has to overlap with the buddy
- * to look as if it is integrated with the buddy control.
- * We nudge the control or change it size to overlap.
- */
- if (UPDOWN_HasBuddyBorder(infoPtr)) {
- if(dwStyle & UDS_ALIGNLEFT)
- width += DEFAULT_BUDDYBORDER;
- else
- x -= DEFAULT_BUDDYBORDER;
- }
+ /* Get the rect of the buddy relative to its parent */
+ GetWindowRect(infoPtr->Buddy, &budRect);
+ MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Buddy), (POINT *)(&budRect.left), 2);
+
+ /* now do the positioning */
+ if (dwStyle & UDS_ALIGNLEFT) {
+ x = budRect.left;
+ budRect.left += DEFAULT_WIDTH + DEFAULT_XSEP;
+ } else if (dwStyle & UDS_ALIGNRIGHT) {
+ budRect.right -= DEFAULT_WIDTH + DEFAULT_XSEP;
+ x = budRect.right+DEFAULT_XSEP;
+ } else {
+ x = budRect.right+DEFAULT_XSEP;
+ }
- SetWindowPos(infoPtr->Self, infoPtr->Buddy, x,
- budRect.top - DEFAULT_ADDTOP, width,
- budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT,
- SWP_NOACTIVATE);
+ /* first adjust the buddy to accomodate the up/down */
+ SetWindowPos(infoPtr->Buddy, 0, budRect.left, budRect.top,
+ budRect.right - budRect.left, budRect.bottom - budRect.top,
+ SWP_NOACTIVATE|SWP_NOZORDER);
+
+ /* now position the up/down */
+ /* Since the UDS_ALIGN* flags were used, */
+ /* we will pick the position and size of the window. */
+ width = DEFAULT_WIDTH;
+
+ /*
+ * If the updown has a buddy border, it has to overlap with the buddy
+ * to look as if it is integrated with the buddy control.
+ * We nudge the control or change it size to overlap.
+ */
+ if (UPDOWN_HasBuddyBorder(infoPtr)) {
+ if(dwStyle & UDS_ALIGNLEFT)
+ width += DEFAULT_BUDDYBORDER;
+ else
+ x -= DEFAULT_BUDDYBORDER;
+ }
- return TRUE;
+ SetWindowPos(infoPtr->Self, infoPtr->Buddy, x,
+ budRect.top - DEFAULT_ADDTOP, width,
+ budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT,
+ SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
+ } else {
+ RECT rect;
+ GetWindowRect(infoPtr->Self, &rect);
+ MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Self), (POINT *)&rect, 2);
+ SetWindowPos(infoPtr->Self, 0, rect.left, rect.top, DEFAULT_WIDTH, rect.bottom - rect.top,
+ SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
+ }
+ return ret;
}
/***********************************************************************
@@ -859,9 +870,7 @@
return (LRESULT)infoPtr->Buddy;
case UDM_SETBUDDY:
- temp = (int)infoPtr->Buddy;
- UPDOWN_SetBuddy (infoPtr, (HWND)wParam);
- return temp;
+ return (LRESULT)UPDOWN_SetBuddy (infoPtr, (HWND)wParam);
case UDM_GETPOS:
temp = UPDOWN_GetBuddyInt (infoPtr);
@@ -948,7 +957,7 @@
WNDCLASSW wndClass;
ZeroMemory( &wndClass, sizeof( WNDCLASSW ) );
- wndClass.style = CS_GLOBALCLASS | CS_VREDRAW;
+ wndClass.style = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW;
wndClass.lpfnWndProc = (WNDPROC)UpDownWindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(UPDOWN_INFO*);
reactos/lib/comctl32
diff -u -r1.5 -r1.6
--- winehq2ros.patch 14 Mar 2004 09:17:52 -0000 1.5
+++ winehq2ros.patch 15 Apr 2004 08:29:57 -0000 1.6
@@ -4,7 +4,7 @@
retrieving revision 1.43
diff -u -r1.43 comctl32.spec
--- comctl32.spec 20 Feb 2004 05:16:37 -0000 1.43
-+++ comctl32.spec 14 Mar 2004 09:18:35 -0000
++++ comctl32.spec 15 Apr 2004 08:36:51 -0000
@@ -106,13 +106,13 @@
412 stdcall RemoveWindowSubclass(long ptr long)
413 stdcall DefSubclassProc(long long long long)
@@ -26,13 +26,34 @@
# Functions imported by name
+Index: imagelist.c
+===================================================================
+RCS file: /home/wine/wine/dlls/comctl32/imagelist.c,v
+retrieving revision 1.85
+diff -u -r1.85 imagelist.c
+--- imagelist.c 27 Feb 2004 04:40:08 -0000 1.85
++++ imagelist.c 15 Apr 2004 08:36:52 -0000
+@@ -1146,11 +1146,13 @@
+ PatBlt(hBlendMaskDC, 0, 0, cx, cy, PATCOPY);
+ SelectObject(hBlendMaskDC, hOldBrush);
+
++#if 0
+ /* Modify the blend mask if an Image Mask exist */
+ if(himl->hbmMask) {
+ BitBlt(hBlendMaskDC, 0, 0, cx, cy, hMaskListDC, lx, ly, 0x220326); /* NOTSRCAND */
+ BitBlt(hBlendMaskDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, NOTSRCCOPY);
+ }
++#endif
+
+ /* now apply blend to the current image given the BlendMask */
+ if (clrBlend == CLR_DEFAULT) clrBlend = GetSysColor (COLOR_HIGHLIGHT);
Index: listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
-retrieving revision 1.384
-diff -u -r1.384 listview.c
---- listview.c 20 Feb 2004 05:12:49 -0000 1.384
-+++ listview.c 14 Mar 2004 09:18:43 -0000
+retrieving revision 1.385
+diff -u -r1.385 listview.c
+--- listview.c 11 Mar 2004 00:39:53 -0000 1.385
++++ listview.c 15 Apr 2004 08:36:56 -0000
@@ -147,6 +147,7 @@
#include <assert.h>
#include <ctype.h>
@@ -41,48 +62,13 @@
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
-Index: rebar.c
-===================================================================
-RCS file: /home/wine/wine/dlls/comctl32/rebar.c,v
-retrieving revision 1.85
-diff -u -r1.85 rebar.c
---- rebar.c 27 Feb 2004 04:32:54 -0000 1.85
-+++ rebar.c 14 Mar 2004 09:18:47 -0000
-@@ -985,7 +985,7 @@
- }
-
- /* text is visible */
-- if (lpBand->fStatus & HAS_TEXT) {
-+ if ((lpBand->fStatus & HAS_TEXT) && !(lpBand->fStyle & RBBS_HIDETITLE)) {
- lpBand->fDraw |= DRAW_TEXT;
- lpBand->rcCapText.right = max(lpBand->rcCapText.left,
- lpBand->rcCapText.right-REBAR_POST_TEXT);
-@@ -1131,7 +1131,7 @@
- }
-
- /* text is visible */
-- if (lpBand->fStatus & HAS_TEXT) {
-+ if ((lpBand->fStatus & HAS_TEXT) && !(lpBand->fStyle & RBBS_HIDETITLE)) {
- lpBand->fDraw |= DRAW_TEXT;
- lpBand->rcCapText.bottom = max(lpBand->rcCapText.top,
- lpBand->rcCapText.bottom);
-@@ -2027,7 +2027,8 @@
- }
-
- /* text is visible */
-- if ((lpBand->fMask & RBBIM_TEXT) && (lpBand->lpText)) {
-+ if ((lpBand->fMask & RBBIM_TEXT) && (lpBand->lpText) &&
-+ !(lpBand->fStyle & RBBS_HIDETITLE)) {
- HDC hdc = GetDC (0);
- HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
- SIZE size;
Index: string.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/string.c,v
retrieving revision 1.3
diff -u -r1.3 string.c
--- string.c 20 Feb 2004 19:58:39 -0000 1.3
-+++ string.c 14 Mar 2004 09:18:48 -0000
++++ string.c 15 Apr 2004 08:36:56 -0000
@@ -254,7 +254,7 @@
{
TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
@@ -101,3 +87,19 @@
}
/*************************************************************************
+Index: treeview.c
+===================================================================
+RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
+retrieving revision 1.145
+diff -u -r1.145 treeview.c
+--- treeview.c 1 Mar 2004 23:10:52 -0000 1.145
++++ treeview.c 15 Apr 2004 08:36:58 -0000
+@@ -3093,7 +3093,7 @@
+ TRACE("\n");
+
+ if (wineItem->state & TVIS_EXPANDED)
+- return FALSE;
++ return TRUE;
+
+ TRACE("TVE_EXPAND %p %s\n", wineItem, TREEVIEW_ItemName(wineItem));
+
CVSspam 0.2.8