Rename STATUSWINDOWINFO to STATUS_INFO, for consistency with other

controls. Fix some prototypes. Always pass infoPtr around.
This commit is contained in:
Dimitrie O. Paun 2004-10-27 21:16:17 +00:00 committed by Alexandre Julliard
parent bc88300968
commit 2bccfc4aa9
1 changed files with 46 additions and 49 deletions

View File

@ -79,7 +79,7 @@ typedef struct
BOOL NtfUnicode; /* notify format */
STATUSWINDOWPART part0; /* simple window */
STATUSWINDOWPART* parts;
} STATUSWINDOWINFO;
} STATUS_INFO;
/*
* Run tests using Waite Group Windows95 API Bible Vol. 1&2
@ -91,11 +91,9 @@ typedef struct
#define VERT_BORDER 2
#define HORZ_GAP 2
#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongPtrW (hwnd, 0))
/* prototype */
static void
STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr);
STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr);
static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW)
{
@ -148,7 +146,7 @@ STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
static void
STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINFO *infoPtr, int itemID)
STATUSBAR_DrawPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
{
RECT r = part->bound;
UINT border = BDR_SUNKENOUTER;
@ -189,7 +187,7 @@ STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINF
static void
STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *part, HDC hdc, int itemID)
STATUSBAR_RefreshPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
{
HBRUSH hbrBk;
HFONT hOldFont;
@ -208,7 +206,7 @@ STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *
hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
STATUSBAR_DrawPart (hdc, part, infoPtr, itemID);
STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);
SelectObject (hdc, hOldFont);
@ -226,7 +224,7 @@ STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *
static LRESULT
STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc)
STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc)
{
int i;
RECT rect;
@ -250,10 +248,10 @@ STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc)
hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
if (infoPtr->simple) {
STATUSBAR_RefreshPart (infoPtr, &infoPtr->part0, hdc, 0);
STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
} else {
for (i = 0; i < infoPtr->numParts; i++) {
STATUSBAR_RefreshPart (infoPtr, &infoPtr->parts[i], hdc, i);
STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
}
}
@ -270,7 +268,7 @@ STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc)
static void
STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr)
STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
{
STATUSWINDOWPART *part;
RECT rect, *r;
@ -315,7 +313,7 @@ STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr)
static LRESULT
STATUSBAR_Relay2Tip (STATUSWINDOWINFO *infoPtr, UINT uMsg,
STATUSBAR_Relay2Tip (STATUS_INFO *infoPtr, UINT uMsg,
WPARAM wParam, LPARAM lParam)
{
MSG msg;
@ -345,7 +343,7 @@ STATUSBAR_GetBorders (INT out[])
static HICON
STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart)
STATUSBAR_GetIcon (STATUS_INFO *infoPtr, INT nPart)
{
TRACE("%d\n", nPart);
/* MSDN says: "simple parts are indexed with -1" */
@ -360,7 +358,7 @@ STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart)
static INT
STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, INT num_parts, INT parts[])
STATUSBAR_GetParts (STATUS_INFO *infoPtr, INT num_parts, INT parts[])
{
INT i;
@ -375,7 +373,7 @@ STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, INT num_parts, INT parts[])
static BOOL
STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, INT nPart, LPRECT rect)
STATUSBAR_GetRect (STATUS_INFO *infoPtr, INT nPart, LPRECT rect)
{
TRACE("part %d\n", nPart);
if (infoPtr->simple)
@ -387,7 +385,7 @@ STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, INT nPart, LPRECT rect)
static LRESULT
STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf)
STATUSBAR_GetTextA (STATUS_INFO *infoPtr, INT nPart, LPSTR buf)
{
STATUSWINDOWPART *part;
LRESULT result;
@ -416,7 +414,7 @@ STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf)
static LRESULT
STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, INT nPart, LPWSTR buf)
STATUSBAR_GetTextW (STATUS_INFO *infoPtr, INT nPart, LPWSTR buf)
{
STATUSWINDOWPART *part;
LRESULT result;
@ -442,7 +440,7 @@ STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, INT nPart, LPWSTR buf)
static LRESULT
STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, INT nPart)
STATUSBAR_GetTextLength (STATUS_INFO *infoPtr, INT nPart)
{
STATUSWINDOWPART *part;
DWORD result;
@ -467,7 +465,7 @@ STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, INT nPart)
}
static LRESULT
STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR tip, INT size)
STATUSBAR_GetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
{
TRACE("\n");
if (tip) {
@ -489,7 +487,7 @@ STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR tip, INT size)
static LRESULT
STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR tip, INT size)
STATUSBAR_GetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR tip, INT size)
{
TRACE("\n");
if (tip) {
@ -512,7 +510,7 @@ STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR tip, INT size)
static COLORREF
STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, COLORREF color)
STATUSBAR_SetBkColor (STATUS_INFO *infoPtr, COLORREF color)
{
COLORREF oldBkColor;
@ -526,7 +524,7 @@ STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, COLORREF color)
static BOOL
STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon)
STATUSBAR_SetIcon (STATUS_INFO *infoPtr, INT nPart, HICON hIcon)
{
if ((nPart < -1) || (nPart >= infoPtr->numParts))
return FALSE;
@ -553,7 +551,7 @@ STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon)
static BOOL
STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, INT height)
STATUSBAR_SetMinHeight (STATUS_INFO *infoPtr, INT height)
{
TRACE("(height=%d)\n", height);
@ -577,7 +575,7 @@ STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, INT height)
static BOOL
STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts)
STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
{
STATUSWINDOWPART *tmp;
int i, oldNumParts;
@ -647,7 +645,7 @@ STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts)
static BOOL
STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style,
STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
LPCWSTR text, BOOL isW)
{
STATUSWINDOWPART *part=NULL;
@ -715,7 +713,7 @@ STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style,
static LRESULT
STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR text)
STATUSBAR_SetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR text)
{
TRACE("part %d: \"%s\"\n", id, text);
if (infoPtr->hwndToolTip) {
@ -734,7 +732,7 @@ STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR text)
static LRESULT
STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR text)
STATUSBAR_SetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR text)
{
TRACE("part %d: \"%s\"\n", id, debugstr_w(text));
if (infoPtr->hwndToolTip) {
@ -753,7 +751,7 @@ STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR text)
inline static LRESULT
STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, BOOL bUnicode)
STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode)
{
BOOL bOld = infoPtr->bUnicode;
@ -765,7 +763,7 @@ STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, BOOL bUnicode)
static BOOL
STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple)
STATUSBAR_Simple (STATUS_INFO *infoPtr, BOOL simple)
{
NMHDR nmhdr;
@ -786,7 +784,7 @@ STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple)
static LRESULT
STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr)
STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
{
int i;
@ -816,7 +814,7 @@ STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr)
static LRESULT
STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
{
STATUSWINDOWINFO *infoPtr;
STATUS_INFO *infoPtr;
NONCLIENTMETRICSW nclm;
DWORD dwStyle;
RECT rect;
@ -824,7 +822,7 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
HDC hdc;
TRACE("\n");
infoPtr = (STATUSWINDOWINFO*)Alloc (sizeof(STATUSWINDOWINFO));
infoPtr = (STATUS_INFO*)Alloc (sizeof(STATUS_INFO));
if (!infoPtr) goto create_fail;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
@ -944,7 +942,7 @@ create_fail:
/* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
* of the first part only (usual behaviour) */
static INT
STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, INT size, LPWSTR buf)
STATUSBAR_WMGetText (STATUS_INFO *infoPtr, INT size, LPWSTR buf)
{
INT len;
@ -970,7 +968,7 @@ STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, INT size, LPWSTR buf)
static BOOL
STATUSBAR_WMNCHitTest (STATUSWINDOWINFO *infoPtr, INT x, INT y)
STATUSBAR_WMNCHitTest (STATUS_INFO *infoPtr, INT x, INT y)
{
if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
RECT rect;
@ -994,7 +992,7 @@ STATUSBAR_WMNCHitTest (STATUSWINDOWINFO *infoPtr, INT x, INT y)
static LRESULT
STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HDC hdc)
STATUSBAR_WMPaint (STATUS_INFO *infoPtr, HDC hdc)
{
PAINTSTRUCT ps;
@ -1009,7 +1007,7 @@ STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HDC hdc)
static LRESULT
STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HFONT font, BOOL redraw)
STATUSBAR_WMSetFont (STATUS_INFO *infoPtr, HFONT font, BOOL redraw)
{
infoPtr->hFont = font;
TRACE("%p\n", infoPtr->hFont);
@ -1021,7 +1019,7 @@ STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HFONT font, BOOL redraw)
static BOOL
STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, LPCSTR text)
STATUSBAR_WMSetText (STATUS_INFO *infoPtr, LPCSTR text)
{
STATUSWINDOWPART *part;
int len;
@ -1058,7 +1056,7 @@ STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, LPCSTR text)
static BOOL
STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags)
STATUSBAR_WMSize (STATUS_INFO *infoPtr, WORD flags)
{
INT width, x, y;
RECT parent_rect;
@ -1088,7 +1086,7 @@ STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags)
static LRESULT
STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd)
STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd)
{
if (cmd == NF_REQUERY) {
INT i = SendMessageW(from, WM_NOTIFYFORMAT, (WPARAM)infoPtr->Self, NF_QUERY);
@ -1099,14 +1097,13 @@ STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd)
static LRESULT
STATUSBAR_SendNotify (HWND hwnd, UINT code)
STATUSBAR_SendNotify (STATUS_INFO *infoPtr, UINT code)
{
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
NMHDR nmhdr;
TRACE("code %04x\n", code);
nmhdr.hwndFrom = hwnd;
nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
nmhdr.hwndFrom = infoPtr->Self;
nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
nmhdr.code = code;
SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
return 0;
@ -1117,7 +1114,7 @@ STATUSBAR_SendNotify (HWND hwnd, UINT code)
static LRESULT WINAPI
StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
STATUS_INFO *infoPtr = (STATUS_INFO *)GetWindowLongPtrW (hwnd, 0);
INT nPart = ((INT) wParam) & 0x00ff;
LRESULT res;
@ -1206,10 +1203,10 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return STATUSBAR_GetTextLength (infoPtr, 0);
case WM_LBUTTONDBLCLK:
return STATUSBAR_SendNotify (hwnd, NM_DBLCLK);
return STATUSBAR_SendNotify (infoPtr, NM_DBLCLK);
case WM_LBUTTONUP:
return STATUSBAR_SendNotify (hwnd, NM_CLICK);
return STATUSBAR_SendNotify (infoPtr, NM_CLICK);
case WM_MOUSEMOVE:
return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
@ -1232,10 +1229,10 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
case WM_RBUTTONDBLCLK:
return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK);
return STATUSBAR_SendNotify (infoPtr, NM_RDBLCLK);
case WM_RBUTTONUP:
return STATUSBAR_SendNotify (hwnd, NM_RCLICK);
return STATUSBAR_SendNotify (infoPtr, NM_RCLICK);
case WM_SETFONT:
return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
@ -1272,7 +1269,7 @@ STATUS_Register (void)
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
wndClass.lpfnWndProc = StatusWindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(STATUSWINDOWINFO *);
wndClass.cbWndExtra = sizeof(STATUS_INFO *);
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = STATUSCLASSNAMEW;