ManaPlus
Public Member Functions | Private Member Functions | Private Attributes
MailViewWindow Class Reference

#include <mailviewwindow.h>

Inheritance diagram for MailViewWindow:
Window ActionListener BasicContainer2 MouseListener WidgetListener BasicContainer Widget WidgetDeathListener Widget2

Public Member Functions

 MailViewWindow (MailMessage *const message, const int itemsCount)
 
 ~MailViewWindow ()
 
void action (const ActionEvent &event)
 
InventorygetInventory () const
 
void updateItems ()
 
void removeItems (const int64_t mailId)
 
void removeMoney (const int64_t mailId)
 
- Public Member Functions inherited from Window
 Window (const std::string &caption="Window", const Modal modal=Modal_false, Window *const parent=0, std::string skin="")
 
virtual ~Window ()
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
void setContentSize (int width, int height)
 
void setLocationRelativeTo (const Widget *const widget)
 
void setLocationHorisontallyRelativeTo (const Widget *const widget)
 
void setLocationRelativeTo (const ImagePosition::Type &position, int offsetX=0, int offsetY=0)
 
void setResizable (const bool resize)
 
void redraw ()
 
void widgetResized (const Event &event)
 
void widgetMoved (const Event &event)
 
void widgetHidden (const Event &event)
 
void setCloseButton (const bool flag)
 
bool getCloseButton () const
 
void setAllowClose (const bool b)
 
bool getAlowClose () const
 
bool isResizable () const
 
void setMinWidth (const int width)
 
int getMinWidth () const
 
void setMinHeight (const int height)
 
int getMinHeight () const
 
void setMaxWidth (const int width)
 
int getMaxWidth () const
 
void setMaxHeight (const int height)
 
int getMaxHeight () const
 
void setShowTitle (bool flag)
 
void setStickyButton (const bool flag)
 
void setSticky (const bool sticky)
 
bool isSticky () const
 
void setStickyButtonLock (const bool sticky)
 
bool isStickyButtonLock () const
 
virtual void setVisible (Visible visible)
 
void setVisible (const Visible visible, const bool forceSticky)
 
bool isDefaultVisible () const
 
void setDefaultVisible (const bool save)
 
bool willSaveVisible () const
 
void setSaveVisible (const bool save)
 
void postInit ()
 
WindowgetParentWindow () const
 
virtual void scheduleDelete ()
 
void mousePressed (MouseEvent &event)
 
void mouseDragged (MouseEvent &event)
 
void mouseMoved (MouseEvent &event)
 
void mouseReleased (MouseEvent &event)
 
void mouseExited (MouseEvent &event)
 
void mouseEntered (MouseEvent &event)
 
void updateResizeHandler (MouseEvent &event)
 
void setWindowName (const std::string &name)
 
const std::string & getWindowName () const
 
void loadWindowState ()
 
void saveWindowState ()
 
void setDefaultSize (const int defaultX, const int defaultY, int defaultWidth, int defaultHeight)
 
void setDefaultSize ()
 
void setDefaultSize (const int defaultWidth, const int defaultHeight, const ImagePosition::Type &position, const int offsetx=0, const int offsetY=0)
 
virtual void resetToDefaultSize ()
 
void adjustPositionAfterResize (const int oldScreenWidth, const int oldScreenHeight)
 
LayoutgetLayout ()
 
void clearLayout ()
 
void reflowLayout (int w=0, int h=0)
 
LayoutCellplace (const int x, const int y, Widget *const wg, const int w=1, const int h=1)
 
ContainerPlacer getPlacer (const int x, const int y)
 
void center ()
 
void centerHorisontally ()
 
virtual void close ()
 
void setModal (const Modal modal)
 
Rect getWindowArea () const
 
bool isResizeAllowed (const MouseEvent &event) const
 
void setCaptionFont (Font *font)
 
void enableVisibleSound (bool b)
 
bool isWindowVisible () const
 
void setPadding (int padding)
 
int getPadding () const
 
void setTitleBarHeight (unsigned int height)
 
unsigned int getTitleBarHeight () const
 
void setCaption (const std::string &caption)
 
