Mana
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members

A light version of the Window class. More...

#include <popup.h>

Inheritance diagram for Popup:
Container BeingPopup CreatePopup EmotePopup ItemPopup MiniStatusWindow PopupMenu SpeechBubble TextPopup

Public Member Functions

 Popup (const std::string &name=std::string(), SkinType skinType=SkinType::Popup)
 Constructor.
 
 ~Popup () override
 Destructor.
 
void add (gcn::Widget *widget) override
 
void add (gcn::Widget *widget, int x, int y) override
 
void draw (gcn::Graphics *graphics) override
 Draws the popup.
 
void drawFrame (gcn::Graphics *graphics) override
 Draws the popup frame.
 
void setContentSize (int width, int height)
 Sets the size of this popup.
 
void setLocationRelativeTo (gcn::Widget *widget)
 Sets the location relative to the given widget.
 
void mouseMoved (gcn::MouseEvent &event) override
 
void setMinWidth (int width)
 Sets the minimum width of the popup.
 
int getMinWidth () const
 
void setMinHeight (int height)
 Sets the minimum height of the popup.
 
int getMinHeight () const
 
void setMaxWidth (int width)
 Sets the maximum width of the popup.
 
int getMaxWidth () const
 
void setMaxHeight (int height)
 Sets the minimum height of the popup.
 
int getMaxHeight () const
 
int getPadding () const
 Gets the padding of the popup.
 
void setPadding (int padding)
 
void setPopupName (const std::string &name)
 Sets the name of the popup.
 
const std::string & getPopupName () const
 
void scheduleDelete ()
 Schedule this popup for deletion.
 
gcn::Rectangle getChildrenArea () override
 
void position (int x, int y)
 Sets the location to display the popup.
 
const SkingetSkin () const
 Returns the Skin used by this popup.
 
- Public Member Functions inherited from Container
 Container ()
 
 ~Container () override
 
void drawFrame (gcn::Graphics *graphics) override
 

Static Public Member Functions

static void setWindowContainer (WindowContainer *windowContainer)
 Sets the window container to be used by new popups.
 

Private Member Functions

void widgetAdded (gcn::Widget *widget) const
 

Private Attributes

std::string mPopupName
 Name of the popup.
 
int mMinWidth = 100
 Minimum popup width.
 
int mMinHeight = 40
 Minimum popup height.
 
int mMaxWidth
 Maximum popup width.
 
int mMaxHeight
 Maximum popup height.
 
int mPadding
 Holds the padding of the popup.
 
SkinType mSkinType
 The skin type used when drawing the popup widget.
 

Additional Inherited Members

- Protected Member Functions inherited from Container
LayoutgetLayout ()
 Gets the layout handler for this container.
 
LayoutCellplace (int x, int y, gcn::Widget *wg, int w=1, int h=1)
 Adds a widget to the container and sets it at given cell.
 
ContainerPlacer getPlacer (int x, int y)
 Returns a proxy for adding widgets in an inner table of the layout.
 

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 47 of file popup.h.

Constructor & Destructor Documentation

◆ Popup()

Popup::Popup ( const std::string &  name = std::string(),
SkinType  skinType = SkinType::Popup 
)
explicit

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.
skinTypeThe skin type used when drawing the popup.

Definition at line 37 of file popup.cpp.

◆ ~Popup()

Popup::~Popup ( )
override

Destructor.

Deletes all the added widgets.

Definition at line 59 of file popup.cpp.

Member Function Documentation

◆ add() [1/2]

void Popup::add ( gcn::Widget *  widget)
override

Definition at line 69 of file popup.cpp.

◆ add() [2/2]

void Popup::add ( gcn::Widget *  widget,
int  x,
int  y 
)
override

Definition at line 75 of file popup.cpp.

◆ draw()

void Popup::draw ( gcn::Graphics *  graphics)
override

Draws the popup.

Definition at line 104 of file popup.cpp.

◆ drawFrame()

void Popup::drawFrame ( gcn::Graphics *  graphics)
override

Draws the popup frame.

Definition at line 112 of file popup.cpp.

◆ getChildrenArea()

gcn::Rectangle Popup::getChildrenArea ( )
override

Definition at line 120 of file popup.cpp.

◆ getMaxHeight()

int Popup::getMaxHeight ( ) const
inline

Definition at line 123 of file popup.h.

◆ getMaxWidth()

int Popup::getMaxWidth ( ) const
inline

Definition at line 116 of file popup.h.

◆ getMinHeight()

int Popup::getMinHeight ( ) const
inline

Definition at line 109 of file popup.h.

◆ getMinWidth()

int Popup::getMinWidth ( ) const
inline

Definition at line 102 of file popup.h.

◆ 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 132 of file popup.h.

◆ getPopupName()

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

Definition at line 142 of file popup.h.

◆ getSkin()

const Skin & Popup::getSkin ( ) const

Returns the Skin used by this popup.

Definition at line 200 of file popup.cpp.

◆ mouseMoved()

void Popup::mouseMoved ( gcn::MouseEvent &  event)
override

Definition at line 205 of file popup.cpp.

◆ position()

void Popup::position ( int  x,
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 183 of file popup.cpp.

◆ scheduleDelete()

void Popup::scheduleDelete ( )

Schedule this popup for deletion.

It will be deleted at the start of the next logic update.

Definition at line 178 of file popup.cpp.

◆ setContentSize()

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

Sets the size of this popup.

Definition at line 127 of file popup.cpp.

◆ setLocationRelativeTo()

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

Sets the location relative to the given widget.

Definition at line 144 of file popup.cpp.

◆ setMaxHeight()

void Popup::setMaxHeight ( int  height)

Sets the minimum height of the popup.

Definition at line 173 of file popup.cpp.

◆ setMaxWidth()

void Popup::setMaxWidth ( int  width)

Sets the maximum width of the popup.

Definition at line 168 of file popup.cpp.

◆ setMinHeight()

void Popup::setMinHeight ( int  height)

Sets the minimum height of the popup.

Definition at line 163 of file popup.cpp.

◆ setMinWidth()

void Popup::setMinWidth ( int  width)

Sets the minimum width of the popup.

Definition at line 158 of file popup.cpp.

◆ setPadding()

void Popup::setPadding ( int  padding)
inline

Definition at line 134 of file popup.h.

◆ 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 139 of file popup.h.

◆ setWindowContainer()

void Popup::setWindowContainer ( WindowContainer windowContainer)
static

Sets the window container to be used by new popups.

Definition at line 64 of file popup.cpp.

◆ widgetAdded()

void Popup::widgetAdded ( gcn::Widget *  widget) const
private

Definition at line 81 of file popup.cpp.

Member Data Documentation

◆ mMaxHeight

int Popup::mMaxHeight
private

Maximum popup height.

Definition at line 175 of file popup.h.

◆ mMaxWidth

int Popup::mMaxWidth
private

Maximum popup width.

Definition at line 174 of file popup.h.

◆ mMinHeight

int Popup::mMinHeight = 40
private

Minimum popup height.

Definition at line 173 of file popup.h.

◆ mMinWidth

int Popup::mMinWidth = 100
private

Minimum popup width.

Definition at line 172 of file popup.h.

◆ mPadding

int Popup::mPadding
private

Holds the padding of the popup.

Definition at line 176 of file popup.h.

◆ mPopupName

std::string Popup::mPopupName
private

Name of the popup.

Definition at line 171 of file popup.h.

◆ mSkinType

SkinType Popup::mSkinType
private

The skin type used when drawing the popup widget.

Definition at line 178 of file popup.h.


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