summaryrefslogtreecommitdiff
path: root/xfa/include/fwl
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/include/fwl')
-rw-r--r--xfa/include/fwl/lightwidget/listbox.h98
-rw-r--r--xfa/include/fwl/lightwidget/theme.h12
-rw-r--r--xfa/include/fwl/theme/widgettp.h27
3 files changed, 83 insertions, 54 deletions
diff --git a/xfa/include/fwl/lightwidget/listbox.h b/xfa/include/fwl/lightwidget/listbox.h
index 70888f6007..09bc018a63 100644
--- a/xfa/include/fwl/lightwidget/listbox.h
+++ b/xfa/include/fwl/lightwidget/listbox.h
@@ -4,13 +4,20 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FWL_LISTBOX_LIGHT_H
-#define _FWL_LISTBOX_LIGHT_H
+#ifndef XFA_INCLUDE_FWL_LIGHTWIDGET_LISTBOX_H_
+#define XFA_INCLUDE_FWL_LIGHTWIDGET_LISTBOX_H_
+
+#include <memory>
+#include <vector>
+
+#include "xfa/include/fwl/lightwidget/widget.h"
+
class CFWL_Widget;
class CFWL_WidgetProperties;
class IFWL_ListBoxDP;
class CFWL_ListBox;
class CFWL_ListItem;
+
class CFWL_ListBox : public CFWL_Widget {
public:
static CFWL_ListBox* Create();
@@ -46,54 +53,58 @@ class CFWL_ListBox : public CFWL_Widget {
public:
CFWL_ListBoxDP();
~CFWL_ListBoxDP();
- virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption);
- virtual int32_t CountItems(IFWL_Widget* pWidget);
- virtual FWL_HLISTITEM GetItem(IFWL_Widget* pWidget, int32_t nIndex);
- virtual int32_t GetItemIndex(IFWL_Widget* pWidget, FWL_HLISTITEM hItem);
- virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem,
- int32_t nIndex);
+ // IFWL_DataProvider:
+ FWL_ERR GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override;
- virtual FX_DWORD GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem);
- virtual FWL_ERR GetItemText(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem,
- CFX_WideString& wsText);
- virtual FWL_ERR GetItemRect(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem,
- CFX_RectF& rtItem);
- virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem);
+ // IFWL_ListBoxDP:
+ int32_t CountItems(IFWL_Widget* pWidget) override;
+ FWL_HLISTITEM GetItem(IFWL_Widget* pWidget, int32_t nIndex) override;
+ int32_t GetItemIndex(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override;
+ FX_BOOL SetItemIndex(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ int32_t nIndex) override;
+ FX_DWORD GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override;
+ FWL_ERR GetItemText(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ CFX_WideString& wsText) override;
+ FWL_ERR GetItemRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ CFX_RectF& rtItem) override;
+ void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override;
+ FWL_ERR SetItemStyles(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ FX_DWORD dwStyle) override;
+ FWL_ERR SetItemText(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ const FX_WCHAR* pszText) override;
+ FWL_ERR SetItemRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ const CFX_RectF& rtItem) override;
+ FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
+ CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem) override;
+ FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ CFX_RectF& rtCheck) override;
+ FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ const CFX_RectF& rtCheck) override;
+ FX_DWORD GetItemCheckState(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem) override;
+ FWL_ERR SetItemCheckState(IFWL_Widget* pWidget,
+ FWL_HLISTITEM hItem,
+ FX_DWORD dwCheckState) override;
- virtual FWL_ERR SetItemStyles(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem,
- FX_DWORD dwStyle);
- virtual FWL_ERR SetItemText(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem,
- const FX_WCHAR* pszText);
- virtual FWL_ERR SetItemRect(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem,
- const CFX_RectF& rtItem);
- virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget);
- virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem);
- virtual FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem,
- CFX_RectF& rtCheck);
- virtual FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem,
- const CFX_RectF& rtCheck);
- virtual FX_DWORD GetItemCheckState(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem);
- virtual FWL_ERR SetItemCheckState(IFWL_Widget* pWidget,
- FWL_HLISTITEM hItem,
- FX_DWORD dwCheckState);
-
- CFX_PtrArray m_arrItem;
+ std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
CFX_WideString m_wsData;
FX_FLOAT m_fItemHeight;
};
+
CFWL_ListBoxDP m_ListBoxDP;
};
+
class CFWL_ListItem {
public:
CFWL_ListItem() {
@@ -113,4 +124,5 @@ class CFWL_ListItem {
FX_DWORD m_dwCheckState;
CFX_RectF m_rtCheckBox;
};
-#endif
+
+#endif // XFA_INCLUDE_FWL_LIGHTWIDGET_LISTBOX_H_
diff --git a/xfa/include/fwl/lightwidget/theme.h b/xfa/include/fwl/lightwidget/theme.h
index 75a60dc9fe..824cacebc7 100644
--- a/xfa/include/fwl/lightwidget/theme.h
+++ b/xfa/include/fwl/lightwidget/theme.h
@@ -4,8 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FWL_THEME_LIGHT_H
-#define _FWL_THEME_LIGHT_H
+#ifndef XFA_INCLUDE_FWL_LIGHTWIDGET_THEME_H_
+#define XFA_INCLUDE_FWL_LIGHTWIDGET_THEME_H_
+
+#include <memory>
+#include <vector>
#include "xfa/include/fwl/core/fwl_theme.h"
@@ -45,6 +48,7 @@ class CFWL_Theme : public IFWL_ThemeProvider {
CFWL_WidgetTP* GetTheme(IFWL_Widget* pWidget);
protected:
- CFX_PtrArray m_arrThemes;
+ std::vector<std::unique_ptr<CFWL_WidgetTP>> m_ThemesArray;
};
-#endif
+
+#endif // XFA_INCLUDE_FWL_LIGHTWIDGET_THEME_H_
diff --git a/xfa/include/fwl/theme/widgettp.h b/xfa/include/fwl/theme/widgettp.h
index adeeb42d6c..404ca51547 100644
--- a/xfa/include/fwl/theme/widgettp.h
+++ b/xfa/include/fwl/theme/widgettp.h
@@ -4,8 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FWL_WIDGETTP_H
-#define _FWL_WIDGETTP_H
+#ifndef XFA_INCLUDE_FWL_THEME_WIDGETTP_H_
+#define XFA_INCLUDE_FWL_THEME_WIDGETTP_H_
+
+#include <memory>
+#include <vector>
+
class IFWL_ThemeProvider;
class IFWL_Widget;
class IFDE_TextOut;
@@ -16,6 +20,7 @@ class IFX_FontSourceEnum;
#endif
class CFWL_WidgetTP;
class CFWL_ArrowData;
+
class CFWL_WidgetTP {
public:
virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
@@ -142,6 +147,7 @@ void FWLTHEME_Release();
FX_DWORD FWL_GetThemeLayout(FX_DWORD dwThemeID);
FX_DWORD FWL_GetThemeColor(FX_DWORD dwThemeID);
FX_DWORD FWL_MakeThemeID(FX_DWORD dwLayout, FX_DWORD dwColor);
+
class CFWL_ArrowData {
public:
static CFWL_ArrowData* GetInstance();
@@ -162,6 +168,7 @@ class CFWL_ArrowData {
CFWL_ArrowData();
static CFWL_ArrowData* m_pInstance;
};
+
class CFWL_FontData {
public:
CFWL_FontData();
@@ -184,16 +191,22 @@ class CFWL_FontData {
IFX_FontSourceEnum* m_pFontSource;
#endif
};
+
class CFWL_FontManager {
public:
- CFWL_FontManager();
- virtual ~CFWL_FontManager();
+ static CFWL_FontManager* GetInstance();
+ static void DestroyInstance();
+
IFX_Font* FindFont(const CFX_WideStringC& wsFontFamily,
FX_DWORD dwFontStyles,
FX_WORD dwCodePage);
protected:
- CFX_PtrArray m_arrFonts;
+ CFWL_FontManager();
+ virtual ~CFWL_FontManager();
+
+ static CFWL_FontManager* s_FontManager;
+ std::vector<std::unique_ptr<CFWL_FontData>> m_FontsArray;
};
-CFWL_FontManager* FWL_GetFontManager();
-#endif
+
+#endif // XFA_INCLUDE_FWL_THEME_WIDGETTP_H_