void CNativeW::Replace( const wchar_t* pszFrom, int nFromLen, const wchar_t* pszTo, int nToLen )
{
	CNativeW	cmemWork;
	int			nBgnOld = 0;
	int			nBgn = 0;
	while( nBgn <= GetStringLength() - nFromLen ){
		if( 0 == wmemcmp( &GetStringPtr()[nBgn], pszFrom, nFromLen ) ){
			if( nBgnOld == 0 && nFromLen <= nToLen ){
				cmemWork.AllocStringBuffer( GetStringLength() );
			}
			if( 0  < nBgn - nBgnOld ){
				cmemWork.AppendString( &GetStringPtr()[nBgnOld], nBgn - nBgnOld );
			}
			cmemWork.AppendString( pszTo, nToLen );
			nBgn = nBgn + nFromLen;
			nBgnOld = nBgn;
		}else{
			nBgn++;
		}
	}
	if( nBgnOld != 0 ){
		if( 0  < GetStringLength() - nBgnOld ){
			cmemWork.AppendString( &GetStringPtr()[nBgnOld], GetStringLength() - nBgnOld );
		}
		SetNativeData( cmemWork );
	}else{
		if( this->GetStringPtr() == NULL ){
			this->SetString(L"");
		}
	}
}
Beispiel #2
0
void StringCopyBuilder::BuildStringUT(WEBC_CHAR *pStringBuffer)
{
  #if (WEBC_SUPPORT_UNICODE)
	if (mpStr8)
	{
		const char *copyFrom = mpStr8;
		WEBC_CHAR tempStr[32];
		int charsLeft = GetStringLength(), toCopy;
		while (charsLeft > 0)
		{
			toCopy = EBSMIN(31, charsLeft);
			webc_c_strncpy(tempStr, copyFrom, toCopy);
			tc_movebytes(pStringBuffer, tempStr, toCopy*sizeof(WEBC_CHAR));
			pStringBuffer += toCopy;
			copyFrom += toCopy;
			charsLeft -= toCopy;
		}
	}
	else
	{
		tc_movebytes(pStringBuffer, mpStr, GetStringLength()*sizeof(WEBC_CHAR));
	}
  #else
	tc_movebytes(pStringBuffer, mpStr, GetStringLength()*sizeof(WEBC_CHAR));
  #endif	
}
/* 文字列置換(日本語考慮版) */
void CNativeA::Replace_j( const char* pszFrom, const char* pszTo )
{
	CNativeA	cmemWork;
	int			nFromLen = strlen( pszFrom );
	int			nToLen = strlen( pszTo );
	int			nBgnOld = 0;
	int			nBgn = 0;
	while( nBgn <= GetStringLength() - nFromLen ){
		if( 0 == memcmp( &GetStringPtr()[nBgn], pszFrom, nFromLen ) ){
			if( 0  < nBgn - nBgnOld ){
				cmemWork.AppendString( &GetStringPtr()[nBgnOld], nBgn - nBgnOld );
			}
			cmemWork.AppendString( pszTo, nToLen );
			nBgn = nBgn + nFromLen;
			nBgnOld = nBgn;
		}else{
			if( _IS_SJIS_1( (unsigned char)GetStringPtr()[nBgn] ) ) nBgn++;
			nBgn++;
		}
	}
	if( 0  < GetStringLength() - nBgnOld ){
		cmemWork.AppendString( &GetStringPtr()[nBgnOld], GetStringLength() - nBgnOld );
	}
	SetNativeData( cmemWork );
	return;
}
Beispiel #4
0
////////////////////////////////////////////////////////////
// ---------------------------------------------------------
// clears the current string
void WI_String::ClearString ( )
{
	for ( WI_Int z = 0; z < GetStringLength ( ); z++ )
	{
		str[ z ] = 0;
	}
}
Beispiel #5
0
////////////////////////////////////////////////////////////
// ---------------------------------------------------------
// returns the string as a LPWSTR
LPWSTR WI_String::GetAsLPWSTR ( )
{
	wchar_t* szWideArray = new wchar_t[ WI_MAX_SIZE ];
	
	mbstowcs ( szWideArray, str, GetStringLength ( ) );

	return szWideArray;
}
// 任意位置の文字取得。nIndexは文字単位。
char CNativeA::operator[](int nIndex) const
{
	if( nIndex < GetStringLength() ){
		return GetStringPtr()[nIndex];
	}else{
		return 0;
	}
}
Beispiel #7
0
////////////////////////////////////////////////////////////
// ---------------------------------------------------------
// extracts a char at index
char WI_String::ExtractChar ( WI_Int index )
{
	if ( index <= GetStringLength ( ) )
	{
		return str[ index ];
	}

	return 0;
}
void StdCompilerINIRead::String(char **pszString, RawCompileType eType)
{
	// Get length
	size_t iLength = GetStringLength(eType);
	// Read data
	StdBuf Buf = ReadString(iLength, eType, true);
	// Set
	*pszString = reinterpret_cast<char *>(Buf.GrabPointer());
}
Beispiel #9
0
void ToLowerCaseBuilder::BuildStringUT(WEBC_CHAR *pStringBuffer)
{
int n;
	
	for (n=0; n<GetStringLength(); n++)
	{
		pStringBuffer[n] = LOWERCASE(mpStr[n]);
	}
}
Beispiel #10
0
WEBC_CHAR *StringBuilder::MallocString(char *file, long line)
{
	WEBC_CHAR *str = (WEBC_CHAR *) WEBC_DEBUG_MALLOC(sizeof(WEBC_CHAR) * (GetStringLength() + 1), file, line,"MallocString", 0);
	if (str)
	{
		BuildString(str);
	}
	return str;
}
Beispiel #11
0
////////////////////////////////////////////////////////////
// ---------------------------------------------------------
// trim string as tho it were assembly language source
void WI_String::AsmTrim ( )
{
	char* output;
	output = new char[ GetStringLength ( ) + 10 ];

	WI_StrTrimCommentsToAssembly ( str, output );
	set ( strlen ( output ) + 10, output );

	// WI_DELETE_PTR ( output );
}
Beispiel #12
0
////////////////////////////////////////////////////////////
// ---------------------------------------------------------
void WI_String::TrimComments ( char start_c,char stop_c )
{
	char* output = new char[ GetStringLength ( ) + 10 ];

	WI_StrTrimComments ( str, output, start_c, stop_c );

	set ( strlen ( output ) + 10, output );

	// WI_DELETE_PTR ( output );
}
Beispiel #13
0
//called to get information about a character. This assumes that the index is within range
void CTextureString::GetCharInfo(uint32 nIndex, int32& nX, int32& nY, bool& bVisible, const CTextureStringGlyph*& pGlyph)
{
	if ( !(nIndex < GetStringLength()))
		ASSERT(!"Error: Invalid index into the character info.");

	nX			= m_pCharacters[nIndex].m_nXPos;
	nY			= m_pCharacters[nIndex].m_nYPos;
	pGlyph		= m_pCharacters[nIndex].m_pGlyph;
	bVisible	= m_pCharacters[nIndex].m_bVisible;
}
Beispiel #14
0
////////////////////////////////////////////////////////////
// ---------------------------------------------------------
// reverse the string
void WI_String::ReverseString ( ) 
{
	char* temp;
	temp = new char[ GetStringLength ( )+10 ];

	WI_StrReverses ( str,temp );
	set ( strlen ( temp ) + 10, temp );

	// WI_DELETE_PTR ( temp );;
}
Beispiel #15
0
GXLRESULT CMOListBox::GetStringW(GXINT nIndex, clStringW& str)
{
  GXINT nLen = GetStringLength(nIndex);
  if(nLen <= 0) {
    return 0;
  }
  WCHAR* pBuf = str.GetBuffer(nLen + 1);
  GXLRESULT lr = gxSendMessage(m_hWnd, GXLB_GETTEXT, nIndex, (GXLPARAM)pBuf);
  str.ReleaseBuffer();
  return lr;
}
Beispiel #16
0
SetupMessageDisplayList(FontEntryPtr fontEntry, int num, char *message[])
{
    FontInfoPtr     fontinfo = fontEntry->fontinfo;
    GLfloat         scaleFactor;
    int             totalHeight, maxWidth, height, width;
    int             i;

    if (!fontinfo) {
	fontinfo = SuckGlyphsFromServer(dpy, fontEntry->xfont->fid);
	fontEntry->fontinfo = fontinfo;
    }
    height = fontinfo->max_ascent + fontinfo->max_descent;
    maxWidth = 0;
    for (i = 0; i < num; i++) {
	MakeStringDisplayList(fontinfo, message[i], base + i + 1);
	width = GetStringLength(fontinfo, message[i]);
	if (width > maxWidth)
	    maxWidth = width;
    }

#define SHRINK_FACTOR 25.0	/* empirical */

    totalHeight = height * num - fontinfo->max_descent;
    if (maxWidth > totalHeight) {
	scaleFactor = SHRINK_FACTOR / maxWidth;
    } else {
	scaleFactor = SHRINK_FACTOR / totalHeight;
    }

    glNewList(base, GL_COMPILE);
    glScalef(scaleFactor, scaleFactor, 1); /* 1 in Z gives glyphs constant depth */
    for (i = 0; i < num; i++) {
	glPushMatrix();
	width = GetStringLength(fontinfo, message[i]);
	glTranslatef(-width / 2.0, height * (num - i - 1) - totalHeight / 2.0, 0);
	glCallList(base + i + 1);
	glPopMatrix();
    }
    glEndList();
}
Beispiel #17
0
//given a character index, this will return the string space bounding rectangle of that string
LTRect2n CTextureString::GetCharRect(uint32 nIndex)
{
	if ( !(nIndex < GetStringLength()) )
		ASSERT(!"Error: Invalid index into the character info.");
	
	LTRect2n rRect;
	rRect.Left()	= m_pCharacters[nIndex].m_nXPos;
	rRect.Top()		= m_pCharacters[nIndex].m_nYPos;
	rRect.Right()	= rRect.Left() + m_pCharacters[nIndex].m_pGlyph->m_nTotalWidth;
	rRect.Bottom()	= rRect.Top() + GetTextureImage()->GetRowHeight();

	return rRect;
}
Beispiel #18
0
bool MBuffer::TrimRight(void)
	{
	int stringlength;
	stringlength=GetStringLength();
	int i;
	for(i=stringlength-1;i>=0;--i)
		{
		if(MStdIsSpace(mBuffer[i])==false)
			{  return true;  }

		mBuffer[i]=0;
		}

	return true;
	}