const std::string & getCaption () const
 
void setAlignment (Graphics::Alignment alignment)
 
Graphics::Alignment getAlignment () const
 
void setMovable (Move movable)
 
bool isMovable () const
 
Rect getChildrenArea ()
 
virtual void resizeToContent ()
 
- Public Member Functions inherited from BasicContainer2
 BasicContainer2 (const Widget2 *const widget)
 
virtual ~BasicContainer2 ()
 
void setOpaque (Opaque opaque)
 
bool isOpaque () const
 
virtual void add (Widget *const widget)
 
void addXY (Widget *const widget, const int x, const int y)
 
- Public Member Functions inherited from BasicContainer
 BasicContainer (const Widget2 *const widget)
 
virtual ~BasicContainer ()
 
void showWidgetPart (Widget *const widget, const Rect &area)
 
void moveToTop (Widget *const widget)
 
void moveToBottom (Widget *const widget)
 
void focusNext ()
 
void focusPrevious ()
 
void logic ()
 
void setFocusHandler (FocusHandler *const focusHandler)
 
void setInternalFocusHandler (FocusHandler *const focusHandler)
 
WidgetgetWidgetAt (int x, int y)
 
void death (const Event &event)
 
WidgetfindFirstWidget (const std::set< Widget *> &list)
 
void add (Widget *const widget)
 
virtual void remove (Widget *const widget)
 
virtual void clear ()
 
- Public Member Functions inherited from Widget
 Widget (const Widget2 *const widget)
 
virtual ~Widget ()
 
virtual void drawFrame (Graphics *graphics)
 
virtual void safeDrawFrame (Graphics *graphics)
 
void setFrameSize (const unsigned int frameSize)
 
unsigned int getFrameSize () const
 
WidgetgetParent () const
 
void setWidth (const int width)
 
int getWidth () const
 
void setHeight (const int height)
 
int getHeight () const
 
void setSize (const int width, const int height)
 
void setX (const int x)
 
int getX () const
 
void setY (const int y)
 
int getY () const
 
void setPosition (const int x, const int y)
 
void setDimension (const Rect &dimension)
 
const RectgetDimension () const
 
void setFocusable (const bool focusable)
 
bool isFocusable () const
 
virtual bool isFocused () const
 
void setEnabled (const bool enabled)
 
bool isEnabled () const
 
void setVisible (Visible visible)
 
bool isVisible () const
 
void setBaseColor (const Color &color)
 
const ColorgetBaseColor () const
 
void setForegroundColor (const Color &color)
 
const ColorgetForegroundColor () const
 
void setBackgroundColor (const Color &color)
 
const ColorgetBackgroundColor () const
 
virtual void requestFocus ()
 
virtual void requestMoveToTop ()
 
virtual void requestMoveToBottom ()
 
FocusHandlergetFocusHandler ()
 
void addActionListener (ActionListener *const actionListener)
 
void removeActionListener (ActionListener *const actionListener)
 
void addDeathListener (WidgetDeathListener *const deathListener)
 
void removeDeathListener (WidgetDeathListener *const deathListener)
 
void addMouseListener (MouseListener *const mouseListener)
 
void removeMouseListener (MouseListener *const mouseListener)
 
void addKeyListener (KeyListener *const keyListener)
 
void removeKeyListener (KeyListener *const keyListener)
 
void addFocusListener (FocusListener *const focusListener)
 
void removeFocusListener (FocusListener *const focusListener)
 
void addWidgetListener (WidgetListener *const widgetListener)
 
void removeWidgetListener (WidgetListener *const widgetListener)
 
void setActionEventId (const std::string &actionEventId)
 
const std::string & getActionEventId () const
 
virtual void getAbsolutePosition (int &x, int &y) const
 
virtual void setParent (Widget *parent)
 
FontgetFont () const
 
void setFont (Font *const font)
 
virtual void fontChanged ()
 
bool isTabInEnabled () const
 
void setTabInEnabled (const bool enabled)
 
bool isTabOutEnabled () const
 
void setTabOutEnabled (const bool enabled)
 
void requestModalFocus ()
 
