ManaPlus
Public Member Functions | Private Attributes | Friends
TargetDebugTab Class Reference

#include <targetdebugtab.h>

Inheritance diagram for TargetDebugTab:
DebugTab Container BasicContainer2 BasicContainer Widget WidgetDeathListener Widget2

Public Member Functions

 TargetDebugTab (const Widget2 *const widget)
 
void logic ()
 
- Public Member Functions inherited from DebugTab
void resize (const int x, const int y)
 
- Public Member Functions inherited from Container
 Container (const Widget2 *const widget)
 
 ~Container ()
 
bool safeRemove (Widget *const widget)
 
void removeControls ()
 
- Public Member Functions inherited from BasicContainer2
 BasicContainer2 (const Widget2 *const widget)
 
 ~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)
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
- Public Member Functions inherited from BasicContainer
 BasicContainer (const Widget2 *const widget)
 
 ~BasicContainer ()
 
void showWidgetPart (Widget *const widget, const Rect &area)
 
void moveToTop (Widget *const widget)
 
void moveToBottom (Widget *const widget)
 
Rect getChildrenArea ()
 
void focusNext ()
 
void focusPrevious ()
 
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)
 
 ~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 ()
 
virtual void postInit ()
 
- Public Member Functions inherited from Widget2
virtual ~Widget2 ()
 
const ColorgetThemeColor (const ThemeColorIdT type, const unsigned int alpha) 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 ()
 

Private Attributes

LabelmTargetLabel
 
LabelmTargetIdLabel
 
LabelmTargetTypeLabel
 
LabelmTargetLevelLabel
 
LabelmTargetRaceLabel
 
LabelmTargetPartyLabel
 
LabelmTargetGuildLabel
 
LabelmAttackDelayLabel
 
LabelmMinHitLabel
 
LabelmMaxHitLabel
 
LabelmCriticalHitLabel
 
LabelmKarmaLabel
 
LabelmMannerLabel
 
LabelmEffectsLabel
 

Friends

class DebugWindow
 

Additional Inherited Members

- 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 DebugTab
 DebugTab (const Widget2 *const widget)
 
- 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 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 29 of file targetdebugtab.h.

Constructor & Destructor Documentation

◆ TargetDebugTab()

TargetDebugTab::TargetDebugTab ( const Widget2 *const  widget)
explicit

Definition at line 35 of file targetdebugtab.cpp.

35  :
36  DebugTab(widget),
37  // TRANSLATORS: debug window label
38  mTargetLabel(new Label(this, strprintf("%s ?", _("Target:")))),
39  // TRANSLATORS: debug window label
40  mTargetIdLabel(new Label(this, strprintf("%s ? ", _("Target Id:")))),
42  // TRANSLATORS: debug window label
43  "%s ? ", _("Target type:")))),
44  // TRANSLATORS: debug window label
45  mTargetLevelLabel(new Label(this, strprintf("%s ?", _("Target level:")))),
46  // TRANSLATORS: debug window label
47  mTargetRaceLabel(new Label(this, strprintf("%s ?", _("Target race:")))),
48  // TRANSLATORS: debug window label
49  mTargetPartyLabel(new Label(this, strprintf("%s ?", _("Target party:")))),
50  // TRANSLATORS: debug window label
51  mTargetGuildLabel(new Label(this, strprintf("%s ?", _("Target guild:")))),
52  // TRANSLATORS: debug window label
53  mAttackDelayLabel(new Label(this, strprintf("%s ?", _("Attack delay:")))),
54  // TRANSLATORS: debug window label
55  mMinHitLabel(new Label(this, strprintf("%s ?", _("Minimal hit:")))),
56  // TRANSLATORS: debug window label
57  mMaxHitLabel(new Label(this, strprintf("%s ?", _("Maximum hit:")))),
58  // TRANSLATORS: debug window label
59  mCriticalHitLabel(new Label(this, strprintf("%s ?", _("Critical hit:")))),
60  // TRANSLATORS: debug window label
61  mKarmaLabel(new Label(this, strprintf("%s ?", _("Karma:")))),
62  // TRANSLATORS: debug window label
63  mMannerLabel(new Label(this, strprintf("%s ?", _("Manner:")))),
64  // TRANSLATORS: debug window label
65  mEffectsLabel(new Label(this, strprintf("%s ?", _("Effects:"))))
66 {
67  LayoutHelper h(this);
68  ContainerPlacer place = h.getPlacer(0, 0);
69 
70  place(0, 0, mTargetLabel, 2, 1);
71  place(0, 1, mTargetIdLabel, 2, 1);
72  place(0, 2, mTargetTypeLabel, 2, 1);
73  place(0, 3, mTargetLevelLabel, 2, 1);
74  place(0, 4, mTargetRaceLabel, 2, 1);
75  place(0, 5, mAttackDelayLabel, 2, 1);
76  place(0, 6, mTargetPartyLabel, 2, 1);
77  place(0, 7, mTargetGuildLabel, 2, 1);
78  place(0, 8, mMinHitLabel, 2, 1);
79  place(0, 9, mMaxHitLabel, 2, 1);
80  place(0, 10, mCriticalHitLabel, 2, 1);
81  place(0, 11, mKarmaLabel, 2, 1);
82  place(0, 12, mMannerLabel, 2, 1);
83  place(0, 13, mEffectsLabel, 2, 1);
84 
85  place.getCell().matchColWidth(0, 0);
86  place = h.getPlacer(0, 1);
87  setDimension(Rect(0, 0, 600, 300));
88 }
LayoutCell & getCell()
DebugTab(const Widget2 *const widget)
Definition: debugtab.h:44
Definition: label.h:91
void matchColWidth(const int n1, const int n2)
Definition: layoutcell.cpp:118
Definition: rect.h:74
Label * mCriticalHitLabel
Label * mMannerLabel
Label * mKarmaLabel
Label * mMaxHitLabel
Label * mTargetLabel
Label * mTargetRaceLabel
Label * mEffectsLabel
Label * mAttackDelayLabel
Label * mTargetIdLabel
Label * mTargetGuildLabel
Label * mTargetPartyLabel
Label * mMinHitLabel
Label * mTargetTypeLabel
Label * mTargetLevelLabel
void setDimension(const Rect &dimension)
Definition: widget.cpp:169
#define _(s)
Definition: gettext.h:35
std::string strprintf(const char *const format,...)

