| 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 #ifndef FPDFSDK_PDFWINDOW_PWL_NOTE_H_ | 7 #ifndef FPDFSDK_PDFWINDOW_PWL_NOTE_H_ |
| 8 #define FPDFSDK_PDFWINDOW_PWL_NOTE_H_ | 8 #define FPDFSDK_PDFWINDOW_PWL_NOTE_H_ |
| 9 | 9 |
| 10 #include "fpdfsdk/pdfwindow/PWL_Button.h" | 10 #include "fpdfsdk/pdfwindow/PWL_Button.h" |
| 11 #include "fpdfsdk/pdfwindow/PWL_Edit.h" | 11 #include "fpdfsdk/pdfwindow/PWL_Edit.h" |
| 12 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" | 12 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" |
| 13 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" | 13 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" |
| 14 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 14 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
| 15 | 15 |
| 16 class CPWL_Label; | 16 class CPWL_Label; |
| 17 class CPWL_Note; | 17 class CPWL_Note; |
| 18 class CPWL_NoteItem; | 18 class CPWL_NoteItem; |
| 19 class CPWL_Note_CloseBox; | 19 class CPWL_Note_CloseBox; |
| 20 class CPWL_Note_Contents; | 20 class CPWL_Note_Contents; |
| 21 class CPWL_Note_Edit; | 21 class CPWL_Note_Edit; |
| 22 class CPWL_Note_Icon; | 22 class CPWL_Note_Icon; |
| 23 class CPWL_Note_LBBox; | 23 class CPWL_Note_LBBox; |
| 24 class CPWL_Note_Options; | 24 class CPWL_Note_Options; |
| 25 class CPWL_Note_RBBox; | 25 class CPWL_Note_RBBox; |
| 26 class IPWL_NoteHandler; | 26 class IPWL_NoteHandler; |
| 27 class IPWL_NoteItem; | 27 class IPWL_NoteItem; |
| 28 class IPWL_NoteNotify; | |
| 29 class IPopup_Note; | 28 class IPopup_Note; |
| 30 | 29 |
| 31 class IPWL_NoteNotify { | |
| 32 public: | |
| 33 virtual ~IPWL_NoteNotify() {} | |
| 34 virtual void OnNoteMove(const FX_RECT& rtWin) = 0; | |
| 35 virtual void OnNoteShow(FX_BOOL bShow) = 0; | |
| 36 virtual void OnNoteActivate(FX_BOOL bActive) = 0; | |
| 37 virtual void OnNoteClose() = 0; | |
| 38 virtual void OnItemCreate(IPWL_NoteItem* pItem) = 0; | |
| 39 virtual void OnItemDelete(IPWL_NoteItem* pItem) = 0; | |
| 40 virtual void OnSetAuthorName(IPWL_NoteItem* pItem) = 0; | |
| 41 virtual void OnSetBkColor(IPWL_NoteItem* pItem) = 0; | |
| 42 virtual void OnSetContents(IPWL_NoteItem* pItem) = 0; | |
| 43 virtual void OnSetDateTime(IPWL_NoteItem* pItem) = 0; | |
| 44 virtual void OnSetSubjectName(IPWL_NoteItem* pItem) = 0; | |
| 45 virtual void OnPopupMenu(int32_t x, int32_t y) = 0; | |
| 46 virtual void OnPopupMenu(IPWL_NoteItem* pItem, int32_t x, int32_t y) = 0; | |
| 47 }; | |
| 48 | |
| 49 class IPWL_NoteHandler { | 30 class IPWL_NoteHandler { |
| 50 public: | 31 public: |
| 51 virtual ~IPWL_NoteHandler() {} | 32 virtual ~IPWL_NoteHandler() {} |
| 52 virtual void OnNoteColorChanged(const CPWL_Color& color) = 0; | 33 virtual void OnNoteColorChanged(const CPWL_Color& color) = 0; |
| 53 }; | 34 }; |
| 54 | 35 |
| 55 class IPWL_NoteItem { | 36 class IPWL_NoteItem { |
| 56 public: | 37 public: |
| 57 virtual ~IPWL_NoteItem() {} | 38 virtual ~IPWL_NoteItem() {} |
| 58 virtual void SetPrivateData(void* pData) = 0; | 39 virtual void SetPrivateData(void* pData) = 0; |
| 59 virtual void SetBkColor(const CPWL_Color& color) = 0; | 40 virtual void SetBkColor(const CPWL_Color& color) = 0; |
| 60 virtual void SetSubjectName(const CFX_WideString& sName) = 0; | 41 virtual void SetSubjectName(const CFX_WideString& sName) = 0; |
| 61 virtual void SetAuthorName(const CFX_WideString& sName) = 0; | |
| 62 virtual void SetDateTime(FX_SYSTEMTIME time) = 0; | 42 virtual void SetDateTime(FX_SYSTEMTIME time) = 0; |
| 63 virtual void SetContents(const CFX_WideString& sContents) = 0; | 43 virtual void SetContents(const CFX_WideString& sContents) = 0; |
| 64 | 44 |
| 65 virtual IPWL_NoteItem* CreateSubItem() = 0; | |
| 66 virtual int32_t CountSubItems() const = 0; | 45 virtual int32_t CountSubItems() const = 0; |
| 67 virtual IPWL_NoteItem* GetSubItems(int32_t index) const = 0; | 46 virtual IPWL_NoteItem* GetSubItems(int32_t index) const = 0; |
| 68 virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem) = 0; | |
| 69 virtual void SetFocus() = 0; | 47 virtual void SetFocus() = 0; |
| 70 | 48 |
| 71 virtual IPWL_NoteItem* GetParentItem() const = 0; | 49 virtual IPWL_NoteItem* GetParentItem() const = 0; |
| 72 virtual void* GetPrivateData() const = 0; | 50 virtual void* GetPrivateData() const = 0; |
| 73 virtual CFX_WideString GetAuthorName() const = 0; | 51 virtual CFX_WideString GetAuthorName() const = 0; |
| 74 virtual CPWL_Color GetBkColor() const = 0; | 52 virtual CPWL_Color GetBkColor() const = 0; |
| 75 virtual CFX_WideString GetContents() const = 0; | 53 virtual CFX_WideString GetContents() const = 0; |
| 76 virtual FX_SYSTEMTIME GetDateTime() const = 0; | 54 virtual FX_SYSTEMTIME GetDateTime() const = 0; |
| 77 virtual CFX_WideString GetSubjectName() const = 0; | 55 virtual CFX_WideString GetSubjectName() const = 0; |
| 78 | 56 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 public: | 162 public: |
| 185 CPWL_Note_Contents(); | 163 CPWL_Note_Contents(); |
| 186 ~CPWL_Note_Contents() override; | 164 ~CPWL_Note_Contents() override; |
| 187 | 165 |
| 188 void SetEditFocus(FX_BOOL bLast); | 166 void SetEditFocus(FX_BOOL bLast); |
| 189 CPWL_Edit* GetEdit() const; | 167 CPWL_Edit* GetEdit() const; |
| 190 | 168 |
| 191 void SetText(const CFX_WideString& sText); | 169 void SetText(const CFX_WideString& sText); |
| 192 CFX_WideString GetText() const; | 170 CFX_WideString GetText() const; |
| 193 | 171 |
| 194 CPWL_NoteItem* CreateSubItem(); | |
| 195 void DeleteSubItem(IPWL_NoteItem* pNoteItem); | |
| 196 int32_t CountSubItems() const; | 172 int32_t CountSubItems() const; |
| 197 IPWL_NoteItem* GetSubItems(int32_t index) const; | 173 IPWL_NoteItem* GetSubItems(int32_t index) const; |
| 198 | 174 |
| 199 virtual IPWL_NoteItem* GetHitNoteItem(const CFX_FloatPoint& point); | 175 virtual IPWL_NoteItem* GetHitNoteItem(const CFX_FloatPoint& point); |
| 200 void EnableRead(FX_BOOL bEnabled); | 176 void EnableRead(FX_BOOL bEnabled); |
| 201 void EnableModify(FX_BOOL bEnabled); | 177 void EnableModify(FX_BOOL bEnabled); |
| 202 | 178 |
| 203 // CPWL_ListCtrl | 179 // CPWL_ListCtrl |
| 204 CFX_ByteString GetClassName() const override; | 180 CFX_ByteString GetClassName() const override; |
| 205 void OnNotify(CPWL_Wnd* pWnd, | 181 void OnNotify(CPWL_Wnd* pWnd, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 216 class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem { | 192 class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem { |
| 217 public: | 193 public: |
| 218 CPWL_NoteItem(); | 194 CPWL_NoteItem(); |
| 219 ~CPWL_NoteItem() override; | 195 ~CPWL_NoteItem() override; |
| 220 | 196 |
| 221 virtual IPWL_NoteItem* GetHitNoteItem(const CFX_FloatPoint& point); | 197 virtual IPWL_NoteItem* GetHitNoteItem(const CFX_FloatPoint& point); |
| 222 virtual IPWL_NoteItem* GetFocusedNoteItem() const; | 198 virtual IPWL_NoteItem* GetFocusedNoteItem() const; |
| 223 | 199 |
| 224 virtual FX_BOOL IsTopItem() const { return FALSE; } | 200 virtual FX_BOOL IsTopItem() const { return FALSE; } |
| 225 | 201 |
| 226 virtual void ResetSubjectName(int32_t nItemIndex); | |
| 227 void EnableRead(FX_BOOL bEnabled); | 202 void EnableRead(FX_BOOL bEnabled); |
| 228 void EnableModify(FX_BOOL bEnabled); | 203 void EnableModify(FX_BOOL bEnabled); |
| 229 | 204 |
| 230 void OnContentsValidate(); | |
| 231 void OnCreateNoteItem(); | |
| 232 | |
| 233 // IPWL_NoteItem | 205 // IPWL_NoteItem |
| 234 void SetPrivateData(void* pData) override; | 206 void SetPrivateData(void* pData) override; |
| 235 void SetBkColor(const CPWL_Color& color) override; | 207 void SetBkColor(const CPWL_Color& color) override; |
| 236 void SetSubjectName(const CFX_WideString& sName) override; | 208 void SetSubjectName(const CFX_WideString& sName) override; |
| 237 void SetAuthorName(const CFX_WideString& sName) override; | |
| 238 void SetDateTime(FX_SYSTEMTIME time) override; | 209 void SetDateTime(FX_SYSTEMTIME time) override; |
| 239 void SetContents(const CFX_WideString& sContents) override; | 210 void SetContents(const CFX_WideString& sContents) override; |
| 240 IPWL_NoteItem* CreateSubItem() override; | |
| 241 int32_t CountSubItems() const override; | 211 int32_t CountSubItems() const override; |
| 242 IPWL_NoteItem* GetSubItems(int32_t index) const override; | 212 IPWL_NoteItem* GetSubItems(int32_t index) const override; |
| 243 void DeleteSubItem(IPWL_NoteItem* pNoteItem) override; | |
| 244 void SetFocus() override { SetNoteFocus(FALSE); } | 213 void SetFocus() override { SetNoteFocus(FALSE); } |
| 245 IPWL_NoteItem* GetParentItem() const override; | 214 IPWL_NoteItem* GetParentItem() const override; |
| 246 void* GetPrivateData() const override; | 215 void* GetPrivateData() const override; |
| 247 CFX_WideString GetAuthorName() const override; | 216 CFX_WideString GetAuthorName() const override; |
| 248 CPWL_Color GetBkColor() const override; | 217 CPWL_Color GetBkColor() const override; |
| 249 CFX_WideString GetContents() const override; | 218 CFX_WideString GetContents() const override; |
| 250 FX_SYSTEMTIME GetDateTime() const override; | 219 FX_SYSTEMTIME GetDateTime() const override; |
| 251 CFX_WideString GetSubjectName() const override; | 220 CFX_WideString GetSubjectName() const override; |
| 252 CPWL_Edit* GetEdit() const override; | 221 CPWL_Edit* GetEdit() const override; |
| 253 | 222 |
| 254 protected: | 223 protected: |
| 255 // CPWL_Wnd | 224 // CPWL_Wnd |
| 256 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; | 225 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; |
| 257 FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; | 226 FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; |
| 258 CFX_ByteString GetClassName() const override; | 227 CFX_ByteString GetClassName() const override; |
| 259 void RePosChildWnd() override; | 228 void RePosChildWnd() override; |
| 260 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | 229 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; |
| 261 void OnNotify(CPWL_Wnd* pWnd, | 230 void OnNotify(CPWL_Wnd* pWnd, |
| 262 uint32_t msg, | 231 uint32_t msg, |
| 263 intptr_t wParam = 0, | 232 intptr_t wParam = 0, |
| 264 intptr_t lParam = 0) override; | 233 intptr_t lParam = 0) override; |
| 265 FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; | 234 FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; |
| 266 FX_FLOAT GetItemLeftMargin() override; | 235 FX_FLOAT GetItemLeftMargin() override; |
| 267 FX_FLOAT GetItemRightMargin() override; | 236 FX_FLOAT GetItemRightMargin() override; |
| 268 | 237 |
| 269 CPWL_NoteItem* CreateNoteItem(); | |
| 270 CPWL_NoteItem* GetParentNoteItem() const; | 238 CPWL_NoteItem* GetParentNoteItem() const; |
| 271 | 239 |
| 272 void SetNoteFocus(FX_BOOL bLast); | 240 void SetNoteFocus(FX_BOOL bLast); |
| 273 void PopupNoteItemMenu(const CFX_FloatPoint& point); | 241 void PopupNoteItemMenu(const CFX_FloatPoint& point); |
| 274 | 242 |
| 275 virtual const CPWL_Note* GetNote() const; | |
| 276 virtual IPWL_NoteNotify* GetNoteNotify() const; | |
| 277 | |
| 278 protected: | 243 protected: |
| 279 CPWL_Label* m_pSubject; | 244 CPWL_Label* m_pSubject; |
| 280 CPWL_Label* m_pDateTime; | 245 CPWL_Label* m_pDateTime; |
| 281 CPWL_Note_Contents* m_pContents; | 246 CPWL_Note_Contents* m_pContents; |
| 282 | 247 |
| 283 private: | 248 private: |
| 284 void* m_pPrivateData; | 249 void* m_pPrivateData; |
| 285 FX_SYSTEMTIME m_dtNote; | 250 FX_SYSTEMTIME m_dtNote; |
| 286 CFX_WideString m_sAuthor; | 251 CFX_WideString m_sAuthor; |
| 287 | 252 |
| 288 FX_FLOAT m_fOldItemHeight; | 253 FX_FLOAT m_fOldItemHeight; |
| 289 FX_BOOL m_bSizeChanged; | 254 FX_BOOL m_bSizeChanged; |
| 290 FX_BOOL m_bAllowModify; | 255 FX_BOOL m_bAllowModify; |
| 291 }; | 256 }; |
| 292 | 257 |
| 293 class CPWL_Note : public CPWL_NoteItem { | |
| 294 public: | |
| 295 CPWL_Note(IPopup_Note* pPopupNote, | |
| 296 IPWL_NoteNotify* pNoteNotify, | |
| 297 IPWL_NoteHandler* pNoteHandler); | |
| 298 ~CPWL_Note() override; | |
| 299 | |
| 300 IPWL_NoteItem* Reply(); | |
| 301 void EnableNotify(FX_BOOL bEnabled); | |
| 302 void SetIconType(int32_t nType); | |
| 303 void SetOptionsText(const CFX_WideString& sText); | |
| 304 void EnableRead(FX_BOOL bEnabled); | |
| 305 void EnableModify(FX_BOOL bEnabled); | |
| 306 | |
| 307 CFX_WideString GetReplyString() const; | |
| 308 void SetReplyString(const CFX_WideString& str); | |
| 309 | |
| 310 // CPWL_NoteItem | |
| 311 void SetSubjectName(const CFX_WideString& sName) override; | |
| 312 void SetAuthorName(const CFX_WideString& sName) override; | |
| 313 CFX_WideString GetAuthorName() const override; | |
| 314 void SetBkColor(const CPWL_Color& color) override; | |
| 315 void ResetSubjectName(int32_t nItemIndex) override {} | |
| 316 FX_BOOL IsTopItem() const override { return TRUE; } | |
| 317 const CPWL_Note* GetNote() const override; | |
| 318 IPWL_NoteNotify* GetNoteNotify() const override; | |
| 319 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
| 320 FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
| 321 FX_BOOL OnMouseWheel(short zDelta, | |
| 322 const CFX_FloatPoint& point, | |
| 323 uint32_t nFlag) override; | |
| 324 void RePosChildWnd() override; | |
| 325 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | |
| 326 void OnNotify(CPWL_Wnd* pWnd, | |
| 327 uint32_t msg, | |
| 328 intptr_t wParam = 0, | |
| 329 intptr_t lParam = 0) override; | |
| 330 | |
| 331 protected: | |
| 332 FX_BOOL ResetScrollBar(); | |
| 333 void RePosNoteChildren(); | |
| 334 FX_BOOL ScrollBarShouldVisible(); | |
| 335 | |
| 336 private: | |
| 337 CPWL_Label* m_pAuthor; | |
| 338 CPWL_Note_Icon* m_pIcon; | |
| 339 CPWL_Note_CloseBox* m_pCloseBox; | |
| 340 CPWL_Note_LBBox* m_pLBBox; | |
| 341 CPWL_Note_RBBox* m_pRBBox; | |
| 342 CPWL_ScrollBar* m_pContentsBar; | |
| 343 CPWL_Note_Options* m_pOptions; | |
| 344 IPWL_NoteNotify* m_pNoteNotify; | |
| 345 FX_BOOL m_bResizing; | |
| 346 PWL_SCROLL_INFO m_OldScrollInfo; | |
| 347 FX_BOOL m_bEnableNotify; | |
| 348 CFX_WideString m_sReplyString; | |
| 349 }; | |
| 350 | |
| 351 #endif // FPDFSDK_PDFWINDOW_PWL_NOTE_H_ | 258 #endif // FPDFSDK_PDFWINDOW_PWL_NOTE_H_ |
| OLD | NEW |