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

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

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_checkbox.cpp ('k') | xfa/fwl/core/ifwl_combobox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/ifwl_combobox.h
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.h b/xfa/fwl/core/ifwl_combobox.h
similarity index 64%
rename from xfa/fwl/basewidget/fwl_comboboximp.h
rename to xfa/fwl/core/ifwl_combobox.h
index 0ed5dbb1fa3a8880afee3cc9f612765a7c933283..106b7c0c08a55d53d018637d3f1a76036850e2e2 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.h
+++ b/xfa/fwl/core/ifwl_combobox.h
@@ -4,93 +4,94 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_
+#ifndef XFA_FWL_CORE_IFWL_COMBOBOX_H_
+#define XFA_FWL_CORE_IFWL_COMBOBOX_H_
-#include <memory>
+#include "xfa/fwl/core/ifwl_form.h"
+#include "xfa/fwl/core/ifwl_listbox.h"
+#include "xfa/fxgraphics/cfx_graphics.h"
-#include "xfa/fwl/basewidget/fwl_editimp.h"
-#include "xfa/fwl/basewidget/fwl_listboximp.h"
-
-class CFWL_WidgetImp;
-class CFWL_WidgetImpProperties;
-class CFWL_WidgetImpDelegate;
-class CFWL_ListBoxImp;
-class CFWL_ListBoxImpDelegate;
-class CFWL_FormProxyImp;
-class IFWL_Widget;
-class CFWL_ComboEditImp;
+class CFWL_ComboBoxImpDelegate;
class CFWL_ComboEditImpDelegate;
-class CFWL_ComboListImp;
class CFWL_ComboListImpDelegate;
-class CFWL_ComboBoxImp;
-class CFWL_ComboBoxImpDelegate;
class CFWL_ComboProxyImpDelegate;
-class CFWL_ComboEditImp : public CFWL_EditImp {
- public:
- CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- void ClearSelected();
- void SetSelected();
- void EndCaret();
- void FlagFocus(FX_BOOL bSet);
+class CFWL_ListBoxImpDelegate;
+class CFWL_WidgetImpProperties;
+class CFWL_WidgetImpDelegate;
+class IFWL_ComboBox;
+class IFWL_ComboEdit;
+class IFWL_ComboList;
+class IFWL_FormProxy;
+class IFWL_ListBox;
+class IFWL_Widget;
- protected:
- void SetComboBoxFocus(FX_BOOL bSet);
- CFWL_ComboBoxImp* m_pOuter;
- friend class CFWL_ComboEditImpDelegate;
-};
-class CFWL_ComboEditImpDelegate : public CFWL_EditImpDelegate {
+#define FWL_CLASS_ComboBox L"FWL_COMBOBOX"
+#define FWL_STYLEEXT_CMB_DropList (0L << 0)
+#define FWL_STYLEEXT_CMB_DropDown (1L << 0)
+#define FWL_STYLEEXT_CMB_Sort (1L << 1)
+#define FWL_STYLEEXT_CMB_ListDrag (1L << 2)
+#define FWL_STYLEEXT_CMB_OwnerDraw (1L << 3)
+#define FWL_STYLEEXT_CMB_EditHNear (0L << 4)
+#define FWL_STYLEEXT_CMB_EditHCenter (1L << 4)
+#define FWL_STYLEEXT_CMB_EditHFar (2L << 4)
+#define FWL_STYLEEXT_CMB_EditVNear (0L << 6)
+#define FWL_STYLEEXT_CMB_EditVCenter (1L << 6)
+#define FWL_STYLEEXT_CMB_EditVFar (2L << 6)
+#define FWL_STYLEEXT_CMB_EditJustified (1L << 8)
+#define FWL_STYLEEXT_CMB_EditDistributed (2L << 8)
+#define FWL_STYLEEXT_CMB_EditHAlignMask (3L << 4)
+#define FWL_STYLEEXT_CMB_EditVAlignMask (3L << 6)
+#define FWL_STYLEEXT_CMB_EditHAlignModeMask (3L << 8)
+#define FWL_STYLEEXT_CMB_ListItemLeftAlign (0L << 10)
+#define FWL_STYLEEXT_CMB_ListItemCenterAlign (1L << 10)
+#define FWL_STYLEEXT_CMB_ListItemRightAlign (2L << 10)
+#define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 10)
+#define FWL_STYLEEXT_CMB_ListItemText (0L << 12)
+#define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12)
+#define FWL_STYLEEXT_CMB_ReadOnly (1L << 13)
+
+FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, CFWL_EventType::PreDropDown)
+
+FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, CFWL_EventType::PostDropDown)
+
+FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, CFWL_EventType::CloseUp)
+
+FWL_EVENT_DEF(CFWL_EvtCmbEditChanged,
+ CFWL_EventType::EditChanged,
+ int32_t nChangeType;
+ CFX_WideString wsInsert;
+ CFX_WideString wsDelete;)
+
+FWL_EVENT_DEF(CFWL_EvtCmbSelChanged,
+ CFWL_EventType::SelectChanged,
+ CFX_Int32Array iArraySels;
+ FX_BOOL bLButtonUp;)
+
+FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged,
+ CFWL_EventType::HoverChanged,
+ int32_t m_iCurHover;)
+
+FWL_EVENT_DEF(CFWL_EvtCmbDrawItem,
+ CFWL_EventType::DrawItem,
+ CFX_Graphics* m_pGraphics;
+ CFX_Matrix m_matrix;
+ int32_t m_index;
+ CFX_RectF m_rtItem;)
+
+class IFWL_ComboBoxDP : public IFWL_ListBoxDP {
public:
- CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner);
- void OnProcessMessage(CFWL_Message* pMessage) override;
-
- protected:
- CFWL_ComboEditImp* m_pOwner;
+ virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0;
};
-class CFWL_ComboListImp : public CFWL_ListBoxImp {
- public:
- CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- // CFWL_WidgetImp
- FWL_Error Initialize() override;
- FWL_Error Finalize() override;
-
- int32_t MatchItem(const CFX_WideString& wsMatch);
- void ChangeSelected(int32_t iSel);
- int32_t CountItems();
- void GetItemRect(int32_t nIndex, CFX_RectF& rtItem);
- void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy);
- void SetFocus(FX_BOOL bSet);
-
- FX_BOOL m_bNotifyOwner;
-
- friend class CFWL_ComboListImpDelegate;
- friend class CFWL_ComboBoxImp;
-};
-class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate {
+class IFWL_ComboBox : public IFWL_Widget {
public:
- CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner);
- void OnProcessMessage(CFWL_Message* pMessage) override;
+ static IFWL_ComboBox* Create(const CFWL_WidgetImpProperties& properties);
- protected:
- void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
- int32_t OnDropListMouseMove(CFWL_MsgMouse* pMsg);
- int32_t OnDropListLButtonDown(CFWL_MsgMouse* pMsg);
- int32_t OnDropListLButtonUp(CFWL_MsgMouse* pMsg);
- int32_t OnDropListKey(CFWL_MsgKey* pKey);
- void OnDropListKeyDown(CFWL_MsgKey* pKey);
- CFWL_ComboListImp* m_pOwner;
-};
-class CFWL_ComboBoxImp : public CFWL_WidgetImp {
- public:
- CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_ComboBoxImp() override;
+ IFWL_ComboBox(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_ComboBox() override;
- // CFWL_WidgetImp
+ // IFWL_Widget
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FWL_Error Initialize() override;
@@ -140,12 +141,12 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
uint32_t dwStylesExRemoved);
protected:
- friend class CFWL_ComboListImp;
- friend class CFWL_ComboEditImp;
+ friend class CFWL_ComboBoxImpDelegate;
friend class CFWL_ComboEditImpDelegate;
friend class CFWL_ComboListImpDelegate;
- friend class CFWL_ComboBoxImpDelegate;
friend class CFWL_ComboProxyImpDelegate;
+ friend class IFWL_ComboEdit;
+ friend class IFWL_ComboList;
void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix);
FX_FLOAT GetListHeight();
@@ -180,9 +181,9 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
CFX_RectF m_rtList;
CFX_RectF m_rtProxy;
CFX_RectF m_rtHandler;
- std::unique_ptr<IFWL_Edit> m_pEdit;
- std::unique_ptr<IFWL_ListBox> m_pListBox;
- IFWL_Form* m_pForm;
+ std::unique_ptr<IFWL_ComboEdit> m_pEdit;
+ std::unique_ptr<IFWL_ComboList> m_pListBox;
+ IFWL_FormProxy* m_pForm;
FX_BOOL m_bLButtonDown;
FX_BOOL m_bUpFormHandler;
int32_t m_iCurSel;
@@ -190,12 +191,12 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
FX_FLOAT m_fComboFormHandler;
FX_FLOAT m_fItemHeight;
FX_BOOL m_bNeedShowList;
- CFWL_FormProxyImp* m_pProxy;
CFWL_ComboProxyImpDelegate* m_pListProxyDelegate;
};
+
class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner);
+ CFWL_ComboBoxImpDelegate(IFWL_ComboBox* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(CFWL_Event* pEvent) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
@@ -209,21 +210,19 @@ class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate {
void OnMouseLeave(CFWL_MsgMouse* pMsg);
void OnKey(CFWL_MsgKey* pMsg);
void DoSubCtrlKey(CFWL_MsgKey* pMsg);
-
- protected:
void DisForm_OnProcessMessage(CFWL_Message* pMessage);
void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg);
void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
void DisForm_OnKey(CFWL_MsgKey* pMsg);
- protected:
- CFWL_ComboBoxImp* m_pOwner;
+ IFWL_ComboBox* m_pOwner;
friend class CFWL_ComboEditImpDelegate;
friend class CFWL_ComboListImpDelegate;
};
+
class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, CFWL_ComboBoxImp* pComboBox);
+ CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, IFWL_ComboBox* pComboBox);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
@@ -239,7 +238,7 @@ class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate {
FX_BOOL m_bLButtonUpSelf;
FX_FLOAT m_fStartPos;
IFWL_Form* m_pForm;
- CFWL_ComboBoxImp* m_pComboBox;
+ IFWL_ComboBox* m_pComboBox;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_
+#endif // XFA_FWL_CORE_IFWL_COMBOBOX_H_
« no previous file with comments | « xfa/fwl/core/ifwl_checkbox.cpp ('k') | xfa/fwl/core/ifwl_combobox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698