References ContainerPlacer::getCell(), LayoutHelper::getPlacer(), LayoutCell::matchColWidth(), mAttackDelayLabel, mCriticalHitLabel, mEffectsLabel, mKarmaLabel, mMannerLabel, mMaxHitLabel, mMinHitLabel, mTargetGuildLabel, mTargetIdLabel, mTargetLabel, mTargetLevelLabel, mTargetPartyLabel, mTargetRaceLabel, mTargetTypeLabel, and Widget::setDimension().

Member Function Documentation

◆ logic()

void TargetDebugTab::logic ( )
virtual

Called for all widgets in the gui each time Gui::logic is called. You can do logic stuff here like playing an animation.

See also
Gui::logic

Reimplemented from DebugTab.

Definition at line 90 of file targetdebugtab.cpp.

91 {
92  BLOCK_START("TargetDebugTab::logic")
93  if ((localPlayer != nullptr) && (localPlayer->getTarget() != nullptr))
94  {
95  const Being *const target = localPlayer->getTarget();
96 
97  // TRANSLATORS: debug window label
98  mTargetLabel->setCaption(strprintf("%s %s (%d, %d)", _("Target:"),
99  target->getName().c_str(), target->getTileX(),
100  target->getTileY()));
101 
103  // TRANSLATORS: debug window label
104  _("Target Id:"), toInt(target->getId(), int)));
106  // TRANSLATORS: debug window label
107  _("Target type:"), toInt(target->getSubType(), int)));
108  if (target->getLevel() != 0)
109  {
111  // TRANSLATORS: debug window label
112  _("Target Level:"), target->getLevel()));
113  }
114  else
115  {
117  // TRANSLATORS: debug window label
118  _("Target Level:")));
119  }
120 
122  // TRANSLATORS: debug window label
123  _("Target race:"), target->getRaceName().c_str()));
124 
125  // TRANSLATORS: debug window label
126  mTargetPartyLabel->setCaption(strprintf("%s %s", _("Target Party:"),
127  target->getPartyName().c_str()));
128 
129  // TRANSLATORS: debug window label
130  mTargetGuildLabel->setCaption(strprintf("%s %s", _("Target Guild:"),
131  target->getGuildName().c_str()));
132 
134  // TRANSLATORS: debug window label
135  _("Minimal hit:"), target->getMinHit()));
137  // TRANSLATORS: debug window label
138  _("Maximum hit:"), target->getMaxHit()));
140  // TRANSLATORS: debug window label
141  _("Critical hit:"), target->getCriticalHit()));
143  // TRANSLATORS: debug window label
144  _("Karma:"), target->getKarma()));
146  // TRANSLATORS: debug window label
147  _("Manner:"), target->getManner()));
149  // TRANSLATORS: debug window label
150  _("Effects:"), target->getStatusEffectsString().c_str()));
151 
152  const int delay = target->getAttackDelay();
153  if (delay != 0)
154  {
156  // TRANSLATORS: debug window label
157  _("Attack delay:"), delay));
158  }
159  else
160  {
162  // TRANSLATORS: debug window label
163  "%s ?", _("Attack delay:")));
164  }
165  }
166  else
167  {
168  // TRANSLATORS: debug window label
169  mTargetLabel->setCaption(strprintf("%s ?", _("Target:")));
170  // TRANSLATORS: debug window label
171  mTargetIdLabel->setCaption(strprintf("%s ?", _("Target Id:")));
172  // TRANSLATORS: debug window label
173  mTargetTypeLabel->setCaption(strprintf("%s ?", _("Target type:")));
174  // TRANSLATORS: debug window label
175  mTargetLevelLabel->setCaption(strprintf("%s ?", _("Target Level:")));
176  // TRANSLATORS: debug window label
177  mTargetPartyLabel->setCaption(strprintf("%s ?", _("Target Party:")));
178  // TRANSLATORS: debug window label
179  mTargetGuildLabel->setCaption(strprintf("%s ?", _("Target Guild:")));
180  // TRANSLATORS: debug window label
181  mAttackDelayLabel->setCaption(strprintf("%s ?", _("Attack delay:")));
182  // TRANSLATORS: debug window label
183  mMinHitLabel->setCaption(strprintf("%s ?", _("Minimal hit:")));
184  // TRANSLATORS: debug window label
185  mMaxHitLabel->setCaption(strprintf("%s ?", _("Maximum hit:")));
186  // TRANSLATORS: debug window label
187  mCriticalHitLabel->setCaption(strprintf("%s ?", _("Critical hit:")));
188  // TRANSLATORS: debug window label
189  mKarmaLabel->setCaption(strprintf("%s ?", _("Karma:")));
190  // TRANSLATORS: debug window label
191  mMannerLabel->setCaption(strprintf("%s ?", _("Manner:")));
192  // TRANSLATORS: debug window label
193  mEffectsLabel->setCaption(strprintf("%s ?", _("Effects:")));
194  }
195 
209  BLOCK_END("TargetDebugTab::logic")
210 }
BeingId getId() const
Definition: actorsprite.h:64
std::string getStatusEffectsString() const
Definition: being.h:96
int getKarma() const
Definition: being.h:1034
virtual int getLevel() const
Definition: being.h:604
std::string getRaceName() const
Definition: being.h:861
int getTileX() const
Definition: being.h:168
int getMaxHit() const
Definition: being.h:782
BeingTypeId getSubType() const
Definition: being.h:400
int getCriticalHit() const
Definition: being.h:788
const std::string & getPartyName() const
Definition: being.h:255
int getMinHit() const
Definition: being.h:776
int getTileY() const
Definition: being.h:174
int getManner() const
Definition: being.h:1040
const std::string & getName() const
Definition: being.h:232
const std::string & getGuildName() const
Definition: being.h:259
int getAttackDelay() const
Definition: being.h:773
void adjustSize()
Definition: label.cpp:200
void setCaption(const std::string &caption)
Definition: label.cpp:264
Being * getTarget() const
if(!vert) return
#define toInt(val, name)
Definition: intdefines.h:47
LocalPlayer * localPlayer
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79

