ManaPlus
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes

#include <popup.h>

Inheritance diagram for Popup:
Container MouseListener WidgetListener BasicContainer2 BasicContainer Widget WidgetDeathListener Widget2 BeingPopup ItemPopup PopupList PopupMenu SkillPopup SpeechBubble SpellPopup StatusPopup TextBoxPopup TextPopup

Public Member Functions

 Popup (const std::string &name, std::string skin)
 
 ~Popup ()
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
void setContentSize (int width, int height)
 
void setLocationRelativeTo (const Widget *const widget)
 
void mouseMoved (MouseEvent &event)
 
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
 
int getPadding () const
 
void setPadding (int padding)
 
void setPopupName (const std::string &name)
 
const std::string & getPopupName () const
 
void scheduleDelete ()
 
Rect getChildrenArea ()
 
void position (const int x, const int y)
 
void hide ()
 
void widgetResized (const Event &event)
 
void widgetMoved (const Event &event)
 
bool isPopupVisible () const
 
void postInit ()
 
- 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)
 
- 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)
 
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)
 
 ~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) 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 mouseEntered (MouseEvent &event)
 
virtual void mouseExited (MouseEvent &event)
 
virtual void mousePressed (MouseEvent &event)
 
virtual void mouseReleased (MouseEvent &event)
 
virtual void mouseClicked (MouseEvent &event)
 
virtual void mouseWheelMovedUp (MouseEvent &event)
 
virtual void mouseWheelMovedDown (MouseEvent &event)
 
virtual void mouseDragged (MouseEvent &event)
 
- Public Member Functions inherited from WidgetListener
virtual ~WidgetListener ()
 
virtual void widgetHidden (const Event &event)
 
virtual void widgetShown (const Event &event)
 

Static Public Member Functions

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)
 

Protected Attributes

int mPadding
 
SkinmSkin
 
- 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
 

Private Attributes

std::string mPopupName
 
ImageCollectionmVertexes
 
int mMinWidth
 
int mMinHeight
 
int mMaxWidth
 
int mMaxHeight
 
bool mInit
 

Additional Inherited Members

- 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 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 ()
 
- Static Protected Attributes inherited from Widget
static FontmGlobalFont = 0
 

Detailed Description

A light version of the Window class. Particularly suited for popup type functionality that doesn't need to be resized or moved around by the mouse once created, but only needs to display some simple content, like a static message.

Popups, in general, shouldn't also need to update their content once created, although this is not an explicit requirement to use the popup class.

Definition at line 49 of file popup.h.

Constructor & Destructor Documentation

◆ Popup()

Popup::Popup ( const std::string &  name,
std::string  skin 
)

Constructor. Initializes the title to the given text and hooks itself into the popup container.

Parameters
nameA human readable name for the popup. Only useful for debugging purposes.
skinThe location where the Popup's skin XML can be found.

Definition at line 40 of file popup.cpp.

