CGUIWindow.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef __C_GUI_WINDOW_H_INCLUDED__
  5. #define __C_GUI_WINDOW_H_INCLUDED__
  6. #include "IrrCompileConfig.h"
  7. #ifdef _IRR_COMPILE_WITH_GUI_
  8. #include "IGUIWindow.h"
  9. namespace irr
  10. {
  11. namespace gui
  12. {
  13. class IGUIButton;
  14. class CGUIWindow : public IGUIWindow
  15. {
  16. public:
  17. //! constructor
  18. CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
  19. //! destructor
  20. virtual ~CGUIWindow();
  21. //! called if an event happened.
  22. virtual bool OnEvent(const SEvent& event);
  23. //! update absolute position
  24. virtual void updateAbsolutePosition();
  25. //! draws the element and its children
  26. virtual void draw();
  27. //! Returns pointer to the close button
  28. virtual IGUIButton* getCloseButton() const;
  29. //! Returns pointer to the minimize button
  30. virtual IGUIButton* getMinimizeButton() const;
  31. //! Returns pointer to the maximize button
  32. virtual IGUIButton* getMaximizeButton() const;
  33. //! Returns true if the window is draggable, false if not
  34. virtual bool isDraggable() const;
  35. //! Sets whether the window is draggable
  36. virtual void setDraggable(bool draggable);
  37. //! Set if the window background will be drawn
  38. virtual void setDrawBackground(bool draw);
  39. //! Get if the window background will be drawn
  40. virtual bool getDrawBackground() const;
  41. //! Set if the window titlebar will be drawn
  42. //! Note: If the background is not drawn, then the titlebar is automatically also not drawn
  43. virtual void setDrawTitlebar(bool draw);
  44. //! Get if the window titlebar will be drawn
  45. virtual bool getDrawTitlebar() const;
  46. //! Returns the rectangle of the drawable area (without border and without titlebar)
  47. virtual core::rect<s32> getClientRect() const;
  48. //! Writes attributes of the element.
  49. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
  50. //! Reads attributes of the element
  51. virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
  52. protected:
  53. void updateClientRect();
  54. void refreshSprites();
  55. IGUIButton* CloseButton;
  56. IGUIButton* MinButton;
  57. IGUIButton* RestoreButton;
  58. core::rect<s32> ClientRect;
  59. video::SColor CurrentIconColor;
  60. core::position2d<s32> DragStart;
  61. bool Dragging, IsDraggable;
  62. bool DrawBackground;
  63. bool DrawTitlebar;
  64. bool IsActive;
  65. };
  66. } // end namespace gui
  67. } // end namespace irr
  68. #endif // _IRR_COMPILE_WITH_GUI_
  69. #endif