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/core/fwl_widgetimp.h" | 7 #include "xfa/fwl/core/fwl_widgetimp.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/fwl/basewidget/ifwl_combobox.h" | 12 #include "xfa/fwl/basewidget/ifwl_combobox.h" |
13 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" | 13 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" |
14 #include "xfa/fwl/core/cfwl_message.h" | 14 #include "xfa/fwl/core/cfwl_message.h" |
15 #include "xfa/fwl/core/cfwl_themebackground.h" | 15 #include "xfa/fwl/core/cfwl_themebackground.h" |
16 #include "xfa/fwl/core/cfwl_themepart.h" | 16 #include "xfa/fwl/core/cfwl_themepart.h" |
17 #include "xfa/fwl/core/cfwl_themetext.h" | 17 #include "xfa/fwl/core/cfwl_themetext.h" |
18 #include "xfa/fwl/core/fwl_appimp.h" | 18 #include "xfa/fwl/core/fwl_appimp.h" |
19 #include "xfa/fwl/core/fwl_noteimp.h" | 19 #include "xfa/fwl/core/fwl_noteimp.h" |
20 #include "xfa/fwl/core/fwl_targetimp.h" | |
21 #include "xfa/fwl/core/fwl_threadimp.h" | |
22 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 20 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
23 #include "xfa/fwl/core/ifwl_adapternative.h" | 21 #include "xfa/fwl/core/ifwl_adapternative.h" |
24 #include "xfa/fwl/core/ifwl_adapterthreadmgr.h" | 22 #include "xfa/fwl/core/ifwl_adapterthreadmgr.h" |
25 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" | 23 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" |
26 #include "xfa/fwl/core/ifwl_app.h" | 24 #include "xfa/fwl/core/ifwl_app.h" |
27 #include "xfa/fwl/core/ifwl_form.h" | 25 #include "xfa/fwl/core/ifwl_form.h" |
28 #include "xfa/fwl/core/ifwl_themeprovider.h" | 26 #include "xfa/fwl/core/ifwl_themeprovider.h" |
29 | 27 |
30 #define FWL_CLASSHASH_Menu 3957949655 | 28 #define FWL_CLASSHASH_Menu 3957949655 |
31 #define FWL_STYLEEXT_MNU_Vert (1L << 0) | 29 #define FWL_STYLEEXT_MNU_Vert (1L << 0) |
32 | 30 |
| 31 IFWL_Widget::~IFWL_Widget() {} |
| 32 |
| 33 FWL_ERR IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { |
| 34 return m_pImpl->GetClassName(wsClass); |
| 35 } |
| 36 |
| 37 uint32_t IFWL_Widget::GetClassID() const { |
| 38 return m_pImpl->GetClassID(); |
| 39 } |
| 40 |
| 41 FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { |
| 42 return m_pImpl->IsInstance(wsClass); |
| 43 } |
| 44 |
| 45 FWL_ERR IFWL_Widget::Initialize() { |
| 46 return m_pImpl->Initialize(); |
| 47 } |
| 48 |
| 49 FWL_ERR IFWL_Widget::Finalize() { |
| 50 return m_pImpl->Finalize(); |
| 51 } |
| 52 |
33 FWL_ERR IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 53 FWL_ERR IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
34 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 54 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
35 ->GetWidgetRect(rect, bAutoSize); | 55 ->GetWidgetRect(rect, bAutoSize); |
36 } | 56 } |
37 FWL_ERR IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { | 57 FWL_ERR IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { |
38 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetGlobalRect(rect); | 58 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetGlobalRect(rect); |
39 } | 59 } |
40 FWL_ERR IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { | 60 FWL_ERR IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { |
41 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetWidgetRect(rect); | 61 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetWidgetRect(rect); |
42 } | 62 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 147 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
128 ->SetThemeProvider(pThemeProvider); | 148 ->SetThemeProvider(pThemeProvider); |
129 } | 149 } |
130 FWL_ERR IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { | 150 FWL_ERR IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { |
131 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 151 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
132 ->SetDataProvider(pDataProvider); | 152 ->SetDataProvider(pDataProvider); |
133 } | 153 } |
134 IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) { | 154 IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) { |
135 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetDelegate(pDelegate); | 155 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetDelegate(pDelegate); |
136 } | 156 } |
137 IFWL_Thread* IFWL_Widget::GetOwnerThread() const { | 157 IFWL_App* IFWL_Widget::GetOwnerApp() const { |
138 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwnerThread(); | 158 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwnerApp(); |
139 } | 159 } |
140 CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { | 160 CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { |
141 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOffsetFromParent(pParent); | 161 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOffsetFromParent(pParent); |
142 } | 162 } |
| 163 |
143 FWL_ERR CFWL_WidgetImp::Initialize() { | 164 FWL_ERR CFWL_WidgetImp::Initialize() { |
144 IFWL_App* pApp = FWL_GetApp(); | 165 IFWL_App* pApp = FWL_GetApp(); |
145 if (!pApp) | 166 if (!pApp) |
146 return FWL_ERR_Indefinite; | 167 return FWL_ERR_Indefinite; |
147 IFWL_AdapterNative* pAdapter = pApp->GetAdapterNative(); | 168 IFWL_AdapterNative* pAdapter = pApp->GetAdapterNative(); |
148 if (!pAdapter) | 169 if (!pAdapter) |
149 return FWL_ERR_Indefinite; | 170 return FWL_ERR_Indefinite; |
150 IFWL_AdapterThreadMgr* pAdapterThread = pAdapter->GetThreadMgr(); | 171 IFWL_AdapterThreadMgr* pAdapterThread = pAdapter->GetThreadMgr(); |
151 if (!pAdapterThread) | 172 if (!pAdapterThread) |
152 return FWL_ERR_Indefinite; | 173 return FWL_ERR_Indefinite; |
153 SetOwnerThread(static_cast<CFWL_ThreadImp*>( | 174 SetOwnerApp( |
154 pAdapterThread->GetCurrentThread()->GetImpl())); | 175 static_cast<CFWL_AppImp*>(pAdapterThread->GetCurrentThread()->GetImpl())); |
155 IFWL_Widget* pParent = m_pProperties->m_pParent; | 176 IFWL_Widget* pParent = m_pProperties->m_pParent; |
156 m_pWidgetMgr->InsertWidget(pParent, m_pInterface); | 177 m_pWidgetMgr->InsertWidget(pParent, m_pInterface); |
157 if (!IsChild()) { | 178 if (!IsChild()) { |
158 { | 179 { |
159 IFWL_Widget* pOwner = m_pProperties->m_pOwner; | 180 IFWL_Widget* pOwner = m_pProperties->m_pOwner; |
160 if (pOwner) { | 181 if (pOwner) { |
161 m_pWidgetMgr->SetOwner(pOwner, m_pInterface); | 182 m_pWidgetMgr->SetOwner(pOwner, m_pInterface); |
162 } | 183 } |
163 } | 184 } |
164 m_pWidgetMgr->CreateWidget_Native(m_pInterface); | 185 m_pWidgetMgr->CreateWidget_Native(m_pInterface); |
165 } | 186 } |
166 return FWL_ERR_Succeeded; | 187 return FWL_ERR_Succeeded; |
167 } | 188 } |
| 189 |
168 FWL_ERR CFWL_WidgetImp::Finalize() { | 190 FWL_ERR CFWL_WidgetImp::Finalize() { |
169 NotifyDriver(); | 191 NotifyDriver(); |
170 if (!IsChild()) | 192 if (!IsChild()) |
171 m_pWidgetMgr->DestroyWidget_Native(m_pInterface); | 193 m_pWidgetMgr->DestroyWidget_Native(m_pInterface); |
172 | 194 |
173 m_pWidgetMgr->RemoveWidget(m_pInterface); | 195 m_pWidgetMgr->RemoveWidget(m_pInterface); |
174 return FWL_ERR_Succeeded; | 196 return FWL_ERR_Succeeded; |
175 } | 197 } |
| 198 |
| 199 FWL_ERR CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { |
| 200 wsClass.clear(); |
| 201 return FWL_ERR_Succeeded; |
| 202 } |
| 203 |
| 204 uint32_t CFWL_WidgetImp::GetClassID() const { |
| 205 return 0; |
| 206 } |
| 207 |
| 208 FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const { |
| 209 return FALSE; |
| 210 } |
| 211 |
176 FWL_ERR CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 212 FWL_ERR CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
177 if (bAutoSize) { | 213 if (bAutoSize) { |
178 if (HasEdge()) { | 214 if (HasEdge()) { |
179 FX_FLOAT fEdge = GetEdgeWidth(); | 215 FX_FLOAT fEdge = GetEdgeWidth(); |
180 rect.Inflate(fEdge, fEdge); | 216 rect.Inflate(fEdge, fEdge); |
181 } | 217 } |
182 if (HasBorder()) { | 218 if (HasBorder()) { |
183 FX_FLOAT fBorder = GetBorderSize(); | 219 FX_FLOAT fBorder = GetBorderSize(); |
184 rect.Inflate(fBorder, fBorder); | 220 rect.Inflate(fBorder, fBorder); |
185 } | 221 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } | 315 } |
280 } | 316 } |
281 FWL_ERR CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { | 317 FWL_ERR CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { |
282 bSet ? (m_pProperties->m_dwStates |= dwStates) | 318 bSet ? (m_pProperties->m_dwStates |= dwStates) |
283 : (m_pProperties->m_dwStates &= ~dwStates); | 319 : (m_pProperties->m_dwStates &= ~dwStates); |
284 FWL_ERR ret = FWL_ERR_Succeeded; | 320 FWL_ERR ret = FWL_ERR_Succeeded; |
285 if (dwStates & FWL_WGTSTATE_Invisible) { | 321 if (dwStates & FWL_WGTSTATE_Invisible) { |
286 if (bSet) { | 322 if (bSet) { |
287 ret = m_pWidgetMgr->HideWidget_Native(m_pInterface); | 323 ret = m_pWidgetMgr->HideWidget_Native(m_pInterface); |
288 CFWL_NoteDriver* noteDriver = | 324 CFWL_NoteDriver* noteDriver = |
289 static_cast<CFWL_NoteDriver*>(GetOwnerThread()->GetNoteDriver()); | 325 static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver()); |
290 IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr(); | 326 IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr(); |
291 noteDriver->NotifyTargetHide(m_pInterface); | 327 noteDriver->NotifyTargetHide(m_pInterface); |
292 IFWL_Widget* child = | 328 IFWL_Widget* child = |
293 widgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild); | 329 widgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild); |
294 while (child) { | 330 while (child) { |
295 noteDriver->NotifyTargetHide(child); | 331 noteDriver->NotifyTargetHide(child); |
296 NotifyHideChildWidget(widgetMgr, child, noteDriver); | 332 NotifyHideChildWidget(widgetMgr, child, noteDriver); |
297 child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); | 333 child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); |
298 } | 334 } |
299 } else { | 335 } else { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 if (!m_pCurDelegate) { | 526 if (!m_pCurDelegate) { |
491 m_pCurDelegate = m_pDelegate; | 527 m_pCurDelegate = m_pDelegate; |
492 } | 528 } |
493 if (!pDelegate) { | 529 if (!pDelegate) { |
494 return m_pCurDelegate; | 530 return m_pCurDelegate; |
495 } | 531 } |
496 IFWL_WidgetDelegate* pOldDelegate = m_pCurDelegate; | 532 IFWL_WidgetDelegate* pOldDelegate = m_pCurDelegate; |
497 m_pCurDelegate = pDelegate; | 533 m_pCurDelegate = pDelegate; |
498 return pOldDelegate; | 534 return pOldDelegate; |
499 } | 535 } |
500 IFWL_Thread* CFWL_WidgetImp::GetOwnerThread() const { | 536 IFWL_App* CFWL_WidgetImp::GetOwnerApp() const { |
501 return static_cast<IFWL_Thread*>(m_pOwnerThread->GetInterface()); | 537 return static_cast<IFWL_App*>(m_pOwnerApp->GetInterface()); |
502 } | 538 } |
503 FWL_ERR CFWL_WidgetImp::SetOwnerThread(CFWL_ThreadImp* pOwnerThread) { | 539 FWL_ERR CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { |
504 m_pOwnerThread = pOwnerThread; | 540 m_pOwnerApp = pOwnerApp; |
505 return FWL_ERR_Succeeded; | 541 return FWL_ERR_Succeeded; |
506 } | 542 } |
507 IFWL_Widget* CFWL_WidgetImp::GetInterface() const { | 543 IFWL_Widget* CFWL_WidgetImp::GetInterface() const { |
508 return m_pInterface; | 544 return m_pInterface; |
509 } | 545 } |
510 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) { | 546 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) { |
511 m_pInterface = pInterface; | 547 m_pInterface = pInterface; |
512 } | 548 } |
513 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, | 549 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, |
514 IFWL_Widget* pOuter) | 550 IFWL_Widget* pOuter) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 CFWL_ThemeText calPart; | 711 CFWL_ThemeText calPart; |
676 calPart.m_pWidget = m_pInterface; | 712 calPart.m_pWidget = m_pInterface; |
677 calPart.m_wsText = wsText; | 713 calPart.m_wsText = wsText; |
678 calPart.m_dwTTOStyles = dwTTOStyles; | 714 calPart.m_dwTTOStyles = dwTTOStyles; |
679 calPart.m_iTTOAlign = iTTOAlign; | 715 calPart.m_iTTOAlign = iTTOAlign; |
680 pTheme->CalcTextRect(&calPart, rect); | 716 pTheme->CalcTextRect(&calPart, rect); |
681 } | 717 } |
682 void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) { | 718 void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) { |
683 if (m_pWidgetMgr->IsFormDisabled()) | 719 if (m_pWidgetMgr->IsFormDisabled()) |
684 return; | 720 return; |
685 IFWL_Thread* pThread = GetOwnerThread(); | 721 |
686 if (!pThread) | 722 IFWL_App* pApp = GetOwnerApp(); |
| 723 if (!pApp) |
687 return; | 724 return; |
| 725 |
688 CFWL_NoteDriver* pDriver = | 726 CFWL_NoteDriver* pDriver = |
689 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 727 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
690 if (!pDriver) | 728 if (!pDriver) |
691 return; | 729 return; |
| 730 |
692 IFWL_Widget* curFocus = pDriver->GetFocus(); | 731 IFWL_Widget* curFocus = pDriver->GetFocus(); |
693 if (bFocus && curFocus != m_pInterface) { | 732 if (bFocus && curFocus != m_pInterface) { |
694 pDriver->SetFocus(m_pInterface); | 733 pDriver->SetFocus(m_pInterface); |
695 } else if (!bFocus && curFocus == m_pInterface) { | 734 } else if (!bFocus && curFocus == m_pInterface) { |
696 pDriver->SetFocus(NULL); | 735 pDriver->SetFocus(NULL); |
697 } | 736 } |
698 } | 737 } |
699 void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) { | 738 void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) { |
700 IFWL_Thread* pThread = GetOwnerThread(); | 739 IFWL_App* pApp = GetOwnerApp(); |
701 if (!pThread) | 740 if (!pApp) |
702 return; | 741 return; |
703 CFWL_NoteDriver* pDriver = | 742 CFWL_NoteDriver* pDriver = |
704 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 743 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
705 pDriver->SetGrab(m_pInterface, bSet); | 744 pDriver->SetGrab(m_pInterface, bSet); |
706 } | 745 } |
707 FX_BOOL CFWL_WidgetImp::GetPopupPos(FX_FLOAT fMinHeight, | 746 FX_BOOL CFWL_WidgetImp::GetPopupPos(FX_FLOAT fMinHeight, |
708 FX_FLOAT fMaxHeight, | 747 FX_FLOAT fMaxHeight, |
709 const CFX_RectF& rtAnchor, | 748 const CFX_RectF& rtAnchor, |
710 CFX_RectF& rtPopup) { | 749 CFX_RectF& rtPopup) { |
711 if (GetClassID() == FWL_CLASSHASH_Menu) { | 750 if (GetClassID() == FWL_CLASSHASH_Menu) { |
712 return GetPopupPosMenu(fMinHeight, fMaxHeight, rtAnchor, rtPopup); | 751 return GetPopupPosMenu(fMinHeight, fMaxHeight, rtAnchor, rtPopup); |
713 } else { | 752 } else { |
714 if (GetClassID() == FWL_CLASSHASH_ComboBox) { | 753 if (GetClassID() == FWL_CLASSHASH_ComboBox) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 rtPopup.height); | 845 rtPopup.height); |
807 } | 846 } |
808 rtPopup.Offset(fx, fy); | 847 rtPopup.Offset(fx, fy); |
809 return TRUE; | 848 return TRUE; |
810 } | 849 } |
811 FX_BOOL CFWL_WidgetImp::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) { | 850 FX_BOOL CFWL_WidgetImp::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) { |
812 return FALSE; | 851 return FALSE; |
813 } | 852 } |
814 void CFWL_WidgetImp::RegisterEventTarget(IFWL_Widget* pEventSource, | 853 void CFWL_WidgetImp::RegisterEventTarget(IFWL_Widget* pEventSource, |
815 uint32_t dwFilter) { | 854 uint32_t dwFilter) { |
816 IFWL_Thread* pThread = GetOwnerThread(); | 855 IFWL_App* pApp = GetOwnerApp(); |
817 if (!pThread) | 856 if (!pApp) |
818 return; | 857 return; |
819 IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver(); | 858 |
| 859 CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver(); |
820 if (!pNoteDriver) | 860 if (!pNoteDriver) |
821 return; | 861 return; |
| 862 |
822 pNoteDriver->RegisterEventTarget(m_pInterface, pEventSource, dwFilter); | 863 pNoteDriver->RegisterEventTarget(m_pInterface, pEventSource, dwFilter); |
823 } | 864 } |
824 void CFWL_WidgetImp::UnregisterEventTarget() { | 865 void CFWL_WidgetImp::UnregisterEventTarget() { |
825 IFWL_Thread* pThread = GetOwnerThread(); | 866 IFWL_App* pApp = GetOwnerApp(); |
826 if (!pThread) | 867 if (!pApp) |
827 return; | 868 return; |
828 IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver(); | 869 |
| 870 CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver(); |
829 if (!pNoteDriver) | 871 if (!pNoteDriver) |
830 return; | 872 return; |
| 873 |
831 pNoteDriver->UnregisterEventTarget(m_pInterface); | 874 pNoteDriver->UnregisterEventTarget(m_pInterface); |
832 } | 875 } |
833 void CFWL_WidgetImp::DispatchKeyEvent(CFWL_MsgKey* pNote) { | 876 void CFWL_WidgetImp::DispatchKeyEvent(CFWL_MsgKey* pNote) { |
834 if (!pNote) | 877 if (!pNote) |
835 return; | 878 return; |
836 CFWL_EvtKey* pEvent = new CFWL_EvtKey; | 879 CFWL_EvtKey* pEvent = new CFWL_EvtKey; |
837 pEvent->m_pSrcTarget = m_pInterface; | 880 pEvent->m_pSrcTarget = m_pInterface; |
838 pEvent->m_dwCmd = pNote->m_dwCmd; | 881 pEvent->m_dwCmd = pNote->m_dwCmd; |
839 pEvent->m_dwKeyCode = pNote->m_dwKeyCode; | 882 pEvent->m_dwKeyCode = pNote->m_dwKeyCode; |
840 pEvent->m_dwFlags = pNote->m_dwFlags; | 883 pEvent->m_dwFlags = pNote->m_dwFlags; |
841 DispatchEvent(pEvent); | 884 DispatchEvent(pEvent); |
842 pEvent->Release(); | 885 pEvent->Release(); |
843 } | 886 } |
844 void CFWL_WidgetImp::DispatchEvent(CFWL_Event* pEvent) { | 887 void CFWL_WidgetImp::DispatchEvent(CFWL_Event* pEvent) { |
845 if (m_pOuter) { | 888 if (m_pOuter) { |
846 IFWL_WidgetDelegate* pDelegate = m_pOuter->SetDelegate(NULL); | 889 IFWL_WidgetDelegate* pDelegate = m_pOuter->SetDelegate(NULL); |
847 pDelegate->OnProcessEvent(pEvent); | 890 pDelegate->OnProcessEvent(pEvent); |
848 return; | 891 return; |
849 } | 892 } |
850 IFWL_Thread* pThread = GetOwnerThread(); | 893 IFWL_App* pApp = GetOwnerApp(); |
851 if (!pThread) | 894 if (!pApp) |
852 return; | 895 return; |
853 IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver(); | 896 CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver(); |
854 if (!pNoteDriver) | 897 if (!pNoteDriver) |
855 return; | 898 return; |
856 pNoteDriver->SendEvent(pEvent); | 899 pNoteDriver->SendEvent(pEvent); |
857 } | 900 } |
858 void CFWL_WidgetImp::Repaint(const CFX_RectF* pRect) { | 901 void CFWL_WidgetImp::Repaint(const CFX_RectF* pRect) { |
859 if (pRect) { | 902 if (pRect) { |
860 m_pWidgetMgr->RepaintWidget(m_pInterface, pRect); | 903 m_pWidgetMgr->RepaintWidget(m_pInterface, pRect); |
861 return; | 904 return; |
862 } | 905 } |
863 CFX_RectF rect; | 906 CFX_RectF rect; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 param.m_pWidget = m_pInterface; | 950 param.m_pWidget = m_pInterface; |
908 param.m_iPart = iPartEdge; | 951 param.m_iPart = iPartEdge; |
909 param.m_pGraphics = pGraphics; | 952 param.m_pGraphics = pGraphics; |
910 if (pMatrix) { | 953 if (pMatrix) { |
911 param.m_matrix.Concat(*pMatrix, TRUE); | 954 param.m_matrix.Concat(*pMatrix, TRUE); |
912 } | 955 } |
913 param.m_rtPart = rtEdge; | 956 param.m_rtPart = rtEdge; |
914 pTheme->DrawBackground(¶m); | 957 pTheme->DrawBackground(¶m); |
915 } | 958 } |
916 void CFWL_WidgetImp::NotifyDriver() { | 959 void CFWL_WidgetImp::NotifyDriver() { |
917 IFWL_Thread* pThread = GetOwnerThread(); | 960 IFWL_App* pApp = GetOwnerApp(); |
918 if (!pThread) | 961 if (!pApp) |
919 return; | 962 return; |
| 963 |
920 CFWL_NoteDriver* pDriver = | 964 CFWL_NoteDriver* pDriver = |
921 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 965 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
922 if (!pDriver) | 966 if (!pDriver) |
923 return; | 967 return; |
| 968 |
924 pDriver->NotifyTargetDestroy(m_pInterface); | 969 pDriver->NotifyTargetDestroy(m_pInterface); |
925 } | 970 } |
926 CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) { | 971 CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) { |
927 if (pParent == GetInterface()) | 972 if (pParent == GetInterface()) |
928 return CFX_SizeF(); | 973 return CFX_SizeF(); |
929 | 974 |
930 IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr(); | 975 IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr(); |
931 if (!pWidgetMgr) | 976 if (!pWidgetMgr) |
932 return CFX_SizeF(); | 977 return CFX_SizeF(); |
933 | 978 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 FWL_ERR CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 1073 FWL_ERR CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
1029 return FWL_ERR_Succeeded; | 1074 return FWL_ERR_Succeeded; |
1030 } | 1075 } |
1031 | 1076 |
1032 FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1077 FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
1033 const CFX_Matrix* pMatrix) { | 1078 const CFX_Matrix* pMatrix) { |
1034 CFWL_EvtDraw evt; | 1079 CFWL_EvtDraw evt; |
1035 evt.m_pGraphics = pGraphics; | 1080 evt.m_pGraphics = pGraphics; |
1036 return FWL_ERR_Succeeded; | 1081 return FWL_ERR_Succeeded; |
1037 } | 1082 } |
OLD | NEW |