References _, Label::adjustSize(), BLOCK_END, BLOCK_START, Being::getAttackDelay(), Being::getCriticalHit(), Being::getGuildName(), ActorSprite::getId(), Being::getKarma(), Being::getLevel(), Being::getManner(), Being::getMaxHit(), Being::getMinHit(), Being::getName(), Being::getPartyName(), Being::getRaceName(), ActorSprite::getStatusEffectsString(), Being::getSubType(), LocalPlayer::getTarget(), Being::getTileX(), Being::getTileY(), localPlayer, mAttackDelayLabel, mCriticalHitLabel, mEffectsLabel, mKarmaLabel, mMannerLabel, mMaxHitLabel, mMinHitLabel, mTargetGuildLabel, mTargetIdLabel, mTargetLabel, mTargetLevelLabel, mTargetPartyLabel, mTargetRaceLabel, mTargetTypeLabel, Label::setCaption(), strprintf(), and toInt.

Referenced by DebugWindow::slowLogic().

Friends And Related Function Documentation

◆ DebugWindow

friend class DebugWindow
friend

Definition at line 31 of file targetdebugtab.h.

Field Documentation

◆ mAttackDelayLabel

Label* TargetDebugTab::mAttackDelayLabel
private

Definition at line 48 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mCriticalHitLabel

Label* TargetDebugTab::mCriticalHitLabel
private

Definition at line 51 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mEffectsLabel

Label* TargetDebugTab::mEffectsLabel
private

Definition at line 54 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mKarmaLabel

Label* TargetDebugTab::mKarmaLabel
private

Definition at line 52 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mMannerLabel

Label* TargetDebugTab::mMannerLabel
private

Definition at line 53 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mMaxHitLabel

Label* TargetDebugTab::mMaxHitLabel
private

Definition at line 50 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mMinHitLabel

Label* TargetDebugTab::mMinHitLabel
private

Definition at line 49 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mTargetGuildLabel

Label* TargetDebugTab::mTargetGuildLabel
private

Definition at line 47 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mTargetIdLabel

Label* TargetDebugTab::mTargetIdLabel
private

Definition at line 42 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mTargetLabel

Label* TargetDebugTab::mTargetLabel
private

Definition at line 41 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mTargetLevelLabel

Label* TargetDebugTab::mTargetLevelLabel
private

Definition at line 44 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mTargetPartyLabel

Label* TargetDebugTab::mTargetPartyLabel
private

Definition at line 46 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mTargetRaceLabel

Label* TargetDebugTab::mTargetRaceLabel
private

Definition at line 45 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().

◆ mTargetTypeLabel

Label* TargetDebugTab::mTargetTypeLabel
private

Definition at line 43 of file targetdebugtab.h.

Referenced by logic(), and TargetDebugTab().


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