8#pragma warning(disable:4100)
15#define WM_XBUTTONDOWN 0x020B
18#define WM_XBUTTONUP 0x020C
21#define WM_MOUSEWHEEL 0x020A
24#define WHEEL_DELTA 120
28#define SCROLLBAR_MINTHUMBSIZE 8
31#define SCROLLBAR_ARROWCLICK_DELAY 0.33
32#define SCROLLBAR_ARROWCLICK_REPEAT 0.05
34#define UI_NEAR_BUTTON_DEPTH 0.6f
35#define UI_FAR_BUTTON_DEPTH 0.8f
37#define UI_MAX_GUI_SPRITES 500
42 ((c >> 8) & 0xFF) / 255.0f,
44 ((c >> 24) & 0xFF) / 255.0f };
48#define UNISCRIBE_DLLNAME L"usp10.dll"
50#define GETPROCADDRESS( Module, APIName, Temp ) \
51 Temp = GetProcAddress( Module, #APIName ); \
53 *(FARPROC*)&_##APIName = Temp
55#define PLACEHOLDERPROC( APIName ) \
56 _##APIName = Dummy_##APIName
58#define IMM32_DLLNAME L"imm32.dll"
59#define VER_DLLNAME L"version.dll"
70#define UI_MAX_EDITBOXLENGTH 0xFFFF
104 return ((rc).right - (rc).left);
108 return ((rc).bottom - (rc).top);
182 SetTexture(0, MAKEINTRESOURCE(0xFFFF), (HMODULE)0xFFFF);
200 LPCWSTR szControlTextureResourceName, HMODULE hControlTextureResourceModule)
206 SetTexture(0, szControlTextureResourceName, hControlTextureResourceModule);
218 assert(
m_pManager != NULL && L
"To fix call RiseDialog::Init() first. See comments for details.");
231 if (pControl->
GetID() == ID)
520 if (!control->m_bVisible || control->m_width<=0 || control->m_height<=0)
continue;
522 rectangles.push_back({x,y,x+control->m_width,y+control->m_height});
531 L
"To fix hook up RiseDialogResourceManager to device callbacks. See comments for details");
617 WCHAR wszOutput[256];
620 wcscat_s(wszOutput, 256, L
" (Minimized)");
636 pControl->
Render(fElapsedTime);
678 nLen = wcslen(strFaceName);
679 if (0 == _wcsnicmp(pFontNode->
strFace, strFaceName, nLen) &&
680 pFontNode->
nHeight == height &&
689 if (pNewFontNode == NULL)
693 wcscpy_s(pNewFontNode->
strFace, MAX_PATH, strFaceName);
694 pNewFontNode->
nHeight = height;
695 pNewFontNode->
nWeight = weight;
715 assert(
m_pManager != NULL && L
"To fix call RiseDialog::Init() first. See comments for details.");
748 nLen = wcslen(strFilename);
750 0 == _wcsnicmp(pTextureNode->
strFilename, strFilename, nLen))
758 if (pNewTextureNode == NULL)
763 wcscpy_s(pNewTextureNode->
strFilename, MAX_PATH, strFilename);
787 if (IS_INTRESOURCE(strResourceName))
790 if ((INT_PTR)strResourceName == pTextureNode->
nResourceID)
797 nLen = wcslen(strResourceName);
798 if (0 == _wcsnicmp(pTextureNode->
strFilename, strResourceName, nLen))
806 if (pNewTextureNode == NULL)
811 if (IS_INTRESOURCE(strResourceName))
818 wcscpy_s(pNewTextureNode->
strFilename, MAX_PATH, strResourceName);
840 assert(
m_pManager != NULL && L
"To fix this, call RiseDialog::Init() first. See comments for details.");
862 assert(
m_pManager != NULL && L
"To fix this, call RiseDialog::Init() first. See comments for details.");
890 bool bHandled =
false;
899 (WM_LBUTTONDOWN == uMsg || WM_LBUTTONDBLCLK == uMsg || WM_KEYDOWN == uMsg))
907 if (uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONDBLCLK)
909 POINT mousePoint = { short(LOWORD(lParam)), short(HIWORD(lParam)) };
919 else if (uMsg == WM_LBUTTONUP &&
m_bDrag)
921 POINT mousePoint = { short(LOWORD(lParam)), short(HIWORD(lParam)) };
957 POINT pt = { -1, -1 };
1012 if (uMsg == WM_KEYDOWN)
1038 bool bShiftDown = ((GetKeyState(VK_SHIFT) & 0x8000) != 0);
1050 case WM_LBUTTONDOWN:
1052 case WM_MBUTTONDOWN:
1054 case WM_RBUTTONDOWN:
1058 case WM_LBUTTONDBLCLK:
1059 case WM_MBUTTONDBLCLK:
1060 case WM_RBUTTONDBLCLK:
1061 case WM_XBUTTONDBLCLK:
1069 POINT mousePoint = { short(LOWORD(lParam)), short(HIWORD(lParam)) };
1070 mousePoint.x -=
m_x;
1071 mousePoint.y -=
m_y;
1089 if (pControl != NULL && pControl->
GetEnabled())
1091 bHandled = pControl->
HandleMouse(uMsg, mousePoint, wParam, lParam);
1099 if (uMsg == WM_LBUTTONDOWN &&
1120 case WM_CAPTURECHANGED:
1127 if ((HWND)lParam != hWnd)
1144 if (pControl == NULL)
1166 if (pControl == NULL)
1178 if (pControl == NULL)
1209 if (pControl != NULL)
1223 pElementHolder->
iElement == iElement)
1225 pElementHolder->
Element = *pElement;
1233 if (pNewHolder == NULL)
1234 return E_OUTOFMEMORY;
1238 pNewHolder->
Element = *pElement;
1257 pElementHolder->
iElement == iElement)
1259 return &pElementHolder->
Element;
1276 if (ppCreated != NULL)
1277 *ppCreated = pStatic;
1279 if (pStatic == NULL)
1280 return E_OUTOFMEMORY;
1290 pStatic->
SetSize(width, height);
1306 if (ppCreated != NULL)
1307 *ppCreated = pButton;
1309 if (pButton == NULL)
1310 return E_OUTOFMEMORY;
1320 pButton->
SetSize(width, height);
1330 UINT nHotkey,
bool bIsDefault,
RiseCheckBox** ppCreated)
1336 if (ppCreated != NULL)
1337 *ppCreated = pCheckBox;
1339 if (pCheckBox == NULL)
1340 return E_OUTOFMEMORY;
1347 pCheckBox->
SetID(ID);
1350 pCheckBox->
SetSize(width, height);
1362 bool bChecked, UINT nHotkey,
bool bIsDefault,
RiseRadioButton** ppCreated)
1368 if (ppCreated != NULL)
1369 *ppCreated = pRadioButton;
1371 if (pRadioButton == NULL)
1372 return E_OUTOFMEMORY;
1379 pRadioButton->
SetID(ID);
1380 pRadioButton->
SetText(strText);
1383 pRadioButton->
SetSize(width, height);
1403 if (ppCreated != NULL)
1404 *ppCreated = pComboBox;
1406 if (pComboBox == NULL)
1407 return E_OUTOFMEMORY;
1414 pComboBox->
SetID(ID);
1416 pComboBox->
SetSize(width, height);
1433 if (ppCreated != NULL)
1434 *ppCreated = pSlider;
1436 if (pSlider == NULL)
1437 return E_OUTOFMEMORY;
1446 pSlider->
SetSize(width, height);
1465 if (ppCreated != NULL)
1466 *ppCreated = pEditBox;
1468 if (pEditBox == NULL)
1469 return E_OUTOFMEMORY;
1476 pEditBox->
SetID(ID);
1478 pEditBox->
SetSize(width, height);
1495 if (ppCreated != NULL)
1496 *ppCreated = pListBox;
1498 if (pListBox == NULL)
1499 return E_OUTOFMEMORY;
1506 pListBox->
SetID(ID);
1508 pListBox->
SetSize(width, height);
1521 if (pControl == NULL)
1522 return E_INVALIDARG;
1569 if (pControl->
GetID() == ID)
1589 if (pControl->
GetID() == ID && pControl->
GetType() == nControlType)
1604 int index = pControl->
m_Index + 1;
1623 int index = pControl->
m_Index - 1;
1633 if (pDialog == NULL)
1667 if (pComboBox == NULL)
1700 RECT rcScreen = *pRect;
1701 OffsetRect(&rcScreen,
m_x,
m_y);
1709 (float)rcScreen.left - 0.5f, (
float)rcScreen.top - 0.5f, 0.5f, 1.0f, color, 0, 0,
1710 (float)rcScreen.right - 0.5f, (
float)rcScreen.top - 0.5f, 0.5f, 1.0f, color, 0, 0,
1711 (float)rcScreen.right - 0.5f, (
float)rcScreen.bottom - 0.5f, 0.5f, 1.0f, color, 0, 0,
1712 (float)rcScreen.left - 0.5f, (
float)rcScreen.bottom - 0.5f, 0.5f, 1.0f, color, 0, 0,
1719 auto savedDrawState = pd3dDevice->
Capture();
1731 pd3dDevice->
Restore(savedDrawState);
1746 if (vertices == NULL)
1747 return E_OUTOFMEMORY;
1750 POINT* pt = apPoints;
1751 for (UINT i = 0; i < nNumPoints; i++)
1753 pVertex->
x =
m_x + (float)pt->x;
1754 pVertex->
y =
m_y + (float)pt->y;
1757 pVertex->
color = color;
1769 auto savedDrawState = pd3dDevice->
Capture();
1781 pd3dDevice->
Restore(savedDrawState);
1802 RECT rcScreen = *prcDest;
1803 OffsetRect(&rcScreen,
m_x,
m_y);
1810 if (pTextureNode == NULL)
1841 if (pFontNode == NULL)
1846 if (pFontNode->
font)
1848 hr = pFontNode->
font->DrawText(NULL, strText, nCount, prcDest, dwTextFormat, pElement->
FontColor.
Current);
1870 RECT rcScreen = *prcDest;
1871 OffsetRect(&rcScreen,
m_x,
m_y);
1885 RECT rcShadow = rcScreen;
1886 OffsetRect(&rcShadow, 1, 1);
1920 if (pNextDialog == NULL)
1990 if (!pDialog || !pControl)
2011 if (!pDialog || !pControl)
2035 for (
int i = 0; i < 0xffff; i++)
2042 if ((!bForward && nLastDialogIndex < nDialogIndex) ||
2043 (bForward && nDialogIndex < nLastDialogIndex))
2066 pLastDialog = pDialog;
2087 OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
2104 if(node->bFileSource)
2108 const bool builtin=node->nResourceID==0xffff && node->hResourceModule==(HMODULE)0xffff;
2109 HMODULE module=builtin ? GetModuleHandleW(
nullptr) : node->hResourceModule;
2110 LPCWSTR
id=builtin ? MAKEINTRESOURCEW(6100) : node->nResourceID ? MAKEINTRESOURCEW(node->nResourceID) : node->strFilename;
2113 if(FAILED(hr))
return hr;
2115 if(FAILED(hr=node->texture->GetLevelDesc(0,&description)))
return hr;
2116 node->dwWidth=description.
Width;node->dwHeight=description.
Height;
return S_OK;
2127 SetFont(0, L
"Arial", 14, FW_NORMAL);
2136 SetRect(&rcTexture, 17, 269, 241, 287);
2158 SetRect(&rcTexture, 0, 0, 136, 54);
2159 Element.SetTexture(0, &rcTexture);
2172 SetRect(&rcTexture, 136, 0, 252, 54);
2186 SetRect(&rcTexture, 0, 54, 27, 81);
2187 Element.SetTexture(0, &rcTexture);
2201 SetRect(&rcTexture, 27, 54, 54, 81);
2202 Element.SetTexture(0, &rcTexture);
2211 SetRect(&rcTexture, 54, 54, 81, 81);
2212 Element.SetTexture(0, &rcTexture);
2226 SetRect(&rcTexture, 81, 54, 108, 81);
2227 Element.SetTexture(0, &rcTexture);
2236 SetRect(&rcTexture, 7, 81, 247, 123);
2237 Element.SetTexture(0, &rcTexture);
2254 SetRect(&rcTexture, 98, 189, 151, 238);
2255 Element.SetTexture(0, &rcTexture);
2268 SetRect(&rcTexture, 13, 123, 241, 160);
2269 Element.SetTexture(0, &rcTexture);
2279 SetRect(&rcTexture, 12, 163, 239, 183);
2280 Element.SetTexture(0, &rcTexture);
2290 SetRect(&rcTexture, 1, 187, 93, 228);
2291 Element.SetTexture(0, &rcTexture);
2302 SetRect(&rcTexture, 151, 193, 192, 234);
2303 Element.SetTexture(0, &rcTexture);
2311 int nScrollBarStartX = 196;
2312 int nScrollBarStartY = 191;
2313 SetRect(&rcTexture, nScrollBarStartX + 0, nScrollBarStartY + 21, nScrollBarStartX + 22, nScrollBarStartY + 32);
2314 Element.SetTexture(0, &rcTexture);
2323 SetRect(&rcTexture, nScrollBarStartX + 0, nScrollBarStartY + 1, nScrollBarStartX + 22, nScrollBarStartY + 21);
2324 Element.SetTexture(0, &rcTexture);
2334 SetRect(&rcTexture, nScrollBarStartX + 0, nScrollBarStartY + 32, nScrollBarStartX + 22, nScrollBarStartY + 53);
2335 Element.SetTexture(0, &rcTexture);
2345 SetRect(&rcTexture, 220, 192, 238, 234);
2346 Element.SetTexture(0, &rcTexture);
2369 SetRect(&rcTexture, 14, 90, 241, 113);
2370 Element.SetTexture(0, &rcTexture);
2372 SetRect(&rcTexture, 8, 82, 14, 90);
2373 Element.SetTexture(0, &rcTexture);
2375 SetRect(&rcTexture, 14, 82, 241, 90);
2376 Element.SetTexture(0, &rcTexture);
2378 SetRect(&rcTexture, 241, 82, 246, 90);
2379 Element.SetTexture(0, &rcTexture);
2381 SetRect(&rcTexture, 8, 90, 14, 113);
2382 Element.SetTexture(0, &rcTexture);
2384 SetRect(&rcTexture, 241, 90, 246, 113);
2385 Element.SetTexture(0, &rcTexture);
2387 SetRect(&rcTexture, 8, 113, 14, 121);
2388 Element.SetTexture(0, &rcTexture);
2390 SetRect(&rcTexture, 14, 113, 241, 121);
2391 Element.SetTexture(0, &rcTexture);
2393 SetRect(&rcTexture, 241, 113, 246, 121);
2394 Element.SetTexture(0, &rcTexture);
2400 SetRect(&rcTexture, 13, 123, 241, 160);
2401 Element.SetTexture(0, &rcTexture);
2411 SetRect(&rcTexture, 16, 166, 240, 183);
2412 Element.SetTexture(0, &rcTexture);
2479 if (pElement == NULL)
2480 return E_INVALIDARG;
2486 if (pNewElement == NULL)
2487 return E_OUTOFMEMORY;
2499 *pCurElement = *pElement;
2572 if (strDest == NULL || bufferCount == 0)
2574 return E_INVALIDARG;
2578 wcscpy_s(strDest, bufferCount,
m_strText);
2587 if (strText == NULL)
2656 case WM_LBUTTONDOWN:
2657 case WM_LBUTTONDBLCLK:
2739 OffsetRect(&rcWindow, nOffsetX, nOffsetY);
2820 case WM_LBUTTONDOWN:
2821 case WM_LBUTTONDBLCLK:
2994 case WM_LBUTTONDOWN:
2995 case WM_LBUTTONDBLCLK:
3041 if (bChecked && bClearGroup)
3152 const DWORD REPEAT_MASK = (0x40000000);
3186 if (lParam & REPEAT_MASK)
3266 case WM_LBUTTONDOWN:
3267 case WM_LBUTTONDBLCLK:
3354 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uLines, 0);
3428 static bool bSBInit =
false;
3465 if (nRemainingHeight < 0)
3532 OffsetRect(&rcWindow, nOffsetX, nOffsetY);
3563 if (strText == NULL)
3565 return E_INVALIDARG;
3576 wcscpy_s(pItem->
strText, 256, strText);
3577 pItem->
pData = pData;
3627 return (-1 !=
FindItem(strText, iStart));
3634 if (strText == NULL)
3641 if (0 == wcscmp(pItem->
strText, strText))
3658 return pItem->
pData;
3688 return pItem->
pData;
3706 return E_INVALIDARG;
3719 if (strText == NULL)
3720 return E_INVALIDARG;
3741 if (pItem->
pData == pData)
3852 case WM_LBUTTONDOWN:
3853 case WM_LBUTTONDBLCLK:
3949 nValue = __max(
m_nMin, nValue);
3950 nValue = __min(
m_nMax, nValue);
4137 static int ThumbOffsetY;
4142 case WM_LBUTTONDOWN:
4143 case WM_LBUTTONDBLCLK:
4231 nMaxThumb / (nMaxFirstItem * 2)) *
4232 nMaxFirstItem / nMaxThumb;
4248 if (WM_CAPTURECHANGED == uMsg)
4422 if (pFontNode && pFontNode->
nHeight)
4438 return E_OUTOFMEMORY;
4440 wcscpy_s(pNewItem->
strText, 256, wszText);
4441 pNewItem->
pData = pData;
4442 SetRect(&pNewItem->
rcActive, 0, 0, 0, 0);
4464 return E_OUTOFMEMORY;
4466 wcscpy_s(pNewItem->
strText, 256, wszText);
4467 pNewItem->
pData = pData;
4468 SetRect(&pNewItem->
rcActive, 0, 0, 0, 0);
4542 if (nPreviousSelected < -1)
4666 if (GetKeyState(VK_SHIFT) < 0)
4717 if (WM_LBUTTONDOWN == uMsg)
4727 case WM_LBUTTONDOWN:
4728 case WM_LBUTTONDBLCLK:
4752 if (uMsg == WM_LBUTTONDBLCLK)
4759 if (!(wParam & MK_SHIFT))
4770 if ((wParam & (MK_SHIFT | MK_CONTROL)) == MK_CONTROL)
4776 else if ((wParam & (MK_SHIFT | MK_CONTROL)) == MK_SHIFT)
4785 for (
int i = 0; i < nBegin; ++i)
4797 for (
int i = nBegin; i <= nEnd; ++i)
4803 else if ((wParam & (MK_SHIFT | MK_CONTROL)) == (MK_SHIFT | MK_CONTROL))
4818 for (
int i = nBegin + 1; i < nEnd; ++i)
4921 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uLines, 0);
4922 int nScrollAmount =
int((
short)HIWORD(wParam)) /
WHEEL_DELTA * uLines;
4935 if (WM_CAPTURECHANGED == uMsg)
4974 static bool bSBInit;
4995 bool bSelectedStyle =
false;
4998 bSelectedStyle =
true;
5006 bSelectedStyle =
true;
5011 rcSel.top = rc.top; rcSel.bottom = rc.bottom;
5030HRESULT(WINAPI* CUniBuffer::_ScriptApplyDigitSubstitution)(
const SCRIPT_DIGITSUBSTITUTE*, SCRIPT_CONTROL*,
5031 SCRIPT_STATE*) = Dummy_ScriptApplyDigitSubstitution;
5033 SCRIPT_STATE*,
const int*, SCRIPT_TABDEF*,
const BYTE*,
5034 SCRIPT_STRING_ANALYSIS*) = Dummy_ScriptStringAnalyse;
5035HRESULT(WINAPI* CUniBuffer::_ScriptStringCPtoX)(SCRIPT_STRING_ANALYSIS,
int,
BOOL,
int*) = Dummy_ScriptStringCPtoX;
5036HRESULT(WINAPI* CUniBuffer::_ScriptStringXtoCP)(SCRIPT_STRING_ANALYSIS,
int,
int*,
int*) = Dummy_ScriptStringXtoCP;
5037HRESULT(WINAPI* CUniBuffer::_ScriptStringFree)(SCRIPT_STRING_ANALYSIS*) = Dummy_ScriptStringFree;
5039Dummy_ScriptString_pLogAttr;
5041Dummy_ScriptString_pcOutChars;
5052#define EDITBOX_SCROLLEXTENT 4
5064 m_dfBlink = GetCaretBlinkTime() * 0.001f;
5119 int nCPNew1st, nNewTrail;
5127 if (nXNew1st < nXNewLeft)
5148 assert(wszText != NULL);
5179 for (
int i = nFirst; i < nLast; ++i)
5219 HGLOBAL hBlock = GlobalAlloc(GMEM_MOVEABLE,
sizeof(WCHAR) * (
m_Buffer.
GetTextSize() + 1));
5222 WCHAR* pwszText = (WCHAR*)GlobalLock(hBlock);
5227 if (nLast - nFirst > 0)
5228 CopyMemory(pwszText,
m_Buffer.
GetBuffer() + nFirst, (nLast - nFirst) *
sizeof(WCHAR));
5229 pwszText[nLast - nFirst] = L
'\0';
5230 GlobalUnlock(hBlock);
5232 SetClipboardData(CF_UNICODETEXT, hBlock);
5246 if (OpenClipboard(NULL))
5248 HANDLE handle = GetClipboardData(CF_UNICODETEXT);
5253 WCHAR* pwszText = (WCHAR*)GlobalLock(handle);
5260 GlobalUnlock(handle);
5274 bool bHandled =
false;
5275 int keystate = GetKeyState(VK_SHIFT);
5276 bool g_bShift = keystate < 0;
5315 if (GetKeyState(VK_CONTROL) < 0)
5320 else if (GetKeyState(VK_SHIFT) < 0)
5350 if (GetKeyState(VK_CONTROL) < 0)
5368 if (GetKeyState(VK_CONTROL) < 0)
5393 bHandled = wParam != VK_ESCAPE;
5409 case WM_LBUTTONDOWN:
5420 int nCP, nTrail, nX1st;
5435 case WM_LBUTTONDBLCLK:
5451 int nCP, nTrail, nX1st;
5492 switch ((WCHAR)wParam)
5505 switch ((WCHAR)wParam)
5535 if ((WCHAR)wParam == 24)
5638 int nSelStartX = 0, nCaretX = 0;
5649 for (
int e = 0; e < 9; ++e)
5670 nSelStartX = nCaretX;
5678 int nSelLeftX = nCaretX, nSelRightX = nSelStartX;
5680 if (nSelLeftX > nSelRightX)
5682 const int nTemp = nSelLeftX;
5683 nSelLeftX = nSelRightX;
5687 SetRect(&rcSelection, nSelLeftX,
m_rcText.top, nSelRightX,
m_rcText.bottom);
5688 OffsetRect(&rcSelection,
m_rcText.left - nXFirst, 0);
5689 IntersectRect(&rcSelection, &
m_rcText, &rcSelection);
5755 rcCaret.right =
m_rcText.left - nXFirst + nRightEdgeX;
5763#define IN_FLOAT_CHARSET( c ) \
5764 ( (c) == L'-' || (c) == L'.' || ( (c) >= L'0' && (c) <= L'9' ) )
5769 const WCHAR* pToken, * pEnd;
5773 while (nWritten < nCount && *pToken != L
'\0')
5776 while (*pToken == L
' ')
5779 if (*pToken == L
'\0')
5788 int nTokenLen = __min(
sizeof(wszToken) /
sizeof(wszToken[0]) - 1,
int(pEnd - pToken));
5789 wcscpy_s(wszToken, nTokenLen, pToken);
5790 *pNumbers = (float)wcstod(wszToken, NULL);
5800 WCHAR wszBuffer[512] = { 0 };
5803 if (pNumbers == NULL)
5806 for (
int i = 0; i < nCount; ++i)
5808 swprintf_s(wszTmp, 64, L
"%.4f ", pNumbers[i]);
5809 wcscat_s(wszBuffer, 512, wszTmp);
5813 if (nCount > 0 && wcslen(wszBuffer) > 0)
5814 wszBuffer[wcslen(wszBuffer) - 1] = 0;
5871 2 : 256) : nNewSize * 2;
5877 WCHAR* pTempBuffer =
new WCHAR[nAllocateSize];
5881 ZeroMemory(pTempBuffer,
sizeof(WCHAR) * nAllocateSize);
5903 SCRIPT_CONTROL ScriptControl;
5904 SCRIPT_STATE ScriptState;
5905 ZeroMemory(&ScriptControl,
sizeof(ScriptControl));
5906 ZeroMemory(&ScriptState,
sizeof(ScriptState));
5907 _ScriptApplyDigitSubstitution(NULL, &ScriptControl, &ScriptState);
5913 HRESULT hr = _ScriptStringAnalyse(hDC,
5918 SSA_BREAK | SSA_GLYPHS | SSA_FALLBACK | SSA_LINK,
5943 if (nInitialSize > 0)
5982 assert(nIndex >= 0);
6002 WCHAR* src = dest - 1;
6040 assert(nIndex >= 0);
6048 nCount = lstrlenW(pStr);
6062 CopyMemory(
m_pwszBuffer + nIndex, pStr, nCount *
sizeof(WCHAR));
6072 assert(wszText != NULL);
6074 int nRequired =
int(wcslen(wszText) + 1);
6106 hr = _ScriptStringCPtoX(
m_Analysis, nCP, bTrail, pX);
6115 assert(pCP && pnTrail);
6116 *pCP = 0; *pnTrail = FALSE;
6123 hr = _ScriptStringXtoCP(
m_Analysis, nX, pCP, pnTrail);
6128 if (*pCP == -1 && *pnTrail == TRUE)
6130 *pCP = 0; *pnTrail = FALSE;
6132 else if (*pCP > lstrlenW(
m_pwszBuffer) && *pnTrail == FALSE)
6157 if (nCP - 1 < nInitial)
6159 for (
int i = nInitial; i > 0; --i)
6160 if (pLogAttr[i].fWordStop ||
6161 (!pLogAttr[i].fWhiteSpace &&
6162 pLogAttr[i - 1].fWhiteSpace))
6190 if (nCP + 1 < nInitial)
6195 while (limit > 0 && i < limit - 1)
6197 if (pLogAttr[i].fWordStop)
6202 else if (pLogAttr[i].fWhiteSpace &&
6203 !pLogAttr[i + 1].fWhiteSpace)
6230 States[i] = defaultColor;
6265 this->
iFont = prmFont;
#define SAFE_DELETE_ARRAY(value)
#define V_RETURN(expression)
#define SAFE_RELEASE(value)
#define SAFE_DELETE(value)
#define UNISCRIBE_DLLNAME
#define GETPROCADDRESS(Module, APIName, Temp)
#define SCROLLBAR_ARROWCLICK_REPEAT
#define IN_FLOAT_CHARSET(c)
#define SCROLLBAR_MINTHUMBSIZE
#define UI_FAR_BUTTON_DEPTH
#define UI_MAX_EDITBOXLENGTH
RiseMath::Color ColorValue(Rendering::PackedColor c)
SCRIPT_CONTROL SCRIPT_STATE const void int
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
SCRIPT_CONTROL SCRIPT_STATE const void SCRIPT_CONTROL SCRIPT_STATE const int SCRIPT_TABDEF const BYTE SCRIPT_STRING_ANALYSIS BOOL
SCRIPT_CONTROL SCRIPT_STATE const void DWORD
#define UI_NEAR_BUTTON_DEPTH
#define SCROLLBAR_ARROWCLICK_DELAY
#define PLACEHOLDERPROC(APIName)
#define EVENT_LISTBOX_ITEM_DBLCLK
#define EVENT_CHECKBOX_CHANGED
#define EVENT_EDITBOX_STRING
#define EVENT_LISTBOX_SELECTION
#define EVENT_BUTTON_CLICKED
VOID(CALLBACK *) UICallback(UINT nEvent, int nControlID, RiseControl *pControl, void *pUserContext)
#define EVENT_SLIDER_VALUE_CHANGED
#define EVENT_EDITBOX_CHANGE
#define EVENT_LISTBOX_SELECTION_END
#define EVENT_EDITBOX_CANCEL
#define MAX_CONTROL_STATES
#define EVENT_RADIOBUTTON_CHANGED
#define EVENT_COMBOBOX_SELECTION_CHANGED
static void WINAPI Initialize()
bool SetText(LPCWSTR wszText)
bool InsertChar(int nIndex, WCHAR wChar)
static HRESULT(WINAPI *_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
bool RemoveChar(int nIndex)
SCRIPT_STRING_ANALYSIS m_Analysis
const WCHAR * GetBuffer()
static SCRIPT_CONTROL SCRIPT_STATE *static const void int
static SCRIPT_CONTROL SCRIPT_STATE *static const void SCRIPT_CONTROL SCRIPT_STATE const int SCRIPT_TABDEF const BYTE SCRIPT_STRING_ANALYSIS *static BOOL
const WCHAR & operator[](int n) const
void SetFontNode(UIFontNode *pFontNode)
static void WINAPI Uninitialize()
bool InsertString(int nIndex, const WCHAR *pStr, int nCount=-1)
void GetNextItemPos(int nCP, int *pPrior)
HRESULT CPtoX(int nCP, BOOL bTrail, int *pX)
bool SetBufferSize(int nSize)
HRESULT XtoCP(int nX, int *pCP, int *pnTrail)
static const int *WINAPI * _ScriptString_pcOutChars(SCRIPT_STRING_ANALYSIS)
static const SCRIPT_LOGATTR *WINAPI * _ScriptString_pLogAttr(SCRIPT_STRING_ANALYSIS)
void GetPriorItemPos(int nCP, int *pPrior)
CUniBuffer(int nInitialSize=1)
HRESULT SetAt(int index, const T &value)
HRESULT Add(const T &value)
HRESULT Remove(int index)
HRESULT Insert(int index, const T &value)
int IndexOf(const T &value) const
HRESULT CreateStateBlock(UINT type, RenderStateSnapshot **result)
HRESULT SetPixelShader(std::nullptr_t)
HRESULT SetRenderState(DWORD state, DWORD value)
HRESULT SetFVF(DWORD value)
HRESULT DrawPrimitiveUP(Primitive type, UINT count, const void *vertices, UINT stride)
HRESULT SetTextureStageState(DWORD stage, DWORD state, DWORD value)
HRESULT SetTexture(DWORD stage, RenderTexture *texture)
HRESULT SetSamplerState(DWORD sampler, DWORD state, DWORD value)
HRESULT SetVertexShader(std::nullptr_t)
HRESULT Restore(const Saved &value)
HRESULT Begin(DWORD flags)
HRESULT SetTransform(const RiseMath::Matrix *value)
HRESULT Draw(RenderTexture *image, const RECT *rectangle, const RiseMath::Vector3 *center, const RiseMath::Vector3 *position, PackedColor color)
virtual void SetCheckedInternal(bool bChecked, bool bFromInput)
virtual bool HandleKeyboard(UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual void Render(float fElapsedTime)
virtual void UpdateRects()
virtual bool HandleMouse(UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam)
virtual BOOL ContainsPoint(POINT pt)
RiseCheckBox(RiseDialog *pDialog=NULL)
void SetChecked(bool bChecked)
ControlArray< UIComboBoxItem * > m_Items
virtual void SetTextColor(Rendering::PackedColor Color, Rendering::PackedColor DisabledColor=Rendering::ColorARGB(200, 128, 128, 128))
void * GetItemData(const WCHAR *strText)
int FindItem(const WCHAR *strText, UINT iStart=0)
virtual bool HandleMouse(UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam)
HRESULT SetSelectedByIndex(UINT index)
virtual void UpdateRects()
virtual void Render(float fElapsedTime)
bool ContainsItem(const WCHAR *strText, UINT iStart=0)
UIComboBoxItem * GetSelectedItem()
void RemoveItem(UINT index)
RiseScrollBar m_ScrollBar
virtual void OnFocusOut()
HRESULT AddItem(const WCHAR *strText, void *pData)
HRESULT SetSelectedByData(void *pData)
HRESULT SetSelectedByText(const WCHAR *strText)
RiseComboBox(RiseDialog *pDialog=NULL)
virtual bool HandleKeyboard(UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual bool HandleKeyboard(UINT uMsg, WPARAM wParam, LPARAM lParam)
RiseElement * GetElement(UINT iElement)
virtual void OnFocusOut()
virtual void OnMouseLeave()
void SetLocation(int x, int y)
virtual bool GetEnabled()
virtual bool HandleMouse(UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam)
void SetHotkey(UINT nHotkey)
virtual void OnMouseEnter()
virtual void Render(float fElapsedTime)
virtual bool MsgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual bool GetVisible()
virtual bool CanHaveFocus()
HRESULT SetElement(UINT iElement, RiseElement *pElement)
virtual void UpdateRects()
void SetSize(int width, int height)
RiseControl(RiseDialog *pDialog=NULL)
virtual BOOL ContainsPoint(POINT pt)
virtual void SetEnabled(bool bEnabled)
ControlArray< RiseElement * > m_Elements
virtual void SetTextColor(Rendering::PackedColor Color)
RiseElement * GetDefaultElement(UINT nControlType, UINT iElement)
static RiseControl * s_pControlFocus
void RemoveControl(int ID)
double m_fTimeLastRefresh
void SetNextDialog(RiseDialog *pNextDialog)
HRESULT DrawPolyLine(POINT *apPoints, UINT nNumPoints, Rendering::PackedColor color)
void SendEvent(UINT nEvent, bool bTriggeredByUser, RiseControl *pControl)
Rendering::PackedColor m_colorTopLeft
void Init(RiseDialogResourceManager *pManager, bool bRegisterDialog=true)
RiseControl * GetControlAtPoint(POINT pt)
HRESULT InitControl(RiseControl *pControl)
RiseDialog * m_pNextDialog
HRESULT SetTexture(UINT index, LPCWSTR strFilename)
Rendering::PackedColor m_colorBottomRight
HRESULT SetDefaultElement(UINT nControlType, UINT iElement, RiseElement *pElement)
HRESULT CalcTextRect(LPCWSTR strText, RiseElement *pElement, RECT *prcDest, int nCount=-1)
Rendering::PackedColor m_colorTopRight
HRESULT AddComboBox(int ID, int x, int y, int width, int height, UINT nHotKey=0, bool bIsDefault=false, RiseComboBox **ppCreated=NULL)
UICallback m_pCallbackEvent
friend class RiseDialogResourceManager
RiseControl * m_pControlMouseOver
static double s_fTimeRefresh
RiseComboBox * GetComboBox(int ID)
void ClearComboBox(int ID)
HRESULT AddListBox(int ID, int x, int y, int width, int height, DWORD dwStyle=0, RiseListBox **ppCreated=NULL)
UITextureNode * GetTexture(UINT index)
HRESULT AddCheckBox(int ID, LPCWSTR strText, int x, int y, int width, int height, bool bChecked=false, UINT nHotkey=0, bool bIsDefault=false, RiseCheckBox **ppCreated=NULL)
static RiseControl *WINAPI GetPrevControl(RiseControl *pControl)
ControlArray< RiseControl * > m_Controls
void ClearRadioButtonGroup(UINT nGroup)
bool MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
void OnMouseMove(POINT pt)
void AppendVisibleBounds(std::vector< RECT > &rectangles) const
void FocusDefaultControl()
UIFontNode * GetFont(UINT index)
RiseDialogResourceManager * m_pManager
RiseControl * GetControl(int ID)
static RiseControl *WINAPI GetNextControl(RiseControl *pControl)
HRESULT DrawText(LPCWSTR strText, RiseElement *pElement, RECT *prcDest, bool bShadow=false, int nCount=-1)
Rendering::PackedColor m_colorBottomLeft
HRESULT AddStatic(int ID, LPCWSTR strText, int x, int y, int width, int height, bool bIsDefault=false, RiseStatic **ppCreated=NULL, bool bShadow=true)
RiseDialog * m_pPrevDialog
static void WINAPI ClearFocus()
ControlArray< UIElementHolder * > m_DefaultElements
void SetBackgroundColors(Rendering::PackedColor colorAllCorners)
ControlArray< int > m_Fonts
bool OnCycleFocus(bool bForward)
bool GetControlEnabled(int ID)
HRESULT OnRender(float fElapsedTime)
HRESULT AddEditBox(int ID, LPCWSTR strText, int x, int y, int width, int height, bool bIsDefault=false, bool bIsPassword=false, RiseEditBox **ppCreated=NULL)
ControlArray< int > m_Textures
void RequestFocus(RiseControl *pControl)
static RiseControl * s_pControlPressed
HRESULT AddRadioButton(int ID, UINT nButtonGroup, LPCWSTR strText, int x, int y, int width, int height, bool bChecked=false, UINT nHotkey=0, bool bIsDefault=false, RiseRadioButton **ppCreated=NULL)
void InitDefaultElements()
void * m_pCallbackEventUserContext
HRESULT DrawRect(RECT *pRect, Rendering::PackedColor color)
HRESULT AddControl(RiseControl *pControl)
HRESULT SetFont(UINT index, LPCWSTR strFaceName, LONG height, LONG weight)
void SetCallback(UICallback pCallback, void *pUserContext=NULL)
HRESULT AddButton(int ID, LPCWSTR strText, int x, int y, int width, int height, UINT nHotkey=0, bool bIsDefault=false, RiseButton **ppCreated=NULL)
RiseDialogResourceManager * GetManager()
bool IsKeyboardInputEnabled() const
HRESULT DrawSprite(RiseElement *pElement, RECT *prcDest, float fDepth=0)
void SetControlEnabled(int ID, bool bEnabled)
HRESULT AddSlider(int ID, int x, int y, int width, int height, int min=0, int max=100, int value=50, bool bIsDefault=false, RiseSlider **ppCreated=NULL)
HRESULT CreateTexture(UINT index)
Rendering::RenderDevice * GetRenderer()
~RiseDialogResourceManager()
RiseDialogResourceManager()
void EnableKeyboardInputForAllDialogs()
Rendering::RenderSprite * m_pSprite
UITextureNode * GetTextureNode(int iIndex)
void UnregisterDialog(RiseDialog *pDialog)
UIFontNode * GetFontNode(int iIndex)
HRESULT OnCreateDevice(Rendering::RenderDevice *pd3dDevice)
bool RegisterDialog(RiseDialog *pDialog)
ControlArray< UIFontNode * > m_FontCache
int AddTexture(LPCWSTR strFilename)
Rendering::RenderStateSnapshot * m_pStateBlock
int AddFont(LPCWSTR strFaceName, LONG height, LONG weight)
ControlArray< UITextureNode * > m_TextureCache
HRESULT CreateFont(UINT index)
Rendering::RenderDevice * m_renderer
bool MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
ControlArray< RiseDialog * > m_Dialogs
Rendering::PackedColor m_SelBkColor
void DeleteSelectionText()
virtual bool HandleMouse(UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam)
void PasteFromClipboard()
virtual void Render(float fElapsedTime)
virtual bool MsgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Rendering::PackedColor m_CaretColor
void SetText(LPCWSTR wszText, bool bSelected=false)
RiseEditBox(RiseDialog *pDialog=NULL)
Rendering::PackedColor m_TextColor
void SetTextFloatArray(const float *pNumbers, int nCount)
HRESULT GetTextCopy(__out_ecount(bufferCount) LPWSTR strDest, UINT bufferCount)
virtual void UpdateRects()
virtual bool HandleKeyboard(UINT uMsg, WPARAM wParam, LPARAM lParam)
Rendering::PackedColor m_SelTextColor
void ParseFloatArray(float *pNumbers, int nCount)
void SetFont(UINT prmFont, Rendering::PackedColor defaultFontColor=Rendering::ColorARGB(255, 255, 255, 255), DWORD prmTextFormat=DT_CENTER|DT_VCENTER)
UIBlendColor TextureColor
void SetTexture(UINT prmTexture, RECT *prcTexture, Rendering::PackedColor defaultTextureColor=Rendering::ColorARGB(255, 255, 255, 255))
UIListBoxItem * GetItem(int nIndex)
RiseListBox(RiseDialog *pDialog=NULL)
virtual void Render(float fElapsedTime)
virtual void UpdateRects()
void RemoveItem(int nIndex)
HRESULT AddItem(const WCHAR *wszText, void *pData)
virtual bool HandleMouse(UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam)
virtual bool MsgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
void SetStyle(DWORD dwStyle)
void SelectItem(int nNewIndex)
ControlArray< UIListBoxItem * > m_Items
void RemoveItemByData(void *pData)
virtual bool HandleKeyboard(UINT uMsg, WPARAM wParam, LPARAM lParam)
RiseScrollBar m_ScrollBar
int GetSelectedIndex(int nPreviousSelected=-1)
HRESULT InsertItem(int nIndex, const WCHAR *wszText, void *pData)
virtual void Render(float fElapsedTime)
virtual bool HandleKeyboard(UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual bool HandleMouse(UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam)
void SetValue(int nValue)
virtual void UpdateRects()
virtual BOOL ContainsPoint(POINT pt)
RiseSlider(RiseDialog *pDialog=NULL)
void SetValueInternal(int nValue, bool bFromInput)
void SetRange(int nMin, int nMax)
RiseStatic(RiseDialog *pDialog=NULL)
WCHAR m_strText[MAX_TEXT]
HRESULT SetText(LPCWSTR strText)
virtual void Render(float fElapsedTime)
HRESULT GetTextCopy(__out_ecount(bufferCount) LPWSTR strDest, UINT bufferCount)
constexpr uint32_t INVSRCALPHA
constexpr uint32_t SRCALPHA
constexpr uint32_t LINEAR
constexpr uint32_t COLORWRITEENABLE
constexpr uint32_t SRCBLEND
constexpr uint32_t SHADEMODE
constexpr uint32_t SEPARATEALPHABLENDENABLE
constexpr uint32_t CULLMODE
constexpr uint32_t ALPHABLENDENABLE
constexpr uint32_t ALPHATESTENABLE
constexpr uint32_t FOGENABLE
constexpr uint32_t FILLMODE
constexpr uint32_t DESTBLEND
constexpr uint32_t ZWRITEENABLE
constexpr uint32_t ZENABLE
constexpr uint32_t BLENDOP
constexpr uint32_t MINFILTER
constexpr uint32_t DIFFUSE
constexpr uint32_t TEXTURE
constexpr uint32_t CURRENT
constexpr uint32_t DISABLE
constexpr uint32_t SELECTARG1
constexpr uint32_t MODULATE
constexpr uint32_t SELECTARG2
constexpr uint32_t COLOROP
constexpr uint32_t COLORARG1
constexpr uint32_t ALPHAARG2
constexpr uint32_t RESULTARG
constexpr uint32_t ALPHAARG1
constexpr uint32_t ALPHAOP
constexpr uint32_t COLORARG2
HRESULT CreateFontW(RenderDevice *owner, INT height, UINT width, UINT weight, UINT mipLevels, BOOL italic, DWORD charset, DWORD precision, DWORD quality, DWORD pitch, const wchar_t *face, RenderFont **result)
HRESULT TraceFailure(const wchar_t *operation, HRESULT code)
HRESULT LoadTextureResource(RenderDevice *owner, HMODULE module, LPCWSTR id, RenderTexture **result, UINT levels)
HRESULT CreateSprite(RenderDevice *owner, RenderSprite **result)
double ClientAbsoluteTime()
HRESULT LoadTexture(RenderDevice *owner, const wchar_t *path, RenderTexture **result, UINT levels=0, UINT width=0, UINT height=0)
constexpr PackedColor ColorARGB(unsigned a, unsigned r, unsigned g, unsigned b)
Color * ColorLerp(Color *out, const Color *a, const Color *b, float t)
Matrix * MatrixIdentity(Matrix *out)
Matrix * MatrixScaling(Matrix *out, float x, float y, float z)
Rendering::PackedColor color
Rendering::PackedColor color
void Blend(UINT iState, float fElapsedTime, float fRate=0.7f)
void Init(Rendering::PackedColor defaultColor, Rendering::PackedColor disabledColor=Rendering::ColorARGB(200, 128, 128, 128), Rendering::PackedColor hiddenColor=0)
Rendering::PackedColor States[MAX_CONTROL_STATES]
Rendering::RenderFont * font
WCHAR strFilename[MAX_PATH]
Rendering::RenderTexture * texture