virtual void requestModalMouseInputFocus ()
 
virtual void releaseModalFocus ()
 
virtual void releaseModalMouseInputFocus ()
 
virtual bool isModalFocused () const
 
virtual bool isModalMouseInputFocused () const
 
const std::list< MouseListener * > & getMouseListeners () const A_CONST
 
const std::list< KeyListener * > & getKeyListeners () const A_CONST
 
const std::list< FocusListener * > & getFocusListeners () const A_CONST
 
virtual FocusHandlergetInternalFocusHandler ()
 
void setInternalFocusHandler (FocusHandler *const internalFocusHandler)
 
void setId (const std::string &id)
 
const std::string & getId () const
 
virtual void showPart (const Rect &rectangle)
 
bool isAllowLogic () const
 
void setMouseConsume (const bool b)
 
bool isMouseConsume () const
 
void setRedraw (const bool b)
 
virtual bool isSelectable () const
 
void setSelectable (const bool selectable)
 
void windowResized ()
 
- Public Member Functions inherited from Widget2
virtual ~Widget2 ()
 
const ColorgetThemeColor (const ThemeColorIdT type, const unsigned int alpha=255U) const A_INLINE
 
const ColorgetThemeCharColor (const signed char c, bool &valid) const A_INLINE
 
virtual void setWidget2 (const Widget2 *const widget)
 
void setPalette (int palette)
 
void checkPalette ()
 
void setForegroundColor2 (const Color &color)
 
WidgetgetWindow () const
 
virtual void setWindow (Widget *const window)
 
- Public Member Functions inherited from WidgetDeathListener
virtual ~WidgetDeathListener ()
 
- Public Member Functions inherited from MouseListener
virtual ~MouseListener ()
 
virtual void mouseClicked (MouseEvent &event)
 
virtual void mouseWheelMovedUp (MouseEvent &event)
 
virtual void mouseWheelMovedDown (MouseEvent &event)
 
- Public Member Functions inherited from WidgetListener
virtual ~WidgetListener ()
 
virtual void widgetShown (const Event &event)
 
- Public Member Functions inherited from ActionListener
virtual ~ActionListener ()
 

Private Member Functions

void updateAttachButton ()
 

Private Attributes

MailMessagemMessage
 
ButtonmGetAttachButton
 
ButtonmGetMoneyButton
 
ButtonmCloseButton
 
ButtonmPrevButton
 
ButtonmNextButton
 
ButtonmReplyButton
 
LabelmTimeLabel
 
LabelmMoneyLabel
 
LabelmFromLabel
 
LabelmSubjectLabel
 
LabelmMessageLabel
 
InventorymInventory
 
ItemContainermItemContainer
 
ScrollAreamItemScrollArea
 
bool mUseMail2
 

Additional Inherited Members

- Static Public Member Functions inherited from Window
static void setWindowContainer (WindowContainer *const windowContainer)
 
- Static Public Member Functions inherited from Widget
static void setGlobalFont (Font *const font)
 
static FontgetGloablFont ()
 
static void cleanGlobalFont ()
 
static bool widgetExists (const Widget *const widget)
 
static void distributeWindowResizeEvent ()
 
static WidgetcallPostInit (Widget *const widget)
 
- Data Fields inherited from Widget
Visible mVisible
 
- Protected Types inherited from BasicContainer
typedef std::vector< Widget * > WidgetList
 
typedef WidgetList::iterator WidgetListIterator
 
typedef WidgetList::const_iterator WidgetListConstIterator
 
typedef WidgetList::reverse_iterator WidgetListReverseIterator
 
typedef WidgetList::const_reverse_iterator WidgetListCReverseIterator
 
- Protected Types inherited from Widget
typedef std::list< MouseListener * > MouseListenerList
 
typedef MouseListenerList::iterator MouseListenerIterator
 
typedef std::list< KeyListener * > KeyListenerList
 
typedef KeyListenerList::iterator KeyListenerIterator
 
typedef std::list< ActionListener * > ActionListenerList
 
typedef ActionListenerList::iterator ActionListenerIterator
 
