29#include <guichan/widgetlistener.hpp>
30#include <guichan/widgets/window.hpp>
58class Window :
public gcn::Window, gcn::WidgetListener
71 Window(
const std::string &caption =
"Window",
79 const std::string &caption =
"Window",
205 void setVisible(
bool visible,
bool forceSticky);
255 void mouseMoved(gcn::MouseEvent &event)
override;
299 int defaultWidth,
int defaultHeight);
314 int offsetx = 0,
int offsetY = 0);
327 int oldScreenHeight);
370 virtual void close();
This class is a helper for adding widgets to nested tables in a window.
This class describes the formatting of a widget in the cell of a layout table.
This class is an helper for setting the position of widgets.
void mouseReleased(gcn::MouseEvent &event) override
When the mouse button has been let go, this ensures that the mouse custom cursor is restored back to ...
int mDefaultY
Default window Y position.
void draw(gcn::Graphics *graphics) override
Draws the window contents.
const Skin & getSkin() const
Returns the Skin used by this window.
void center()
Positions the window in the center of it's parent.
int mMinWinWidth
Minimum window width.
std::string mWindowName
Name of the window.
virtual void setVisible(bool visible)
Overloads window setVisible by Guichan to allow sticky window handling.
gcn::Rectangle getStickyButtonRect() const
int mDefaultHeight
Default window height.
bool willSaveVisible() const
Returns whether the window will save it's visibility.
void setDefaultVisible(bool save)
Sets whether the window is visible by default.
void adjustPositionAfterResize(int oldScreenWidth, int oldScreenHeight)
Adjusts the window position after the application window has been resized.
void setMinHeight(int height)
Sets the minimum height of the window.
void setStickyButton(bool flag)
Sets whether or not the window has a sticky button.
virtual void close()
Overrideable functionality for when the window is to close.
void clearLayout()
Clears the window's layout (useful for redesigning the window).
void setContentSize(int width, int height)
Sets the size of this window.
bool mShowTitle
Window has a title bar.
Window * mParent
The parent window.
Window * getParentWindow() const
Returns the parent window.
Layout & getLayout()
Gets the layout handler for this window.
void setWindowName(const std::string &name)
Sets the name of the window.
~Window() override
Destructor.
void ensureOnScreen()
Ensures the window is on the screen, moving it if necessary.
bool isSticky() const
Returns whether the window is sticky.
void mouseDragged(gcn::MouseEvent &event) override
Implements window resizing and makes sure the window is not dragged/resized outside of the screen.
int mMinWinHeight
Minimum window height.
bool isDefaultVisible() const
Returns whether the window is visible by default.
bool mDefaultVisible
Window's default visibility.
virtual void resetToDefaultSize()
Reset the win pos and size to default.
int mDefaultWidth
Default window width.
bool mSaveVisible
Window will save visibility.
void saveWindowState() const
Saves the window state so that when the window is reloaded, it'll maintain its previous state and loc...
Layout * mLayout
Layout handler.
void setMinimumContentSize(int width, int height)
Sets the minimum size of the window content.
void setSticky(bool sticky)
Sets whether the window is sticky.
static void setWindowContainer(WindowContainer *windowContainer)
Sets the window container to be used by new windows.
SkinType mSkinType
The skin type used when drawing the window.
static int getGuiAlpha()
Gets the alpha value used by the window, in a Guichan usable format.
ContainerPlacer getPlacer(int x, int y)
Returns a proxy for adding widgets in an inner table of the layout.
void setResizable(bool resize)
Sets whether or not the window can be resized.
int mMaxWinHeight
Maximum window height.
bool mSticky
Window resists hiding.
void reflowLayout(int w=0, int h=0)
Computes the position of the widgets according to the current layout.
void drawFrame(gcn::Graphics *graphics) override
Draws the window frame.
void mouseMoved(gcn::MouseEvent &event) override
Implements custom cursor image changing context, based on mouse relative position.
void widgetHidden(const gcn::Event &event) override
Called whenever the widget is hidden.
gcn::Rectangle getCloseButtonRect() const
int getResizeHandles(gcn::MouseEvent &event)
Determines if the mouse is in a resize area and returns appropriate resize handles.
void setSaveVisible(bool save)
Sets whether the window will save it's visibility.
LayoutCell & place(int x, int y, gcn::Widget *, int w=1, int h=1)
Adds a widget to the window and sets it at given cell.
void setShowTitle(bool flag)
Sets flag to show a title or not.
void widgetResized(const gcn::Event &event) override
Called whenever the widget changes size.
void mouseExited(gcn::MouseEvent &event) override
When the mouse leaves the window this ensures that the custom cursor is restored back to it's standar...
void scheduleDelete()
Schedule this window for deletion.
bool mCloseButton
Window has a close button.
const std::string & getWindowName() const
Returns the name of the window.
int mMaxWinWidth
Maximum window width.
static int instances
Number of Window instances.
void setCloseButton(bool flag)
Sets whether or not the window has a close button.
void setLocationRelativeTo(gcn::Widget *widget)
Sets the location relative to the given widget.
void setDefaultSize()
Set the default win pos and size to the current ones.
int mDefaultX
Default window X position.
bool mStickyButton
Window has a sticky button.
bool isResizable() const
Returns whether the window can be resized.
ResizeGrip * mGrip
Resize grip.
void loadWindowState()
Reads the position (and the size for resizable windows) in the configuration based on the given strin...
void mousePressed(gcn::MouseEvent &event) override
Starts window resizing when appropriate.
static int mouseResize
Active resize handles.
void setMaxHeight(int height)
Sets the minimum height of the window.
void setMinWidth(int width)
Sets the minimum width of the window.
void setMaxWidth(int width)
Sets the maximum width of the window.
bool mModal
Window is modal.
WindowContainer * windowContainer