84 #include "gui/viewport.h"
134 mParentWindow(parent),
140 mWindowName(
"window"),
150 mOldResizeHandles(-1),
154 mCaptionFont(getFont()),
156 mCloseWindowButton(false),
157 mDefaultVisible(false),
159 mStickyButton(false),
161 mStickyButtonLock(false),
162 mPlayVisibleSound(false),
167 logger->
log(
"Window::Window(\"%s\")", caption.c_str());
187 int childPalette = 1;
189 if (
theme !=
nullptr)
195 if (
mSkin !=
nullptr)
222 childPalette =
getOption(
"childPalette", 0);
253 reportAlways(
"error: Window created with calling postInit() "
254 "more than once: %s",
288 if (
mSkin !=
nullptr)
290 if (
theme !=
nullptr)
294 if (
mGrip !=
nullptr)
301 reportAlways(
"error: Window created without calling postInit(): %s",
313 if (
mSkin ==
nullptr)
341 if (button !=
nullptr)
353 if (button !=
nullptr)
362 if (
mGrip !=
nullptr)
406 if (image !=
nullptr)
425 if (
mSkin ==
nullptr)
440 if (button !=
nullptr)
447 if (button !=
nullptr)
451 if (
mGrip !=
nullptr)
483 if (image !=
nullptr)
511 if (widget ==
nullptr)
530 if (widget ==
nullptr)
546 int offsetX,
int offsetY)
593 if (
mSkin !=
nullptr)
606 if (
mSkin !=
nullptr)
629 if ((
mGrip !=
nullptr) == r)
632 if (
mGrip !=
nullptr)
637 if (
mGrip !=
nullptr)
657 if (
mGrip !=
nullptr)
670 if (
mSkin !=
nullptr)
677 if (button !=
nullptr)
689 if (button !=
nullptr)
758 return mGrip !=
nullptr;
811 if (event !=
nullptr)
813 const int x =
event->getX();
814 const int y =
event->getY();
854 const int x =
event.getX();
855 const int y =
event.getY();
1020 const int newHeight = newDim.
height
1032 const int newWidth = newDim.
width
1044 newDim.
width += newDim.
x;
1108 if (
mGrip !=
nullptr)
1163 if (
mGrip !=
nullptr)
1181 int defaultWidth,
int defaultHeight)
1208 const int offsetX,
const int offsetY)
1267 const int oldScreenHeight)
1271 const int bottomMargin = oldScreenHeight
1287 if (
mGrip ==
nullptr)
1308 if (event.
getX() < 0 || event.
getY() < 0)
1311 int resizeHandles = 0;
1312 const unsigned y =
event.getY();
1313 const unsigned x =
event.getX();
1319 if ((
mGrip !=
nullptr) &&
1342 return resizeHandles;
1347 const int y =
event.getY();
1349 if ((
mGrip !=
nullptr) &&
1353 const int x =
event.getX();
1385 const int w,
const int h)
1456 if (
mSkin !=
nullptr)
1468 if (
mSkin !=
nullptr)
1488 const Widget *
const widget = *it;
1489 const int x = widget->
getX();
1490 const int y = widget->
getY();
1491 const int width = widget->
getWidth();
#define fromBool(val, name)
#define reportAlways(...)
virtual void add(Widget *const widget)
virtual void safeDrawChildren(Graphics *const graphics)
virtual void logicChildren()
WidgetList::const_iterator WidgetListConstIterator
virtual void drawChildren(Graphics *const graphics)
void windowRemoved(const Window *const window)
int getValueInt(const std::string &key, const int deflt) const
bool getValueBool(const std::string &key, const bool deflt) const
void setValue(const std::string &key, const std::string &value)
Widget * getSource() const
bool isFocused(const Widget *const widget) const
void generate(TextChunk &chunk)
int getWidth(const std::string &text) const
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
virtual void drawTileCollection(const ImageCollection *const vertCol)=0
virtual void calcTileCollection(ImageCollection *const vertCol, const Image *const image, int x, int y)=0
virtual void finalize(ImageCollection *const col)
virtual void calcWindow(ImageCollection *const vertCol, const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
virtual void drawImageRect(const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
void setRedraw(const bool n)
void setCursorType(const CursorT index)
MouseEvent * createMouseEvent(Window *const widget)
void removeDragged(const Widget *const widget)
LayoutCell & place(Widget *const wg, const int x, const int y, const int w, const int h)
void reflow(int &nW, int &nH)
void log(const char *const log_text,...)
bool isPointInRect(const int x_, const int y_) const
void unregisterWindowForReset(const Window *const window)
int getOption(const std::string &name) const
const ImageRect & getBorder() const
const Image * getCloseImage(const bool state) const
int getTitlePadding() const
const Image * getStickyImage(const bool state) const
void playGuiSound(const std::string &name)
void unload(Skin *const skin)
static std::string getThemePath()
static Image * getImageFromThemeXml(const std::string &name, const std::string &name2)
Skin * load(const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath)
void scheduleDelete(Widget *const widget)
void safeDraw(Graphics *const graphics)
void adjustSizeToScreen()
void mouseReleased(MouseEvent &event)
void setResizable(const bool resize)
void widgetHidden(const Event &event)
void setMaxWidth(const int width)
void centerHorisontally()
ContainerPlacer getPlacer(const int x, const int y)
virtual void setVisible(Visible visible)
bool isWindowVisible() const
bool getOptionBool(const std::string &name, const bool def) const
void setContentSize(int width, int height)
void adjustPositionAfterResize(const int oldScreenWidth, const int oldScreenHeight)
void reflowLayout(int w, int h)
ImageCollection * mVertexes
static int windowInstances
bool isResizeAllowed(const MouseEvent &event) const
int getOption(const std::string &name, const int def) const
void mouseExited(MouseEvent &event)
void mouseDragged(MouseEvent &event)
Window(const std::string &caption, const Modal modal, Window *const parent, std::string skin)
unsigned int mTitleBarHeight
Rect getWindowArea() const
virtual void resetToDefaultSize()
void setSticky(const bool sticky)
void setModal(const Modal modal)
Graphics::Alignment mCaptionAlign
void mouseEntered(MouseEvent &event)
void setMinHeight(const int height)
void mouseMoved(MouseEvent &event)
virtual void resizeToContent()
void setMaxHeight(const int height)
void setMinWidth(const int width)
void mousePressed(MouseEvent &event)
void widgetResized(const Event &event)
int getResizeHandles(const MouseEvent &event)
void widgetMoved(const Event &event)
void draw(Graphics *const graphics)
static void setWindowContainer(WindowContainer *const windowContainer)
void setCloseButton(const bool flag)
virtual void scheduleDelete()
void setPadding(int padding)
const std::string & getCaption() const
void setStickyButtonLock(const bool sticky)
LayoutCell & place(const int x, const int y, Widget *const wg, const int w, const int h)
void setLocationHorisontallyRelativeTo(const Widget *const widget)
void setLocationRelativeTo(const Widget *const widget)
void setTitleBarHeight(unsigned int height)
void setStickyButton(const bool flag)
static const unsigned resizeBorderWidth
void updateResizeHandler(MouseEvent &event)
@ CURSOR_RESIZE_DOWN_RIGHT
@ CURSOR_RESIZE_DOWN_LEFT
#define BLOCK_START(name)
#define isBatchDrawRenders(val)
SetupWindow * setupWindow
static const int buttonWidth
static const std::string SOUND_HIDE_WINDOW
static const std::string SOUND_SHOW_WINDOW
SoundManager soundManager
WindowContainer * windowContainer