typedef std::list< WidgetDeathListener * > WidgetDeathListenerList
 
typedef WidgetDeathListenerList::iterator WidgetDeathListenerIterator
 
typedef std::list< FocusListener * > FocusListenerList
 
typedef FocusListenerList::iterator FocusListenerIterator
 
typedef std::list< WidgetListener * > WidgetListenerList
 
typedef WidgetListenerList::iterator WidgetListenerIterator
 
- Protected Member Functions inherited from Window
bool canMove () const
 
int getOption (const std::string &name, const int def=0) const
 
bool getOptionBool (const std::string &name, const bool def=false) const
 
void setTitlePadding (const int p)
 
int getTitlePadding () const
 
- Protected Member Functions inherited from BasicContainer
virtual void drawChildren (Graphics *const graphics)
 
virtual void safeDrawChildren (Graphics *const graphics)
 
virtual void logicChildren ()
 
- Protected Member Functions inherited from Widget
void distributeActionEvent ()
 
void distributeResizedEvent ()
 
void distributeMovedEvent ()
 
void distributeHiddenEvent ()
 
void distributeShownEvent ()
 
- Protected Member Functions inherited from Widget2
 Widget2 (const Widget2 *const widget)
 
- Protected Member Functions inherited from WidgetDeathListener
 WidgetDeathListener ()
 
- Protected Member Functions inherited from MouseListener
 MouseListener ()
 
- Protected Member Functions inherited from WidgetListener
 WidgetListener ()
 
- Protected Member Functions inherited from ActionListener
 ActionListener ()
 
- Protected Attributes inherited from Window
std::string mCaption
 
Graphics::Alignment mAlignment
 
int mPadding
 
unsigned int mTitleBarHeight
 
Move mMovable
 
int mDragOffsetX
 
int mDragOffsetY
 
bool mMoved
 
SkinmSkin
 
int mDefaultX
 
int mDefaultY
 
int mDefaultWidth
 
int mDefaultHeight
 
int mCaptionOffsetX
 
int mCaptionOffsetY
 
bool mShowTitle
 
bool mLastRedraw
 
- Protected Attributes inherited from BasicContainer2
Opaque mOpaque
 
- Protected Attributes inherited from BasicContainer
WidgetList mWidgets
 
WidgetList mLogicWidgets
 
- Protected Attributes inherited from Widget
MouseListenerList mMouseListeners
 
KeyListenerList mKeyListeners
 
ActionListenerList mActionListeners
 
WidgetDeathListenerList mDeathListeners
 
FocusListenerList mFocusListeners
 
WidgetListenerList mWidgetListeners
 
Color mForegroundColor
 
Color mBackgroundColor
 
Color mBaseColor
 
Rect mDimension
 
std::string mActionEventId
 
std::string mId
 
FocusHandlermFocusHandler
 
FocusHandlermInternalFocusHandler
 
WidgetmParent
 
FontmCurrentFont
 
unsigned int mFrameSize
 
bool mFocusable
 
bool mTabIn
 
bool mTabOut
 
bool mEnabled
 
bool mAllowLogic
 
bool mMouseConsume
 
bool mRedraw
 
bool mSelectable
 
- Protected Attributes inherited from Widget2
int mPaletteOffset
 
WidgetmWindow
 
Color mForegroundColor2
 
- Static Protected Attributes inherited from Widget
static FontmGlobalFont = 0
 

Detailed Description

Definition at line 36 of file mailviewwindow.h.

Constructor & Destructor Documentation

◆ MailViewWindow()

MailViewWindow::MailViewWindow ( MailMessage *const  message,
const int  itemsCount 
)

Definition at line 49 of file mailviewwindow.cpp.

References _, CAST_U32, ImagePosition::CENTER, Window::center(), Window::enableVisibleSound(), Window::getPlacer(), Window::loadWindowState(), mCloseButton, mFromLabel, mGetAttachButton, mGetMoneyButton, mItemScrollArea, mMessageLabel, mMoneyLabel, mNextButton, MailMessage::money, mPrevButton, mReplyButton, mSubjectLabel, mTimeLabel, mUseMail2, Window::setCloseButton(), Window::setDefaultSize(), ScrollArea::setHeight(), ScrollArea::setHorizontalScrollPolicy(), Window::setMinHeight(), Window::setMinWidth(), Window::setResizable(), Window::setSaveVisible(), Window::setStickyButtonLock(), Window::setVisible(), Window::setWindowName(), ScrollArea::SHOW_NEVER, strprintf(), updateAttachButton(), and Visible_true.