/* 大文字 */
void CNativeA::ToUpper()
{
	unsigned char*	pBuf = (unsigned char*)GetStringPtr();
	int				nBufLen = GetStringLength();
	int				i;
	int				nCharChars;
	unsigned char	uc;
	for( i = 0; i < nBufLen; ++i ){
		// 2005-09-02 D.S.Koba GetSizeOfChar
		nCharChars = CShiftJis::GetSizeOfChar( (const char *)pBuf, nBufLen, i );
		if( nCharChars == 1 ){
			uc = (unsigned char)toupper( pBuf[i] );
			pBuf[i] = uc;
		}
		else if( nCharChars == 2 ){
			/* 全角英小文字→全角英大文字 */
			if( pBuf[i] == 0x82 && pBuf[i + 1] >= 0x81 && pBuf[i + 1] <= 0x9a ){
				pBuf[i] = pBuf[i];
				pBuf[i + 1] = pBuf[i + 1] - 0x21;
//@@@ 2001.02.03 Start by MIK: ギリシャ文字変換
			//大文字:0x839f〜0x83b6
			//小文字:0x83bf〜0x83d6
			}else if( pBuf[i] == 0x83 && pBuf[i + 1] >= 0xbf && pBuf[i + 1] <= 0xd6 ){
				pBuf[i] = pBuf[i];
				pBuf[i + 1] = pBuf[i + 1] - 0x20;
//@@@ 2001.02.03 End
//@@@ 2001.02.03 Start by MIK: ロシア文字変換
			//大文字:0x8440〜0x8460
			//小文字:0x8470〜0x8491 0x847fがない!
			}else if( pBuf[i] == 0x84 && pBuf[i + 1] >= 0x70 && pBuf[i + 1] <= 0x91 && pBuf[i + 1] != 0x7f ){
				pBuf[i] = pBuf[i];
				if( pBuf[i + 1] >= 0x7f ){
					pBuf[i + 1] = pBuf[i + 1] - 0x31;
				}else{
					pBuf[i + 1] = pBuf[i + 1] - 0x30;
				}
//@@@ 2001.02.03 End
			}
		}
		if( nCharChars > 0 ){
			i += nCharChars - 1;
		}
	}
	return;
}
Beispiel #20
0
static Boolean TauntMeasureProc( char *taunt )
{
	Rect boxRect;
	short length = GetStringLength( taunt );
	char savedChar = taunt[length+1];
	Boolean result = true;
	
	boxRect.top = 0;
	boxRect.left = 0;
	boxRect.bottom = kTauntPatHeight * 8;
	boxRect.right = (kTauntPatHalfWidth * 2 * 8);
	
	taunt[length] = 'W';
	taunt[length+1] = 0;
	
	if ( SegaBoxText(&boxRect, taunt, kJustCenter, kDontDraw) < length )
		result = false;
	
	taunt[length] = 0;
	taunt[length+1] = savedChar;
	
	return result;
}
Beispiel #21
0
void StringBuilder::BuildString(WEBC_CHAR *pStringBuffer)
{
	BuildStringUT(pStringBuffer);
	pStringBuffer[GetStringLength()] = (WEBC_CHAR) 0;
}
Beispiel #22
0
BOOLEAN
CompareId (
    _In_opt_ PSTR DeviceId,
    _In_ ULONG  DeviceIdLength,
    _In_opt_ PZZSTR TargetId,
    _In_ ULONG  TargetIdLength,
    _Inout_opt_ PULONG Value
)
/*++
Character comparison between DeviceId and TargetId to the min(DeviceIdLength, TargetIdLength)

Note that TargetId is a multi_sz string. DeviceId will be used to compare with each of strings in TargetId.

When string matches and 'Value' is asked, put value of remaining TargetId into "Value" field

DeviceId -- source string for comparison, in format of ASCII string.

TargetId -- target string for comparison, in format of multi_sz string.
    TargetId format: xxxxxxxx nnn (first part is the ID to compare, second part is the value)

    Special character in TargetId:
        '?' - matches any character in DeviceId
        '*' - indicating end of TargetId, matches any characters left in DeviceId. It should be used only at the end of string.

Return Value:
    TRUE - On a match or contain
    FALSE - On a mismatch
--*/
{
    ULONG   compareLength;
    ULONG   i;
    PUCHAR  localDeviceId;
    PSTR    localStrings = TargetId;
    PUCHAR  localTargetId = (PUCHAR)localStrings;
    BOOLEAN matches = FALSE;

    if ((DeviceId == NULL) || (TargetId == NULL)) {
        // nothing to compare, return TRUE
        return TRUE;
    }

    while ( (*localStrings != '\0') || (*(localStrings + 1) != '\0') ) {
        localDeviceId = (PUCHAR)DeviceId;
        compareLength = min(DeviceIdLength, GetStringLength(localStrings, TargetIdLength));
        if (compareLength == 0) {
            return FALSE;
        }

        matches = TRUE;
        for(i = 0; i < compareLength; i++) {
            if (*localTargetId == '*') {
                localTargetId++;
                break;  // whole string match
            } else if ( (*localDeviceId == '\0') || (*localTargetId == '\0') ) {
                matches = FALSE;
                break;
            } else if ( (*localDeviceId == *localTargetId) ||
                        (*localTargetId == '?') ) {
                localDeviceId++;
                localTargetId++;
            } else {
                matches = FALSE;
                break;
            }
        }

        if (matches) {
            break;
        }

        localStrings+= GetStringLength(localStrings, TargetIdLength) + 1;
        localTargetId = (PUCHAR)localStrings;
    }

    if ( (Value != NULL) &&
         (matches == TRUE) &&
         (*localTargetId == ' ') ) {

         //convert the left part of localTargetId into a value
         localTargetId++;
         if (!StringToULONG((PSTR)localTargetId, Value)) {
             matches = FALSE;
         }
    }

    return matches;
}
Beispiel #23
0
void HTMLString::AppendOuterHTML (WebString* toString)
{
	toString->appendHtmlEscaped(GetString(), GetStringLength());
}
/* 半角→全角 */
void CNativeA::ToZenkaku(
		int bHiragana,		/* 1== ひらがな 0==カタカナ //2==英数専用 2001/07/30 Misaka 追加 */
		int bHanKataOnly	/* 1== 半角カタカナにのみ作用する*/
)
{
	unsigned char*			pBuf = (unsigned char*)GetStringPtr();
	int						nBufLen = GetStringLength();
	int						i;
	int						nCharChars;
//	unsigned char			uc;
	unsigned short			usSrc;
	unsigned short			usDes;
	unsigned char*			pBufDes;
	int						nBufDesLen;
	static unsigned char*	pszHanKataSet = (unsigned char*)"。「」、・ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゙゚";
	static unsigned char*	pszDakuSet = (unsigned char*)"カキクケコサシスセソタチツテトハヒフヘホ";
	static unsigned char*	pszYouSet = (unsigned char*)"ハヒフヘホ";
	BOOL					bHenkanOK;

	pBufDes = new unsigned char[nBufLen * 2 + 1];
	if( NULL ==	pBufDes ){
		return;
	}
	nBufDesLen = 0;
	for( i = 0; i < nBufLen; ++i ){
		// 2005-09-02 D.S.Koba GetSizeOfChar
		nCharChars = CShiftJis::GetSizeOfChar( (const char *)pBuf, nBufLen, i );
		if( nCharChars == 1){
			bHenkanOK = FALSE;
			if( bHanKataOnly ){	/* 1== 半角カタカナにのみ作用する */
				if( NULL != strchr( (const char *)pszHanKataSet, pBuf[i] ) ){
					bHenkanOK = TRUE;
				}
			}else{
				//! 英数変換用に新たな条件を付加 2001/07/30 Misaka
				if( ( (unsigned char)0x20 <= pBuf[i] && pBuf[i] <= (unsigned char)0x7E ) ||
					( bHiragana != 2 && (unsigned char)0xA1 <= pBuf[i] && pBuf[i] <= (unsigned char)0xDF )
				){
					bHenkanOK = TRUE;
				}
			}
			if( bHenkanOK ){
				usSrc = pBuf[i];
				if( !bHiragana &&
					pBuf[i]		== (unsigned char)'ウ' &&
					pBuf[i + 1] == (unsigned char)'゙' &&
					bHiragana != 2
				){
					usDes = (unsigned short)0x8394; /* ヴ */
					nCharChars = 2;
				}else {
					usDes = (unsigned short)_mbbtombc( usSrc );
					/* 濁音 */
					if( bHiragana != 2 && pBuf[i + 1] == (unsigned char)'゙' && NULL != strchr( (const char *)pszDakuSet, pBuf[i] ) ){
						usDes++;
						nCharChars = 2;
					}
					/* 拗音 */
					//! 英数変換用に新たな条件を付加 2001/07/30 Misaka
					//! bHiragana != 2 //英数変換フラグがオンではない場合
					if( bHiragana != 2 && pBuf[i + 1] == (unsigned char)'゚' && NULL != strchr( (const char *)pszYouSet, pBuf[i] ) ){
						usDes += 2;
						nCharChars = 2;
					}
				}

				if( bHiragana == 1 ){
					/* ひらがなに変換可能なカタカナならば、ひらがなに変換する */
					if( (unsigned short)0x8340 <= usDes && usDes <= (unsigned short)0x837e ){	/* ァ〜ミ */
						usDes-= (unsigned short)0x00a1;
					}else
					if( (unsigned short)0x8380 <= usDes && usDes <= (unsigned short)0x8393 ){	/* ム〜ン */
						usDes-= (unsigned short)0x00a2;
					}
				}
				pBufDes[nBufDesLen]		= ( usDes & 0xff00 ) >>  8;
				pBufDes[nBufDesLen + 1] = ( usDes & 0x00ff );
				nBufDesLen += 2;
			}else{
				memcpy( &pBufDes[nBufDesLen], &pBuf[i], nCharChars );
				nBufDesLen += nCharChars;

			}
		}else
Beispiel #25
0
/****************************************************************************
 *                                                                          *
 * Function: CreateHypCtrl                                                  *
 *                                                                          *
 * Purpose : Create Hyperlink control.                                      *
 *                                                                          *
 * History : Date      Reason                                               *
 *           00/00/00  Created                                              *
 *                                                                          *
 ****************************************************************************/
HWND CreateHypCtrl(HWND hWndParent, HYPCTRL* pHc, int x, int y, int width, int height)
{
	HYPCTRL* pHcWnd;
	HWND hWndHyperlink;
	RECT rect;
	LOGFONT lf;
	HFONT hFontParent, hFontNormal, hFontHover;

	// some error checking
	if (hInst == NULL) return (HWND) NULL;
	if (hWndParent == NULL) return (HWND) NULL;

	if (pHc->cbFn == NULL) {
		// if the hyperlink opens a normal link, require the szLink member
		if (pHc->szLink == NULL) return (HWND) NULL;
	} else {
		// if the hyperlink calls a callback function, require the szText member
		if (pHc->szText == NULL) return (HWND) NULL;
	}

	hWndHyperlink = CreateWindow(lpszClassname,
						NULL,
						WS_CHILD,
						x, y, width, height,
						hWndParent,
						NULL,
						hInst,
						NULL);

	if (!hWndHyperlink) return (HWND) NULL;

	// alloc some space to hold all hyperlink stuff
	if ((pHcWnd = GlobalAllocPtr(GPTR, sizeof(HYPCTRL))) == NULL) {
		DestroyWindow(hWndHyperlink);
		return (HWND) NULL;
	}
	CopyMemory(pHcWnd, pHc, sizeof(HYPCTRL));

	// copy the text entries from HYPCTRL
	if (pHcWnd->cbFn == NULL) {
		if (pHcWnd->szLink != NULL) {
			if ((pHcWnd->szLink = (LPTSTR) GlobalAllocPtr(GPTR, STRBYTESIZE(pHc->szLink))) == NULL) {
				if (pHcWnd) GlobalFreePtr(pHcWnd);
				DestroyWindow(hWndHyperlink);
				return (HWND) NULL;
			}
			CopyMemory(pHcWnd->szLink, pHc->szLink, STRBYTESIZE(pHc->szLink));
		}
	}

	if (pHcWnd->szText != NULL) {
		if ((pHcWnd->szText = GlobalAllocPtr(GPTR, STRBYTESIZE(pHc->szText))) == NULL) {
			if (pHcWnd->szLink) GlobalFreePtr(pHcWnd->szLink);
			if (pHcWnd) GlobalFreePtr(pHcWnd);
			DestroyWindow(hWndHyperlink);
			return (HWND) NULL;
		}
		CopyMemory(pHcWnd->szText, pHc->szText, STRBYTESIZE(pHc->szText));
	} else {
		// no callback function and no szText given so we use szLink as text
		if(pHcWnd->cbFn == NULL) pHcWnd->szText = pHcWnd->szLink;
	}

	if (pHcWnd->szTooltip != NULL) {
		if ((pHcWnd->szTooltip = GlobalAllocPtr(GPTR, STRBYTESIZE(pHc->szTooltip))) == NULL) {
			if (pHcWnd->szLink) GlobalFreePtr(pHcWnd->szLink);
			if (pHcWnd->szText) GlobalFreePtr(pHcWnd->szText);
			if (pHcWnd) GlobalFreePtr(pHcWnd);
			DestroyWindow(hWndHyperlink);
			return (HWND) NULL;
		}
		CopyMemory(pHcWnd->szTooltip, pHc->szTooltip, STRBYTESIZE(pHc->szTooltip));
	}

	// save a pointer to the structure in the window extra space
	SetWindowLong(hWndHyperlink, WND_HYPSTRUCT, (LONG) (pHcWnd));
	SetWindowWord(hWndHyperlink, WND_ISHOVER, (WORD) FALSE);

	// create the fonts for the control
	hFontParent = (HFONT) SendMessage(GetParent(hWndHyperlink), WM_GETFONT, 0, 0);

	if (hFontParent != NULL) {
		GetObject(hFontParent, sizeof(LOGFONT), &lf);

		switch (pHcWnd->ulStyle) {
			case ulHover:
				hFontNormal = CreateFontIndirect(&lf);
				lf.lfUnderline = (BYTE) TRUE;
				hFontHover  = CreateFontIndirect(&lf);
				break;
			case ulAlways:
				lf.lfUnderline = (BYTE) TRUE;
				hFontNormal = CreateFontIndirect(&lf);
				hFontHover  = CreateFontIndirect(&lf);
				break;
			case ulNone:
				hFontNormal = CreateFontIndirect(&lf);
				hFontHover  = CreateFontIndirect(&lf);
				break;
			}
			// save the fonts in the window extra space
			SetWindowLong(hWndHyperlink, WND_FONTN, (LONG) hFontNormal);
			SetWindowLong(hWndHyperlink, WND_FONTH, (LONG) hFontHover);
	} else {
		// use the system font
		SetWindowLong(hWndHyperlink, WND_FONTN, (LONG) NULL);
		SetWindowLong(hWndHyperlink, WND_FONTH, (LONG) NULL);
	}

	GetClientRect(hWndHyperlink, &rect);

	// adjust window size to fit the text
	if (pHcWnd->bAutoSize) {
		PAINTSTRUCT ps;
		HDC hdc;
		SIZE size;

		hdc	= BeginPaint(hWndHyperlink, &ps);
 		SelectObject(hdc, (HFONT) GetWindowLong(hWndHyperlink, WND_FONTN));
		GetTextExtentPoint32(hdc, pHcWnd->szText, GetStringLength(pHcWnd->szText), &size);
		rect.right	= size.cx - rect.left;
		rect.bottom	= size.cy - rect.top;
		EndPaint(hWndHyperlink, &ps);

		SetWindowPos(hWndHyperlink,
			0,
			0, 0, size.cx, size.cy,
			SWP_NOMOVE | SWP_NOZORDER);
	}

	// save window size in the window extra space
	SetWindowLong(hWndHyperlink, WND_LEFT, (LONG) (rect.left));
	SetWindowLong(hWndHyperlink, WND_TOP, (LONG) (rect.top));
	SetWindowLong(hWndHyperlink, WND_RIGHT, (LONG) (rect.right));
	SetWindowLong(hWndHyperlink, WND_BOTTOM, (LONG) (rect.bottom));

	// create tooltip if requested
	if (pHcWnd->szTooltip != NULL) {
    	HWND hWndTT;
    	TOOLINFO ti;

    	hWndTT = CreateWindowEx(WS_EX_TOPMOST,
    		TOOLTIPS_CLASS,
    		NULL,
    		WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
    		CW_USEDEFAULT,
    		CW_USEDEFAULT,
    		CW_USEDEFAULT,
    		CW_USEDEFAULT,
    		hWndHyperlink,
    		NULL,
    		hInst,
    		NULL);
    				
    	if (!hWndTT) return FALSE;

    	SetWindowPos(hWndTT,
    		HWND_TOPMOST,
    		0, 0, 0, 0,
    		SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

    	ti.cbSize      = sizeof(TOOLINFO);
    	ti.uFlags      = TTF_SUBCLASS;
    	ti.hwnd        = hWndHyperlink;
    	ti.hinst       = hInst;
    	ti.uId         = 0;
    	ti.lpszText    = pHcWnd->szTooltip; // get text for tooltip
    	ti.rect.left   = (LONG) GetWindowLong(hWndHyperlink, WND_LEFT);
    	ti.rect.top    = (LONG) GetWindowLong(hWndHyperlink, WND_TOP);
    	ti.rect.right  = (LONG) GetWindowLong(hWndHyperlink, WND_RIGHT);
    	ti.rect.bottom = (LONG) GetWindowLong(hWndHyperlink, WND_BOTTOM);

    	// add tooltip
    	SendMessage(hWndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
	}

	// show the window
	ShowWindow(hWndHyperlink, SW_NORMAL);
	UpdateWindow(hWndHyperlink);

	return hWndHyperlink;
}
//ShiftJISに変換して返す
const char* CNativeW::GetStringPtrOld() const
{
	return to_achar(GetStringPtr(),GetStringLength());
}
const char* CNativeA::GetStringPtr(int* pnLength) const
{
	if(pnLength)*pnLength=GetStringLength();
	return GetStringPtr();
}
Beispiel #28
0
void DecimalStringBuilder::BuildStringUT(WEBC_CHAR *pStringBuffer)
{
	tc_movebytes(pStringBuffer, mpStr, GetStringLength()*sizeof(WEBC_CHAR));
}