Remove a few unused variables, functions, and member variables.
[pdfium.git] / fpdfsdk / include / pdfwindow / PWL_Note.h
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 _PWL_NOTE_H_
8 #define _PWL_NOTE_H_
9
10 class IPWL_NoteNotify;
11 class IPWL_NoteHandler;
12 class IPWL_NoteItem;
13 class CPWL_NoteItem;
14 class CPWL_Note;
15 class CPWL_Label;
16 class CPWL_Edit;
17 class CPWL_Note_Icon;
18 class CPWL_Note_CloseBox;
19 class CPWL_Note_LBBox;
20 class CPWL_Note_RBBox;
21 class CPWL_Note_Edit;
22 class CPWL_Note_Options;
23 class CPWL_Note_Contents;
24 class IPopup_Note;
25
26
27 class IPWL_NoteNotify
28 {
29 public:
30         virtual void                                            OnNoteMove(const FX_RECT& rtWin) = 0;
31         virtual void                                            OnNoteShow(FX_BOOL bShow) = 0;
32         virtual void                                            OnNoteActivate(FX_BOOL bActive) = 0;
33         virtual void                                            OnNoteClose() = 0;
34         virtual void                                            OnItemCreate(IPWL_NoteItem* pItem) = 0;
35         virtual void                                            OnItemDelete(IPWL_NoteItem* pItem) = 0;
36         virtual void                                            OnSetAuthorName(IPWL_NoteItem* pItem) = 0;
37         virtual void                                            OnSetBkColor(IPWL_NoteItem* pItem) = 0;
38         virtual void                                            OnSetContents(IPWL_NoteItem* pItem) = 0;
39         virtual void                                            OnSetDateTime(IPWL_NoteItem* pItem) = 0;
40         virtual void                                            OnSetSubjectName(IPWL_NoteItem* pItem) = 0;
41         virtual void                                            OnPopupMenu(FX_INT32 x, FX_INT32 y) = 0;
42         virtual void                                            OnPopupMenu(IPWL_NoteItem* pItem, FX_INT32 x, FX_INT32 y) = 0;
43 };
44
45 class IPWL_NoteHandler
46 {
47 public:
48         virtual void                                            OnNoteColorChanged(const CPWL_Color& color) = 0;
49 };
50
51 class IPWL_NoteItem
52 {
53 public:
54         virtual void                                            SetPrivateData(void* pData) = 0;
55         virtual void                                            SetBkColor(const CPWL_Color& color) = 0;
56         virtual void                                            SetSubjectName(const CFX_WideString& sName) = 0;
57         virtual void                                            SetAuthorName(const CFX_WideString& sName) = 0;
58         virtual void                                            SetDateTime(FX_SYSTEMTIME time) = 0;
59         virtual void                                            SetContents(const CFX_WideString& sContents) = 0;
60
61         virtual IPWL_NoteItem*                          CreateSubItem() = 0;
62         virtual FX_INT32                                        CountSubItems() const = 0;
63         virtual IPWL_NoteItem*                          GetSubItems(FX_INT32 index) const = 0;
64         virtual void                                            DeleteSubItem(IPWL_NoteItem* pNoteItem) = 0;
65         virtual void                                            SetFocus() = 0;
66         
67         virtual IPWL_NoteItem*                          GetParentItem() const = 0;
68         virtual void*                                           GetPrivateData() const = 0;
69         virtual CFX_WideString                          GetAuthorName() const = 0;
70         virtual CPWL_Color                                      GetBkColor() const = 0;
71         virtual CFX_WideString                          GetContents() const = 0;
72         virtual FX_SYSTEMTIME                           GetDateTime() const = 0;
73         virtual CFX_WideString                          GetSubjectName() const = 0;
74
75         virtual CPWL_Edit*                                      GetEdit() const = 0;
76 };
77
78 class PWL_CLASS CPWL_Note_Icon : public CPWL_Wnd
79 {
80 public:
81         CPWL_Note_Icon();
82         virtual ~CPWL_Note_Icon();
83
84         void                                                            SetIconType(FX_INT32 nType);
85
86 public:
87
88 protected:
89         virtual void                                            DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
90
91 private:
92         FX_INT32                                                        m_nType;
93 };
94
95 class CPWL_Note_CloseBox : public CPWL_Button
96 {
97 public:
98         CPWL_Note_CloseBox();
99         virtual ~CPWL_Note_CloseBox();
100
101 protected:
102         virtual void                                            DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
103         virtual FX_BOOL                                         OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
104         virtual FX_BOOL                                         OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
105
106 private:
107         FX_BOOL                                                         m_bMouseDown;
108 };
109
110 class CPWL_Note_LBBox : public CPWL_Wnd
111 {
112 public:
113         CPWL_Note_LBBox();
114         virtual ~CPWL_Note_LBBox();
115
116 protected:
117         virtual void                                            DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
118 };
119
120 class CPWL_Note_RBBox : public CPWL_Wnd
121 {
122 public:
123         CPWL_Note_RBBox();
124         virtual ~CPWL_Note_RBBox();
125
126 protected:
127         virtual void                                            DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
128 };
129
130 class CPWL_Note_Edit : public CPWL_Edit
131 {
132 public:
133         CPWL_Note_Edit();
134         virtual ~CPWL_Note_Edit();
135
136         void                                                            EnableNotify(FX_BOOL bEnable) {m_bEnableNotify = bEnable;}
137         virtual FX_FLOAT                                        GetItemHeight(FX_FLOAT fLimitWidth);
138         FX_FLOAT                                                        GetItemLeftMargin();
139         FX_FLOAT                                                        GetItemRightMargin();
140
141         virtual void                                            SetText(FX_LPCWSTR csText);
142
143 protected:
144         virtual void                                            OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
145         virtual void                                            RePosChildWnd();
146         virtual void                                            OnSetFocus();
147         virtual void                                            OnKillFocus();  
148
149 private:
150         FX_BOOL                                                         m_bEnableNotify;
151         FX_FLOAT                                                        m_fOldItemHeight;
152         FX_BOOL                                                         m_bSizeChanged;
153         FX_FLOAT                                                        m_fOldMin;
154         FX_FLOAT                                                        m_fOldMax;
155 };
156
157 class CPWL_Note_Options : public CPWL_Wnd
158 {
159 public:
160         CPWL_Note_Options();
161         virtual ~CPWL_Note_Options();
162
163         CPDF_Rect                                                       GetContentRect() const;
164         virtual void                                            SetTextColor(const CPWL_Color & color);
165         void                                                            SetText(const CFX_WideString& sText);
166
167 protected:
168         virtual void                                            RePosChildWnd();
169         virtual void                                            CreateChildWnd(const PWL_CREATEPARAM & cp);
170         virtual void                                            DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
171
172 private:
173         CPWL_Label*                                                     m_pText;
174 };
175
176 class CPWL_Note_Contents : public CPWL_ListCtrl
177 {
178 public:
179         CPWL_Note_Contents();
180         virtual ~CPWL_Note_Contents();
181
182         virtual CFX_ByteString                          GetClassName() const;
183         virtual void                                            OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
184         virtual FX_BOOL                                         OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
185
186         void                                                            SetEditFocus(FX_BOOL bLast);
187         CPWL_Edit*                                                      GetEdit() const;
188
189 public:
190         void                                                            SetText(const CFX_WideString& sText);
191         CFX_WideString                                          GetText() const;
192
193         CPWL_NoteItem*                                          CreateSubItem();
194         void                                                            DeleteSubItem(IPWL_NoteItem* pNoteItem);
195         FX_INT32                                                        CountSubItems() const;
196         IPWL_NoteItem*                                          GetSubItems(FX_INT32 index) const;
197
198         virtual IPWL_NoteItem*                          GetHitNoteItem(const CPDF_Point& point);
199         void                                                            EnableRead(FX_BOOL bEnabled);
200         void                                                            EnableModify(FX_BOOL bEnabled);
201
202 protected:
203         virtual void                                            CreateChildWnd(const PWL_CREATEPARAM & cp);
204
205 private:
206         CPWL_Note_Edit*                                         m_pEdit;
207 };
208
209 class PWL_CLASS CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem 
210 {
211 public:
212         CPWL_NoteItem();
213         virtual ~CPWL_NoteItem();
214
215 public:
216         virtual void                                            SetPrivateData(void* pData);
217         virtual void                                            SetBkColor(const CPWL_Color& color);
218         virtual void                                            SetSubjectName(const CFX_WideString& sName);
219         virtual void                                            SetAuthorName(const CFX_WideString& sName);
220         virtual void                                            SetDateTime(FX_SYSTEMTIME time);
221         virtual void                                            SetContents(const CFX_WideString& sContents);
222
223         virtual IPWL_NoteItem*                          CreateSubItem();
224         virtual FX_INT32                                        CountSubItems() const;
225         virtual IPWL_NoteItem*                          GetSubItems(FX_INT32 index) const;
226         virtual void                                            DeleteSubItem(IPWL_NoteItem* pNoteItem);
227         virtual void                                            SetFocus(){SetNoteFocus(FALSE);}
228
229         virtual IPWL_NoteItem*                          GetParentItem() const;
230         virtual void*                                           GetPrivateData() const;
231         virtual CFX_WideString                          GetAuthorName() const;
232         virtual CPWL_Color                                      GetBkColor() const;
233         virtual CFX_WideString                          GetContents() const;
234         virtual FX_SYSTEMTIME                           GetDateTime() const;
235         virtual CFX_WideString                          GetSubjectName() const;
236         virtual FX_BOOL                                         IsTopItem() const { return FALSE;}
237         virtual CPWL_Edit*                                      GetEdit() const;
238
239 public:
240         virtual FX_BOOL                                         OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
241         virtual FX_BOOL                                         OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
242         virtual CFX_ByteString                          GetClassName() const;
243         virtual IPWL_NoteItem*                          GetHitNoteItem(const CPDF_Point& point);
244         virtual IPWL_NoteItem*                          GetFocusedNoteItem() const;
245
246         virtual void                                            ResetSubjectName(FX_INT32 nItemIndex);
247         void                                                            EnableRead(FX_BOOL bEnabled);
248         void                                                            EnableModify(FX_BOOL bEnabled);
249
250 protected:
251         virtual void                                            RePosChildWnd();
252         virtual void                                            CreateChildWnd(const PWL_CREATEPARAM & cp);
253
254         virtual void                                            OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
255
256 public:
257         virtual FX_FLOAT                                        GetItemHeight(FX_FLOAT fLimitWidth);
258         virtual FX_FLOAT                                        GetItemLeftMargin();
259         virtual FX_FLOAT                                        GetItemRightMargin();
260         CPWL_NoteItem*                                          CreateNoteItem();
261         CPWL_NoteItem*                                          GetParentNoteItem() const;
262
263         void                                                            SetNoteFocus(FX_BOOL bLast);
264         void                                                            OnContentsValidate();
265         
266         void                                                            OnCreateNoteItem();
267
268 protected:
269         void                                                            PopupNoteItemMenu(const CPDF_Point& point);
270
271         virtual const CPWL_Note*                        GetNote() const;
272         virtual IPWL_NoteNotify*                        GetNoteNotify() const;
273
274 protected:
275         CPWL_Label*                                                     m_pSubject;
276         CPWL_Label*                                                     m_pDateTime;
277         CPWL_Note_Contents*                                     m_pContents;
278
279 private:
280         void*                                                           m_pPrivateData;
281         FX_SYSTEMTIME                                           m_dtNote;
282         CFX_WideString                                          m_sAuthor;
283
284         FX_FLOAT                                                        m_fOldItemHeight;
285         FX_BOOL                                                         m_bSizeChanged;
286         FX_BOOL                                                         m_bAllowModify;
287 };
288
289 class PWL_CLASS CPWL_Note : public CPWL_NoteItem
290 {
291 public:
292         CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler);
293         virtual ~CPWL_Note();
294
295 public:
296         virtual void                                            SetSubjectName(const CFX_WideString& sName);
297         virtual void                                            SetAuthorName(const CFX_WideString& sName);
298         virtual CFX_WideString                          GetAuthorName() const;
299         virtual void                                            SetBkColor(const CPWL_Color& color);
300         virtual void                                            ResetSubjectName(FX_INT32 nItemIndex){}
301         virtual FX_BOOL                                         IsTopItem() const {return TRUE;}
302         virtual const CPWL_Note*                        GetNote() const;
303         virtual IPWL_NoteNotify*                        GetNoteNotify() const;
304
305 public:
306         IPWL_NoteItem*                                          Reply();
307         void                                                            EnableNotify(FX_BOOL bEnabled);
308         void                                                            SetIconType(FX_INT32 nType);
309         void                                                            SetOptionsText(const CFX_WideString& sText);
310         void                                                            EnableRead(FX_BOOL bEnabled);
311         void                                                            EnableModify(FX_BOOL bEnabled);
312
313         CFX_WideString                                          GetReplyString() const;
314         void                                                            SetReplyString(const CFX_WideString& string);
315
316         //0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options 
317         FX_INT32                                                        NoteHitTest(const CPDF_Point& point) const;
318         CPDF_Rect                                                       GetCaptionRect() const {return m_rcCaption;}
319         IPopup_Note*                                            GetPopupNote() const {return m_pPopupNote;}
320
321 public:
322         virtual FX_BOOL                                         OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
323         virtual FX_BOOL                                         OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
324         virtual FX_BOOL                                         OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
325
326 protected:
327         virtual void                                            RePosChildWnd();
328         virtual void                                            CreateChildWnd(const PWL_CREATEPARAM & cp);
329
330         virtual void                                            OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
331
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         CPDF_Rect                                                       m_rcCaption;
348         FX_BOOL                                                         m_bEnalbleNotify;
349         IPopup_Note*                                            m_pPopupNote;
350         CFX_WideString                                          m_sReplyString;
351 };
352
353 #endif
354