50  :
51  // TRANSLATORS: mail view window name
52  Window(_("View mail"), Modal_false, nullptr, "mailview.xml"),
54  mMessage(message),
55  mGetAttachButton(new Button(this,
56  // TRANSLATORS: mail view attach / items button
57  settings.enableNewMailSystem ? _("Get items") : _("Get attach"),
58  "attach", this)),
59  mGetMoneyButton(nullptr),
60  // TRANSLATORS: mail view window button
61  mCloseButton(new Button(this, _("Close"), "close", this)),
62  mPrevButton(new Button(this, "<", "prev", this)),
63  mNextButton(new Button(this, ">", "next", this)),
64  // TRANSLATORS: mail view window button
65  mReplyButton(new Button(this, _("Reply"), "reply", this)),
66  // TRANSLATORS: mail view window label
67  mTimeLabel(new Label(this, strprintf("%s %s", _("Time:"),
68  message->strTime.c_str()))),
69  mMoneyLabel(nullptr),
70  // TRANSLATORS: mail view window label
71  mFromLabel(new Label(this, strprintf("%s %s", _("From:"),
72  message->sender.c_str()))),
73  // TRANSLATORS: mail view window label
74  mSubjectLabel(new Label(this, strprintf("%s %s", _("Subject:"),
75  message->title.c_str()))),
76  // TRANSLATORS: mail view window label
77  mMessageLabel(new Label(this, strprintf("%s %s", _("Message:"),
78  message->text.c_str()))),
82  fromBool(getOptionBool("showitemsbackground"), Opaque),
83  "mailview_listbackground.xml")),
85 {
86  setWindowName("MailView");
87  setCloseButton(true);
88  setResizable(true);
89  setSaveVisible(false);
90  setStickyButtonLock(true);
92 
94  setMinWidth(200);
95  setMinHeight(100);
96  center();
98 
100 
101  ContainerPlacer placer;
102  placer = getPlacer(0, 0);
103 
104  int n = 0;
105  placer(0, n++, mTimeLabel);
106  placer(0, n++, mFromLabel);
107  placer(0, n++, mSubjectLabel);
108  if (message->money != 0)
109  {
110  mMoneyLabel = new Label(this, strprintf("%s %u",
111  // TRANSLATORS: mail view window label
112  _("Money:"),
113  CAST_U32(message->money)));
114  placer(0, n++, mMoneyLabel);
115  }
116  placer(0, n++, mMessageLabel);
117  placer(0, n++, mItemScrollArea);
118 
119  if (mUseMail2 && message->money != 0)
120  {
121  mGetMoneyButton = new Button(this,
122  // TRANSLATORS: mail view attached money button
123  _("Get money"),
124  "money", this);
125  placer(0, n++, mGetMoneyButton);
126  }
127  placer(0, n++, mGetAttachButton);
129 
130  ContainerPlacer placer2;
131  placer2 = getPlacer(0, n);
132 
133  placer2(0, 0, mPrevButton);
134  placer2(1, 0, mNextButton);
135  placer2(3, 0, mReplyButton);
136  placer2(4, 0, mCloseButton);
137 
138  loadWindowState();
139  enableVisibleSound(true);
140 }
#define CAST_U32
Definition: cast.h:30
void setDefaultSize()
Definition: window.cpp:1186
Button * mPrevButton
#define _(s)
Definition: gettext.h:34
std::string text
Definition: mailmessage.h:51
const bool Visible_true
Definition: visible.h:29
std::string sender
Definition: mailmessage.h:49
Label * mTimeLabel
int64_t money
Definition: mailmessage.h:55
void loadWindowState()
Definition: window.cpp:1075
Inventory * mInventory
void setMinWidth(const int width)
Definition: window.cpp:579
bool Opaque
Definition: opaque.h:29
MailMessage * mMessage
Button * mGetAttachButton
Definition: button.h:94
Button * mCloseButton
ScrollArea * mItemScrollArea
bool getOptionBool(const std::string &name, const bool def=false) const
Definition: window.cpp:1454
Label * mSubjectLabel
void setHeight(int height)
ItemContainer * mItemContainer
Label * mMessageLabel
Settings settings
Definition: settings.cpp:31
std::string title
Definition: mailmessage.h:48
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
Definition: label.h:87
#define fromBool(val, name)
Definition: booldefines.h:48
std::string strTime
Definition: mailmessage.h:50
Label * mMoneyLabel
Button * mGetMoneyButton
Label * mFromLabel
void setCloseButton(const bool flag)
Definition: window.cpp:737
void enableVisibleSound(bool b)
Definition: window.h:473
void setMinHeight(const int height)
Definition: window.cpp:592
ContainerPlacer getPlacer(const int x, const int y)
Definition: window.cpp:1379
void setSaveVisible(const bool save)
Definition: window.h:298
Button * mNextButton
virtual void setVisible(Visible visible)
Definition: window.cpp:766
void center()
Definition: window.cpp:1405
void setResizable(const bool resize)
Definition: window.cpp:615
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:760
Window(const std::string &caption="Window", const Modal modal=Modal_false, Window *const parent=0, std::string skin="")
Definition: window.cpp:108
Button * mReplyButton
bool enableNewMailSystem
Definition: settings.h:163
void setWindowName(const std::string &name)
Definition: window.h:353
void setHorizontalScrollPolicy(const ScrollPolicy hPolicy)

