1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2011-2019 The ManaPlus Developers |
4 |
|
|
* |
5 |
|
|
* This file is part of The ManaPlus Client. |
6 |
|
|
* |
7 |
|
|
* This program is free software; you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU General Public License as published by |
9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
10 |
|
|
* any later version. |
11 |
|
|
* |
12 |
|
|
* This program is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#ifndef GUI_WINDOWS_MAILWINDOW_H |
22 |
|
|
#define GUI_WINDOWS_MAILWINDOW_H |
23 |
|
|
|
24 |
|
|
#include "gui/widgets/window.h" |
25 |
|
|
|
26 |
|
|
#include "enums/net/mailopentype.h" |
27 |
|
|
|
28 |
|
|
#include "listeners/actionlistener.h" |
29 |
|
|
|
30 |
|
|
class Button; |
31 |
|
|
class ExtendedListBox; |
32 |
|
|
class ExtendedNamesModel; |
33 |
|
|
class ScrollArea; |
34 |
|
|
|
35 |
|
|
struct MailMessage; |
36 |
|
|
|
37 |
|
|
/** |
38 |
|
|
* A dialog to choose between buying or selling at a shop. |
39 |
|
|
* |
40 |
|
|
* \ingroup Interface |
41 |
|
|
*/ |
42 |
|
|
class MailWindow final : public Window, |
43 |
|
|
public ActionListener |
44 |
|
|
{ |
45 |
|
|
public: |
46 |
|
|
MailWindow(); |
47 |
|
|
|
48 |
|
|
A_DELETE_COPY(MailWindow) |
49 |
|
|
|
50 |
|
|
~MailWindow() override final; |
51 |
|
|
|
52 |
|
|
void action(const ActionEvent &event) override final; |
53 |
|
|
|
54 |
|
|
void addMail(MailMessage *const message); |
55 |
|
|
|
56 |
|
|
void clear() override final; |
57 |
|
|
|
58 |
|
|
void showMessage(MailMessage *const mail, |
59 |
|
|
const int itemsCount); |
60 |
|
|
|
61 |
|
|
void removeMail(const int64_t id); |
62 |
|
|
|
63 |
|
|
void viewNext(const int64_t id); |
64 |
|
|
|
65 |
|
|
void viewPrev(const int64_t id); |
66 |
|
|
|
67 |
|
|
void mouseClicked(MouseEvent &event) override final; |
68 |
|
|
|
69 |
|
|
void postConnection(); |
70 |
|
|
|
71 |
|
|
void createMail(const std::string &to); |
72 |
|
|
|
73 |
|
|
MailMessage *findMail(const int64_t id) A_WARN_UNUSED; |
74 |
|
|
|
75 |
|
|
void setOpenType(const MailOpenTypeT &type) |
76 |
|
|
{ mOpenType = type; } |
77 |
|
|
|
78 |
|
|
MailOpenTypeT getOpenType() const A_WARN_UNUSED |
79 |
|
|
{ return mOpenType; } |
80 |
|
|
|
81 |
|
|
void setLastPage(); |
82 |
|
|
|
83 |
|
|
void refreshMailNames(); |
84 |
|
|
|
85 |
|
|
private: |
86 |
|
|
void refreshMails(); |
87 |
|
|
|
88 |
|
|
std::string getMailHeader(const MailMessage *const message) const |
89 |
|
|
A_WARN_UNUSED A_NONNULL(2); |
90 |
|
|
|
91 |
|
|
STD_VECTOR<MailMessage*> mMessages; |
92 |
|
|
std::map<int64_t, MailMessage*> mMessagesMap; |
93 |
|
|
ExtendedNamesModel *mMailModel; |
94 |
|
|
ExtendedListBox *mListBox; |
95 |
|
|
ScrollArea *mListScrollArea; |
96 |
|
|
Button *mRefreshButton; |
97 |
|
|
Button *mNewButton; |
98 |
|
|
Button *mDeleteButton; |
99 |
|
|
Button *mReturnButton; |
100 |
|
|
Button *mOpenButton; |
101 |
|
|
MailOpenTypeT mOpenType; |
102 |
|
|
bool mUseMail2; |
103 |
|
|
bool mLastPage; |
104 |
|
|
}; |
105 |
|
|
|
106 |
|
|
extern MailWindow *mailWindow; |
107 |
|
|
|
108 |
|
|
#endif // GUI_WINDOWS_MAILWINDOW_H |