2019-12-12 17:32:41 +01:00
|
|
|
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
2021-08-27 17:55:04 +02:00
|
|
|
#ifndef IRR_C_GUI_WINDOW_H_INCLUDED
|
|
|
|
#define IRR_C_GUI_WINDOW_H_INCLUDED
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
#include "IrrCompileConfig.h"
|
|
|
|
#ifdef _IRR_COMPILE_WITH_GUI_
|
|
|
|
|
|
|
|
#include "IGUIWindow.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace gui
|
|
|
|
{
|
|
|
|
class IGUIButton;
|
|
|
|
|
|
|
|
class CGUIWindow : public IGUIWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
|
|
|
|
|
|
|
|
//! destructor
|
|
|
|
virtual ~CGUIWindow();
|
|
|
|
|
|
|
|
//! called if an event happened.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool OnEvent(const SEvent& event) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! update absolute position
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void updateAbsolutePosition() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! draws the element and its children
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void draw() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns pointer to the close button
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual IGUIButton* getCloseButton() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns pointer to the minimize button
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual IGUIButton* getMinimizeButton() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns pointer to the maximize button
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual IGUIButton* getMaximizeButton() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns true if the window is draggable, false if not
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool isDraggable() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets whether the window is draggable
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setDraggable(bool draggable) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Set if the window background will be drawn
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setDrawBackground(bool draw) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Get if the window background will be drawn
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool getDrawBackground() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Set if the window titlebar will be drawn
|
|
|
|
//! Note: If the background is not drawn, then the titlebar is automatically also not drawn
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setDrawTitlebar(bool draw) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Get if the window titlebar will be drawn
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool getDrawTitlebar() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns the rectangle of the drawable area (without border and without titlebar)
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual core::rect<s32> getClientRect() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Writes attributes of the element.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Reads attributes of the element
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void updateClientRect();
|
|
|
|
void refreshSprites();
|
|
|
|
|
|
|
|
IGUIButton* CloseButton;
|
|
|
|
IGUIButton* MinButton;
|
|
|
|
IGUIButton* RestoreButton;
|
|
|
|
core::rect<s32> ClientRect;
|
|
|
|
video::SColor CurrentIconColor;
|
|
|
|
|
|
|
|
core::position2d<s32> DragStart;
|
|
|
|
bool Dragging, IsDraggable;
|
|
|
|
bool DrawBackground;
|
|
|
|
bool DrawTitlebar;
|
|
|
|
bool IsActive;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace gui
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
#endif // _IRR_COMPILE_WITH_GUI_
|
|
|
|
|
|
|
|
#endif
|