◆ ~MailViewWindow()

MailViewWindow::~MailViewWindow ( )

Definition at line 142 of file mailviewwindow.cpp.

References delete2, mGetMoneyButton, mInventory, mMessage, and mUseMail2.

143 {
144  if (mUseMail2)
145  {
146  mMessage = nullptr;
147  }
148  else
149  {
150  delete2(mMessage);
152  }
154  mailViewWindow = nullptr;
155 }
Inventory * mInventory
MailMessage * mMessage
MailViewWindow * mailViewWindow
#define delete2(var)
Definition: delete2.h:24
Button * mGetMoneyButton

Member Function Documentation

◆ action()

void MailViewWindow::action ( const ActionEvent actionEvent)
virtual

Called when an action is recieved from a widget. It is used to be able to recieve a notification that an action has occured.

Parameters
actionEventThe event of the action.

Implements ActionListener.

Definition at line 157 of file mailviewwindow.cpp.

References CAST_S32, CREATEWIDGETV0, Net::MailHandler::getAttach(), MailWindow::getOpenType(), MailMessage::id, mail2Handler, mailEditWindow, mailHandler, mailWindow, mMessage, mUseMail2, Net::Mail2Handler::requestItems(), Net::Mail2Handler::requestMoney(), Window::scheduleDelete(), MailMessage::sender, MailEditWindow::setMessage(), MailEditWindow::setSubject(), MailEditWindow::setTo(), MailMessage::text, MailMessage::title, MailWindow::viewNext(), and MailWindow::viewPrev().

