Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Unified Diff: xfa/fwl/core/ifwl_combobox.cpp

Issue 2432423002: Merge the CFWL_*Imp classes into the IFWL_* classes. (Closed)
Patch Set: Review feedback Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_combobox.h ('k') | xfa/fwl/core/ifwl_comboedit.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/ifwl_combobox.cpp
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/core/ifwl_combobox.cpp
similarity index 61%
rename from xfa/fwl/basewidget/fwl_comboboximp.cpp
rename to xfa/fwl/core/ifwl_combobox.cpp
index e586055c3bee17254cff131443ff5e74022a97e4..6a4c13f4a624f7c60db5b62b83e4a38c7a26f902 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -4,473 +4,31 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_comboboximp.h"
+#include "xfa/fwl/core/ifwl_combobox.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/fwl_editimp.h"
-#include "xfa/fwl/basewidget/fwl_formproxyimp.h"
-#include "xfa/fwl/basewidget/fwl_listboximp.h"
-#include "xfa/fwl/basewidget/fwl_scrollbarimp.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/cfwl_widgetmgr.h"
-#include "xfa/fwl/core/fwl_formimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_app.h"
+#include "xfa/fwl/core/ifwl_comboedit.h"
+#include "xfa/fwl/core/ifwl_combolist.h"
+#include "xfa/fwl/core/ifwl_formproxy.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
// static
IFWL_ComboBox* IFWL_ComboBox::Create(
const CFWL_WidgetImpProperties& properties) {
- IFWL_ComboBox* pComboBox = new IFWL_ComboBox;
- CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr);
- pComboBox->SetImpl(pComboBoxImpl);
- pComboBoxImpl->SetInterface(pComboBox);
- return pComboBox;
-}
-IFWL_ComboBox::IFWL_ComboBox() {}
-int32_t IFWL_ComboBox::GetCurSel() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetCurSel();
-}
-FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetCurSel(iSel);
-}
-FWL_Error IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditText(wsText);
-}
-int32_t IFWL_ComboBox::GetEditTextLength() const {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditTextLength();
-}
-FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())
- ->GetEditText(wsText, nStart, nCount);
-}
-FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())
- ->SetEditSelRange(nStart, nCount);
-}
-int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())
- ->GetEditSelRange(nIndex, nStart);
-}
-int32_t IFWL_ComboBox::GetEditLimit() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditLimit();
-}
-FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditLimit(nLimit);
-}
-FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDoClipboard(iCmd);
-}
-FX_BOOL IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditRedo(pRecord);
-}
-FX_BOOL IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditUndo(pRecord);
-}
-IFWL_ListBox* IFWL_ComboBox::GetListBoxt() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetListBoxt();
-}
-FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->AfterFocusShowDropList();
-}
-FWL_Error IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->OpenDropDownList(bActivate);
-}
-FX_BOOL IFWL_ComboBox::EditCanUndo() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanUndo();
-}
-FX_BOOL IFWL_ComboBox::EditCanRedo() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanRedo();
-}
-FX_BOOL IFWL_ComboBox::EditUndo() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditUndo();
-}
-FX_BOOL IFWL_ComboBox::EditRedo() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditRedo();
-}
-FX_BOOL IFWL_ComboBox::EditCanCopy() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanCopy();
-}
-FX_BOOL IFWL_ComboBox::EditCanCut() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanCut();
-}
-FX_BOOL IFWL_ComboBox::EditCanSelectAll() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanSelectAll();
-}
-FX_BOOL IFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCopy(wsCopy);
-}
-FX_BOOL IFWL_ComboBox::EditCut(CFX_WideString& wsCut) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCut(wsCut);
-}
-FX_BOOL IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditPaste(wsPaste);
-}
-FX_BOOL IFWL_ComboBox::EditSelectAll() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditSelectAll();
-}
-FX_BOOL IFWL_ComboBox::EditDelete() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDelete();
-}
-FX_BOOL IFWL_ComboBox::EditDeSelect() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDeSelect();
-}
-FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetBBox(rect);
-}
-FWL_Error IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())
- ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
-}
-
-CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_EditImp(properties, pOuter) {
- m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl());
-}
-
-CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner)
- : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
-
-void CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
- FX_BOOL backDefault = TRUE;
- switch (pMessage->GetClassID()) {
- case CFWL_MessageType::SetFocus: {
- m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
- backDefault = FALSE;
- break;
- }
- case CFWL_MessageType::KillFocus: {
- m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
- backDefault = FALSE;
- break;
- }
- case CFWL_MessageType::Mouse: {
- CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
- if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) &&
- ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) {
- m_pOwner->SetSelected();
- m_pOwner->SetComboBoxFocus(TRUE);
- }
- break;
- }
- default:
- break;
- }
- if (backDefault)
- CFWL_EditImpDelegate::OnProcessMessage(pMessage);
-}
-
-void CFWL_ComboEditImp::ClearSelected() {
- ClearSelections();
- Repaint(&m_rtClient);
-}
-void CFWL_ComboEditImp::SetSelected() {
- FlagFocus(TRUE);
- EndCaret();
- AddSelRange(0);
-}
-void CFWL_ComboEditImp::EndCaret() {
- m_pEdtEngine->MoveCaretPos(MC_End);
-}
-void CFWL_ComboEditImp::FlagFocus(FX_BOOL bSet) {
- if (bSet) {
- m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
- } else {
- m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
- ShowCaret(FALSE);
- }
-}
-void CFWL_ComboEditImp::SetComboBoxFocus(FX_BOOL bSet) {
- m_pOuter->SetFocus(bSet);
-}
-CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) {
- ASSERT(pOuter);
-}
-FWL_Error CFWL_ComboListImp::Initialize() {
- if (CFWL_ListBoxImp::Initialize() != FWL_Error::Succeeded)
- return FWL_Error::Indefinite;
- delete m_pDelegate;
- m_pDelegate = new CFWL_ComboListImpDelegate(this);
- return FWL_Error::Succeeded;
-}
-FWL_Error CFWL_ComboListImp::Finalize() {
- delete m_pDelegate;
- m_pDelegate = nullptr;
- return CFWL_ListBoxImp::Finalize();
-}
-int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) {
- if (wsMatch.IsEmpty()) {
- return -1;
- }
- if (!m_pProperties->m_pDataProvider)
- return -1;
- IFWL_ListBoxDP* pData =
- static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
- for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
- CFX_WideString wsText;
- pData->GetItemText(m_pInterface, hItem, wsText);
- FX_STRSIZE pos = wsText.Find(wsMatch.c_str());
- if (!pos) {
- return i;
- }
- }
- return -1;
-}
-void CFWL_ComboListImp::ChangeSelected(int32_t iSel) {
- if (!m_pProperties->m_pDataProvider)
- return;
- IFWL_ListBoxDP* pData =
- static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iSel);
- CFX_RectF rtInvalidate;
- rtInvalidate.Reset();
- IFWL_ListItem* hOld = GetSelItem(0);
- int32_t iOld = pData->GetItemIndex(m_pInterface, hOld);
- if (iOld == iSel) {
- return;
- } else if (iOld > -1) {
- GetItemRect(iOld, rtInvalidate);
- SetSelItem(hOld, FALSE);
- }
- if (hItem) {
- CFX_RectF rect;
- GetItemRect(iSel, rect);
- rtInvalidate.Union(rect);
- IFWL_ListItem* hSel = pData->GetItem(m_pInterface, iSel);
- SetSelItem(hSel, TRUE);
- }
- if (!rtInvalidate.IsEmpty()) {
- Repaint(&rtInvalidate);
- }
-}
-int32_t CFWL_ComboListImp::CountItems() {
- IFWL_ListBoxDP* pData =
- static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- return pData ? pData->CountItems(m_pInterface) : 0;
-}
-void CFWL_ComboListImp::GetItemRect(int32_t nIndex, CFX_RectF& rtItem) {
- IFWL_ListBoxDP* pData =
- static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, nIndex);
- pData->GetItemRect(m_pInterface, hItem, rtItem);
-}
-void CFWL_ComboListImp::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
- fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top;
- IFWL_Widget* pOwner = GetOwner();
- if (!pOwner)
- return;
- pOwner->TransformTo(m_pOuter, fx, fy);
-}
-void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) {
- CFWL_WidgetImp::SetFocus(bSet);
-}
-
-CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner)
- : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {}
-
-void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
- CFWL_MessageType dwHashCode = pMessage->GetClassID();
- FX_BOOL backDefault = TRUE;
- if (dwHashCode == CFWL_MessageType::SetFocus ||
- dwHashCode == CFWL_MessageType::KillFocus) {
- OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus);
- } else if (dwHashCode == CFWL_MessageType::Mouse) {
- CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
- if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
- CFX_RectF rect;
- m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
- pMsg->m_fx -= rect.left;
- pMsg->m_fy -= rect.top;
- IFWL_WidgetDelegate* pDelegate =
- m_pOwner->m_pVertScrollBar->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
- return;
- }
- }
- switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::Move: {
- backDefault = FALSE;
- OnDropListMouseMove(pMsg);
- break;
- }
- case FWL_MouseCommand::LeftButtonDown: {
- backDefault = FALSE;
- OnDropListLButtonDown(pMsg);
- break;
- }
- case FWL_MouseCommand::LeftButtonUp: {
- backDefault = FALSE;
- OnDropListLButtonUp(pMsg);
- break;
- }
- default:
- break;
- }
- } else if (dwHashCode == CFWL_MessageType::Key) {
- backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage));
- }
- if (backDefault)
- CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage);
+ return new IFWL_ComboBox(properties, nullptr);
}
-void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg,
- FX_BOOL bSet) {
- if (!bSet) {
- CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg);
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- if (pKill->m_pSetFocus == m_pOwner->m_pOuter ||
- pKill->m_pSetFocus == pOuter->m_pEdit.get()) {
- pOuter->ShowDropList(FALSE);
- }
- }
-}
-int32_t CFWL_ComboListImpDelegate::OnDropListMouseMove(CFWL_MsgMouse* pMsg) {
- if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
- if (m_pOwner->m_bNotifyOwner) {
- m_pOwner->m_bNotifyOwner = FALSE;
- }
- if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
- CFX_RectF rect;
- m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
- return 1;
- }
- }
- IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
- if (hItem) {
- if (!m_pOwner->m_pProperties->m_pDataProvider)
- return 0;
- IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
- m_pOwner->m_pProperties->m_pDataProvider);
- int32_t iSel = pData->GetItemIndex(m_pOwner->m_pInterface, hItem);
- CFWL_EvtCmbHoverChanged event;
- event.m_pSrcTarget = m_pOwner->m_pOuter;
- event.m_iCurHover = iSel;
- m_pOwner->DispatchEvent(&event);
- m_pOwner->ChangeSelected(iSel);
- }
- } else if (m_pOwner->m_bNotifyOwner) {
- m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- pOuter->m_pDelegate->OnProcessMessage(pMsg);
- }
- return 1;
-}
-int32_t CFWL_ComboListImpDelegate::OnDropListLButtonDown(CFWL_MsgMouse* pMsg) {
- if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
- return 0;
- }
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- pOuter->ShowDropList(FALSE);
- return 1;
-}
-int32_t CFWL_ComboListImpDelegate::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) {
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- if (m_pOwner->m_bNotifyOwner) {
- m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
- pOuter->m_pDelegate->OnProcessMessage(pMsg);
- } else {
- if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
- CFX_RectF rect;
- m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
- return 1;
- }
- }
- pOuter->ShowDropList(FALSE);
- IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
- if (hItem) {
- pOuter->ProcessSelChanged(TRUE);
- }
- }
- return 1;
-}
-int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) {
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- FX_BOOL bPropagate = FALSE;
- if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) {
- uint32_t dwKeyCode = pKey->m_dwKeyCode;
- switch (dwKeyCode) {
- case FWL_VKEY_Return:
- case FWL_VKEY_Escape: {
- pOuter->ShowDropList(FALSE);
- return 1;
- }
- case FWL_VKEY_Up:
- case FWL_VKEY_Down: {
- OnDropListKeyDown(pKey);
- pOuter->SetDelegate(nullptr);
- pOuter->ProcessSelChanged(FALSE);
- return 1;
- }
- default: { bPropagate = TRUE; }
- }
- } else if (pKey->m_dwCmd == FWL_KeyCommand::Char) {
- bPropagate = TRUE;
- }
- if (bPropagate) {
- pKey->m_pDstTarget = m_pOwner->m_pOuter;
- pOuter->m_pDelegate->OnProcessMessage(pKey);
- return 1;
- }
- return 0;
-}
-void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) {
- uint32_t dwKeyCode = pKey->m_dwKeyCode;
- switch (dwKeyCode) {
- case FWL_VKEY_Up:
- case FWL_VKEY_Down:
- case FWL_VKEY_Home:
- case FWL_VKEY_End: {
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
- m_pOwner->m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem =
- pData->GetItem(m_pOwner->m_pInterface, pOuter->m_iCurSel);
- hItem = m_pOwner->GetItem(hItem, dwKeyCode);
- if (!hItem) {
- break;
- }
- m_pOwner->SetSelection(hItem, hItem, TRUE);
- m_pOwner->ScrollToVisible(hItem);
- CFX_RectF rtInvalidate;
- rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width,
- m_pOwner->m_pProperties->m_rtWidget.height);
- m_pOwner->Repaint(&rtInvalidate);
- break;
- }
- default: {}
- }
-}
-CFWL_ComboBoxImp::CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_ComboBox::IFWL_ComboBox(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_pForm(nullptr),
m_bLButtonDown(FALSE),
m_iCurSel(-1),
@@ -482,22 +40,22 @@ CFWL_ComboBoxImp::CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties,
m_rtHandler.Reset();
}
-CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {}
+IFWL_ComboBox::~IFWL_ComboBox() {}
-FWL_Error CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_ComboBox::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_ComboBox;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_ComboBoxImp::GetClassID() const {
+FWL_Type IFWL_ComboBox::GetClassID() const {
return FWL_Type::ComboBox;
}
-FWL_Error CFWL_ComboBoxImp::Initialize() {
+FWL_Error IFWL_ComboBox::Initialize() {
if (m_pWidgetMgr->IsFormDisabled())
return DisForm_Initialize();
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
@@ -508,31 +66,32 @@ FWL_Error CFWL_ComboBoxImp::Initialize() {
prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon;
prop.m_pDataProvider = m_pProperties->m_pDataProvider;
- m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface));
+ m_pListBox.reset(IFWL_ComboList::Create(prop, this));
m_pListBox->Initialize();
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
CFWL_WidgetImpProperties prop2;
- m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop2, m_pInterface));
+ m_pEdit.reset(IFWL_ComboEdit::Create(prop2, this));
m_pEdit->Initialize();
- static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
+ m_pEdit->SetOuter(this);
}
if (m_pEdit)
- m_pEdit->SetParent(m_pInterface);
+ m_pEdit->SetParent(this);
SetStates(m_pProperties->m_dwStates);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::Finalize() {
+FWL_Error IFWL_ComboBox::Finalize() {
if (m_pEdit) {
m_pEdit->Finalize();
}
m_pListBox->Finalize();
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Reset();
FX_BOOL bIsDropDown = IsDropDownStyle();
@@ -550,14 +109,15 @@ FWL_Error CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (!pFWidth)
return FWL_Error::Indefinite;
rect.Inflate(0, 0, *pFWidth, 0);
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
+
+FWL_Error IFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
@@ -565,16 +125,17 @@ FWL_Error CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded,
bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown);
if (bAddDropDown && !m_pEdit) {
CFWL_WidgetImpProperties prop;
- m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr));
+ m_pEdit.reset(IFWL_ComboEdit::Create(prop, nullptr));
m_pEdit->Initialize();
- static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
- m_pEdit->SetParent(m_pInterface);
+ m_pEdit->SetOuter(this);
+ m_pEdit->SetParent(this);
} else if (bRemoveDropDown && m_pEdit) {
m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE);
}
- return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
+ return IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
-FWL_Error CFWL_ComboBoxImp::Update() {
+
+FWL_Error IFWL_ComboBox::Update() {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_Update();
}
@@ -591,20 +152,22 @@ FWL_Error CFWL_ComboBoxImp::Update() {
}
Layout();
CFWL_ThemePart part;
- part.m_pWidget = m_pInterface;
+ part.m_pWidget = this;
m_fComboFormHandler =
*static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity(
&part, CFWL_WidgetCapacity::ComboFormHandler));
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+
+FWL_WidgetHit IFWL_ComboBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_HitTest(fx, fy);
}
- return CFWL_WidgetImp::HitTest(fx, fy);
+ return IFWL_Widget::HitTest(fx, fy);
}
-FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_DrawWidget(pGraphics, pMatrix);
}
@@ -624,7 +187,7 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
CFX_RectF rtTextBk(m_rtClient);
rtTextBk.width -= m_rtBtn.width;
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_pGraphics = pGraphics;
if (pMatrix) {
@@ -633,8 +196,7 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
param.m_rtPart = rtTextBk;
if (m_iCurSel >= 0) {
IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->m_pProperties->m_pDataProvider);
+ m_pListBox->m_pProperties->m_pDataProvider);
void* p = pData->GetItemData(m_pListBox.get(),
pData->GetItem(m_pListBox.get(), m_iCurSel));
if (p) {
@@ -656,11 +218,10 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
+ m_pListBox->GetItemText(hItem, wsText);
CFWL_ThemeText theme_text;
- theme_text.m_pWidget = m_pInterface;
+ theme_text.m_pWidget = this;
theme_text.m_iPart = CFWL_Part::Caption;
theme_text.m_dwStates = m_iBtnState;
theme_text.m_pGraphics = pGraphics;
@@ -677,7 +238,7 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
}
{
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::DropDownButton;
param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)
? CFWL_PartState_Disabled
@@ -689,8 +250,8 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::SetThemeProvider(
- IFWL_ThemeProvider* pThemeProvider) {
+
+FWL_Error IFWL_ComboBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
if (!pThemeProvider)
return FWL_Error::Indefinite;
m_pProperties->m_pThemeProvider = pThemeProvider;
@@ -700,12 +261,13 @@ FWL_Error CFWL_ComboBoxImp::SetThemeProvider(
m_pEdit->SetThemeProvider(pThemeProvider);
return FWL_Error::Succeeded;
}
-int32_t CFWL_ComboBoxImp::GetCurSel() {
+
+int32_t IFWL_ComboBox::GetCurSel() {
return m_iCurSel;
}
-FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) {
- int32_t iCount =
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems();
+
+FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) {
+ int32_t iCount = m_pListBox->CountItems();
FX_BOOL bClearSel = iSel < 0 || iSel >= iCount;
FX_BOOL bDropDown = IsDropDownStyle();
if (bDropDown && m_pEdit) {
@@ -715,9 +277,8 @@ FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) {
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iSel);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, iSel);
+ m_pListBox->GetItemText(hItem, wsText);
m_pEdit->SetText(wsText);
}
m_pEdit->Update();
@@ -726,79 +287,87 @@ FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) {
return FWL_Error::Succeeded;
}
-void CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+void IFWL_ComboBox::SetStates(uint32_t dwStates, FX_BOOL bSet) {
FX_BOOL bIsDropDown = IsDropDownStyle();
if (bIsDropDown && m_pEdit)
m_pEdit->SetStates(dwStates, bSet);
if (m_pListBox)
m_pListBox->SetStates(dwStates, bSet);
- CFWL_WidgetImp::SetStates(dwStates, bSet);
+ IFWL_Widget::SetStates(dwStates, bSet);
}
-FWL_Error CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) {
+FWL_Error IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
if (!m_pEdit)
return FWL_Error::Indefinite;
m_pEdit->SetText(wsText);
return m_pEdit->Update();
}
-int32_t CFWL_ComboBoxImp::GetEditTextLength() const {
+
+int32_t IFWL_ComboBox::GetEditTextLength() const {
if (!m_pEdit)
return -1;
return m_pEdit->GetTextLength();
}
-FWL_Error CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
+
+FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText,
+ int32_t nStart,
+ int32_t nCount) const {
if (m_pEdit) {
return m_pEdit->GetText(wsText, nStart, nCount);
} else if (m_pListBox) {
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
return m_pListBox->GetItemText(hItem, wsText);
}
return FWL_Error::Indefinite;
}
-FWL_Error CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) {
+
+FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
if (!m_pEdit)
return FWL_Error::Indefinite;
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected();
+ m_pEdit->ClearSelected();
m_pEdit->AddSelRange(nStart, nCount);
return FWL_Error::Succeeded;
}
-int32_t CFWL_ComboBoxImp::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
+
+int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
if (!m_pEdit)
return -1;
return m_pEdit->GetSelRange(nIndex, nStart);
}
-int32_t CFWL_ComboBoxImp::GetEditLimit() {
+
+int32_t IFWL_ComboBox::GetEditLimit() {
if (!m_pEdit)
return -1;
return m_pEdit->GetLimit();
}
-FWL_Error CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) {
+
+FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) {
if (!m_pEdit)
return FWL_Error::Indefinite;
return m_pEdit->SetLimit(nLimit);
}
-FWL_Error CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) {
+
+FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) {
if (!m_pEdit)
return FWL_Error::Indefinite;
return m_pEdit->DoClipboard(iCmd);
}
-FX_BOOL CFWL_ComboBoxImp::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) {
+FX_BOOL IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) {
return m_pEdit && m_pEdit->Redo(pRecord);
}
-FX_BOOL CFWL_ComboBoxImp::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) {
+FX_BOOL IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) {
return m_pEdit && m_pEdit->Undo(pRecord);
}
-IFWL_ListBox* CFWL_ComboBoxImp::GetListBoxt() {
+IFWL_ListBox* IFWL_ComboBox::GetListBoxt() {
return m_pListBox.get();
}
-FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() {
+
+FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() {
if (!m_bNeedShowList) {
return FALSE;
}
@@ -809,53 +378,68 @@ FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() {
m_bNeedShowList = FALSE;
return TRUE;
}
-FWL_Error CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) {
+
+FWL_Error IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) {
ShowDropList(bActivate);
return FWL_Error::Succeeded;
}
-FX_BOOL CFWL_ComboBoxImp::EditCanUndo() {
+
+FX_BOOL IFWL_ComboBox::EditCanUndo() {
return m_pEdit->CanUndo();
}
-FX_BOOL CFWL_ComboBoxImp::EditCanRedo() {
+
+FX_BOOL IFWL_ComboBox::EditCanRedo() {
return m_pEdit->CanRedo();
}
-FX_BOOL CFWL_ComboBoxImp::EditUndo() {
+
+FX_BOOL IFWL_ComboBox::EditUndo() {
return m_pEdit->Undo();
}
-FX_BOOL CFWL_ComboBoxImp::EditRedo() {
+
+FX_BOOL IFWL_ComboBox::EditRedo() {
return m_pEdit->Redo();
}
-FX_BOOL CFWL_ComboBoxImp::EditCanCopy() {
+
+FX_BOOL IFWL_ComboBox::EditCanCopy() {
return m_pEdit->CountSelRanges() > 0;
}
-FX_BOOL CFWL_ComboBoxImp::EditCanCut() {
+
+FX_BOOL IFWL_ComboBox::EditCanCut() {
if (m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) {
return FALSE;
}
return m_pEdit->CountSelRanges() > 0;
}
-FX_BOOL CFWL_ComboBoxImp::EditCanSelectAll() {
+
+FX_BOOL IFWL_ComboBox::EditCanSelectAll() {
return m_pEdit->GetTextLength() > 0;
}
-FX_BOOL CFWL_ComboBoxImp::EditCopy(CFX_WideString& wsCopy) {
+
+FX_BOOL IFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) {
return m_pEdit->Copy(wsCopy);
}
-FX_BOOL CFWL_ComboBoxImp::EditCut(CFX_WideString& wsCut) {
+
+FX_BOOL IFWL_ComboBox::EditCut(CFX_WideString& wsCut) {
return m_pEdit->Cut(wsCut);
}
-FX_BOOL CFWL_ComboBoxImp::EditPaste(const CFX_WideString& wsPaste) {
+
+FX_BOOL IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) {
return m_pEdit->Paste(wsPaste);
}
-FX_BOOL CFWL_ComboBoxImp::EditSelectAll() {
+
+FX_BOOL IFWL_ComboBox::EditSelectAll() {
return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded;
}
-FX_BOOL CFWL_ComboBoxImp::EditDelete() {
+
+FX_BOOL IFWL_ComboBox::EditDelete() {
return m_pEdit->ClearText() == FWL_Error::Succeeded;
}
-FX_BOOL CFWL_ComboBoxImp::EditDeSelect() {
+
+FX_BOOL IFWL_ComboBox::EditDeSelect() {
return m_pEdit->ClearSelections() == FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) {
+
+FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_GetBBox(rect);
}
@@ -869,31 +453,33 @@ FWL_Error CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
+FWL_Error IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved) {
if (!m_pEdit)
return FWL_Error::ParameterInvalid;
return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
-FX_FLOAT CFWL_ComboBoxImp::GetListHeight() {
+FX_FLOAT IFWL_ComboBox::GetListHeight() {
return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider)
- ->GetListHeight(m_pInterface);
+ ->GetListHeight(this);
}
-void CFWL_ComboBoxImp::DrawStretchHandler(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_ComboBox::DrawStretchHandler(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground param;
param.m_pGraphics = pGraphics;
param.m_iPart = CFWL_Part::StretchHandler;
param.m_dwStates = CFWL_PartState_Normal;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
if (pMatrix) {
param.m_matrix.Concat(*pMatrix);
}
param.m_rtPart = m_rtHandler;
m_pProperties->m_pThemeProvider->DrawBackground(&param);
}
-void CFWL_ComboBoxImp::ShowDropList(FX_BOOL bActivate) {
+
+void IFWL_ComboBox::ShowDropList(FX_BOOL bActivate) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_ShowDropList(bActivate);
}
@@ -906,8 +492,7 @@ void CFWL_ComboBoxImp::ShowDropList(FX_BOOL bActivate) {
}
m_pListProxyDelegate->Reset();
if (bActivate) {
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->ChangeSelected(m_iCurSel);
+ m_pListBox->ChangeSelected(m_iCurSel);
ReSetListItemAlignment();
uint32_t dwStyleAdd = m_pProperties->m_dwStyleExes &
(FWL_STYLEEXT_CMB_Sort | FWL_STYLEEXT_CMB_OwnerDraw);
@@ -950,58 +535,58 @@ void CFWL_ComboBoxImp::ShowDropList(FX_BOOL bActivate) {
m_pListBox->SetWidgetRect(m_rtList);
m_pListBox->Update();
CFWL_EvtCmbPreDropDown ev;
- ev.m_pSrcTarget = m_pInterface;
+ ev.m_pSrcTarget = this;
DispatchEvent(&ev);
- m_fItemHeight =
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->m_fItemHeight;
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->SetFocus(TRUE);
+ m_fItemHeight = m_pListBox->m_fItemHeight;
+ m_pListBox->SetFocus(TRUE);
m_pForm->DoModal();
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->SetFocus(FALSE);
+ m_pListBox->SetFocus(FALSE);
} else {
m_pForm->EndDoModal();
CFWL_EvtCmbCloseUp ev;
- ev.m_pSrcTarget = m_pInterface;
+ ev.m_pSrcTarget = this;
DispatchEvent(&ev);
m_bLButtonDown = FALSE;
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->m_bNotifyOwner =
- TRUE;
+ m_pListBox->m_bNotifyOwner = TRUE;
SetFocus(TRUE);
}
}
-FX_BOOL CFWL_ComboBoxImp::IsDropListShowed() {
+
+FX_BOOL IFWL_ComboBox::IsDropListShowed() {
return m_pForm && !(m_pForm->GetStates() & FWL_WGTSTATE_Invisible);
}
-FX_BOOL CFWL_ComboBoxImp::IsDropDownStyle() const {
+
+FX_BOOL IFWL_ComboBox::IsDropDownStyle() const {
return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown;
}
-void CFWL_ComboBoxImp::MatchEditText() {
+
+void IFWL_ComboBox::MatchEditText() {
CFX_WideString wsText;
m_pEdit->GetText(wsText);
- int32_t iMatch =
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->MatchItem(wsText);
+ int32_t iMatch = m_pListBox->MatchItem(wsText);
if (iMatch != m_iCurSel) {
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->ChangeSelected(iMatch);
+ m_pListBox->ChangeSelected(iMatch);
if (iMatch >= 0) {
SynchrEditText(iMatch);
}
} else if (iMatch >= 0) {
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected();
+ m_pEdit->SetSelected();
}
m_iCurSel = iMatch;
}
-void CFWL_ComboBoxImp::SynchrEditText(int32_t iListItem) {
+
+void IFWL_ComboBox::SynchrEditText(int32_t iListItem) {
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iListItem);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, iListItem);
+ m_pListBox->GetItemText(hItem, wsText);
m_pEdit->SetText(wsText);
m_pEdit->Update();
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected();
+ m_pEdit->SetSelected();
}
-void CFWL_ComboBoxImp::Layout() {
+
+void IFWL_ComboBox::Layout() {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_Layout();
}
@@ -1023,9 +608,8 @@ void CFWL_ComboBoxImp::Layout() {
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
+ m_pListBox->GetItemText(hItem, wsText);
m_pEdit->LockUpdate();
m_pEdit->SetText(wsText);
m_pEdit->UnlockUpdate();
@@ -1033,7 +617,8 @@ void CFWL_ComboBoxImp::Layout() {
m_pEdit->Update();
}
}
-void CFWL_ComboBoxImp::ReSetTheme() {
+
+void IFWL_ComboBox::ReSetTheme() {
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
if (!pTheme) {
pTheme = GetAvailableTheme();
@@ -1044,7 +629,8 @@ void CFWL_ComboBoxImp::ReSetTheme() {
if (m_pEdit && !m_pEdit->GetThemeProvider())
m_pEdit->SetThemeProvider(pTheme);
}
-void CFWL_ComboBoxImp::ReSetEditAlignment() {
+
+void IFWL_ComboBox::ReSetEditAlignment() {
if (!m_pEdit)
return;
uint32_t dwStylExes = m_pProperties->m_dwStyleExes;
@@ -1081,7 +667,8 @@ void CFWL_ComboBoxImp::ReSetEditAlignment() {
FWL_STYLEEXT_EDT_HAlignModeMask |
FWL_STYLEEXT_EDT_VAlignMask);
}
-void CFWL_ComboBoxImp::ReSetListItemAlignment() {
+
+void IFWL_ComboBox::ReSetListItemAlignment() {
if (!m_pListBox)
return;
uint32_t dwStylExes = m_pProperties->m_dwStyleExes;
@@ -1097,26 +684,27 @@ void CFWL_ComboBoxImp::ReSetListItemAlignment() {
}
m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask);
}
-void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) {
+
+void IFWL_ComboBox::ProcessSelChanged(FX_BOOL bLButtonUp) {
IFWL_ComboBoxDP* pDatas =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- m_iCurSel = pDatas->GetItemIndex(m_pInterface, m_pListBox->GetSelItem(0));
+ m_iCurSel = pDatas->GetItemIndex(this, m_pListBox->GetSelItem(0));
FX_BOOL bDropDown = IsDropDownStyle();
if (bDropDown) {
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
if (hItem) {
CFX_WideString wsText;
- pData->GetItemText(m_pInterface, hItem, wsText);
+ pData->GetItemText(this, hItem, wsText);
if (m_pEdit) {
m_pEdit->SetText(wsText);
m_pEdit->Update();
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected();
+ m_pEdit->SetSelected();
}
CFWL_EvtCmbSelChanged ev;
ev.bLButtonUp = bLButtonUp;
- ev.m_pSrcTarget = m_pInterface;
+ ev.m_pSrcTarget = this;
ev.iArraySels.Add(m_iCurSel);
DispatchEvent(&ev);
}
@@ -1125,27 +713,25 @@ void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) {
}
}
-void CFWL_ComboBoxImp::InitProxyForm() {
+void IFWL_ComboBox::InitProxyForm() {
if (m_pForm)
return;
if (!m_pListBox)
return;
CFWL_WidgetImpProperties propForm;
- propForm.m_pOwner = m_pInterface;
+ propForm.m_pOwner = this;
propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
propForm.m_dwStates = FWL_WGTSTATE_Invisible;
- CFX_WideString className;
- m_pForm = IFWL_Form::CreateFormProxy(propForm, &className, m_pListBox.get());
+ m_pForm = IFWL_FormProxy::Create(propForm, m_pListBox.get());
m_pForm->Initialize();
- m_pProxy = static_cast<CFWL_FormProxyImp*>(m_pForm->GetImpl());
m_pListBox->SetParent(m_pForm);
m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this);
- m_pProxy->SetDelegate(m_pListProxyDelegate);
+ m_pForm->SetDelegate(m_pListProxyDelegate);
}
-FWL_Error CFWL_ComboBoxImp::DisForm_Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_ComboBox::DisForm_Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
@@ -1154,41 +740,42 @@ FWL_Error CFWL_ComboBoxImp::DisForm_Initialize() {
return FWL_Error::Succeeded;
}
-void CFWL_ComboBoxImp::DisForm_InitComboList() {
+void IFWL_ComboBox::DisForm_InitComboList() {
if (m_pListBox)
return;
CFWL_WidgetImpProperties prop;
- prop.m_pParent = m_pInterface;
+ prop.m_pParent = this;
prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
prop.m_dwStates = FWL_WGTSTATE_Invisible;
prop.m_pDataProvider = m_pProperties->m_pDataProvider;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface));
+ m_pListBox.reset(IFWL_ComboList::Create(prop, this));
m_pListBox->Initialize();
}
-void CFWL_ComboBoxImp::DisForm_InitComboEdit() {
+
+void IFWL_ComboBox::DisForm_InitComboEdit() {
if (m_pEdit) {
return;
}
CFWL_WidgetImpProperties prop;
- prop.m_pParent = m_pInterface;
+ prop.m_pParent = this;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, m_pInterface));
+ m_pEdit.reset(IFWL_ComboEdit::Create(prop, this));
m_pEdit->Initialize();
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
+ m_pEdit->SetOuter(this);
}
-void CFWL_ComboBoxImp::DisForm_ShowDropList(FX_BOOL bActivate) {
+
+void IFWL_ComboBox::DisForm_ShowDropList(FX_BOOL bActivate) {
FX_BOOL bDropList = DisForm_IsDropListShowed();
if (bDropList == bActivate) {
return;
}
if (bActivate) {
CFWL_EvtCmbPreDropDown preEvent;
- preEvent.m_pSrcTarget = m_pInterface;
+ preEvent.m_pSrcTarget = this;
DispatchEvent(&preEvent);
- CFWL_ComboListImp* pComboList =
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl());
+ IFWL_ComboList* pComboList = m_pListBox.get();
int32_t iItems = pComboList->CountItems();
if (iItems < 1) {
return;
@@ -1216,7 +803,7 @@ void CFWL_ComboBoxImp::DisForm_ShowDropList(FX_BOOL bActivate) {
m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate);
if (bActivate) {
CFWL_EvtCmbPostDropDown postEvent;
- postEvent.m_pSrcTarget = m_pInterface;
+ postEvent.m_pSrcTarget = this;
DispatchEvent(&postEvent);
}
CFX_RectF rect;
@@ -1224,11 +811,13 @@ void CFWL_ComboBoxImp::DisForm_ShowDropList(FX_BOOL bActivate) {
rect.Inflate(2, 2);
Repaint(&rect);
}
-FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() {
+
+FX_BOOL IFWL_ComboBox::DisForm_IsDropListShowed() {
return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible);
}
-FWL_Error CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
+
+FWL_Error IFWL_ComboBox::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved) {
if (!m_pEdit) {
DisForm_InitComboEdit();
}
@@ -1241,9 +830,10 @@ FWL_Error CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
} else if (bDelDropDown) {
m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0);
}
- return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
+ return IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
-FWL_Error CFWL_ComboBoxImp::DisForm_Update() {
+
+FWL_Error IFWL_ComboBox::DisForm_Update() {
if (m_iLock) {
return FWL_Error::Indefinite;
}
@@ -1254,7 +844,8 @@ FWL_Error CFWL_ComboBoxImp::DisForm_Update() {
Layout();
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+
+FWL_WidgetHit IFWL_ComboBox::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rect;
rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width,
m_pProperties->m_rtWidget.height);
@@ -1269,8 +860,9 @@ FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
}
return FWL_WidgetHit::Unknown;
}
-FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
CFX_Matrix mtOrg;
mtOrg.Set(1, 0, 0, 1, 0, 0);
@@ -1282,7 +874,7 @@ FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics,
pGraphics->ConcatMatrix(&mtOrg);
if (!m_rtBtn.IsEmpty(0.1f)) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::DropDownButton;
param.m_dwStates = m_iBtnState;
param.m_pGraphics = pGraphics;
@@ -1308,7 +900,8 @@ FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) {
+
+FWL_Error IFWL_ComboBox::DisForm_GetBBox(CFX_RectF& rect) {
rect = m_pProperties->m_rtWidget;
if (m_pListBox && DisForm_IsDropListShowed()) {
CFX_RectF rtList;
@@ -1318,7 +911,8 @@ FWL_Error CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) {
}
return FWL_Error::Succeeded;
}
-void CFWL_ComboBoxImp::DisForm_Layout() {
+
+void IFWL_ComboBox::DisForm_Layout() {
GetClientRect(m_rtClient);
m_rtContent = m_rtClient;
FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
@@ -1347,9 +941,8 @@ void CFWL_ComboBoxImp::DisForm_Layout() {
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
+ m_pListBox->GetItemText(hItem, wsText);
m_pEdit->LockUpdate();
m_pEdit->SetText(wsText);
m_pEdit->UnlockUpdate();
@@ -1358,7 +951,7 @@ void CFWL_ComboBoxImp::DisForm_Layout() {
}
}
-CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner)
+CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(IFWL_ComboBox* pOwner)
: m_pOwner(pOwner) {}
void CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -1406,9 +999,7 @@ void CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnKey(static_cast<CFWL_MsgKey*>(pMessage));
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
@@ -1420,7 +1011,7 @@ void CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
CFWL_EvtLtbDrawItem* pDrawItemEvent =
static_cast<CFWL_EvtLtbDrawItem*>(pEvent);
CFWL_EvtCmbDrawItem pTemp;
- pTemp.m_pSrcTarget = m_pOwner->m_pInterface;
+ pTemp.m_pSrcTarget = m_pOwner;
pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics;
pTemp.m_index = pDrawItemEvent->m_index;
pTemp.m_rtItem = pDrawItemEvent->m_rect;
@@ -1428,7 +1019,7 @@ void CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
} else if (dwFlag == CFWL_EventType::Scroll) {
CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent);
CFWL_EvtScroll pScrollEv;
- pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface;
+ pScrollEv.m_pSrcTarget = m_pOwner;
pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode;
pScrollEv.m_fPos = pScrollEvent->m_fPos;
m_pOwner->DispatchEvent(&pScrollEv);
@@ -1436,7 +1027,7 @@ void CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
CFWL_EvtEdtTextChanged* pTextChangedEvent =
static_cast<CFWL_EvtEdtTextChanged*>(pEvent);
CFWL_EvtCmbEditChanged pTemp;
- pTemp.m_pSrcTarget = m_pOwner->m_pInterface;
+ pTemp.m_pSrcTarget = m_pOwner;
pTemp.wsInsert = pTextChangedEvent->wsInsert;
pTemp.wsDelete = pTextChangedEvent->wsDelete;
pTemp.nChangeType = pTextChangedEvent->nChangeType;
@@ -1459,8 +1050,7 @@ void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
if (bDropDown && pSrcTarget != m_pOwner->m_pListBox.get()) {
if (!m_pOwner->m_pEdit)
return;
- static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
- ->SetSelected();
+ m_pOwner->m_pEdit->SetSelected();
} else {
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
@@ -1469,15 +1059,14 @@ void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
if (bDropDown && pDstTarget != m_pOwner->m_pListBox.get()) {
if (!m_pOwner->m_pEdit)
return;
- static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
- ->FlagFocus(FALSE);
- static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
- ->ClearSelected();
+ m_pOwner->m_pEdit->FlagFocus(FALSE);
+ m_pOwner->m_pEdit->ClearSelected();
} else {
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
}
}
+
void CFWL_ComboBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) {
return;
@@ -1497,6 +1086,7 @@ void CFWL_ComboBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
}
+
void CFWL_ComboBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->m_bLButtonDown = FALSE;
if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
@@ -1506,6 +1096,7 @@ void CFWL_ComboBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
}
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
+
void CFWL_ComboBoxImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
int32_t iOldState = m_pOwner->m_iBtnState;
if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
@@ -1520,6 +1111,7 @@ void CFWL_ComboBoxImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
}
+
void CFWL_ComboBoxImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
if (!m_pOwner->IsDropListShowed() &&
!((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) ==
@@ -1528,23 +1120,23 @@ void CFWL_ComboBoxImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
}
+
void CFWL_ComboBoxImpDelegate::OnKey(CFWL_MsgKey* pMsg) {
uint32_t dwKeyCode = pMsg->m_dwKeyCode;
if (dwKeyCode == FWL_VKEY_Tab) {
m_pOwner->DispatchKeyEvent(pMsg);
return;
}
- if (pMsg->m_pDstTarget == m_pOwner->m_pInterface)
+ if (pMsg->m_pDstTarget == m_pOwner)
DoSubCtrlKey(pMsg);
}
+
void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
uint32_t dwKeyCode = pMsg->m_dwKeyCode;
const bool bUp = dwKeyCode == FWL_VKEY_Up;
const bool bDown = dwKeyCode == FWL_VKEY_Down;
if (bUp || bDown) {
- int32_t iCount =
- static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl())
- ->CountItems();
+ int32_t iCount = m_pOwner->m_pListBox->CountItems();
if (iCount < 1) {
return;
}
@@ -1554,15 +1146,13 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
if (bDropDown && m_pOwner->m_pEdit) {
CFX_WideString wsText;
m_pOwner->m_pEdit->GetText(wsText);
- iCurSel = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl())
- ->MatchItem(wsText);
+ iCurSel = m_pOwner->m_pListBox->MatchItem(wsText);
if (iCurSel >= 0) {
CFX_WideString wsTemp;
IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(
m_pOwner->m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel);
- static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl())
- ->GetItemText(hItem, wsTemp);
+ IFWL_ListItem* hItem = pData->GetItem(m_pOwner, iCurSel);
+ m_pOwner->m_pListBox->GetItemText(hItem, wsTemp);
bMatchEqual = wsText == wsTemp;
}
}
@@ -1592,6 +1182,7 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
pDelegate->OnProcessMessage(pMsg);
}
}
+
void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage(
CFWL_Message* pMessage) {
if (!pMessage)
@@ -1671,6 +1262,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) {
}
}
}
+
void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
FX_BOOL bSet) {
if (bSet) {
@@ -1692,13 +1284,13 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
pDelegate->OnProcessMessage(&msg);
}
}
+
void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) {
uint32_t dwKeyCode = pMsg->m_dwKeyCode;
const bool bUp = dwKeyCode == FWL_VKEY_Up;
const bool bDown = dwKeyCode == FWL_VKEY_Down;
if (bUp || bDown) {
- CFWL_ComboListImp* pComboList =
- static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl());
+ IFWL_ComboList* pComboList = m_pOwner->m_pListBox.get();
int32_t iCount = pComboList->CountItems();
if (iCount < 1) {
return;
@@ -1738,9 +1330,8 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) {
}
}
-CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate(
- IFWL_Form* pForm,
- CFWL_ComboBoxImp* pComboBox)
+CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate(IFWL_Form* pForm,
+ IFWL_ComboBox* pComboBox)
: m_bLButtonDown(FALSE),
m_bLButtonUpSelf(FALSE),
m_fStartPos(0),
@@ -1814,6 +1405,7 @@ void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pComboBox->ShowDropList(FALSE);
}
}
+
void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_bLButtonDown = FALSE;
IFWL_App* pApp = m_pForm->GetOwnerApp();
@@ -1835,10 +1427,13 @@ void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_bLButtonUpSelf = TRUE;
}
}
+
void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {}
+
void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) {
m_pComboBox->ShowDropList(FALSE);
}
+
void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg,
FX_BOOL bSet) {
if (!bSet) {
« no previous file with comments | « xfa/fwl/core/ifwl_combobox.h ('k') | xfa/fwl/core/ifwl_comboedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698