| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef FPDFSDK_PDFWINDOW_PWL_NOTE_H_ | |
| 8 #define FPDFSDK_PDFWINDOW_PWL_NOTE_H_ | |
| 9 | |
| 10 #include "fpdfsdk/pdfwindow/PWL_Button.h" | |
| 11 #include "fpdfsdk/pdfwindow/PWL_Edit.h" | |
| 12 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" | |
| 13 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" | |
| 14 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | |
| 15 | |
| 16 class CPWL_Label; | |
| 17 class CPWL_Note; | |
| 18 class CPWL_NoteItem; | |
| 19 class CPWL_Note_CloseBox; | |
| 20 class CPWL_Note_Contents; | |
| 21 class CPWL_Note_Edit; | |
| 22 class CPWL_Note_Icon; | |
| 23 class CPWL_Note_LBBox; | |
| 24 class CPWL_Note_Options; | |
| 25 class CPWL_Note_RBBox; | |
| 26 class IPWL_NoteHandler; | |
| 27 class IPWL_NoteItem; | |
| 28 class IPopup_Note; | |
| 29 | |
| 30 class IPWL_NoteHandler { | |
| 31 public: | |
| 32 virtual ~IPWL_NoteHandler() {} | |
| 33 virtual void OnNoteColorChanged(const CPWL_Color& color) = 0; | |
| 34 }; | |
| 35 | |
| 36 class IPWL_NoteItem { | |
| 37 public: | |
| 38 virtual ~IPWL_NoteItem() {} | |
| 39 virtual void SetPrivateData(void* pData) = 0; | |
| 40 virtual void SetBkColor(const CPWL_Color& color) = 0; | |
| 41 virtual void SetSubjectName(const CFX_WideString& sName) = 0; | |
| 42 virtual void SetDateTime(FX_SYSTEMTIME time) = 0; | |
| 43 virtual void SetContents(const CFX_WideString& sContents) = 0; | |
| 44 | |
| 45 virtual int32_t CountSubItems() const = 0; | |
| 46 virtual IPWL_NoteItem* GetSubItems(int32_t index) const = 0; | |
| 47 virtual void SetFocus() = 0; | |
| 48 | |
| 49 virtual IPWL_NoteItem* GetParentItem() const = 0; | |
| 50 virtual void* GetPrivateData() const = 0; | |
| 51 virtual CFX_WideString GetAuthorName() const = 0; | |
| 52 virtual CPWL_Color GetBkColor() const = 0; | |
| 53 virtual CFX_WideString GetContents() const = 0; | |
| 54 virtual FX_SYSTEMTIME GetDateTime() const = 0; | |
| 55 virtual CFX_WideString GetSubjectName() const = 0; | |
| 56 | |
| 57 virtual CPWL_Edit* GetEdit() const = 0; | |
| 58 }; | |
| 59 | |
| 60 class CPWL_Note_Icon : public CPWL_Wnd { | |
| 61 public: | |
| 62 CPWL_Note_Icon(); | |
| 63 ~CPWL_Note_Icon() override; | |
| 64 | |
| 65 void SetIconType(int32_t nType); | |
| 66 | |
| 67 protected: | |
| 68 // CPWL_Wnd | |
| 69 void DrawThisAppearance(CFX_RenderDevice* pDevice, | |
| 70 CFX_Matrix* pUser2Device) override; | |
| 71 | |
| 72 private: | |
| 73 int32_t m_nType; | |
| 74 }; | |
| 75 | |
| 76 class CPWL_Note_CloseBox : public CPWL_Button { | |
| 77 public: | |
| 78 CPWL_Note_CloseBox(); | |
| 79 ~CPWL_Note_CloseBox() override; | |
| 80 | |
| 81 protected: | |
| 82 // CPWL_Button | |
| 83 void DrawThisAppearance(CFX_RenderDevice* pDevice, | |
| 84 CFX_Matrix* pUser2Device) override; | |
| 85 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
| 86 FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
| 87 | |
| 88 private: | |
| 89 FX_BOOL m_bMouseDown; | |
| 90 }; | |
| 91 | |
| 92 class CPWL_Note_LBBox : public CPWL_Wnd { | |
| 93 public: | |
| 94 CPWL_Note_LBBox(); | |
| 95 ~CPWL_Note_LBBox() override; | |
| 96 | |
| 97 protected: | |
| 98 // CPWL_Wnd | |
| 99 void DrawThisAppearance(CFX_RenderDevice* pDevice, | |
| 100 CFX_Matrix* pUser2Device) override; | |
| 101 }; | |
| 102 | |
| 103 class CPWL_Note_RBBox : public CPWL_Wnd { | |
| 104 public: | |
| 105 CPWL_Note_RBBox(); | |
| 106 ~CPWL_Note_RBBox() override; | |
| 107 | |
| 108 protected: | |
| 109 // CPWL_Wnd | |
| 110 void DrawThisAppearance(CFX_RenderDevice* pDevice, | |
| 111 CFX_Matrix* pUser2Device) override; | |
| 112 }; | |
| 113 | |
| 114 class CPWL_Note_Edit : public CPWL_Edit { | |
| 115 public: | |
| 116 CPWL_Note_Edit(); | |
| 117 ~CPWL_Note_Edit() override; | |
| 118 | |
| 119 void EnableNotify(FX_BOOL bEnable) { m_bEnableNotify = bEnable; } | |
| 120 | |
| 121 // CPWL_Edit | |
| 122 FX_FLOAT GetItemLeftMargin() override; | |
| 123 FX_FLOAT GetItemRightMargin() override; | |
| 124 FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; | |
| 125 void SetText(const FX_WCHAR* csText) override; | |
| 126 void OnNotify(CPWL_Wnd* pWnd, | |
| 127 uint32_t msg, | |
| 128 intptr_t wParam = 0, | |
| 129 intptr_t lParam = 0) override; | |
| 130 void RePosChildWnd() override; | |
| 131 void OnSetFocus() override; | |
| 132 void OnKillFocus() override; | |
| 133 | |
| 134 private: | |
| 135 FX_BOOL m_bEnableNotify; | |
| 136 FX_FLOAT m_fOldItemHeight; | |
| 137 FX_BOOL m_bSizeChanged; | |
| 138 FX_FLOAT m_fOldMin; | |
| 139 FX_FLOAT m_fOldMax; | |
| 140 }; | |
| 141 | |
| 142 class CPWL_Note_Options : public CPWL_Wnd { | |
| 143 public: | |
| 144 CPWL_Note_Options(); | |
| 145 ~CPWL_Note_Options() override; | |
| 146 | |
| 147 CFX_FloatRect GetContentRect() const; | |
| 148 void SetText(const CFX_WideString& sText); | |
| 149 | |
| 150 // CPWL_Wnd | |
| 151 void RePosChildWnd() override; | |
| 152 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | |
| 153 void DrawThisAppearance(CFX_RenderDevice* pDevice, | |
| 154 CFX_Matrix* pUser2Device) override; | |
| 155 void SetTextColor(const CPWL_Color& color) override; | |
| 156 | |
| 157 private: | |
| 158 CPWL_Label* m_pText; | |
| 159 }; | |
| 160 | |
| 161 class CPWL_Note_Contents : public CPWL_ListCtrl { | |
| 162 public: | |
| 163 CPWL_Note_Contents(); | |
| 164 ~CPWL_Note_Contents() override; | |
| 165 | |
| 166 void SetEditFocus(FX_BOOL bLast); | |
| 167 CPWL_Edit* GetEdit() const; | |
| 168 | |
| 169 void SetText(const CFX_WideString& sText); | |
| 170 CFX_WideString GetText() const; | |
| 171 | |
| 172 int32_t CountSubItems() const; | |
| 173 IPWL_NoteItem* GetSubItems(int32_t index) const; | |
| 174 | |
| 175 virtual IPWL_NoteItem* GetHitNoteItem(const CFX_FloatPoint& point); | |
| 176 void EnableRead(FX_BOOL bEnabled); | |
| 177 void EnableModify(FX_BOOL bEnabled); | |
| 178 | |
| 179 // CPWL_ListCtrl | |
| 180 CFX_ByteString GetClassName() const override; | |
| 181 void OnNotify(CPWL_Wnd* pWnd, | |
| 182 uint32_t msg, | |
| 183 intptr_t wParam = 0, | |
| 184 intptr_t lParam = 0) override; | |
| 185 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
| 186 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | |
| 187 | |
| 188 private: | |
| 189 CPWL_Note_Edit* m_pEdit; | |
| 190 }; | |
| 191 | |
| 192 class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem { | |
| 193 public: | |
| 194 CPWL_NoteItem(); | |
| 195 ~CPWL_NoteItem() override; | |
| 196 | |
| 197 virtual IPWL_NoteItem* GetHitNoteItem(const CFX_FloatPoint& point); | |
| 198 virtual IPWL_NoteItem* GetFocusedNoteItem() const; | |
| 199 | |
| 200 virtual FX_BOOL IsTopItem() const { return FALSE; } | |
| 201 | |
| 202 void EnableRead(FX_BOOL bEnabled); | |
| 203 void EnableModify(FX_BOOL bEnabled); | |
| 204 | |
| 205 // IPWL_NoteItem | |
| 206 void SetPrivateData(void* pData) override; | |
| 207 void SetBkColor(const CPWL_Color& color) override; | |
| 208 void SetSubjectName(const CFX_WideString& sName) override; | |
| 209 void SetDateTime(FX_SYSTEMTIME time) override; | |
| 210 void SetContents(const CFX_WideString& sContents) override; | |
| 211 int32_t CountSubItems() const override; | |
| 212 IPWL_NoteItem* GetSubItems(int32_t index) const override; | |
| 213 void SetFocus() override { SetNoteFocus(FALSE); } | |
| 214 IPWL_NoteItem* GetParentItem() const override; | |
| 215 void* GetPrivateData() const override; | |
| 216 CFX_WideString GetAuthorName() const override; | |
| 217 CPWL_Color GetBkColor() const override; | |
| 218 CFX_WideString GetContents() const override; | |
| 219 FX_SYSTEMTIME GetDateTime() const override; | |
| 220 CFX_WideString GetSubjectName() const override; | |
| 221 CPWL_Edit* GetEdit() const override; | |
| 222 | |
| 223 protected: | |
| 224 // CPWL_Wnd | |
| 225 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
| 226 FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
| 227 CFX_ByteString GetClassName() const override; | |
| 228 void RePosChildWnd() override; | |
| 229 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | |
| 230 void OnNotify(CPWL_Wnd* pWnd, | |
| 231 uint32_t msg, | |
| 232 intptr_t wParam = 0, | |
| 233 intptr_t lParam = 0) override; | |
| 234 FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; | |
| 235 FX_FLOAT GetItemLeftMargin() override; | |
| 236 FX_FLOAT GetItemRightMargin() override; | |
| 237 | |
| 238 CPWL_NoteItem* GetParentNoteItem() const; | |
| 239 | |
| 240 void SetNoteFocus(FX_BOOL bLast); | |
| 241 void PopupNoteItemMenu(const CFX_FloatPoint& point); | |
| 242 | |
| 243 protected: | |
| 244 CPWL_Label* m_pSubject; | |
| 245 CPWL_Label* m_pDateTime; | |
| 246 CPWL_Note_Contents* m_pContents; | |
| 247 | |
| 248 private: | |
| 249 void* m_pPrivateData; | |
| 250 FX_SYSTEMTIME m_dtNote; | |
| 251 CFX_WideString m_sAuthor; | |
| 252 | |
| 253 FX_FLOAT m_fOldItemHeight; | |
| 254 FX_BOOL m_bSizeChanged; | |
| 255 FX_BOOL m_bAllowModify; | |
| 256 }; | |
| 257 | |
| 258 #endif // FPDFSDK_PDFWINDOW_PWL_NOTE_H_ | |
| OLD | NEW |