158 {
159  const std::string &eventId = event.getId();
160  if (eventId == "close")
161  {
162  scheduleDelete();
163  }
164  else if (eventId == "attach")
165  {
166  if (mUseMail2)
167  {
169  mMessage->id);
170  }
171  else
172  {
174  }
175  }
176  else if (eventId == "money")
177  {
178  if (mUseMail2)
179  {
181  mMessage->id);
182  }
183  }
184  else if (eventId == "next")
185  {
186  if (mMessage != nullptr)
188  }
189  else if (eventId == "prev")
190  {
191  if (mMessage != nullptr)
193  }
194  else if (eventId == "reply")
195  {
196  if (mMessage == nullptr)
197  return;
198  if (mailEditWindow != nullptr)
204  scheduleDelete();
205  }
206 }
#define CREATEWIDGETV0(var, type)
Definition: createwidget.h:31
std::string text
Definition: mailmessage.h:51
std::string sender
Definition: mailmessage.h:49
MailMessage * mMessage
Net::Mail2Handler * mail2Handler
Definition: net.cpp:104
void setSubject(const std::string &str)
std::string title
Definition: mailmessage.h:48
#define CAST_S32
Definition: cast.h:29
MailOpenTypeT getOpenType() const
Definition: mailwindow.h:78
void setMessage(const std::string &str)
virtual void requestMoney(const MailOpenTypeT openType, const int64_t mailId) const =0
void setTo(const std::string &str)
Net::MailHandler * mailHandler
Definition: net.cpp:105
virtual void scheduleDelete()
Definition: window.cpp:819
virtual void getAttach(const int msgId) const =0
virtual void requestItems(const MailOpenTypeT openType, const int64_t mailId) const =0
void viewNext(const int64_t id)
Definition: mailwindow.cpp:272
MailWindow * mailWindow
Definition: mailwindow.cpp:54
MailEditWindow * mailEditWindow
void viewPrev(const int64_t id)
Definition: mailwindow.cpp:300
int64_t id
Definition: mailmessage.h:52

◆ getInventory()

Inventory * MailViewWindow::getInventory ( ) const

Definition at line 208 of file mailviewwindow.cpp.

References mInventory.

Referenced by EAthena::MailRecv::processReadMail(), and EAthena::Mail2Recv::processReadMail().

209 {
210  return mInventory;
211 }
Inventory * mInventory

◆ removeItems()

void MailViewWindow::removeItems ( const int64_t  mailId)

Definition at line 232 of file mailviewwindow.cpp.

References CAST_S32, Inventory::clear(), MailMessage::id, MailMessageType::Item, mailWindow, mInventory, mMessage, MailWindow::refreshMailNames(), MailMessage::type, and updateAttachButton().

Referenced by EAthena::Mail2Recv::processRequestItems().

