| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fwl/theme/cfwl_widgettp.h" | 7 #include "xfa/fwl/theme/cfwl_widgettp.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "xfa/fde/tto/fde_textout.h" | 11 #include "xfa/fde/tto/fde_textout.h" |
| 12 #include "xfa/fgas/font/fgas_gefont.h" | 12 #include "xfa/fgas/font/fgas_gefont.h" |
| 13 #include "xfa/fgas/font/fgas_stdfontmgr.h" | 13 #include "xfa/fgas/font/fgas_stdfontmgr.h" |
| 14 #include "xfa/fwl/core/cfwl_themebackground.h" | 14 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 15 #include "xfa/fwl/core/cfwl_themepart.h" | 15 #include "xfa/fwl/core/cfwl_themepart.h" |
| 16 #include "xfa/fwl/core/cfwl_themetext.h" | 16 #include "xfa/fwl/core/cfwl_themetext.h" |
| 17 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 17 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
| 18 #include "xfa/fwl/core/ifwl_themeprovider.h" | 18 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 19 #include "xfa/fwl/core/ifwl_widget.h" | 19 #include "xfa/fwl/core/ifwl_widget.h" |
| 20 #include "xfa/fwl/theme/cfwl_arrowdata.h" |
| 20 #include "xfa/fxgraphics/cfx_color.h" | 21 #include "xfa/fxgraphics/cfx_color.h" |
| 21 #include "xfa/fxgraphics/cfx_path.h" | 22 #include "xfa/fxgraphics/cfx_path.h" |
| 22 #include "xfa/fxgraphics/cfx_shading.h" | 23 #include "xfa/fxgraphics/cfx_shading.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 const float kEdgeFlat = 2.0f; | 27 const float kEdgeFlat = 2.0f; |
| 27 const float kEdgeRaised = 2.0f; | 28 const float kEdgeRaised = 2.0f; |
| 28 const float kEdgeSunken = 2.0f; | 29 const float kEdgeSunken = 2.0f; |
| 29 const float kLineHeight = 12.0f; | 30 const float kLineHeight = 12.0f; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 54 | 55 |
| 55 uint32_t CFWL_WidgetTP::GetThemeID(IFWL_Widget* pWidget) { | 56 uint32_t CFWL_WidgetTP::GetThemeID(IFWL_Widget* pWidget) { |
| 56 return m_dwThemeID; | 57 return m_dwThemeID; |
| 57 } | 58 } |
| 58 | 59 |
| 59 uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, | 60 uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, |
| 60 uint32_t dwThemeID, | 61 uint32_t dwThemeID, |
| 61 FX_BOOL bChildren) { | 62 FX_BOOL bChildren) { |
| 62 uint32_t dwOld = m_dwThemeID; | 63 uint32_t dwOld = m_dwThemeID; |
| 63 m_dwThemeID = dwThemeID; | 64 m_dwThemeID = dwThemeID; |
| 64 if (CFWL_ArrowData::IsInstance()) { | 65 if (CFWL_ArrowData::HasInstance()) { |
| 65 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(dwThemeID)); | 66 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(dwThemeID)); |
| 66 } | 67 } |
| 67 if (bChildren) { | 68 if (bChildren) { |
| 68 FWL_SetChildThemeID(pWidget, dwThemeID); | 69 FWL_SetChildThemeID(pWidget, dwThemeID); |
| 69 } | 70 } |
| 70 return dwOld; | 71 return dwOld; |
| 71 } | 72 } |
| 73 |
| 72 FWL_Error CFWL_WidgetTP::GetThemeMatrix(IFWL_Widget* pWidget, | 74 FWL_Error CFWL_WidgetTP::GetThemeMatrix(IFWL_Widget* pWidget, |
| 73 CFX_Matrix& matrix) { | 75 CFX_Matrix& matrix) { |
| 74 matrix.Set(_ctm.a, _ctm.b, _ctm.c, _ctm.d, _ctm.e, _ctm.f); | 76 matrix.Set(_ctm.a, _ctm.b, _ctm.c, _ctm.d, _ctm.e, _ctm.f); |
| 75 return FWL_Error::Succeeded; | 77 return FWL_Error::Succeeded; |
| 76 } | 78 } |
| 79 |
| 77 FWL_Error CFWL_WidgetTP::SetThemeMatrix(IFWL_Widget* pWidget, | 80 FWL_Error CFWL_WidgetTP::SetThemeMatrix(IFWL_Widget* pWidget, |
| 78 const CFX_Matrix& matrix) { | 81 const CFX_Matrix& matrix) { |
| 79 _ctm.Set(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f); | 82 _ctm.Set(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f); |
| 80 return FWL_Error::Succeeded; | 83 return FWL_Error::Succeeded; |
| 81 } | 84 } |
| 85 |
| 82 FX_BOOL CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 86 FX_BOOL CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) { |
| 83 return TRUE; | 87 return TRUE; |
| 84 } | 88 } |
| 89 |
| 85 FX_BOOL CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { | 90 FX_BOOL CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { |
| 86 if (!m_pTextOut) | 91 if (!m_pTextOut) |
| 87 InitTTO(); | 92 InitTTO(); |
| 88 | 93 |
| 89 int32_t iLen = pParams->m_wsText.GetLength(); | 94 int32_t iLen = pParams->m_wsText.GetLength(); |
| 90 if (iLen <= 0) | 95 if (iLen <= 0) |
| 91 return FALSE; | 96 return FALSE; |
| 92 CFX_Graphics* pGraphics = pParams->m_pGraphics; | 97 CFX_Graphics* pGraphics = pParams->m_pGraphics; |
| 93 m_pTextOut->SetRenderDevice(pGraphics->GetRenderDevice()); | 98 m_pTextOut->SetRenderDevice(pGraphics->GetRenderDevice()); |
| 94 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 99 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
| 95 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 100 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
| 96 CFX_Matrix* pMatrix = &pParams->m_matrix; | 101 CFX_Matrix* pMatrix = &pParams->m_matrix; |
| 97 pMatrix->Concat(*pGraphics->GetMatrix()); | 102 pMatrix->Concat(*pGraphics->GetMatrix()); |
| 98 m_pTextOut->SetMatrix(*pMatrix); | 103 m_pTextOut->SetMatrix(*pMatrix); |
| 99 m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), iLen, pParams->m_rtPart); | 104 m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), iLen, pParams->m_rtPart); |
| 100 return TRUE; | 105 return TRUE; |
| 101 } | 106 } |
| 107 |
| 102 void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, | 108 void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, |
| 103 CFWL_WidgetCapacity dwCapacity) { | 109 CFWL_WidgetCapacity dwCapacity) { |
| 104 switch (dwCapacity) { | 110 switch (dwCapacity) { |
| 105 case CFWL_WidgetCapacity::CXBorder: { | 111 case CFWL_WidgetCapacity::CXBorder: { |
| 106 m_fValue = kCXBorder; | 112 m_fValue = kCXBorder; |
| 107 break; | 113 break; |
| 108 } | 114 } |
| 109 case CFWL_WidgetCapacity::CYBorder: { | 115 case CFWL_WidgetCapacity::CYBorder: { |
| 110 m_fValue = kCYBorder; | 116 m_fValue = kCYBorder; |
| 111 break; | 117 break; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 break; | 153 break; |
| 148 } | 154 } |
| 149 case CFWL_WidgetCapacity::UIMargin: { | 155 case CFWL_WidgetCapacity::UIMargin: { |
| 150 m_rtMargin.Set(0, 0, 0, 0); | 156 m_rtMargin.Set(0, 0, 0, 0); |
| 151 return &m_rtMargin; | 157 return &m_rtMargin; |
| 152 } | 158 } |
| 153 default: { return nullptr; } | 159 default: { return nullptr; } |
| 154 } | 160 } |
| 155 return &m_fValue; | 161 return &m_fValue; |
| 156 } | 162 } |
| 163 |
| 157 FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { | 164 FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { |
| 158 return FWL_GetThemeLayout(m_dwThemeID); | 165 return FWL_GetThemeLayout(m_dwThemeID); |
| 159 } | 166 } |
| 167 |
| 160 FWL_Error CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart, | 168 FWL_Error CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart, |
| 161 CFX_RectF& rect) { | 169 CFX_RectF& rect) { |
| 162 return FWL_Error::Succeeded; | 170 return FWL_Error::Succeeded; |
| 163 } | 171 } |
| 172 |
| 164 FX_BOOL CFWL_WidgetTP::IsInPart(CFWL_ThemePart* pThemePart, | 173 FX_BOOL CFWL_WidgetTP::IsInPart(CFWL_ThemePart* pThemePart, |
| 165 FX_FLOAT fx, | 174 FX_FLOAT fx, |
| 166 FX_FLOAT fy) { | 175 FX_FLOAT fy) { |
| 167 return TRUE; | 176 return TRUE; |
| 168 } | 177 } |
| 178 |
| 169 FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { | 179 FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { |
| 170 if (!pParams) | 180 if (!pParams) |
| 171 return FALSE; | 181 return FALSE; |
| 172 if (!m_pTextOut) | 182 if (!m_pTextOut) |
| 173 return FALSE; | 183 return FALSE; |
| 174 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 184 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
| 175 m_pTextOut->SetStyles(pParams->m_dwTTOStyles | FDE_TTOSTYLE_ArabicContext); | 185 m_pTextOut->SetStyles(pParams->m_dwTTOStyles | FDE_TTOSTYLE_ArabicContext); |
| 176 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), | 186 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), |
| 177 pParams->m_wsText.GetLength(), rect); | 187 pParams->m_wsText.GetLength(), rect); |
| 178 return TRUE; | 188 return TRUE; |
| 179 } | 189 } |
| 190 |
| 180 FWL_Error CFWL_WidgetTP::Initialize() { | 191 FWL_Error CFWL_WidgetTP::Initialize() { |
| 181 m_dwThemeID = 0; | 192 m_dwThemeID = 0; |
| 182 _ctm.SetIdentity(); | 193 _ctm.SetIdentity(); |
| 183 return FWL_Error::Succeeded; | 194 return FWL_Error::Succeeded; |
| 184 } | 195 } |
| 196 |
| 185 FWL_Error CFWL_WidgetTP::Finalize() { | 197 FWL_Error CFWL_WidgetTP::Finalize() { |
| 186 if (!m_pTextOut) | 198 if (!m_pTextOut) |
| 187 FinalizeTTO(); | 199 FinalizeTTO(); |
| 188 return FWL_Error::Succeeded; | 200 return FWL_Error::Succeeded; |
| 189 } | 201 } |
| 202 |
| 190 CFWL_WidgetTP::~CFWL_WidgetTP() {} | 203 CFWL_WidgetTP::~CFWL_WidgetTP() {} |
| 204 |
| 191 FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, | 205 FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, |
| 192 const FX_WCHAR* strFont, | 206 const FX_WCHAR* strFont, |
| 193 FX_FLOAT fFontSize, | 207 FX_FLOAT fFontSize, |
| 194 FX_ARGB rgbFont) { | 208 FX_ARGB rgbFont) { |
| 195 if (!m_pTextOut) | 209 if (!m_pTextOut) |
| 196 return FWL_Error::Succeeded; | 210 return FWL_Error::Succeeded; |
| 197 | 211 |
| 198 m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0); | 212 m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0); |
| 199 m_pTextOut->SetFont(m_pFDEFont); | 213 m_pTextOut->SetFont(m_pFDEFont); |
| 200 m_pTextOut->SetFontSize(fFontSize); | 214 m_pTextOut->SetFontSize(fFontSize); |
| 201 m_pTextOut->SetTextColor(rgbFont); | 215 m_pTextOut->SetTextColor(rgbFont); |
| 202 return FWL_Error::Succeeded; | 216 return FWL_Error::Succeeded; |
| 203 } | 217 } |
| 218 |
| 204 FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, | 219 FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, |
| 205 CFGAS_GEFont* pFont, | 220 CFGAS_GEFont* pFont, |
| 206 FX_FLOAT fFontSize, | 221 FX_FLOAT fFontSize, |
| 207 FX_ARGB rgbFont) { | 222 FX_ARGB rgbFont) { |
| 208 if (!m_pTextOut) | 223 if (!m_pTextOut) |
| 209 return FWL_Error::Succeeded; | 224 return FWL_Error::Succeeded; |
| 210 | 225 |
| 211 m_pTextOut->SetFont(pFont); | 226 m_pTextOut->SetFont(pFont); |
| 212 m_pTextOut->SetFontSize(fFontSize); | 227 m_pTextOut->SetFontSize(fFontSize); |
| 213 m_pTextOut->SetTextColor(rgbFont); | 228 m_pTextOut->SetTextColor(rgbFont); |
| 214 return FWL_Error::Succeeded; | 229 return FWL_Error::Succeeded; |
| 215 } | 230 } |
| 231 |
| 216 CFGAS_GEFont* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) { | 232 CFGAS_GEFont* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) { |
| 217 return m_pFDEFont; | 233 return m_pFDEFont; |
| 218 } | 234 } |
| 219 | 235 |
| 220 CFWL_WidgetTP::CFWL_WidgetTP() | 236 CFWL_WidgetTP::CFWL_WidgetTP() |
| 221 : m_dwRefCount(1), m_pFDEFont(nullptr), m_dwThemeID(0) {} | 237 : m_dwRefCount(1), m_pFDEFont(nullptr), m_dwThemeID(0) {} |
| 222 | 238 |
| 223 FWL_Error CFWL_WidgetTP::InitTTO() { | 239 FWL_Error CFWL_WidgetTP::InitTTO() { |
| 224 if (m_pTextOut) | 240 if (m_pTextOut) |
| 225 return FWL_Error::Succeeded; | 241 return FWL_Error::Succeeded; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 pathRB.LineTo(fRight, fBottom); | 361 pathRB.LineTo(fRight, fBottom); |
| 346 pathRB.LineTo(fLeft, fBottom); | 362 pathRB.LineTo(fLeft, fBottom); |
| 347 pathRB.LineTo(fLeft, fBottom - fHalfWidth); | 363 pathRB.LineTo(fLeft, fBottom - fHalfWidth); |
| 348 pathRB.LineTo(fRight - fHalfWidth, fBottom - fHalfWidth); | 364 pathRB.LineTo(fRight - fHalfWidth, fBottom - fHalfWidth); |
| 349 pathRB.LineTo(fRight - fHalfWidth, fTop); | 365 pathRB.LineTo(fRight - fHalfWidth, fTop); |
| 350 pathRB.LineTo(fRight, fTop); | 366 pathRB.LineTo(fRight, fTop); |
| 351 pGraphics->FillPath(&pathRB, FXFILL_WINDING, pMatrix); | 367 pGraphics->FillPath(&pathRB, FXFILL_WINDING, pMatrix); |
| 352 } | 368 } |
| 353 pGraphics->RestoreGraphState(); | 369 pGraphics->RestoreGraphState(); |
| 354 } | 370 } |
| 371 |
| 355 void CFWL_WidgetTP::Draw3DCircle(CFX_Graphics* pGraphics, | 372 void CFWL_WidgetTP::Draw3DCircle(CFX_Graphics* pGraphics, |
| 356 FWLTHEME_EDGE eType, | 373 FWLTHEME_EDGE eType, |
| 357 FX_FLOAT fWidth, | 374 FX_FLOAT fWidth, |
| 358 const CFX_RectF* pRect, | 375 const CFX_RectF* pRect, |
| 359 FX_ARGB cr1, | 376 FX_ARGB cr1, |
| 360 FX_ARGB cr2, | 377 FX_ARGB cr2, |
| 361 FX_ARGB cr3, | 378 FX_ARGB cr3, |
| 362 FX_ARGB cr4, | 379 FX_ARGB cr4, |
| 363 CFX_Matrix* pMatrix) { | 380 CFX_Matrix* pMatrix) { |
| 364 if (!pGraphics) | 381 if (!pGraphics) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 387 CFX_Color crFill3(eType == FWLTHEME_EDGE_Raised ? cr1 : cr3); | 404 CFX_Color crFill3(eType == FWLTHEME_EDGE_Raised ? cr1 : cr3); |
| 388 pGraphics->SetStrokeColor(&crFill3); | 405 pGraphics->SetStrokeColor(&crFill3); |
| 389 pGraphics->StrokePath(&path, pMatrix); | 406 pGraphics->StrokePath(&path, pMatrix); |
| 390 path.AddArc(rtInner.left, rtInner.top, rtInner.width, rtInner.height, | 407 path.AddArc(rtInner.left, rtInner.top, rtInner.width, rtInner.height, |
| 391 FX_PI * 7 / 4, FX_PI); | 408 FX_PI * 7 / 4, FX_PI); |
| 392 CFX_Color crFill4(eType == FWLTHEME_EDGE_Raised ? cr2 : cr4); | 409 CFX_Color crFill4(eType == FWLTHEME_EDGE_Raised ? cr2 : cr4); |
| 393 pGraphics->SetStrokeColor(&crFill4); | 410 pGraphics->SetStrokeColor(&crFill4); |
| 394 pGraphics->StrokePath(&path, pMatrix); | 411 pGraphics->StrokePath(&path, pMatrix); |
| 395 pGraphics->RestoreGraphState(); | 412 pGraphics->RestoreGraphState(); |
| 396 } | 413 } |
| 414 |
| 397 void CFWL_WidgetTP::DrawBorder(CFX_Graphics* pGraphics, | 415 void CFWL_WidgetTP::DrawBorder(CFX_Graphics* pGraphics, |
| 398 const CFX_RectF* pRect, | 416 const CFX_RectF* pRect, |
| 399 CFX_Matrix* pMatrix) { | 417 CFX_Matrix* pMatrix) { |
| 400 if (!pGraphics) | 418 if (!pGraphics) |
| 401 return; | 419 return; |
| 402 if (!pRect) | 420 if (!pRect) |
| 403 return; | 421 return; |
| 404 CFX_Path path; | 422 CFX_Path path; |
| 405 path.Create(); | 423 path.Create(); |
| 406 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); | 424 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); |
| 407 path.AddRectangle(pRect->left + 1, pRect->top + 1, pRect->width - 2, | 425 path.AddRectangle(pRect->left + 1, pRect->top + 1, pRect->width - 2, |
| 408 pRect->height - 2); | 426 pRect->height - 2); |
| 409 pGraphics->SaveGraphState(); | 427 pGraphics->SaveGraphState(); |
| 410 CFX_Color crFill(ArgbEncode(255, 0, 0, 0)); | 428 CFX_Color crFill(ArgbEncode(255, 0, 0, 0)); |
| 411 pGraphics->SetFillColor(&crFill); | 429 pGraphics->SetFillColor(&crFill); |
| 412 pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); | 430 pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); |
| 413 pGraphics->RestoreGraphState(); | 431 pGraphics->RestoreGraphState(); |
| 414 } | 432 } |
| 433 |
| 415 void CFWL_WidgetTP::FillBackground(CFX_Graphics* pGraphics, | 434 void CFWL_WidgetTP::FillBackground(CFX_Graphics* pGraphics, |
| 416 const CFX_RectF* pRect, | 435 const CFX_RectF* pRect, |
| 417 CFX_Matrix* pMatrix) { | 436 CFX_Matrix* pMatrix) { |
| 418 FillSoildRect(pGraphics, FWLTHEME_COLOR_Background, pRect, pMatrix); | 437 FillSoildRect(pGraphics, FWLTHEME_COLOR_Background, pRect, pMatrix); |
| 419 } | 438 } |
| 439 |
| 420 void CFWL_WidgetTP::FillSoildRect(CFX_Graphics* pGraphics, | 440 void CFWL_WidgetTP::FillSoildRect(CFX_Graphics* pGraphics, |
| 421 FX_ARGB fillColor, | 441 FX_ARGB fillColor, |
| 422 const CFX_RectF* pRect, | 442 const CFX_RectF* pRect, |
| 423 CFX_Matrix* pMatrix) { | 443 CFX_Matrix* pMatrix) { |
| 424 if (!pGraphics) | 444 if (!pGraphics) |
| 425 return; | 445 return; |
| 426 if (!pRect) | 446 if (!pRect) |
| 427 return; | 447 return; |
| 428 pGraphics->SaveGraphState(); | 448 pGraphics->SaveGraphState(); |
| 429 CFX_Color crFill(fillColor); | 449 CFX_Color crFill(fillColor); |
| 430 pGraphics->SetFillColor(&crFill); | 450 pGraphics->SetFillColor(&crFill); |
| 431 CFX_Path path; | 451 CFX_Path path; |
| 432 path.Create(); | 452 path.Create(); |
| 433 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); | 453 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); |
| 434 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | 454 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); |
| 435 pGraphics->RestoreGraphState(); | 455 pGraphics->RestoreGraphState(); |
| 436 } | 456 } |
| 457 |
| 437 void CFWL_WidgetTP::DrawAxialShading(CFX_Graphics* pGraphics, | 458 void CFWL_WidgetTP::DrawAxialShading(CFX_Graphics* pGraphics, |
| 438 FX_FLOAT fx1, | 459 FX_FLOAT fx1, |
| 439 FX_FLOAT fy1, | 460 FX_FLOAT fy1, |
| 440 FX_FLOAT fx2, | 461 FX_FLOAT fx2, |
| 441 FX_FLOAT fy2, | 462 FX_FLOAT fy2, |
| 442 FX_ARGB beginColor, | 463 FX_ARGB beginColor, |
| 443 FX_ARGB endColor, | 464 FX_ARGB endColor, |
| 444 CFX_Path* path, | 465 CFX_Path* path, |
| 445 int32_t fillMode, | 466 int32_t fillMode, |
| 446 CFX_Matrix* pMatrix) { | 467 CFX_Matrix* pMatrix) { |
| 447 if (!pGraphics || !path) | 468 if (!pGraphics || !path) |
| 448 return; | 469 return; |
| 449 | 470 |
| 450 CFX_PointF begPoint(fx1, fy1); | 471 CFX_PointF begPoint(fx1, fy1); |
| 451 CFX_PointF endPoint(fx2, fy2); | 472 CFX_PointF endPoint(fx2, fy2); |
| 452 CFX_Shading shading(begPoint, endPoint, FALSE, FALSE, beginColor, endColor); | 473 CFX_Shading shading(begPoint, endPoint, FALSE, FALSE, beginColor, endColor); |
| 453 pGraphics->SaveGraphState(); | 474 pGraphics->SaveGraphState(); |
| 454 CFX_Color color1(&shading); | 475 CFX_Color color1(&shading); |
| 455 pGraphics->SetFillColor(&color1); | 476 pGraphics->SetFillColor(&color1); |
| 456 pGraphics->FillPath(path, fillMode, pMatrix); | 477 pGraphics->FillPath(path, fillMode, pMatrix); |
| 457 pGraphics->RestoreGraphState(); | 478 pGraphics->RestoreGraphState(); |
| 458 } | 479 } |
| 480 |
| 459 void CFWL_WidgetTP::DrawAnnulusRect(CFX_Graphics* pGraphics, | 481 void CFWL_WidgetTP::DrawAnnulusRect(CFX_Graphics* pGraphics, |
| 460 FX_ARGB fillColor, | 482 FX_ARGB fillColor, |
| 461 const CFX_RectF* pRect, | 483 const CFX_RectF* pRect, |
| 462 FX_FLOAT fRingWidth, | 484 FX_FLOAT fRingWidth, |
| 463 CFX_Matrix* pMatrix) { | 485 CFX_Matrix* pMatrix) { |
| 464 if (!pGraphics) | 486 if (!pGraphics) |
| 465 return; | 487 return; |
| 466 if (!pRect) | 488 if (!pRect) |
| 467 return; | 489 return; |
| 468 pGraphics->SaveGraphState(); | 490 pGraphics->SaveGraphState(); |
| 469 CFX_Color cr(fillColor); | 491 CFX_Color cr(fillColor); |
| 470 pGraphics->SetFillColor(&cr); | 492 pGraphics->SetFillColor(&cr); |
| 471 CFX_Path path; | 493 CFX_Path path; |
| 472 path.Create(); | 494 path.Create(); |
| 473 CFX_RectF rtInner(*pRect); | 495 CFX_RectF rtInner(*pRect); |
| 474 rtInner.Deflate(fRingWidth, fRingWidth); | 496 rtInner.Deflate(fRingWidth, fRingWidth); |
| 475 path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height); | 497 path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height); |
| 476 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); | 498 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); |
| 477 pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); | 499 pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); |
| 478 pGraphics->RestoreGraphState(); | 500 pGraphics->RestoreGraphState(); |
| 479 } | 501 } |
| 502 |
| 480 void CFWL_WidgetTP::DrawAnnulusCircle(CFX_Graphics* pGraphics, | 503 void CFWL_WidgetTP::DrawAnnulusCircle(CFX_Graphics* pGraphics, |
| 481 FX_ARGB fillColor, | 504 FX_ARGB fillColor, |
| 482 const CFX_RectF* pRect, | 505 const CFX_RectF* pRect, |
| 483 FX_FLOAT fWidth, | 506 FX_FLOAT fWidth, |
| 484 CFX_Matrix* pMatrix) { | 507 CFX_Matrix* pMatrix) { |
| 485 if (!pGraphics) | 508 if (!pGraphics) |
| 486 return; | 509 return; |
| 487 if (!pRect) | 510 if (!pRect) |
| 488 return; | 511 return; |
| 489 if (fWidth > pRect->width / 2) { | 512 if (fWidth > pRect->width / 2) { |
| 490 return; | 513 return; |
| 491 } | 514 } |
| 492 pGraphics->SaveGraphState(); | 515 pGraphics->SaveGraphState(); |
| 493 CFX_Color cr(fillColor); | 516 CFX_Color cr(fillColor); |
| 494 pGraphics->SetFillColor(&cr); | 517 pGraphics->SetFillColor(&cr); |
| 495 CFX_Path path; | 518 CFX_Path path; |
| 496 path.Create(); | 519 path.Create(); |
| 497 path.AddEllipse(*pRect); | 520 path.AddEllipse(*pRect); |
| 498 CFX_RectF rtIn(*pRect); | 521 CFX_RectF rtIn(*pRect); |
| 499 rtIn.Inflate(-fWidth, -fWidth); | 522 rtIn.Inflate(-fWidth, -fWidth); |
| 500 path.AddEllipse(rtIn); | 523 path.AddEllipse(rtIn); |
| 501 pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); | 524 pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); |
| 502 pGraphics->RestoreGraphState(); | 525 pGraphics->RestoreGraphState(); |
| 503 } | 526 } |
| 527 |
| 504 void CFWL_WidgetTP::DrawFocus(CFX_Graphics* pGraphics, | 528 void CFWL_WidgetTP::DrawFocus(CFX_Graphics* pGraphics, |
| 505 const CFX_RectF* pRect, | 529 const CFX_RectF* pRect, |
| 506 CFX_Matrix* pMatrix) { | 530 CFX_Matrix* pMatrix) { |
| 507 if (!pGraphics) | 531 if (!pGraphics) |
| 508 return; | 532 return; |
| 509 if (!pRect) | 533 if (!pRect) |
| 510 return; | 534 return; |
| 511 pGraphics->SaveGraphState(); | 535 pGraphics->SaveGraphState(); |
| 512 CFX_Color cr(0xFF000000); | 536 CFX_Color cr(0xFF000000); |
| 513 pGraphics->SetStrokeColor(&cr); | 537 pGraphics->SetStrokeColor(&cr); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 path.LineTo(rtArrow.left + fBtn / 2, rtArrow.bottom()); | 591 path.LineTo(rtArrow.left + fBtn / 2, rtArrow.bottom()); |
| 568 path.LineTo(rtArrow.left, rtArrow.top); | 592 path.LineTo(rtArrow.left, rtArrow.top); |
| 569 } | 593 } |
| 570 } | 594 } |
| 571 pGraphics->SaveGraphState(); | 595 pGraphics->SaveGraphState(); |
| 572 CFX_Color cr(argbFill); | 596 CFX_Color cr(argbFill); |
| 573 pGraphics->SetFillColor(&cr); | 597 pGraphics->SetFillColor(&cr); |
| 574 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | 598 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); |
| 575 pGraphics->RestoreGraphState(); | 599 pGraphics->RestoreGraphState(); |
| 576 } | 600 } |
| 601 |
| 577 void CFWL_WidgetTP::DrawArrow(CFX_Graphics* pGraphics, | 602 void CFWL_WidgetTP::DrawArrow(CFX_Graphics* pGraphics, |
| 578 const CFX_RectF* pRect, | 603 const CFX_RectF* pRect, |
| 579 FWLTHEME_DIRECTION eDict, | 604 FWLTHEME_DIRECTION eDict, |
| 580 FX_ARGB argSign, | 605 FX_ARGB argSign, |
| 581 CFX_Matrix* pMatrix) { | 606 CFX_Matrix* pMatrix) { |
| 582 FX_BOOL bVert = | 607 FX_BOOL bVert = |
| 583 (eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down); | 608 (eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down); |
| 584 FX_FLOAT fLeft = | 609 FX_FLOAT fLeft = |
| 585 (FX_FLOAT)(((pRect->width - (bVert ? 9 : 6)) / 2 + pRect->left) + 0.5); | 610 (FX_FLOAT)(((pRect->width - (bVert ? 9 : 6)) / 2 + pRect->left) + 0.5); |
| 586 FX_FLOAT fTop = | 611 FX_FLOAT fTop = |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 path.LineTo(fLeft + 2, fTop + 4); | 647 path.LineTo(fLeft + 2, fTop + 4); |
| 623 path.LineTo(fLeft + 5, fTop + 7); | 648 path.LineTo(fLeft + 5, fTop + 7); |
| 624 path.LineTo(fLeft + 4, fTop + 8); | 649 path.LineTo(fLeft + 4, fTop + 8); |
| 625 break; | 650 break; |
| 626 } | 651 } |
| 627 } | 652 } |
| 628 CFX_Color cr(argSign); | 653 CFX_Color cr(argSign); |
| 629 pGraphics->SetFillColor(&cr); | 654 pGraphics->SetFillColor(&cr); |
| 630 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | 655 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); |
| 631 } | 656 } |
| 657 |
| 632 void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics, | 658 void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics, |
| 633 const CFX_RectF* pRect, | 659 const CFX_RectF* pRect, |
| 634 FWLTHEME_STATE eState, | 660 FWLTHEME_STATE eState, |
| 635 CFX_Matrix* pMatrix) { | 661 CFX_Matrix* pMatrix) { |
| 636 CFX_Path path; | 662 CFX_Path path; |
| 637 path.Create(); | 663 path.Create(); |
| 638 if (!CFWL_ArrowData::IsInstance()) { | 664 if (!CFWL_ArrowData::HasInstance()) { |
| 639 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); | 665 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); |
| 640 } | 666 } |
| 641 CFWL_ArrowData::CColorData* pColorData = | 667 CFWL_ArrowData::CColorData* pColorData = |
| 642 CFWL_ArrowData::GetInstance()->m_pColorData; | 668 CFWL_ArrowData::GetInstance()->m_pColorData.get(); |
| 643 FX_FLOAT fRight = pRect->right(); | 669 FX_FLOAT fRight = pRect->right(); |
| 644 FX_FLOAT fBottom = pRect->bottom(); | 670 FX_FLOAT fBottom = pRect->bottom(); |
| 645 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); | 671 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); |
| 646 DrawAxialShading(pGraphics, pRect->left, pRect->top, fRight, fBottom, | 672 DrawAxialShading(pGraphics, pRect->left, pRect->top, fRight, fBottom, |
| 647 pColorData->clrStart[eState - 1], | 673 pColorData->clrStart[eState - 1], |
| 648 pColorData->clrEnd[eState - 1], &path, FXFILL_WINDING, | 674 pColorData->clrEnd[eState - 1], &path, FXFILL_WINDING, |
| 649 pMatrix); | 675 pMatrix); |
| 650 CFX_Color rcStroke; | 676 CFX_Color rcStroke; |
| 651 rcStroke.Set(pColorData->clrBorder[eState - 1]); | 677 rcStroke.Set(pColorData->clrBorder[eState - 1]); |
| 652 pGraphics->SetStrokeColor(&rcStroke); | 678 pGraphics->SetStrokeColor(&rcStroke); |
| 653 pGraphics->StrokePath(&path, pMatrix); | 679 pGraphics->StrokePath(&path, pMatrix); |
| 654 } | 680 } |
| 681 |
| 655 void CFWL_WidgetTP::DrawArrowBtn(CFX_Graphics* pGraphics, | 682 void CFWL_WidgetTP::DrawArrowBtn(CFX_Graphics* pGraphics, |
| 656 const CFX_RectF* pRect, | 683 const CFX_RectF* pRect, |
| 657 FWLTHEME_DIRECTION eDict, | 684 FWLTHEME_DIRECTION eDict, |
| 658 FWLTHEME_STATE eState, | 685 FWLTHEME_STATE eState, |
| 659 CFX_Matrix* pMatrix) { | 686 CFX_Matrix* pMatrix) { |
| 660 DrawBtn(pGraphics, pRect, eState, pMatrix); | 687 DrawBtn(pGraphics, pRect, eState, pMatrix); |
| 661 if (!CFWL_ArrowData::IsInstance()) { | 688 if (!CFWL_ArrowData::HasInstance()) { |
| 662 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); | 689 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); |
| 663 } | 690 } |
| 664 CFWL_ArrowData::CColorData* pColorData = | 691 CFWL_ArrowData::CColorData* pColorData = |
| 665 CFWL_ArrowData::GetInstance()->m_pColorData; | 692 CFWL_ArrowData::GetInstance()->m_pColorData.get(); |
| 666 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); | 693 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); |
| 667 } | 694 } |
| 695 |
| 668 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(nullptr) { | 696 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(nullptr) { |
| 669 SetColorData(0); | 697 SetColorData(0); |
| 670 } | 698 } |
| 699 |
| 671 CFWL_FontData::CFWL_FontData() | 700 CFWL_FontData::CFWL_FontData() |
| 672 : m_dwStyles(0), | 701 : m_dwStyles(0), |
| 673 m_dwCodePage(0), | 702 m_dwCodePage(0), |
| 674 m_pFont(0), | 703 m_pFont(0), |
| 675 m_pFontMgr(nullptr) | 704 m_pFontMgr(nullptr) |
| 676 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 705 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 677 , | 706 , |
| 678 m_pFontSource(nullptr) | 707 m_pFontSource(nullptr) |
| 679 #endif | 708 #endif |
| 680 { | 709 { |
| 681 } | 710 } |
| 711 |
| 682 CFWL_FontData::~CFWL_FontData() { | 712 CFWL_FontData::~CFWL_FontData() { |
| 683 if (m_pFont) { | 713 if (m_pFont) { |
| 684 m_pFont->Release(); | 714 m_pFont->Release(); |
| 685 } | 715 } |
| 686 if (m_pFontMgr) { | 716 if (m_pFontMgr) { |
| 687 m_pFontMgr->Release(); | 717 m_pFontMgr->Release(); |
| 688 } | 718 } |
| 689 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 719 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 690 if (m_pFontSource) { | 720 if (m_pFontSource) { |
| 691 m_pFontSource->Release(); | 721 m_pFontSource->Release(); |
| 692 } | 722 } |
| 693 #endif | 723 #endif |
| 694 } | 724 } |
| 725 |
| 695 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily, | 726 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily, |
| 696 uint32_t dwFontStyles, | 727 uint32_t dwFontStyles, |
| 697 uint16_t wCodePage) { | 728 uint16_t wCodePage) { |
| 698 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles && | 729 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles && |
| 699 m_dwCodePage == wCodePage; | 730 m_dwCodePage == wCodePage; |
| 700 } | 731 } |
| 732 |
| 701 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, | 733 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, |
| 702 uint32_t dwFontStyles, | 734 uint32_t dwFontStyles, |
| 703 uint16_t dwCodePage) { | 735 uint16_t dwCodePage) { |
| 704 m_wsFamily = wsFontFamily; | 736 m_wsFamily = wsFontFamily; |
| 705 m_dwStyles = dwFontStyles; | 737 m_dwStyles = dwFontStyles; |
| 706 m_dwCodePage = dwCodePage; | 738 m_dwCodePage = dwCodePage; |
| 707 if (!m_pFontMgr) { | 739 if (!m_pFontMgr) { |
| 708 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 740 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 709 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator()); | 741 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator()); |
| 710 #else | 742 #else |
| 711 m_pFontSource = new CFX_FontSourceEnum_File; | 743 m_pFontSource = new CFX_FontSourceEnum_File; |
| 712 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource); | 744 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource); |
| 713 #endif | 745 #endif |
| 714 } | 746 } |
| 715 m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.c_str(), dwFontStyles, | 747 m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.c_str(), dwFontStyles, |
| 716 dwCodePage, m_pFontMgr); | 748 dwCodePage, m_pFontMgr); |
| 717 return !!m_pFont; | 749 return !!m_pFont; |
| 718 } | 750 } |
| 719 | 751 |
| 720 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr; | 752 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr; |
| 721 CFWL_FontManager* CFWL_FontManager::GetInstance() { | 753 CFWL_FontManager* CFWL_FontManager::GetInstance() { |
| 722 if (!s_FontManager) | 754 if (!s_FontManager) |
| 723 s_FontManager = new CFWL_FontManager; | 755 s_FontManager = new CFWL_FontManager; |
| 724 return s_FontManager; | 756 return s_FontManager; |
| 725 } | 757 } |
| 758 |
| 726 void CFWL_FontManager::DestroyInstance() { | 759 void CFWL_FontManager::DestroyInstance() { |
| 727 delete s_FontManager; | 760 delete s_FontManager; |
| 728 s_FontManager = nullptr; | 761 s_FontManager = nullptr; |
| 729 } | 762 } |
| 763 |
| 730 CFWL_FontManager::CFWL_FontManager() {} | 764 CFWL_FontManager::CFWL_FontManager() {} |
| 765 |
| 731 CFWL_FontManager::~CFWL_FontManager() {} | 766 CFWL_FontManager::~CFWL_FontManager() {} |
| 767 |
| 732 CFGAS_GEFont* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily, | 768 CFGAS_GEFont* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily, |
| 733 uint32_t dwFontStyles, | 769 uint32_t dwFontStyles, |
| 734 uint16_t wCodePage) { | 770 uint16_t wCodePage) { |
| 735 for (const auto& pData : m_FontsArray) { | 771 for (const auto& pData : m_FontsArray) { |
| 736 if (pData->Equal(wsFontFamily, dwFontStyles, wCodePage)) | 772 if (pData->Equal(wsFontFamily, dwFontStyles, wCodePage)) |
| 737 return pData->GetFont(); | 773 return pData->GetFont(); |
| 738 } | 774 } |
| 739 std::unique_ptr<CFWL_FontData> pFontData(new CFWL_FontData); | 775 std::unique_ptr<CFWL_FontData> pFontData(new CFWL_FontData); |
| 740 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage)) | 776 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage)) |
| 741 return nullptr; | 777 return nullptr; |
| 742 m_FontsArray.push_back(std::move(pFontData)); | 778 m_FontsArray.push_back(std::move(pFontData)); |
| 743 return m_FontsArray.back()->GetFont(); | 779 return m_FontsArray.back()->GetFont(); |
| 744 } | 780 } |
| 781 |
| 745 FX_BOOL FWLTHEME_Init() { | 782 FX_BOOL FWLTHEME_Init() { |
| 746 return TRUE; | 783 return TRUE; |
| 747 } | 784 } |
| 785 |
| 748 void FWLTHEME_Release() { | 786 void FWLTHEME_Release() { |
| 749 CFWL_ArrowData::DestroyInstance(); | 787 CFWL_ArrowData::DestroyInstance(); |
| 750 CFWL_FontManager::DestroyInstance(); | 788 CFWL_FontManager::DestroyInstance(); |
| 751 } | 789 } |
| 790 |
| 752 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) { | 791 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) { |
| 753 return 0xffff0000 & dwThemeID; | 792 return 0xffff0000 & dwThemeID; |
| 754 } | 793 } |
| 794 |
| 755 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { | 795 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { |
| 756 return 0x0000ffff & dwThemeID; | 796 return 0x0000ffff & dwThemeID; |
| 757 } | 797 } |
| 758 | |
| 759 CFWL_ArrowData* CFWL_ArrowData::m_pInstance = nullptr; | |
| 760 | |
| 761 CFWL_ArrowData* CFWL_ArrowData::GetInstance() { | |
| 762 if (!m_pInstance) | |
| 763 m_pInstance = new CFWL_ArrowData; | |
| 764 return m_pInstance; | |
| 765 } | |
| 766 | |
| 767 FX_BOOL CFWL_ArrowData::IsInstance() { | |
| 768 return !!m_pInstance; | |
| 769 } | |
| 770 | |
| 771 void CFWL_ArrowData::DestroyInstance() { | |
| 772 delete m_pInstance; | |
| 773 m_pInstance = nullptr; | |
| 774 } | |
| 775 | |
| 776 CFWL_ArrowData::~CFWL_ArrowData() { | |
| 777 delete m_pColorData; | |
| 778 } | |
| 779 | |
| 780 void CFWL_ArrowData::SetColorData(uint32_t dwID) { | |
| 781 if (!m_pColorData) { | |
| 782 m_pColorData = new CColorData; | |
| 783 } | |
| 784 if (dwID) { | |
| 785 m_pColorData->clrBorder[0] = ArgbEncode(255, 142, 153, 125); | |
| 786 m_pColorData->clrBorder[1] = ArgbEncode(255, 157, 171, 119); | |
| 787 m_pColorData->clrBorder[2] = ArgbEncode(255, 118, 131, 97); | |
| 788 m_pColorData->clrBorder[3] = ArgbEncode(255, 172, 168, 153); | |
| 789 m_pColorData->clrStart[0] = ArgbEncode(255, 203, 215, 186); | |
| 790 m_pColorData->clrStart[1] = ArgbEncode(255, 218, 232, 185); | |
| 791 m_pColorData->clrStart[2] = ArgbEncode(255, 203, 215, 186); | |
| 792 m_pColorData->clrStart[3] = ArgbEncode(255, 254, 254, 251); | |
| 793 m_pColorData->clrEnd[0] = ArgbEncode(255, 149, 167, 117); | |
| 794 m_pColorData->clrEnd[1] = ArgbEncode(255, 198, 211, 155); | |
| 795 m_pColorData->clrEnd[2] = ArgbEncode(255, 149, 167, 117); | |
| 796 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236); | |
| 797 m_pColorData->clrSign[0] = ArgbEncode(255, 255, 255, 255); | |
| 798 m_pColorData->clrSign[1] = ArgbEncode(255, 255, 255, 255); | |
| 799 m_pColorData->clrSign[2] = ArgbEncode(255, 255, 255, 255); | |
| 800 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128); | |
| 801 } else { | |
| 802 m_pColorData->clrBorder[0] = ArgbEncode(255, 202, 216, 249); | |
| 803 m_pColorData->clrBorder[1] = ArgbEncode(255, 171, 190, 233); | |
| 804 m_pColorData->clrBorder[2] = ArgbEncode(255, 135, 147, 219); | |
| 805 m_pColorData->clrBorder[3] = ArgbEncode(255, 172, 168, 153); | |
| 806 m_pColorData->clrStart[0] = ArgbEncode(255, 225, 234, 254); | |
| 807 m_pColorData->clrStart[1] = ArgbEncode(255, 253, 255, 255); | |
| 808 m_pColorData->clrStart[2] = ArgbEncode(255, 110, 142, 241); | |
| 809 m_pColorData->clrStart[3] = ArgbEncode(255, 254, 254, 251); | |
| 810 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251); | |
| 811 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251); | |
| 812 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235); | |
| 813 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236); | |
| 814 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133); | |
| 815 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133); | |
| 816 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133); | |
| 817 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128); | |
| 818 } | |
| 819 } | |
| OLD | NEW |