2004-08-06 21:17:49 +02:00
|
|
|
/*
|
|
|
|
* SysLink control
|
|
|
|
*
|
2006-01-06 13:08:09 +01:00
|
|
|
* Copyright 2004 - 2006 Thomas Weidenmueller <w3seek@reactos.com>
|
2004-08-06 21:17:49 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-08-06 21:17:49 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "winnls.h"
|
|
|
|
#include "commctrl.h"
|
2005-03-25 21:49:00 +01:00
|
|
|
#include "comctl32.h"
|
2004-08-06 21:17:49 +02:00
|
|
|
#include "wine/debug.h"
|
2016-05-20 07:04:22 +02:00
|
|
|
#include "wine/list.h"
|
2004-08-06 21:17:49 +02:00
|
|
|
|
2010-05-18 12:47:25 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(syslink);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int nChars;
|
2005-11-21 14:34:06 +01:00
|
|
|
int nSkip;
|
2004-08-06 21:17:49 +02:00
|
|
|
RECT rc;
|
|
|
|
} DOC_TEXTBLOCK, *PDOC_TEXTBLOCK;
|
|
|
|
|
|
|
|
#define LIF_FLAGSMASK (LIF_STATE | LIF_ITEMID | LIF_URL)
|
|
|
|
#define LIS_MASK (LIS_FOCUSED | LIS_ENABLED | LIS_VISITED)
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
slText = 0,
|
|
|
|
slLink
|
|
|
|
} SL_ITEM_TYPE;
|
|
|
|
|
|
|
|
typedef struct _DOC_ITEM
|
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
struct list entry;
|
2004-08-06 21:17:49 +02:00
|
|
|
UINT nText; /* Number of characters of the text */
|
|
|
|
SL_ITEM_TYPE Type; /* type of the item */
|
|
|
|
PDOC_TEXTBLOCK Blocks; /* Array of text blocks */
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UINT state; /* Link state */
|
|
|
|
WCHAR *szID; /* Link ID string */
|
|
|
|
WCHAR *szUrl; /* Link URL string */
|
|
|
|
} Link;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UINT Dummy;
|
|
|
|
} Text;
|
|
|
|
} u;
|
2006-01-06 13:08:09 +01:00
|
|
|
WCHAR Text[1]; /* Text of the document item */
|
2004-08-06 21:17:49 +02:00
|
|
|
} DOC_ITEM, *PDOC_ITEM;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
HWND Self; /* The window handle for this control */
|
2005-04-11 14:58:30 +02:00
|
|
|
HWND Notify; /* The parent handle to receive notifications */
|
|
|
|
DWORD Style; /* Styles for this control */
|
2016-05-20 07:04:22 +02:00
|
|
|
struct list Items; /* Document items list */
|
2004-08-06 21:17:49 +02:00
|
|
|
BOOL HasFocus; /* Whether the control has the input focus */
|
|
|
|
int MouseDownID; /* ID of the link that the mouse button first selected */
|
|
|
|
HFONT Font; /* Handle to the font for text */
|
|
|
|
HFONT LinkFont; /* Handle to the font for links */
|
|
|
|
COLORREF TextColor; /* Color of the text */
|
|
|
|
COLORREF LinkColor; /* Color of links */
|
|
|
|
COLORREF VisitedColor; /* Color of visited links */
|
2005-11-21 14:34:06 +01:00
|
|
|
WCHAR BreakChar; /* Break Character for the current font */
|
2009-10-20 19:55:12 +02:00
|
|
|
BOOL IgnoreReturn; /* (infoPtr->Style & LWS_IGNORERETURN) on creation */
|
2004-08-06 21:17:49 +02:00
|
|
|
} SYSLINK_INFO;
|
|
|
|
|
|
|
|
/* Control configuration constants */
|
|
|
|
|
|
|
|
#define SL_LEFTMARGIN (0)
|
|
|
|
#define SL_TOPMARGIN (0)
|
|
|
|
#define SL_RIGHTMARGIN (0)
|
|
|
|
#define SL_BOTTOMMARGIN (0)
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_FreeDocItem
|
|
|
|
* Frees all data and gdi objects associated with a document item
|
|
|
|
*/
|
|
|
|
static VOID SYSLINK_FreeDocItem (PDOC_ITEM DocItem)
|
|
|
|
{
|
|
|
|
if(DocItem->Type == slLink)
|
|
|
|
{
|
2007-02-13 21:18:24 +01:00
|
|
|
Free(DocItem->u.Link.szID);
|
|
|
|
Free(DocItem->u.Link.szUrl);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
2016-05-20 07:04:21 +02:00
|
|
|
Free(DocItem->Blocks);
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
/* we don't free Text because it's just a pointer to a character in the
|
|
|
|
entire window text string */
|
|
|
|
|
2005-03-25 21:49:00 +01:00
|
|
|
Free(DocItem);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_AppendDocItem
|
|
|
|
* Create and append a new document item.
|
|
|
|
*/
|
2005-04-11 14:58:30 +02:00
|
|
|
static PDOC_ITEM SYSLINK_AppendDocItem (SYSLINK_INFO *infoPtr, LPCWSTR Text, UINT textlen,
|
2004-08-06 21:17:49 +02:00
|
|
|
SL_ITEM_TYPE type, PDOC_ITEM LastItem)
|
|
|
|
{
|
|
|
|
PDOC_ITEM Item;
|
2006-01-06 13:08:09 +01:00
|
|
|
|
2019-05-29 08:44:58 +02:00
|
|
|
textlen = min(textlen, lstrlenW(Text));
|
2006-01-06 13:08:09 +01:00
|
|
|
Item = Alloc(FIELD_OFFSET(DOC_ITEM, Text[textlen + 1]));
|
2004-08-06 21:17:49 +02:00
|
|
|
if(Item == NULL)
|
|
|
|
{
|
|
|
|
ERR("Failed to alloc DOC_ITEM structure!\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Item->nText = textlen;
|
|
|
|
Item->Type = type;
|
|
|
|
Item->Blocks = NULL;
|
|
|
|
lstrcpynW(Item->Text, Text, textlen + 1);
|
2016-05-20 07:04:22 +02:00
|
|
|
if (LastItem)
|
|
|
|
list_add_after(&LastItem->entry, &Item->entry);
|
|
|
|
else
|
|
|
|
list_add_tail(&infoPtr->Items, &Item->entry);
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
return Item;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_ClearDoc
|
|
|
|
* Clears the document tree
|
|
|
|
*/
|
|
|
|
static VOID SYSLINK_ClearDoc (SYSLINK_INFO *infoPtr)
|
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
DOC_ITEM *Item, *Item2;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(Item, Item2, &infoPtr->Items, DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
list_remove(&Item->entry);
|
2004-08-06 21:17:49 +02:00
|
|
|
SYSLINK_FreeDocItem(Item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_ParseText
|
|
|
|
* Parses the window text string and creates a document. Returns the
|
|
|
|
* number of document items created.
|
|
|
|
*/
|
2005-04-11 14:58:30 +02:00
|
|
|
static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2005-04-11 14:58:30 +02:00
|
|
|
LPCWSTR current, textstart = NULL, linktext = NULL, firsttag = NULL;
|
|
|
|
int taglen = 0, textlen = 0, linklen = 0, docitems = 0;
|
2004-08-06 21:17:49 +02:00
|
|
|
PDOC_ITEM Last = NULL;
|
|
|
|
SL_ITEM_TYPE CurrentType = slText;
|
2005-04-11 14:58:30 +02:00
|
|
|
LPCWSTR lpID, lpUrl;
|
2004-08-06 21:17:49 +02:00
|
|
|
UINT lenId, lenUrl;
|
|
|
|
|
2010-05-18 12:47:25 +02:00
|
|
|
TRACE("(%p %s)\n", infoPtr, debugstr_w(Text));
|
|
|
|
|
2005-04-11 14:58:30 +02:00
|
|
|
for(current = Text; *current != 0;)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
if(*current == '<')
|
|
|
|
{
|
2020-05-01 17:42:03 +02:00
|
|
|
if(!wcsnicmp(current, L"<a", 2) && (CurrentType == slText))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
BOOL ValidParam = FALSE, ValidLink = FALSE;
|
|
|
|
|
2005-11-21 14:34:06 +01:00
|
|
|
if(*(current + 2) == '>')
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
/* we just have to deal with a <a> tag */
|
|
|
|
taglen = 3;
|
|
|
|
ValidLink = TRUE;
|
|
|
|
ValidParam = TRUE;
|
|
|
|
firsttag = current;
|
|
|
|
linklen = 0;
|
|
|
|
lpID = NULL;
|
|
|
|
lpUrl = NULL;
|
2005-11-21 14:34:06 +01:00
|
|
|
}
|
|
|
|
else if(*(current + 2) == infoPtr->BreakChar)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
/* we expect parameters, parse them */
|
2005-04-11 14:58:30 +02:00
|
|
|
LPCWSTR *CurrentParameter = NULL, tmp;
|
2004-08-06 21:17:49 +02:00
|
|
|
UINT *CurrentParameterLen = NULL;
|
|
|
|
|
|
|
|
taglen = 3;
|
|
|
|
tmp = current + taglen;
|
|
|
|
lpID = NULL;
|
|
|
|
lpUrl = NULL;
|
|
|
|
|
|
|
|
CheckParameter:
|
|
|
|
/* compare the current position with all known parameters */
|
2020-05-01 17:42:03 +02:00
|
|
|
if(!wcsnicmp(tmp, L"href=\"", 6))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
taglen += 6;
|
|
|
|
ValidParam = TRUE;
|
|
|
|
CurrentParameter = &lpUrl;
|
|
|
|
CurrentParameterLen = &lenUrl;
|
|
|
|
}
|
2020-05-01 17:42:03 +02:00
|
|
|
else if(!wcsnicmp(tmp, L"id=\"", 4))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
taglen += 4;
|
|
|
|
ValidParam = TRUE;
|
|
|
|
CurrentParameter = &lpID;
|
|
|
|
CurrentParameterLen = &lenId;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ValidParam = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ValidParam)
|
|
|
|
{
|
|
|
|
/* we got a known parameter, now search until the next " character.
|
|
|
|
If we can't find a " character, there's a syntax error and we just assume it's text */
|
|
|
|
ValidParam = FALSE;
|
|
|
|
*CurrentParameter = current + taglen;
|
|
|
|
*CurrentParameterLen = 0;
|
|
|
|
|
|
|
|
for(tmp = *CurrentParameter; *tmp != 0; tmp++)
|
|
|
|
{
|
|
|
|
taglen++;
|
|
|
|
if(*tmp == '\"')
|
|
|
|
{
|
|
|
|
ValidParam = TRUE;
|
|
|
|
tmp++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
(*CurrentParameterLen)++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(ValidParam)
|
|
|
|
{
|
|
|
|
/* we're done with this parameter, now there are only 2 possibilities:
|
|
|
|
* 1. another parameter is coming, so expect a ' ' (space) character
|
|
|
|
* 2. the tag is being closed, so expect a '<' character
|
|
|
|
*/
|
2005-11-21 14:34:06 +01:00
|
|
|
if(*tmp == infoPtr->BreakChar)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
/* we expect another parameter, do the whole thing again */
|
|
|
|
taglen++;
|
|
|
|
tmp++;
|
|
|
|
goto CheckParameter;
|
2005-11-21 14:34:06 +01:00
|
|
|
}
|
|
|
|
else if(*tmp == '>')
|
|
|
|
{
|
2004-08-06 21:17:49 +02:00
|
|
|
/* the tag is being closed, we're done */
|
|
|
|
ValidLink = TRUE;
|
|
|
|
taglen++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ValidLink && ValidParam)
|
|
|
|
{
|
|
|
|
/* the <a ...> tag appears to be valid. save all information
|
|
|
|
so we can add the link if we find a valid </a> tag later */
|
|
|
|
CurrentType = slLink;
|
|
|
|
linktext = current + taglen;
|
|
|
|
linklen = 0;
|
|
|
|
firsttag = current;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
taglen = 1;
|
|
|
|
lpID = NULL;
|
|
|
|
lpUrl = NULL;
|
|
|
|
if(textstart == NULL)
|
|
|
|
{
|
|
|
|
textstart = current;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-01 17:42:03 +02:00
|
|
|
else if (!wcsnicmp(current, L"</a>", 4) && (CurrentType == slLink) && firsttag)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
/* there's a <a...> tag opened, first add the previous text, if present */
|
|
|
|
if(textstart != NULL && textlen > 0 && firsttag > textstart)
|
|
|
|
{
|
|
|
|
Last = SYSLINK_AppendDocItem(infoPtr, textstart, firsttag - textstart, slText, Last);
|
|
|
|
if(Last == NULL)
|
|
|
|
{
|
|
|
|
ERR("Unable to create new document item!\n");
|
|
|
|
return docitems;
|
|
|
|
}
|
|
|
|
docitems++;
|
|
|
|
textstart = NULL;
|
|
|
|
textlen = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now it's time to add the link to the document */
|
|
|
|
current += 4;
|
|
|
|
if(linktext != NULL && linklen > 0)
|
|
|
|
{
|
|
|
|
Last = SYSLINK_AppendDocItem(infoPtr, linktext, linklen, slLink, Last);
|
|
|
|
if(Last == NULL)
|
|
|
|
{
|
|
|
|
ERR("Unable to create new document item!\n");
|
|
|
|
return docitems;
|
|
|
|
}
|
|
|
|
docitems++;
|
|
|
|
if(CurrentType == slLink)
|
|
|
|
{
|
|
|
|
int nc;
|
|
|
|
|
2005-04-11 14:58:30 +02:00
|
|
|
if(!(infoPtr->Style & WS_DISABLED))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
Last->u.Link.state |= LIS_ENABLED;
|
|
|
|
}
|
|
|
|
/* Copy the tag parameters */
|
|
|
|
if(lpID != NULL)
|
|
|
|
{
|
2019-05-29 08:44:58 +02:00
|
|
|
nc = min(lenId, lstrlenW(lpID));
|
2006-01-06 13:08:09 +01:00
|
|
|
nc = min(nc, MAX_LINKID_TEXT - 1);
|
|
|
|
Last->u.Link.szID = Alloc((nc + 1) * sizeof(WCHAR));
|
2004-08-06 21:17:49 +02:00
|
|
|
if(Last->u.Link.szID != NULL)
|
|
|
|
{
|
|
|
|
lstrcpynW(Last->u.Link.szID, lpID, nc + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Last->u.Link.szID = NULL;
|
|
|
|
if(lpUrl != NULL)
|
|
|
|
{
|
2019-05-29 08:44:58 +02:00
|
|
|
nc = min(lenUrl, lstrlenW(lpUrl));
|
2006-01-06 13:08:09 +01:00
|
|
|
nc = min(nc, L_MAX_URL_LENGTH - 1);
|
|
|
|
Last->u.Link.szUrl = Alloc((nc + 1) * sizeof(WCHAR));
|
2004-08-06 21:17:49 +02:00
|
|
|
if(Last->u.Link.szUrl != NULL)
|
|
|
|
{
|
|
|
|
lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Last->u.Link.szUrl = NULL;
|
|
|
|
}
|
|
|
|
linktext = NULL;
|
|
|
|
}
|
|
|
|
CurrentType = slText;
|
|
|
|
firsttag = NULL;
|
|
|
|
textstart = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* we don't know what tag it is, so just continue */
|
|
|
|
taglen = 1;
|
|
|
|
linklen++;
|
|
|
|
if(CurrentType == slText && textstart == NULL)
|
|
|
|
{
|
|
|
|
textstart = current;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
textlen += taglen;
|
|
|
|
current += taglen;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
textlen++;
|
|
|
|
linklen++;
|
|
|
|
|
|
|
|
/* save the pointer of the current text item if we couldn't find a tag */
|
|
|
|
if(textstart == NULL && CurrentType == slText)
|
|
|
|
{
|
|
|
|
textstart = current;
|
|
|
|
}
|
|
|
|
|
|
|
|
current++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(textstart != NULL && textlen > 0)
|
|
|
|
{
|
|
|
|
Last = SYSLINK_AppendDocItem(infoPtr, textstart, textlen, CurrentType, Last);
|
|
|
|
if(Last == NULL)
|
|
|
|
{
|
|
|
|
ERR("Unable to create new document item!\n");
|
|
|
|
return docitems;
|
|
|
|
}
|
|
|
|
if(CurrentType == slLink)
|
|
|
|
{
|
|
|
|
int nc;
|
|
|
|
|
2005-04-11 14:58:30 +02:00
|
|
|
if(!(infoPtr->Style & WS_DISABLED))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
Last->u.Link.state |= LIS_ENABLED;
|
|
|
|
}
|
|
|
|
/* Copy the tag parameters */
|
|
|
|
if(lpID != NULL)
|
|
|
|
{
|
2019-05-29 08:44:58 +02:00
|
|
|
nc = min(lenId, lstrlenW(lpID));
|
2006-01-06 13:08:09 +01:00
|
|
|
nc = min(nc, MAX_LINKID_TEXT - 1);
|
|
|
|
Last->u.Link.szID = Alloc((nc + 1) * sizeof(WCHAR));
|
2004-08-06 21:17:49 +02:00
|
|
|
if(Last->u.Link.szID != NULL)
|
|
|
|
{
|
|
|
|
lstrcpynW(Last->u.Link.szID, lpID, nc + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Last->u.Link.szID = NULL;
|
|
|
|
if(lpUrl != NULL)
|
|
|
|
{
|
2019-05-29 08:44:58 +02:00
|
|
|
nc = min(lenUrl, lstrlenW(lpUrl));
|
2006-01-06 13:08:09 +01:00
|
|
|
nc = min(nc, L_MAX_URL_LENGTH - 1);
|
|
|
|
Last->u.Link.szUrl = Alloc((nc + 1) * sizeof(WCHAR));
|
2004-08-06 21:17:49 +02:00
|
|
|
if(Last->u.Link.szUrl != NULL)
|
|
|
|
{
|
|
|
|
lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Last->u.Link.szUrl = NULL;
|
|
|
|
}
|
|
|
|
docitems++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(linktext != NULL && linklen > 0)
|
|
|
|
{
|
2005-03-30 19:08:31 +02:00
|
|
|
/* we got an unclosed link, just display the text */
|
2004-08-06 21:17:49 +02:00
|
|
|
Last = SYSLINK_AppendDocItem(infoPtr, linktext, linklen, slText, Last);
|
|
|
|
if(Last == NULL)
|
|
|
|
{
|
|
|
|
ERR("Unable to create new document item!\n");
|
|
|
|
return docitems;
|
|
|
|
}
|
|
|
|
docitems++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return docitems;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_RepaintLink
|
|
|
|
* Repaints a link.
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static VOID SYSLINK_RepaintLink (const SYSLINK_INFO *infoPtr, const DOC_ITEM *DocItem)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
PDOC_TEXTBLOCK bl;
|
|
|
|
int n;
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
if(DocItem->Type != slLink)
|
|
|
|
{
|
|
|
|
ERR("DocItem not a link!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-11-21 14:34:06 +01:00
|
|
|
bl = DocItem->Blocks;
|
|
|
|
if (bl != NULL)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
n = DocItem->nText;
|
|
|
|
|
|
|
|
while(n > 0)
|
|
|
|
{
|
|
|
|
InvalidateRect(infoPtr->Self, &bl->rc, TRUE);
|
|
|
|
n -= bl->nChars + bl->nSkip;
|
|
|
|
bl++;
|
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_GetLinkItemByIndex
|
2005-03-02 14:53:50 +01:00
|
|
|
* Retrieves a document link by its index
|
2004-08-06 21:17:49 +02:00
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static PDOC_ITEM SYSLINK_GetLinkItemByIndex (const SYSLINK_INFO *infoPtr, int iLink)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
DOC_ITEM *Current;
|
2004-08-06 21:17:49 +02:00
|
|
|
|
2016-05-20 07:04:22 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(Current, &infoPtr->Items, DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
if ((Current->Type == slLink) && (iLink-- <= 0))
|
2004-08-06 21:17:49 +02:00
|
|
|
return Current;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_GetFocusLink
|
2005-03-02 14:53:50 +01:00
|
|
|
* Retrieves the link that has the LIS_FOCUSED bit
|
2004-08-06 21:17:49 +02:00
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static PDOC_ITEM SYSLINK_GetFocusLink (const SYSLINK_INFO *infoPtr, int *LinkId)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
DOC_ITEM *Current;
|
2004-08-06 21:17:49 +02:00
|
|
|
int id = 0;
|
|
|
|
|
2016-05-20 07:04:22 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(Current, &infoPtr->Items, DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2011-04-13 01:27:11 +02:00
|
|
|
if(Current->Type == slLink)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
if(Current->u.Link.state & LIS_FOCUSED)
|
|
|
|
{
|
|
|
|
if(LinkId != NULL)
|
|
|
|
*LinkId = id;
|
|
|
|
return Current;
|
|
|
|
}
|
|
|
|
id++;
|
|
|
|
}
|
|
|
|
}
|
2016-05-20 07:04:22 +02:00
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_GetNextLink
|
|
|
|
* Gets the next link
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static PDOC_ITEM SYSLINK_GetNextLink (const SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
DOC_ITEM *Next;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY(Next, Current ? &Current->entry : &infoPtr->Items, DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
if (Next->Type == slLink)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
return Next;
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_GetPrevLink
|
|
|
|
* Gets the previous link
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static PDOC_ITEM SYSLINK_GetPrevLink (const SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
DOC_ITEM *Prev;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY_REV(Prev, Current ? &Current->entry : list_tail(&infoPtr->Items), DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
if (Prev->Type == slLink)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2016-05-20 07:04:22 +02:00
|
|
|
return Prev;
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
}
|
2016-05-20 07:04:22 +02:00
|
|
|
|
|
|
|
return NULL;
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_WrapLine
|
|
|
|
* Tries to wrap a line.
|
|
|
|
*/
|
2011-12-01 20:30:16 +01:00
|
|
|
static BOOL SYSLINK_WrapLine (LPWSTR Text, WCHAR BreakChar, int x, int *LineLen,
|
2009-01-17 20:45:21 +01:00
|
|
|
int nFit, LPSIZE Extent)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2011-11-18 11:57:07 +01:00
|
|
|
int i;
|
2004-08-06 21:17:49 +02:00
|
|
|
|
2019-09-01 15:23:36 +02:00
|
|
|
for (i = 0; i < nFit; i++) if (Text[i] == '\r' || Text[i] == '\n') break;
|
2004-08-06 21:17:49 +02:00
|
|
|
|
2011-11-18 11:57:07 +01:00
|
|
|
if (i == *LineLen) return FALSE;
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
/* check if we're in the middle of a word */
|
2019-09-01 15:23:36 +02:00
|
|
|
if (Text[i] != '\r' && Text[i] != '\n' && Text[i] != BreakChar)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
/* search for the beginning of the word */
|
2011-11-18 11:57:07 +01:00
|
|
|
while (i && Text[i - 1] != BreakChar) i--;
|
|
|
|
|
|
|
|
if (i == 0)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
Extent->cx = 0;
|
|
|
|
Extent->cy = 0;
|
2011-12-01 20:30:16 +01:00
|
|
|
if (x == SL_LEFTMARGIN) i = max( nFit, 1 );
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
}
|
2011-11-18 11:57:07 +01:00
|
|
|
*LineLen = i;
|
2004-08-06 21:17:49 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_Render
|
|
|
|
* Renders the document in memory
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static VOID SYSLINK_Render (const SYSLINK_INFO *infoPtr, HDC hdc, PRECT pRect)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
RECT rc;
|
|
|
|
PDOC_ITEM Current;
|
|
|
|
HGDIOBJ hOldFont;
|
|
|
|
int x, y, LineHeight;
|
2007-02-19 16:25:01 +01:00
|
|
|
SIZE szDoc;
|
2011-11-18 11:57:07 +01:00
|
|
|
TEXTMETRICW tm;
|
2007-02-19 16:25:01 +01:00
|
|
|
|
|
|
|
szDoc.cx = szDoc.cy = 0;
|
|
|
|
|
|
|
|
rc = *pRect;
|
2004-08-06 21:17:49 +02:00
|
|
|
rc.right -= SL_RIGHTMARGIN;
|
|
|
|
rc.bottom -= SL_BOTTOMMARGIN;
|
2007-02-19 16:25:01 +01:00
|
|
|
|
|
|
|
if(rc.right - SL_LEFTMARGIN < 0)
|
|
|
|
rc.right = MAXLONG;
|
|
|
|
if (rc.bottom - SL_TOPMARGIN < 0)
|
|
|
|
rc.bottom = MAXLONG;
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
hOldFont = SelectObject(hdc, infoPtr->Font);
|
|
|
|
|
|
|
|
x = SL_LEFTMARGIN;
|
|
|
|
y = SL_TOPMARGIN;
|
2011-11-18 11:57:07 +01:00
|
|
|
GetTextMetricsW( hdc, &tm );
|
|
|
|
LineHeight = tm.tmHeight + tm.tmExternalLeading;
|
|
|
|
|
2016-05-20 07:04:22 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(Current, &infoPtr->Items, DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
int n, nBlocks;
|
|
|
|
LPWSTR tx;
|
|
|
|
PDOC_TEXTBLOCK bl, cbl;
|
|
|
|
INT nFit;
|
|
|
|
SIZE szDim;
|
2011-11-18 11:57:07 +01:00
|
|
|
int SkipChars = 0;
|
2007-03-07 21:55:31 +01:00
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
if(Current->nText == 0)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2007-03-07 21:55:31 +01:00
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
tx = Current->Text;
|
|
|
|
n = Current->nText;
|
2005-11-21 14:34:06 +01:00
|
|
|
|
2007-03-07 21:55:31 +01:00
|
|
|
Free(Current->Blocks);
|
|
|
|
Current->Blocks = NULL;
|
2005-11-21 14:34:06 +01:00
|
|
|
bl = NULL;
|
2004-08-06 21:17:49 +02:00
|
|
|
nBlocks = 0;
|
2007-03-07 21:55:31 +01:00
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
if(Current->Type == slText)
|
|
|
|
{
|
|
|
|
SelectObject(hdc, infoPtr->Font);
|
|
|
|
}
|
|
|
|
else if(Current->Type == slLink)
|
|
|
|
{
|
|
|
|
SelectObject(hdc, infoPtr->LinkFont);
|
|
|
|
}
|
|
|
|
|
|
|
|
while(n > 0)
|
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
/* skip break characters unless they're the first of the doc item */
|
|
|
|
if(tx != Current->Text || x == SL_LEFTMARGIN)
|
|
|
|
{
|
2019-09-01 15:23:36 +02:00
|
|
|
if (n && *tx == '\r')
|
|
|
|
{
|
|
|
|
tx++;
|
|
|
|
SkipChars++;
|
|
|
|
n--;
|
|
|
|
}
|
2011-11-18 11:57:07 +01:00
|
|
|
if (n && *tx == '\n')
|
|
|
|
{
|
|
|
|
tx++;
|
|
|
|
SkipChars++;
|
|
|
|
n--;
|
|
|
|
}
|
2005-11-21 14:34:06 +01:00
|
|
|
while(n > 0 && (*tx) == infoPtr->BreakChar)
|
|
|
|
{
|
|
|
|
tx++;
|
|
|
|
SkipChars++;
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if((n == 0 && SkipChars != 0) ||
|
|
|
|
GetTextExtentExPointW(hdc, tx, n, rc.right - x, &nFit, NULL, &szDim))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
int LineLen = n;
|
2005-11-21 14:34:06 +01:00
|
|
|
BOOL Wrap = FALSE;
|
2007-02-19 16:25:01 +01:00
|
|
|
PDOC_TEXTBLOCK nbl;
|
2004-08-06 21:17:49 +02:00
|
|
|
|
2005-11-21 14:34:06 +01:00
|
|
|
if(n != 0)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2011-12-01 20:30:16 +01:00
|
|
|
Wrap = SYSLINK_WrapLine(tx, infoPtr->BreakChar, x, &LineLen, nFit, &szDim);
|
2005-11-21 14:34:06 +01:00
|
|
|
|
|
|
|
if(LineLen == 0)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2011-11-18 11:57:07 +01:00
|
|
|
/* move one line down, the word didn't fit into the line */
|
|
|
|
x = SL_LEFTMARGIN;
|
|
|
|
y += LineHeight;
|
|
|
|
continue;
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
2005-11-21 14:34:06 +01:00
|
|
|
|
|
|
|
if(LineLen != n)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
if(!GetTextExtentExPointW(hdc, tx, LineLen, rc.right - x, NULL, NULL, &szDim))
|
|
|
|
{
|
|
|
|
if(bl != NULL)
|
|
|
|
{
|
|
|
|
Free(bl);
|
|
|
|
bl = NULL;
|
2006-01-06 13:08:09 +01:00
|
|
|
nBlocks = 0;
|
2005-11-21 14:34:06 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-19 16:25:01 +01:00
|
|
|
nbl = ReAlloc(bl, (nBlocks + 1) * sizeof(DOC_TEXTBLOCK));
|
|
|
|
if (nbl != NULL)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2007-02-19 16:25:01 +01:00
|
|
|
bl = nbl;
|
|
|
|
nBlocks++;
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
cbl = bl + nBlocks - 1;
|
|
|
|
|
|
|
|
cbl->nChars = LineLen;
|
2005-11-21 14:34:06 +01:00
|
|
|
cbl->nSkip = SkipChars;
|
2016-04-29 15:58:29 +02:00
|
|
|
SetRect(&cbl->rc, x, y, x + szDim.cx, y + szDim.cy);
|
2007-02-19 16:25:01 +01:00
|
|
|
|
|
|
|
if (cbl->rc.right > szDoc.cx)
|
|
|
|
szDoc.cx = cbl->rc.right;
|
|
|
|
if (cbl->rc.bottom > szDoc.cy)
|
|
|
|
szDoc.cy = cbl->rc.bottom;
|
|
|
|
|
2005-11-21 14:34:06 +01:00
|
|
|
if(LineLen != 0)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
x += szDim.cx;
|
|
|
|
if(Wrap)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
x = SL_LEFTMARGIN;
|
|
|
|
y += LineHeight;
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-02-19 16:25:01 +01:00
|
|
|
Free(bl);
|
|
|
|
bl = NULL;
|
|
|
|
nBlocks = 0;
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
ERR("Failed to alloc DOC_TEXTBLOCK structure!\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
n -= LineLen;
|
|
|
|
tx += LineLen;
|
2011-11-18 11:57:07 +01:00
|
|
|
SkipChars = 0;
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
}
|
2005-11-21 14:34:06 +01:00
|
|
|
|
|
|
|
if(nBlocks != 0)
|
|
|
|
{
|
|
|
|
Current->Blocks = bl;
|
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SelectObject(hdc, hOldFont);
|
2007-02-19 16:25:01 +01:00
|
|
|
|
|
|
|
pRect->right = pRect->left + szDoc.cx;
|
|
|
|
pRect->bottom = pRect->top + szDoc.cy;
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_Draw
|
|
|
|
* Draws the SysLink control.
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static LRESULT SYSLINK_Draw (const SYSLINK_INFO *infoPtr, HDC hdc)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
RECT rc;
|
|
|
|
PDOC_ITEM Current;
|
|
|
|
HFONT hOldFont;
|
|
|
|
COLORREF OldTextColor, OldBkColor;
|
2011-09-26 16:22:40 +02:00
|
|
|
HBRUSH hBrush;
|
2012-01-12 12:20:46 +01:00
|
|
|
UINT text_flags = ETO_CLIPPED;
|
|
|
|
UINT mode = GetBkMode( hdc );
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
hOldFont = SelectObject(hdc, infoPtr->Font);
|
|
|
|
OldTextColor = SetTextColor(hdc, infoPtr->TextColor);
|
2012-01-12 12:20:46 +01:00
|
|
|
OldBkColor = SetBkColor(hdc, comctl32_color.clrWindow);
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
GetClientRect(infoPtr->Self, &rc);
|
|
|
|
rc.right -= SL_RIGHTMARGIN + SL_LEFTMARGIN;
|
|
|
|
rc.bottom -= SL_BOTTOMMARGIN + SL_TOPMARGIN;
|
|
|
|
|
|
|
|
if(rc.right < 0 || rc.bottom < 0) return 0;
|
|
|
|
|
2011-09-26 16:22:40 +02:00
|
|
|
hBrush = (HBRUSH)SendMessageW(infoPtr->Notify, WM_CTLCOLORSTATIC,
|
|
|
|
(WPARAM)hdc, (LPARAM)infoPtr->Self);
|
2012-01-12 12:20:46 +01:00
|
|
|
if (!(infoPtr->Style & LWS_TRANSPARENT))
|
|
|
|
{
|
|
|
|
FillRect(hdc, &rc, hBrush);
|
|
|
|
if (GetBkMode( hdc ) == OPAQUE) text_flags |= ETO_OPAQUE;
|
|
|
|
}
|
|
|
|
else SetBkMode( hdc, TRANSPARENT );
|
|
|
|
|
2011-09-26 16:22:40 +02:00
|
|
|
DeleteObject(hBrush);
|
|
|
|
|
2016-05-20 07:04:22 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(Current, &infoPtr->Items, DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
LPWSTR tx;
|
|
|
|
PDOC_TEXTBLOCK bl;
|
|
|
|
|
|
|
|
bl = Current->Blocks;
|
|
|
|
if(bl != NULL)
|
|
|
|
{
|
|
|
|
tx = Current->Text;
|
|
|
|
n = Current->nText;
|
|
|
|
|
|
|
|
if(Current->Type == slText)
|
|
|
|
{
|
|
|
|
SelectObject(hdc, infoPtr->Font);
|
|
|
|
SetTextColor(hdc, infoPtr->TextColor);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SelectObject(hdc, infoPtr->LinkFont);
|
|
|
|
SetTextColor(hdc, (!(Current->u.Link.state & LIS_VISITED) ? infoPtr->LinkColor : infoPtr->VisitedColor));
|
|
|
|
}
|
|
|
|
|
|
|
|
while(n > 0)
|
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
tx += bl->nSkip;
|
2012-01-12 12:20:46 +01:00
|
|
|
ExtTextOutW(hdc, bl->rc.left, bl->rc.top, text_flags, &bl->rc, tx, bl->nChars, NULL);
|
2004-08-06 21:17:49 +02:00
|
|
|
if((Current->Type == slLink) && (Current->u.Link.state & LIS_FOCUSED) && infoPtr->HasFocus)
|
|
|
|
{
|
2006-01-06 13:04:14 +01:00
|
|
|
COLORREF PrevTextColor;
|
|
|
|
PrevTextColor = SetTextColor(hdc, infoPtr->TextColor);
|
2004-08-06 21:17:49 +02:00
|
|
|
DrawFocusRect(hdc, &bl->rc);
|
2006-01-06 13:04:14 +01:00
|
|
|
SetTextColor(hdc, PrevTextColor);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
tx += bl->nChars;
|
2005-11-21 14:34:06 +01:00
|
|
|
n -= bl->nChars + bl->nSkip;
|
2004-08-06 21:17:49 +02:00
|
|
|
bl++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetBkColor(hdc, OldBkColor);
|
|
|
|
SetTextColor(hdc, OldTextColor);
|
|
|
|
SelectObject(hdc, hOldFont);
|
2012-01-12 12:20:46 +01:00
|
|
|
SetBkMode(hdc, mode);
|
2004-08-06 21:17:49 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_Paint
|
|
|
|
* Handles the WM_PAINT message.
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static LRESULT SYSLINK_Paint (const SYSLINK_INFO *infoPtr, HDC hdcParam)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
HDC hdc;
|
|
|
|
PAINTSTRUCT ps;
|
2005-03-25 11:26:10 +01:00
|
|
|
|
|
|
|
hdc = hdcParam ? hdcParam : BeginPaint (infoPtr->Self, &ps);
|
2006-01-06 13:04:14 +01:00
|
|
|
if (hdc)
|
|
|
|
{
|
|
|
|
SYSLINK_Draw (infoPtr, hdc);
|
|
|
|
if (!hdcParam) EndPaint (infoPtr->Self, &ps);
|
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_SetFont
|
|
|
|
* Set new Font for the SysLink control.
|
|
|
|
*/
|
|
|
|
static HFONT SYSLINK_SetFont (SYSLINK_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
|
|
|
|
{
|
|
|
|
HDC hdc;
|
|
|
|
LOGFONTW lf;
|
2005-11-21 14:34:06 +01:00
|
|
|
TEXTMETRICW tm;
|
2007-02-19 16:25:01 +01:00
|
|
|
RECT rcClient;
|
2004-08-06 21:17:49 +02:00
|
|
|
HFONT hOldFont = infoPtr->Font;
|
|
|
|
infoPtr->Font = hFont;
|
|
|
|
|
|
|
|
/* free the underline font */
|
|
|
|
if(infoPtr->LinkFont != NULL)
|
|
|
|
{
|
|
|
|
DeleteObject(infoPtr->LinkFont);
|
|
|
|
infoPtr->LinkFont = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Render text position and word wrapping in memory */
|
2007-02-19 16:25:01 +01:00
|
|
|
if (GetClientRect(infoPtr->Self, &rcClient))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2007-02-19 16:25:01 +01:00
|
|
|
hdc = GetDC(infoPtr->Self);
|
|
|
|
if(hdc != NULL)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2007-02-19 16:25:01 +01:00
|
|
|
/* create a new underline font */
|
|
|
|
if(GetTextMetricsW(hdc, &tm) &&
|
|
|
|
GetObjectW(infoPtr->Font, sizeof(LOGFONTW), &lf))
|
|
|
|
{
|
|
|
|
lf.lfUnderline = TRUE;
|
|
|
|
infoPtr->LinkFont = CreateFontIndirectW(&lf);
|
|
|
|
infoPtr->BreakChar = tm.tmBreakChar;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Failed to create link font!\n");
|
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
|
2007-02-19 16:25:01 +01:00
|
|
|
SYSLINK_Render(infoPtr, hdc, &rcClient);
|
|
|
|
ReleaseDC(infoPtr->Self, hdc);
|
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(bRedraw)
|
|
|
|
{
|
|
|
|
RedrawWindow(infoPtr->Self, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hOldFont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_SetText
|
|
|
|
* Set new text for the SysLink control.
|
|
|
|
*/
|
2005-04-11 14:58:30 +02:00
|
|
|
static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
/* clear the document */
|
|
|
|
SYSLINK_ClearDoc(infoPtr);
|
2008-04-15 23:19:12 +02:00
|
|
|
|
|
|
|
if(Text == NULL || *Text == 0)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
2008-04-15 23:19:12 +02:00
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
/* let's parse the string and create a document */
|
|
|
|
if(SYSLINK_ParseText(infoPtr, Text) > 0)
|
|
|
|
{
|
2007-02-19 16:25:01 +01:00
|
|
|
RECT rcClient;
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
/* Render text position and word wrapping in memory */
|
2007-02-19 16:25:01 +01:00
|
|
|
if (GetClientRect(infoPtr->Self, &rcClient))
|
2006-01-06 13:04:14 +01:00
|
|
|
{
|
2007-02-19 16:25:01 +01:00
|
|
|
HDC hdc = GetDC(infoPtr->Self);
|
|
|
|
if (hdc != NULL)
|
|
|
|
{
|
|
|
|
SYSLINK_Render(infoPtr, hdc, &rcClient);
|
|
|
|
ReleaseDC(infoPtr->Self, hdc);
|
2006-01-06 13:04:14 +01:00
|
|
|
|
2007-02-19 16:25:01 +01:00
|
|
|
InvalidateRect(infoPtr->Self, NULL, TRUE);
|
|
|
|
}
|
2006-01-06 13:04:14 +01:00
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_SetFocusLink
|
2019-09-02 04:30:40 +02:00
|
|
|
* Updates the focus status bits and focuses the specified link.
|
2004-08-06 21:17:49 +02:00
|
|
|
* If no document item is specified, the focus bit will be removed from all links.
|
|
|
|
* Returns the previous focused item.
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static PDOC_ITEM SYSLINK_SetFocusLink (const SYSLINK_INFO *infoPtr, const DOC_ITEM *DocItem)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM Current, PrevFocus = NULL;
|
2016-05-20 07:04:22 +02:00
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY(Current, &infoPtr->Items, DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
if(Current->Type == slLink)
|
|
|
|
{
|
|
|
|
if((PrevFocus == NULL) && (Current->u.Link.state & LIS_FOCUSED))
|
|
|
|
{
|
|
|
|
PrevFocus = Current;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Current == DocItem)
|
|
|
|
{
|
|
|
|
Current->u.Link.state |= LIS_FOCUSED;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Current->u.Link.state &= ~LIS_FOCUSED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return PrevFocus;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_SetItem
|
|
|
|
* Sets the states and attributes of a link item.
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static LRESULT SYSLINK_SetItem (const SYSLINK_INFO *infoPtr, const LITEM *Item)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM di;
|
2006-01-06 13:08:09 +01:00
|
|
|
int nc;
|
|
|
|
PWSTR szId = NULL;
|
|
|
|
PWSTR szUrl = NULL;
|
2004-08-06 21:17:49 +02:00
|
|
|
BOOL Repaint = FALSE;
|
|
|
|
|
|
|
|
if(!(Item->mask & LIF_ITEMINDEX) || !(Item->mask & (LIF_FLAGSMASK)))
|
|
|
|
{
|
|
|
|
ERR("Invalid Flags!\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
di = SYSLINK_GetLinkItemByIndex(infoPtr, Item->iLink);
|
|
|
|
if(di == NULL)
|
|
|
|
{
|
|
|
|
ERR("Link %d couldn't be found\n", Item->iLink);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Item->mask & LIF_ITEMID)
|
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
nc = min(lstrlenW(Item->szID), MAX_LINKID_TEXT - 1);
|
|
|
|
szId = Alloc((nc + 1) * sizeof(WCHAR));
|
|
|
|
if(szId)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
lstrcpynW(szId, Item->szID, nc + 1);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
2006-01-06 13:08:09 +01:00
|
|
|
else
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
ERR("Unable to allocate memory for link id\n");
|
|
|
|
return FALSE;
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Item->mask & LIF_URL)
|
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
nc = min(lstrlenW(Item->szUrl), L_MAX_URL_LENGTH - 1);
|
|
|
|
szUrl = Alloc((nc + 1) * sizeof(WCHAR));
|
|
|
|
if(szUrl)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
lstrcpynW(szUrl, Item->szUrl, nc + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-02-13 21:18:24 +01:00
|
|
|
Free(szId);
|
2007-02-19 16:25:01 +01:00
|
|
|
|
2006-01-06 13:08:09 +01:00
|
|
|
ERR("Unable to allocate memory for link url\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Item->mask & LIF_ITEMID)
|
|
|
|
{
|
2007-02-13 21:18:24 +01:00
|
|
|
Free(di->u.Link.szID);
|
2006-01-06 13:08:09 +01:00
|
|
|
di->u.Link.szID = szId;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Item->mask & LIF_URL)
|
|
|
|
{
|
2007-02-13 21:18:24 +01:00
|
|
|
Free(di->u.Link.szUrl);
|
2006-01-06 13:08:09 +01:00
|
|
|
di->u.Link.szUrl = szUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Item->mask & LIF_STATE)
|
|
|
|
{
|
|
|
|
UINT oldstate = di->u.Link.state;
|
|
|
|
/* clear the masked bits */
|
|
|
|
di->u.Link.state &= ~(Item->stateMask & LIS_MASK);
|
|
|
|
/* copy the bits */
|
|
|
|
di->u.Link.state |= (Item->state & Item->stateMask) & LIS_MASK;
|
|
|
|
Repaint = (oldstate != di->u.Link.state);
|
|
|
|
|
|
|
|
/* update the focus */
|
|
|
|
SYSLINK_SetFocusLink(infoPtr, ((di->u.Link.state & LIS_FOCUSED) ? di : NULL));
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(Repaint)
|
|
|
|
{
|
|
|
|
SYSLINK_RepaintLink(infoPtr, di);
|
|
|
|
}
|
|
|
|
|
2006-01-06 13:08:09 +01:00
|
|
|
return TRUE;
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_GetItem
|
|
|
|
* Retrieves the states and attributes of a link item.
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static LRESULT SYSLINK_GetItem (const SYSLINK_INFO *infoPtr, PLITEM Item)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM di;
|
|
|
|
|
|
|
|
if(!(Item->mask & LIF_ITEMINDEX) || !(Item->mask & (LIF_FLAGSMASK)))
|
|
|
|
{
|
|
|
|
ERR("Invalid Flags!\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
di = SYSLINK_GetLinkItemByIndex(infoPtr, Item->iLink);
|
|
|
|
if(di == NULL)
|
|
|
|
{
|
|
|
|
ERR("Link %d couldn't be found\n", Item->iLink);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Item->mask & LIF_STATE)
|
|
|
|
{
|
|
|
|
Item->state = (di->u.Link.state & Item->stateMask);
|
|
|
|
if(!infoPtr->HasFocus)
|
|
|
|
{
|
|
|
|
/* remove the LIS_FOCUSED bit if the control doesn't have focus */
|
|
|
|
Item->state &= ~LIS_FOCUSED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Item->mask & LIF_ITEMID)
|
|
|
|
{
|
|
|
|
if(di->u.Link.szID)
|
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
lstrcpyW(Item->szID, di->u.Link.szID);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Item->szID[0] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Item->mask & LIF_URL)
|
|
|
|
{
|
|
|
|
if(di->u.Link.szUrl)
|
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
lstrcpyW(Item->szUrl, di->u.Link.szUrl);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Item->szUrl[0] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-11-21 14:34:06 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_PtInDocItem
|
|
|
|
* Determines if a point is in the region of a document item
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static BOOL SYSLINK_PtInDocItem (const DOC_ITEM *DocItem, POINT pt)
|
2005-11-21 14:34:06 +01:00
|
|
|
{
|
|
|
|
PDOC_TEXTBLOCK bl;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
bl = DocItem->Blocks;
|
|
|
|
if (bl != NULL)
|
|
|
|
{
|
|
|
|
n = DocItem->nText;
|
|
|
|
|
|
|
|
while(n > 0)
|
|
|
|
{
|
|
|
|
if (PtInRect(&bl->rc, pt))
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
n -= bl->nChars + bl->nSkip;
|
|
|
|
bl++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_HitTest
|
|
|
|
* Determines the link the user clicked on.
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static LRESULT SYSLINK_HitTest (const SYSLINK_INFO *infoPtr, PLHITTESTINFO HitTest)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM Current;
|
|
|
|
int id = 0;
|
|
|
|
|
2016-05-20 07:04:22 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(Current, &infoPtr->Items, DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
if(Current->Type == slLink)
|
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
if(SYSLINK_PtInDocItem(Current, HitTest->pt))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
HitTest->item.mask = 0;
|
|
|
|
HitTest->item.iLink = id;
|
|
|
|
HitTest->item.state = 0;
|
|
|
|
HitTest->item.stateMask = 0;
|
|
|
|
if(Current->u.Link.szID)
|
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
lstrcpyW(HitTest->item.szID, Current->u.Link.szID);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HitTest->item.szID[0] = 0;
|
|
|
|
}
|
|
|
|
if(Current->u.Link.szUrl)
|
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
lstrcpyW(HitTest->item.szUrl, Current->u.Link.szUrl);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HitTest->item.szUrl[0] = 0;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
id++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_GetIdealHeight
|
|
|
|
* Returns the preferred height of a link at the current control's width.
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static LRESULT SYSLINK_GetIdealHeight (const SYSLINK_INFO *infoPtr)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
HDC hdc = GetDC(infoPtr->Self);
|
|
|
|
if(hdc != NULL)
|
|
|
|
{
|
|
|
|
LRESULT height;
|
|
|
|
TEXTMETRICW tm;
|
|
|
|
HGDIOBJ hOldFont = SelectObject(hdc, infoPtr->Font);
|
|
|
|
|
|
|
|
if(GetTextMetricsW(hdc, &tm))
|
|
|
|
{
|
|
|
|
height = tm.tmHeight;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
height = 0;
|
|
|
|
}
|
|
|
|
SelectObject(hdc, hOldFont);
|
|
|
|
ReleaseDC(infoPtr->Self, hdc);
|
|
|
|
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_SendParentNotify
|
|
|
|
* Sends a WM_NOTIFY message to the parent window.
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static LRESULT SYSLINK_SendParentNotify (const SYSLINK_INFO *infoPtr, UINT code, const DOC_ITEM *Link, int iLink)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
NMLINK nml;
|
|
|
|
|
|
|
|
nml.hdr.hwndFrom = infoPtr->Self;
|
2004-08-25 19:33:01 +02:00
|
|
|
nml.hdr.idFrom = GetWindowLongPtrW(infoPtr->Self, GWLP_ID);
|
2004-08-06 21:17:49 +02:00
|
|
|
nml.hdr.code = code;
|
|
|
|
|
|
|
|
nml.item.mask = 0;
|
|
|
|
nml.item.iLink = iLink;
|
|
|
|
nml.item.state = 0;
|
|
|
|
nml.item.stateMask = 0;
|
|
|
|
if(Link->u.Link.szID)
|
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
lstrcpyW(nml.item.szID, Link->u.Link.szID);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nml.item.szID[0] = 0;
|
|
|
|
}
|
|
|
|
if(Link->u.Link.szUrl)
|
|
|
|
{
|
2006-01-06 13:08:09 +01:00
|
|
|
lstrcpyW(nml.item.szUrl, Link->u.Link.szUrl);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nml.item.szUrl[0] = 0;
|
|
|
|
}
|
|
|
|
|
2007-12-29 16:37:34 +01:00
|
|
|
return SendMessageW(infoPtr->Notify, WM_NOTIFY, nml.hdr.idFrom, (LPARAM)&nml);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_SetFocus
|
|
|
|
* Handles receiving the input focus.
|
|
|
|
*/
|
2009-01-30 22:42:29 +01:00
|
|
|
static LRESULT SYSLINK_SetFocus (SYSLINK_INFO *infoPtr)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM Focus;
|
|
|
|
|
|
|
|
infoPtr->HasFocus = TRUE;
|
|
|
|
|
2005-11-21 14:34:06 +01:00
|
|
|
/* We always select the first link, even if we activated the control using
|
|
|
|
SHIFT+TAB. This is the default behavior */
|
2004-08-06 21:17:49 +02:00
|
|
|
Focus = SYSLINK_GetNextLink(infoPtr, NULL);
|
|
|
|
if(Focus != NULL)
|
|
|
|
{
|
|
|
|
SYSLINK_SetFocusLink(infoPtr, Focus);
|
2009-06-08 18:13:22 +02:00
|
|
|
SYSLINK_RepaintLink(infoPtr, Focus);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_KillFocus
|
|
|
|
* Handles losing the input focus.
|
|
|
|
*/
|
2009-01-30 22:42:29 +01:00
|
|
|
static LRESULT SYSLINK_KillFocus (SYSLINK_INFO *infoPtr)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM Focus;
|
|
|
|
|
|
|
|
infoPtr->HasFocus = FALSE;
|
|
|
|
Focus = SYSLINK_GetFocusLink(infoPtr, NULL);
|
|
|
|
|
|
|
|
if(Focus != NULL)
|
|
|
|
{
|
|
|
|
SYSLINK_RepaintLink(infoPtr, Focus);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_LinkAtPt
|
|
|
|
* Returns a link at the specified position
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static PDOC_ITEM SYSLINK_LinkAtPt (const SYSLINK_INFO *infoPtr, const POINT *pt, int *LinkId, BOOL MustBeEnabled)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM Current;
|
|
|
|
int id = 0;
|
|
|
|
|
2016-05-20 07:04:22 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(Current, &infoPtr->Items, DOC_ITEM, entry)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
if((Current->Type == slLink) && SYSLINK_PtInDocItem(Current, *pt) &&
|
2015-10-20 13:03:51 +02:00
|
|
|
(!MustBeEnabled || (Current->u.Link.state & LIS_ENABLED)))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
if(LinkId != NULL)
|
|
|
|
{
|
|
|
|
*LinkId = id;
|
|
|
|
}
|
|
|
|
return Current;
|
|
|
|
}
|
|
|
|
id++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_LButtonDown
|
|
|
|
* Handles mouse clicks
|
|
|
|
*/
|
2009-01-30 22:42:29 +01:00
|
|
|
static LRESULT SYSLINK_LButtonDown (SYSLINK_INFO *infoPtr, const POINT *pt)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM Current, Old;
|
|
|
|
int id;
|
|
|
|
|
|
|
|
Current = SYSLINK_LinkAtPt(infoPtr, pt, &id, TRUE);
|
|
|
|
if(Current != NULL)
|
|
|
|
{
|
2005-11-21 14:34:06 +01:00
|
|
|
SetFocus(infoPtr->Self);
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
Old = SYSLINK_SetFocusLink(infoPtr, Current);
|
|
|
|
if(Old != NULL && Old != Current)
|
|
|
|
{
|
|
|
|
SYSLINK_RepaintLink(infoPtr, Old);
|
|
|
|
}
|
|
|
|
infoPtr->MouseDownID = id;
|
|
|
|
SYSLINK_RepaintLink(infoPtr, Current);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_LButtonUp
|
|
|
|
* Handles mouse clicks
|
|
|
|
*/
|
2009-01-30 22:42:29 +01:00
|
|
|
static LRESULT SYSLINK_LButtonUp (SYSLINK_INFO *infoPtr, const POINT *pt)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
if(infoPtr->MouseDownID > -1)
|
|
|
|
{
|
|
|
|
PDOC_ITEM Current;
|
|
|
|
int id;
|
|
|
|
|
|
|
|
Current = SYSLINK_LinkAtPt(infoPtr, pt, &id, TRUE);
|
|
|
|
if((Current != NULL) && (Current->u.Link.state & LIS_FOCUSED) && (infoPtr->MouseDownID == id))
|
|
|
|
{
|
|
|
|
SYSLINK_SendParentNotify(infoPtr, NM_CLICK, Current, id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
infoPtr->MouseDownID = -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_OnEnter
|
|
|
|
* Handles ENTER key events
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static BOOL SYSLINK_OnEnter (const SYSLINK_INFO *infoPtr)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2009-10-20 19:55:12 +02:00
|
|
|
if(infoPtr->HasFocus && !infoPtr->IgnoreReturn)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM Focus;
|
|
|
|
int id;
|
|
|
|
|
|
|
|
Focus = SYSLINK_GetFocusLink(infoPtr, &id);
|
2009-10-20 19:55:12 +02:00
|
|
|
if(Focus)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
SYSLINK_SendParentNotify(infoPtr, NM_RETURN, Focus, id);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSKEY_SelectNextPrevLink
|
|
|
|
* Changes the currently focused link
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static BOOL SYSKEY_SelectNextPrevLink (const SYSLINK_INFO *infoPtr, BOOL Prev)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
if(infoPtr->HasFocus)
|
|
|
|
{
|
|
|
|
PDOC_ITEM Focus;
|
|
|
|
int id;
|
|
|
|
|
|
|
|
Focus = SYSLINK_GetFocusLink(infoPtr, &id);
|
|
|
|
if(Focus != NULL)
|
|
|
|
{
|
|
|
|
PDOC_ITEM NewFocus, OldFocus;
|
|
|
|
|
|
|
|
if(Prev)
|
|
|
|
NewFocus = SYSLINK_GetPrevLink(infoPtr, Focus);
|
|
|
|
else
|
|
|
|
NewFocus = SYSLINK_GetNextLink(infoPtr, Focus);
|
|
|
|
|
|
|
|
if(NewFocus != NULL)
|
|
|
|
{
|
|
|
|
OldFocus = SYSLINK_SetFocusLink(infoPtr, NewFocus);
|
|
|
|
|
2009-06-08 18:13:22 +02:00
|
|
|
if(OldFocus && OldFocus != NewFocus)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
SYSLINK_RepaintLink(infoPtr, OldFocus);
|
|
|
|
}
|
|
|
|
SYSLINK_RepaintLink(infoPtr, NewFocus);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSKEY_SelectNextPrevLink
|
|
|
|
* Determines if there's a next or previous link to decide whether the control
|
|
|
|
* should capture the tab key message
|
|
|
|
*/
|
2007-04-02 18:49:00 +02:00
|
|
|
static BOOL SYSLINK_NoNextLink (const SYSLINK_INFO *infoPtr, BOOL Prev)
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
|
|
|
PDOC_ITEM Focus, NewFocus;
|
|
|
|
|
|
|
|
Focus = SYSLINK_GetFocusLink(infoPtr, NULL);
|
|
|
|
if(Prev)
|
|
|
|
NewFocus = SYSLINK_GetPrevLink(infoPtr, Focus);
|
|
|
|
else
|
|
|
|
NewFocus = SYSLINK_GetNextLink(infoPtr, Focus);
|
|
|
|
|
|
|
|
return NewFocus == NULL;
|
|
|
|
}
|
|
|
|
|
2007-02-19 16:25:01 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_GetIdealSize
|
|
|
|
* Calculates the ideal size of a link control at a given maximum width.
|
|
|
|
*/
|
2017-12-01 06:30:17 +01:00
|
|
|
static LONG SYSLINK_GetIdealSize (const SYSLINK_INFO *infoPtr, int cxMaxWidth, SIZE *lpSize)
|
2007-02-19 16:25:01 +01:00
|
|
|
{
|
|
|
|
RECT rc;
|
|
|
|
HDC hdc;
|
|
|
|
|
|
|
|
rc.left = rc.top = rc.bottom = 0;
|
|
|
|
rc.right = cxMaxWidth;
|
|
|
|
|
|
|
|
hdc = GetDC(infoPtr->Self);
|
|
|
|
if (hdc != NULL)
|
|
|
|
{
|
|
|
|
HGDIOBJ hOldFont = SelectObject(hdc, infoPtr->Font);
|
|
|
|
|
|
|
|
SYSLINK_Render(infoPtr, hdc, &rc);
|
|
|
|
|
|
|
|
SelectObject(hdc, hOldFont);
|
|
|
|
ReleaseDC(infoPtr->Self, hdc);
|
|
|
|
|
|
|
|
lpSize->cx = rc.right;
|
|
|
|
lpSize->cy = rc.bottom;
|
|
|
|
}
|
2017-12-01 06:30:17 +01:00
|
|
|
|
|
|
|
return rc.bottom;
|
2007-02-19 16:25:01 +01:00
|
|
|
}
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SysLinkWindowProc
|
|
|
|
*/
|
|
|
|
static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
|
|
|
|
WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
SYSLINK_INFO *infoPtr;
|
|
|
|
|
2022-02-07 07:07:55 +01:00
|
|
|
TRACE("hwnd %p, msg %04x, wparam %Ix, lParam %Ix\n", hwnd, message, wParam, lParam);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
2004-08-25 19:33:01 +02:00
|
|
|
infoPtr = (SYSLINK_INFO *)GetWindowLongPtrW(hwnd, 0);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
if (!infoPtr && message != WM_CREATE)
|
2011-04-24 05:49:33 +02:00
|
|
|
return DefWindowProcW(hwnd, message, wParam, lParam);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
switch(message) {
|
2005-11-08 13:52:35 +01:00
|
|
|
case WM_PRINTCLIENT:
|
2004-08-06 21:17:49 +02:00
|
|
|
case WM_PAINT:
|
2005-03-25 11:26:10 +01:00
|
|
|
return SYSLINK_Paint (infoPtr, (HDC)wParam);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
2009-10-20 19:47:50 +02:00
|
|
|
case WM_ERASEBKGND:
|
2012-01-12 12:20:46 +01:00
|
|
|
if (!(infoPtr->Style & LWS_TRANSPARENT))
|
|
|
|
{
|
|
|
|
HDC hdc = (HDC)wParam;
|
|
|
|
HBRUSH brush = CreateSolidBrush( comctl32_color.clrWindow );
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
GetClipBox( hdc, &rect );
|
|
|
|
FillRect( hdc, &rect, brush );
|
|
|
|
DeleteObject( brush );
|
|
|
|
return 1;
|
|
|
|
}
|
2011-09-26 16:22:40 +02:00
|
|
|
return 0;
|
2009-10-20 19:47:50 +02:00
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
case WM_SETCURSOR:
|
|
|
|
{
|
|
|
|
LHITTESTINFO ht;
|
|
|
|
DWORD mp = GetMessagePos();
|
|
|
|
|
2004-11-24 19:28:31 +01:00
|
|
|
ht.pt.x = (short)LOWORD(mp);
|
|
|
|
ht.pt.y = (short)HIWORD(mp);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
ScreenToClient(infoPtr->Self, &ht.pt);
|
|
|
|
if(SYSLINK_HitTest (infoPtr, &ht))
|
|
|
|
{
|
|
|
|
SetCursor(LoadCursorW(0, (LPCWSTR)IDC_HAND));
|
|
|
|
return TRUE;
|
|
|
|
}
|
2011-04-24 05:49:33 +02:00
|
|
|
|
|
|
|
return DefWindowProcW(hwnd, message, wParam, lParam);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case WM_SIZE:
|
|
|
|
{
|
2007-02-19 16:25:01 +01:00
|
|
|
RECT rcClient;
|
|
|
|
if (GetClientRect(infoPtr->Self, &rcClient))
|
2004-08-06 21:17:49 +02:00
|
|
|
{
|
2007-02-19 16:25:01 +01:00
|
|
|
HDC hdc = GetDC(infoPtr->Self);
|
|
|
|
if(hdc != NULL)
|
|
|
|
{
|
|
|
|
SYSLINK_Render(infoPtr, hdc, &rcClient);
|
|
|
|
ReleaseDC(infoPtr->Self, hdc);
|
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case WM_GETFONT:
|
|
|
|
return (LRESULT)infoPtr->Font;
|
|
|
|
|
|
|
|
case WM_SETFONT:
|
|
|
|
return (LRESULT)SYSLINK_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam);
|
|
|
|
|
|
|
|
case WM_SETTEXT:
|
|
|
|
SYSLINK_SetText(infoPtr, (LPWSTR)lParam);
|
2011-04-24 05:49:33 +02:00
|
|
|
return DefWindowProcW(hwnd, message, wParam, lParam);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
case WM_LBUTTONDOWN:
|
|
|
|
{
|
|
|
|
POINT pt;
|
2006-10-25 17:41:48 +02:00
|
|
|
pt.x = (short)LOWORD(lParam);
|
|
|
|
pt.y = (short)HIWORD(lParam);
|
2009-01-30 22:42:29 +01:00
|
|
|
return SYSLINK_LButtonDown(infoPtr, &pt);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
case WM_LBUTTONUP:
|
|
|
|
{
|
|
|
|
POINT pt;
|
2006-10-25 17:41:48 +02:00
|
|
|
pt.x = (short)LOWORD(lParam);
|
|
|
|
pt.y = (short)HIWORD(lParam);
|
2009-01-30 22:42:29 +01:00
|
|
|
return SYSLINK_LButtonUp(infoPtr, &pt);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case WM_KEYDOWN:
|
|
|
|
{
|
|
|
|
switch(wParam)
|
|
|
|
{
|
|
|
|
case VK_RETURN:
|
|
|
|
SYSLINK_OnEnter(infoPtr);
|
|
|
|
return 0;
|
|
|
|
case VK_TAB:
|
|
|
|
{
|
|
|
|
BOOL shift = GetKeyState(VK_SHIFT) & 0x8000;
|
|
|
|
SYSKEY_SelectNextPrevLink(infoPtr, shift);
|
|
|
|
return 0;
|
|
|
|
}
|
2011-04-24 05:49:33 +02:00
|
|
|
default:
|
|
|
|
return DefWindowProcW(hwnd, message, wParam, lParam);
|
2004-08-06 21:17:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
case WM_GETDLGCODE:
|
|
|
|
{
|
|
|
|
LRESULT Ret = DLGC_HASSETSEL;
|
|
|
|
int vk = (lParam != 0 ? (int)((LPMSG)lParam)->wParam : 0);
|
|
|
|
switch(vk)
|
|
|
|
{
|
|
|
|
case VK_RETURN:
|
|
|
|
Ret |= DLGC_WANTMESSAGE;
|
|
|
|
break;
|
|
|
|
case VK_TAB:
|
|
|
|
{
|
|
|
|
BOOL shift = GetKeyState(VK_SHIFT) & 0x8000;
|
|
|
|
if(!SYSLINK_NoNextLink(infoPtr, shift))
|
|
|
|
{
|
|
|
|
Ret |= DLGC_WANTTAB;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Ret |= DLGC_WANTCHARS;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
case WM_NCHITTEST:
|
|
|
|
{
|
|
|
|
POINT pt;
|
|
|
|
RECT rc;
|
2006-10-25 17:41:48 +02:00
|
|
|
pt.x = (short)LOWORD(lParam);
|
|
|
|
pt.y = (short)HIWORD(lParam);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
GetClientRect(infoPtr->Self, &rc);
|
|
|
|
ScreenToClient(infoPtr->Self, &pt);
|
|
|
|
if(pt.x < 0 || pt.y < 0 || pt.x > rc.right || pt.y > rc.bottom)
|
|
|
|
{
|
|
|
|
return HTNOWHERE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(SYSLINK_LinkAtPt(infoPtr, &pt, NULL, FALSE))
|
|
|
|
{
|
|
|
|
return HTCLIENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
return HTTRANSPARENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
case LM_HITTEST:
|
|
|
|
return SYSLINK_HitTest(infoPtr, (PLHITTESTINFO)lParam);
|
|
|
|
|
|
|
|
case LM_SETITEM:
|
|
|
|
return SYSLINK_SetItem(infoPtr, (PLITEM)lParam);
|
|
|
|
|
|
|
|
case LM_GETITEM:
|
|
|
|
return SYSLINK_GetItem(infoPtr, (PLITEM)lParam);
|
|
|
|
|
|
|
|
case LM_GETIDEALHEIGHT:
|
2007-02-19 16:25:01 +01:00
|
|
|
if (lParam)
|
2017-12-01 06:30:17 +01:00
|
|
|
return SYSLINK_GetIdealSize(infoPtr, (int)wParam, (SIZE *)lParam);
|
|
|
|
else
|
|
|
|
return SYSLINK_GetIdealHeight(infoPtr);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
case WM_SETFOCUS:
|
2009-01-30 22:42:29 +01:00
|
|
|
return SYSLINK_SetFocus(infoPtr);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
case WM_KILLFOCUS:
|
2009-01-30 22:42:29 +01:00
|
|
|
return SYSLINK_KillFocus(infoPtr);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
2005-04-11 14:58:30 +02:00
|
|
|
case WM_ENABLE:
|
2007-02-19 16:25:01 +01:00
|
|
|
infoPtr->Style &= ~WS_DISABLED;
|
|
|
|
infoPtr->Style |= (wParam ? 0 : WS_DISABLED);
|
|
|
|
InvalidateRect (infoPtr->Self, NULL, FALSE);
|
|
|
|
return 0;
|
2005-04-11 14:58:30 +02:00
|
|
|
|
|
|
|
case WM_STYLECHANGED:
|
|
|
|
if (wParam == GWL_STYLE)
|
|
|
|
{
|
|
|
|
infoPtr->Style = ((LPSTYLESTRUCT)lParam)->styleNew;
|
|
|
|
|
|
|
|
InvalidateRect(infoPtr->Self, NULL, TRUE);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
case WM_CREATE:
|
2016-05-20 07:04:22 +02:00
|
|
|
{
|
|
|
|
CREATESTRUCTW *cs = (CREATESTRUCTW*)lParam;
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
/* allocate memory for info struct */
|
2005-03-25 21:49:00 +01:00
|
|
|
infoPtr = Alloc (sizeof(SYSLINK_INFO));
|
2004-08-06 21:17:49 +02:00
|
|
|
if (!infoPtr) return -1;
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
|
2004-08-06 21:17:49 +02:00
|
|
|
|
|
|
|
/* initialize the info struct */
|
|
|
|
infoPtr->Self = hwnd;
|
2016-05-20 07:04:22 +02:00
|
|
|
infoPtr->Notify = cs->hwndParent;
|
|
|
|
infoPtr->Style = cs->style;
|
2004-08-06 21:17:49 +02:00
|
|
|
infoPtr->Font = 0;
|
|
|
|
infoPtr->LinkFont = 0;
|
2016-05-20 07:04:22 +02:00
|
|
|
list_init(&infoPtr->Items);
|
2004-08-06 21:17:49 +02:00
|
|
|
infoPtr->HasFocus = FALSE;
|
|
|
|
infoPtr->MouseDownID = -1;
|
2009-05-18 17:59:13 +02:00
|
|
|
infoPtr->TextColor = comctl32_color.clrWindowText;
|
2011-09-26 16:22:40 +02:00
|
|
|
infoPtr->LinkColor = comctl32_color.clrHighlight;
|
2009-05-18 17:59:13 +02:00
|
|
|
infoPtr->VisitedColor = comctl32_color.clrHighlight;
|
2005-11-21 14:34:06 +01:00
|
|
|
infoPtr->BreakChar = ' ';
|
2009-10-20 19:55:12 +02:00
|
|
|
infoPtr->IgnoreReturn = infoPtr->Style & LWS_IGNORERETURN;
|
2004-08-06 21:17:49 +02:00
|
|
|
TRACE("SysLink Ctrl creation, hwnd=%p\n", hwnd);
|
2016-05-20 07:04:22 +02:00
|
|
|
SYSLINK_SetText(infoPtr, cs->lpszName);
|
2004-08-06 21:17:49 +02:00
|
|
|
return 0;
|
2016-05-20 07:04:22 +02:00
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
case WM_DESTROY:
|
|
|
|
TRACE("SysLink Ctrl destruction, hwnd=%p\n", hwnd);
|
|
|
|
SYSLINK_ClearDoc(infoPtr);
|
2004-12-08 20:36:23 +01:00
|
|
|
if(infoPtr->Font != 0) DeleteObject(infoPtr->Font);
|
|
|
|
if(infoPtr->LinkFont != 0) DeleteObject(infoPtr->LinkFont);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, 0, 0);
|
2005-03-25 21:49:00 +01:00
|
|
|
Free (infoPtr);
|
2004-08-06 21:17:49 +02:00
|
|
|
return 0;
|
|
|
|
|
2009-05-18 17:59:13 +02:00
|
|
|
case WM_SYSCOLORCHANGE:
|
|
|
|
COMCTL32_RefreshSysColors();
|
|
|
|
return 0;
|
|
|
|
|
2004-08-06 21:17:49 +02:00
|
|
|
default:
|
2008-07-22 00:18:09 +02:00
|
|
|
if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message))
|
2005-11-21 14:34:06 +01:00
|
|
|
{
|
2022-02-07 07:07:55 +01:00
|
|
|
ERR("unknown msg %04x, wp %Ix, lp %Ix\n", message, wParam, lParam );
|
2005-11-21 14:34:06 +01:00
|
|
|
}
|
2004-08-06 21:17:49 +02:00
|
|
|
return DefWindowProcW(hwnd, message, wParam, lParam);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_Register [Internal]
|
|
|
|
*
|
|
|
|
* Registers the SysLink window class.
|
|
|
|
*/
|
|
|
|
VOID SYSLINK_Register (void)
|
|
|
|
{
|
|
|
|
WNDCLASSW wndClass;
|
|
|
|
|
|
|
|
ZeroMemory (&wndClass, sizeof(wndClass));
|
|
|
|
wndClass.style = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW;
|
2004-11-06 04:49:03 +01:00
|
|
|
wndClass.lpfnWndProc = SysLinkWindowProc;
|
2004-08-06 21:17:49 +02:00
|
|
|
wndClass.cbClsExtra = 0;
|
|
|
|
wndClass.cbWndExtra = sizeof (SYSLINK_INFO *);
|
|
|
|
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
|
|
|
|
wndClass.lpszClassName = WC_LINK;
|
|
|
|
|
|
|
|
RegisterClassW (&wndClass);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SYSLINK_Unregister [Internal]
|
|
|
|
*
|
|
|
|
* Unregisters the SysLink window class.
|
|
|
|
*/
|
|
|
|
VOID SYSLINK_Unregister (void)
|
|
|
|
{
|
|
|
|
UnregisterClassW (WC_LINK, NULL);
|
|
|
|
}
|