41  :
42  Container(nullptr),
43  MouseListener(),
45  mPadding(3),
46  mSkin(nullptr),
47  mPopupName(name),
49  mMinWidth(100),
50  mMinHeight(40),
53  mInit(false)
54 {
55  logger->log("Popup::Popup(\"%s\")", name.c_str());
56 
57  mWindow = this;
58 
59  addWidgetListener(this);
60 
61  if (skin.empty())
62  skin = "popup.xml";
63 
64  if (theme != nullptr)
65  {
66  mSkin = theme->load(skin,
67  "popup.xml",
68  true,
70  if (mSkin != nullptr)
71  {
73  setPalette(mSkin->getOption("palette"));
74  }
75  }
76 
77  if (windowContainer != nullptr)
78  windowContainer->add(this);
79 
80  // Popups are invisible by default
82 }
virtual void add(Widget *const widget)
Container(const Widget2 *const widget)
Definition: container.cpp:30
int mWidth
Definition: graphics.h:484
int mHeight
Definition: graphics.h:485
void log(const char *const log_text,...)
Definition: logger.cpp:269
Skin * mSkin
Definition: popup.h:182
void setPadding(int padding)
Definition: popup.h:138
int mMinHeight
Definition: popup.h:188
std::string mPopupName
Definition: popup.h:185
ImageCollection * mVertexes
Definition: popup.h:186
int mMinWidth
Definition: popup.h:187
int mMaxWidth
Definition: popup.h:189
int mMaxHeight
Definition: popup.h:190
int mPadding
Definition: popup.h:181
bool mInit
Definition: popup.h:191
int getOption(const std::string &name) const
Definition: skin.h:106
int getPadding() const
Definition: skin.h:100
static std::string getThemePath()
Definition: theme.h:67
Skin * load(const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath)
Definition: theme.cpp:179
Widget * mWindow
Definition: widget2.h:112
void setPalette(int palette)
Definition: widget2.h:69
void setVisible(Visible visible)
Definition: widget.cpp:225
void addWidgetListener(WidgetListener *const widgetListener)
Definition: widget.cpp:302
Graphics * mainGraphics
Definition: graphics.cpp:109
Logger * logger
Definition: logger.cpp:89
Theme * theme
Definition: theme.cpp:62
const bool Visible_false
Definition: visible.h:30
WindowContainer * windowContainer

References BasicContainer2::add(), Widget::addWidgetListener(), Skin::getOption(), Skin::getPadding(), Theme::getThemePath(), Theme::load(), Logger::log(), logger, mSkin, Widget2::mWindow, setPadding(), Widget2::setPalette(), Widget::setVisible(), theme, Visible_false, and windowContainer.

◆ ~Popup()

Popup::~Popup ( )

Destructor. Deletes all the added widgets.

Definition at line 84 of file popup.cpp.

85 {
86  logger->log("Popup::~Popup(\"%s\")", mPopupName.c_str());
87 
89 
90  if (mSkin != nullptr)
91  {
92  if (theme != nullptr)
93  theme->unload(mSkin);
94  mSkin = nullptr;
95  }
96 
97  if (!mInit)
98  {
99  logger->log("error: Popup created without calling postInit(): "
100  + mPopupName);
101  }
102 }
void unload(Skin *const skin)
Definition: theme.cpp:250
#define delete2(var)
Definition: delete2.h:25

References delete2, Logger::log(), logger, mInit, mPopupName, mSkin, mVertexes, theme, and Theme::unload().

Member Function Documentation

◆ draw()

void Popup::draw ( Graphics *const  graphics)
virtual

Draws the popup.

Reimplemented from BasicContainer2.

Definition at line 109 of file popup.cpp.

110 {
111  BLOCK_START("Popup::draw")
112 
113  if (mSkin != nullptr)
114  {
115  if (mRedraw)
116  {
117  mRedraw = false;
118  mVertexes->clear();
119  graphics->calcWindow(mVertexes,
120  0, 0,
122  mSkin->getBorder());
123  }
124  // need cache or remove calc call.
125  graphics->finalize(mVertexes);
126  graphics->drawTileCollection(mVertexes);
127  }
128 
129  drawChildren(graphics);
130  BLOCK_END("Popup::draw")
131 }
virtual void drawChildren(Graphics *const graphics)
virtual void drawTileCollection(const ImageCollection *const vertCol)=0
virtual void finalize(ImageCollection *const col)
Definition: graphics.h:465
virtual void calcWindow(ImageCollection *const vertCol, const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
int width
Definition: rect.h:219
int height
Definition: rect.h:224
const ImageRect & getBorder() const
Definition: skin.h:68
Rect mDimension
Definition: widget.h:1101
bool mRedraw
Definition: widget.h:1164
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79

References BLOCK_END, BLOCK_START, Graphics::calcWindow(), ImageCollection::clear(), BasicContainer::drawChildren(), Graphics::drawTileCollection(), Graphics::finalize(), Skin::getBorder(), Rect::height, Widget::mDimension, Widget::mRedraw, mSkin, mVertexes, and Rect::width.

◆ getChildrenArea()

Rect Popup::getChildrenArea ( )
virtual

Gets the area of the widget occupied by the widget's children. By default this method returns an empty rectangle as not all widgets are containers. If you want to make a container this method should return the area where the children resides. This method is used when drawing children of a widget when computing clip rectangles for the children.

An example of a widget that overloads this method is ScrollArea. A ScrollArea has a view of its contant and that view is the children area. The size of a ScrollArea's children area might vary depending on if the scroll bars of the ScrollArea is shown or not.

Returns
The area of the widget occupied by the widget's children.
See also
BasicContainer
BasicContainer::getChildrenArea
BasicContainer::drawChildren

Reimplemented from BasicContainer.

Definition at line 148 of file popup.cpp.

149 {
150  const int pad2 = mPadding * 2;
151  return Rect(mPadding, mPadding,
152  mDimension.width - pad2, mDimension.height - pad2);
153 }
Definition: rect.h:74

References Rect::height, Widget::mDimension, mPadding, and Rect::width.

◆ getMaxHeight()

int Popup::getMaxHeight ( ) const
inline

Definition at line 125 of file popup.h.

126  { return mMaxHeight; }

References mMaxHeight.

◆ getMaxWidth()

int Popup::getMaxWidth ( ) const
inline

Definition at line 117 of file popup.h.

118  { return mMaxWidth; }

References mMaxWidth.

◆ getMinHeight()

int Popup::getMinHeight ( ) const
inline

Definition at line 109 of file popup.h.

110  { return mMinHeight; }

References mMinHeight.

◆ getMinWidth()

int Popup::getMinWidth ( ) const
inline

Definition at line 101 of file popup.h.

102  { return mMinWidth; }

References mMinWidth.

◆ getPadding()

int Popup::getPadding ( ) const
inline

Gets the padding of the popup. The padding is the distance between the popup border and the content.

Returns
The padding of the popup.
See also
setPadding

Definition at line 135 of file popup.h.

136  { return mPadding; }

References mPadding.

Referenced by DropDown::dropDown().

◆ getPopupName()

const std::string& Popup::getPopupName ( ) const
inline

Definition at line 147 of file popup.h.

148  { return mPopupName; }

References mPopupName.

◆ hide()

void Popup::hide ( )

◆ isPopupVisible()

bool Popup::isPopupVisible ( ) const
inline

◆ mouseMoved()

void Popup::mouseMoved ( MouseEvent event)
virtual

Called when the mouse has moved in the widget area and no mouse button has been pressed (i.e no widget is being dragged).

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 255 of file popup.cpp.

256 {
257  if (popupManager != nullptr)
258  {
261  }
262  mRedraw = true;
263 }
static void hideTextPopup()
static void hideBeingPopup()
PopupManager * popupManager

References PopupManager::hideBeingPopup(), PopupManager::hideTextPopup(), Widget::mRedraw, and popupManager.

Referenced by ItemPopup::mouseMoved(), SkillPopup::mouseMoved(), SpellPopup::mouseMoved(), TextBoxPopup::mouseMoved(), and TextPopup::mouseMoved().

◆ position()

void Popup::position ( const int  x,
const int  y 
)

Sets the location to display the popup. Tries to horizontally center the popup and provide a vertical buffer between the given point and the popup. Prevents the popup from extending off-screen, if possible.

Definition at line 235 of file popup.cpp.

236 {
237  const int distance = 20;
238 
239  const int width = mDimension.width;
240  const int height = mDimension.height;
241  int posX = std::max(0, x - width / 2);
242  int posY = y + distance;
243 
244  if (posX + width > mainGraphics->mWidth)
245  posX = mainGraphics->mWidth - width;
246  if (posY + height > mainGraphics->mHeight)
247  posY = y - height - distance;
248 
249  setPosition(posX, posY);
252  mRedraw = true;
253 }
virtual void requestMoveToTop()
Definition: widget.cpp:213
void setPosition(const int x, const int y)
Definition: widget.cpp:161

References Rect::height, mainGraphics, Widget::mDimension, Graphics::mHeight, Widget::mRedraw, Graphics::mWidth, Widget::requestMoveToTop(), Widget::setPosition(), Widget::setVisible(), Visible_true, Rect::width, x, and y.

Referenced by ItemLinkHandler::handleItemLink(), ItemContainer::mouseMoved(), ItemShortcutContainer::mouseMoved(), ShopListBox::mouseMoved(), SkillListBox::mouseMoved(), SkillRectangleListBox::mouseMoved(), VirtShortcutContainer::mouseMoved(), EquipmentWindow::mouseMoved(), ItemAmountWindow::mouseMoved(), and BeingPopup::show().

◆ postInit()

void Popup::postInit ( )
inlinevirtual

◆ safeDraw()

void Popup::safeDraw ( Graphics *const  graphics)
virtual

Reimplemented from BasicContainer2.

Definition at line 133 of file popup.cpp.

134 {
135  BLOCK_START("Popup::safeDraw")
136 
137  if (mSkin != nullptr)
138  {
139  graphics->drawImageRect(0, 0,
141  mSkin->getBorder());
142  }
143 
144  safeDrawChildren(graphics);
145  BLOCK_END("Popup::safeDraw")
146 }
virtual void safeDrawChildren(Graphics *const graphics)
virtual void drawImageRect(const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0

References BLOCK_END, BLOCK_START, Graphics::drawImageRect(), Skin::getBorder(), Rect::height, Widget::mDimension, mSkin, BasicContainer::safeDrawChildren(), and Rect::width.

◆ scheduleDelete()

void Popup::scheduleDelete ( )

Schedule this popup for deletion. It will be deleted at the start of the next logic update.

Definition at line 230 of file popup.cpp.

231 {
233 }
void scheduleDelete(Widget *const widget)

References WindowContainer::scheduleDelete(), and windowContainer.

◆ setContentSize()

void Popup::setContentSize ( int  width,
int  height 
)

Sets the size of this popup.

Definition at line 155 of file popup.cpp.

156 {
157  const int pad2 = mPadding * 2;
158  width += pad2;
159  height += pad2;
160 
161  if (mMinWidth > width)
162  width = mMinWidth;
163  else if (mMaxWidth < width)
164  width = mMaxWidth;
165  if (mMinHeight > height)
166  height = mMinHeight;
167  else if (mMaxHeight < height)
168  height = mMaxHeight;
169 
170  setSize(width, height);
171  mRedraw = true;
172 }
void setSize(const int width, const int height)
Definition: widget.cpp:367

References mMaxHeight, mMaxWidth, mMinHeight, mMinWidth, mPadding, Widget::mRedraw, and Widget::setSize().

Referenced by ItemPopup::setItem(), SpellPopup::setItem(), SpeechBubble::setText(), BeingPopup::show(), TextBoxPopup::show(), SkillPopup::show(), PopupList::show(), PopupMenu::showPopup(), and SpeechBubble::SpeechBubble().

◆ setLocationRelativeTo()

void Popup::setLocationRelativeTo ( const Widget *const  widget)

Sets the location relative to the given widget.

Definition at line 174 of file popup.cpp.

175 {
176  if (widget == nullptr)
177  return;
178 
179  int wx;
180  int wy;
181  int x;
182  int y;
183 
184  widget->getAbsolutePosition(wx, wy);
186 
187  setPosition(mDimension.x + (wx + (widget->getWidth()
188  - mDimension.width) / 2 - x),
189  mDimension.y + (wy + (widget->getHeight()
190  - mDimension.height) / 2 - y));
191  mRedraw = true;
192 }
int y
Definition: rect.h:214
int x
Definition: rect.h:209
virtual void getAbsolutePosition(int &x, int &y) const
Definition: widget.cpp:312
int getHeight() const
Definition: widget.h:240
int getWidth() const
Definition: widget.h:221

References Widget::getAbsolutePosition(), Widget::getHeight(), Widget::getWidth(), Rect::height, Widget::mDimension, Widget::mRedraw, Widget::setPosition(), Rect::width, Rect::x, x, Rect::y, and y.

◆ setMaxHeight()

void Popup::setMaxHeight ( const int  height)

Sets the minimum height of the popup.

Definition at line 225 of file popup.cpp.

226 {
227  mMaxHeight = height;
228 }

References mMaxHeight.

◆ setMaxWidth()

void Popup::setMaxWidth ( const int  width)

Sets the maximum width of the popup.

Definition at line 220 of file popup.cpp.

221 {
222  mMaxWidth = width;
223 }

References mMaxWidth.

◆ setMinHeight()

void Popup::setMinHeight ( const int  height)

Sets the minimum height of the popup.

Definition at line 207 of file popup.cpp.

208 {
209  if (mSkin != nullptr)
210  {
211  mMinHeight = height > mSkin->getMinHeight() ?
212  height : mSkin->getMinHeight();
213  }
214  else
215  {
216  mMinHeight = height;
217  }
218 }
int getMinHeight() const
Definition: skin.cpp:142

References Skin::getMinHeight(), mMinHeight, and mSkin.

Referenced by BeingPopup::BeingPopup(), TextBoxPopup::postInit(), and SpeechBubble::SpeechBubble().

◆ setMinWidth()

void Popup::setMinWidth ( const int  width)

Sets the minimum width of the popup.

Definition at line 194 of file popup.cpp.

195 {
196  if (mSkin != nullptr)
197  {
198  mMinWidth = width > mSkin->getMinWidth()
199  ? width : mSkin->getMinWidth();
200  }
201  else
202  {
203  mMinWidth = width;
204  }
205 }
int getMinWidth() const
Definition: skin.cpp:129

References Skin::getMinWidth(), mMinWidth, and mSkin.

Referenced by SpeechBubble::SpeechBubble().

◆ setPadding()

void Popup::setPadding ( int  padding)
inline

Definition at line 138 of file popup.h.

139  { mPadding = padding; }

References mPadding.

Referenced by Popup().

◆ setPopupName()

void Popup::setPopupName ( const std::string &  name)
inline

Sets the name of the popup. This is only useful for debug purposes.

Definition at line 144 of file popup.h.

145  { mPopupName = name; }

References mPopupName.

◆ setWindowContainer()

void Popup::setWindowContainer ( WindowContainer *const  windowContainer)
static

Sets the window container to be used by new popups.

Definition at line 104 of file popup.cpp.

105 {
106  windowContainer = wc;
107 }

References windowContainer.

◆ widgetMoved()

void Popup::widgetMoved ( const Event event)
virtual

Invoked when a widget is moved.

Parameters
eventDescribes the event.

Reimplemented from WidgetListener.

Definition at line 276 of file popup.cpp.

277 {
278  mRedraw = true;
279 }

References Widget::mRedraw.

◆ widgetResized()

void Popup::widgetResized ( const Event event)
virtual

Invoked when a widget changes its size.

Parameters
eventDescribes the event.

Reimplemented from WidgetListener.

Reimplemented in PopupList.

Definition at line 271 of file popup.cpp.

272 {
273  mRedraw = true;
274 }

References Widget::mRedraw.

Referenced by PopupList::widgetResized().

Field Documentation

◆ mInit

bool Popup::mInit
private

Definition at line 191 of file popup.h.

Referenced by postInit(), and ~Popup().

◆ mMaxHeight

int Popup::mMaxHeight
private

Maximum popup height

Definition at line 190 of file popup.h.

Referenced by getMaxHeight(), setContentSize(), and setMaxHeight().

◆ mMaxWidth

int Popup::mMaxWidth
private

Maximum popup width

Definition at line 189 of file popup.h.

Referenced by getMaxWidth(), setContentSize(), and setMaxWidth().

◆ mMinHeight

int Popup::mMinHeight
private

Minimum popup height

Definition at line 188 of file popup.h.

Referenced by getMinHeight(), setContentSize(), and setMinHeight().

◆ mMinWidth

int Popup::mMinWidth
private

Minimum popup width

Definition at line 187 of file popup.h.

Referenced by getMinWidth(), setContentSize(), and setMinWidth().

◆ mPadding

int Popup::mPadding
protected

◆ mPopupName

std::string Popup::mPopupName
private

Name of the popup

Definition at line 185 of file popup.h.

Referenced by getPopupName(), setPopupName(), and ~Popup().

◆ mSkin

Skin* Popup::mSkin
protected

Skin in use by this popup

Definition at line 182 of file popup.h.

Referenced by draw(), Popup(), safeDraw(), setMinHeight(), setMinWidth(), and ~Popup().

◆ mVertexes

ImageCollection* Popup::mVertexes
private

Definition at line 186 of file popup.h.

Referenced by draw(), and ~Popup().


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