233 {
234  if (mailId != mMessage->id)
235  return;
236  mInventory->clear();
237  mMessage->type = static_cast<MailMessageType::Type>(
239  mMessage->type = static_cast<MailMessageType::Type>(
242  if (mailWindow != nullptr)
244 }
Inventory * mInventory
MailMessage * mMessage
void clear()
Definition: inventory.cpp:237
#define CAST_S32
Definition: cast.h:29
MailMessageType::Type type
Definition: mailmessage.h:56
void refreshMailNames()
Definition: mailwindow.cpp:384
MailWindow * mailWindow
Definition: mailwindow.cpp:54
int64_t id
Definition: mailmessage.h:52

◆ removeMoney()

void MailViewWindow::removeMoney ( const int64_t  mailId)

Definition at line 246 of file mailviewwindow.cpp.

References _, CAST_S32, MailMessage::id, mailWindow, mGetMoneyButton, mMessage, mMoneyLabel, MailMessageType::Money, MailMessage::money, MailWindow::refreshMailNames(), Label::setCaption(), Widget::setVisible(), strprintf(), MailMessage::type, and Visible_false.

Referenced by EAthena::Mail2Recv::processRequestMoney().

247 {
248  if (mailId != mMessage->id)
249  return;
250  mMessage->type = static_cast<MailMessageType::Type>(
252  mMessage->type = static_cast<MailMessageType::Type>(
254 
255  mMessage->money = 0;
256 
257  if (mMoneyLabel == nullptr)
258  return;
259 
260  if (mGetMoneyButton != nullptr)
262 
264  // TRANSLATORS: mail view window label
265  _("Money:"),
266  0));
267  if (mailWindow != nullptr)
269 }
#define _(s)
Definition: gettext.h:34
int64_t money
Definition: mailmessage.h:55
void setVisible(Visible visible)
Definition: widget.cpp:224
MailMessage * mMessage
#define CAST_S32
Definition: cast.h:29
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setCaption(const std::string &caption)
Definition: label.cpp:256
const bool Visible_false
Definition: visible.h:29
MailMessageType::Type type
Definition: mailmessage.h:56
Label * mMoneyLabel
Button * mGetMoneyButton
void refreshMailNames()
Definition: mailwindow.cpp:384
MailWindow * mailWindow
Definition: mailwindow.cpp:54
int64_t id
Definition: mailmessage.h:52

◆ updateAttachButton()

void MailViewWindow::updateAttachButton ( )
private

Definition at line 213 of file mailviewwindow.cpp.

References Inventory::getLastUsedSlot(), mGetAttachButton, mInventory, mMessage, MailMessage::money, mUseMail2, Widget::setVisible(), Visible_false, and Visible_true.

Referenced by MailViewWindow(), removeItems(), and updateItems().

214 {
215  if ((mMessage->money != 0 && !mUseMail2) ||
216  mInventory->getLastUsedSlot() != -1)
217  {
219  }
220  else
221  {
223  }
224 }
const bool Visible_true
Definition: visible.h:29
int64_t money
Definition: mailmessage.h:55
void setVisible(Visible visible)
Definition: widget.cpp:224
Inventory * mInventory
MailMessage * mMessage
Button * mGetAttachButton
const bool Visible_false
Definition: visible.h:29
int getLastUsedSlot() const
Definition: inventory.cpp:290

◆ updateItems()

void MailViewWindow::updateItems ( )

Field Documentation

◆ mCloseButton

Button* MailViewWindow::mCloseButton
private

Definition at line 63 of file mailviewwindow.h.

Referenced by MailViewWindow().

◆ mFromLabel

Label* MailViewWindow::mFromLabel
private

Definition at line 69 of file mailviewwindow.h.

Referenced by MailViewWindow().

◆ mGetAttachButton

Button* MailViewWindow::mGetAttachButton
private

Definition at line 61 of file mailviewwindow.h.

Referenced by MailViewWindow(), and updateAttachButton().

◆ mGetMoneyButton

Button* MailViewWindow::mGetMoneyButton
private

Definition at line 62 of file mailviewwindow.h.

Referenced by MailViewWindow(), removeMoney(), and ~MailViewWindow().

◆ mInventory

Inventory* MailViewWindow::mInventory
private

Definition at line 72 of file mailviewwindow.h.

Referenced by getInventory(), removeItems(), updateAttachButton(), and ~MailViewWindow().

◆ mItemContainer

ItemContainer* MailViewWindow::mItemContainer
private

Definition at line 73 of file mailviewwindow.h.

Referenced by updateItems().

◆ mItemScrollArea

ScrollArea* MailViewWindow::mItemScrollArea
private

Definition at line 74 of file mailviewwindow.h.

Referenced by MailViewWindow().

◆ mMessage

MailMessage* MailViewWindow::mMessage
private

◆ mMessageLabel

Label* MailViewWindow::mMessageLabel
private

Definition at line 71 of file mailviewwindow.h.

Referenced by MailViewWindow().

◆ mMoneyLabel

Label* MailViewWindow::mMoneyLabel
private

Definition at line 68 of file mailviewwindow.h.

Referenced by MailViewWindow(), and removeMoney().

◆ mNextButton

Button* MailViewWindow::mNextButton
private

Definition at line 65 of file mailviewwindow.h.

Referenced by MailViewWindow().

◆ mPrevButton

Button* MailViewWindow::mPrevButton
private

Definition at line 64 of file mailviewwindow.h.

Referenced by MailViewWindow().

◆ mReplyButton

Button* MailViewWindow::mReplyButton
private

Definition at line 66 of file mailviewwindow.h.

Referenced by MailViewWindow().

◆ mSubjectLabel

Label* MailViewWindow::mSubjectLabel
private

Definition at line 70 of file mailviewwindow.h.

Referenced by MailViewWindow().

◆ mTimeLabel

Label* MailViewWindow::mTimeLabel
private

Definition at line 67 of file mailviewwindow.h.

Referenced by MailViewWindow().

◆ mUseMail2

bool MailViewWindow::mUseMail2
private

Definition at line 75 of file mailviewwindow.h.

Referenced by action(), MailViewWindow(), updateAttachButton(), and ~MailViewWindow().


The documentation for this class was generated from the following files: