guiEditBoxWithScrollbar.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt, Modified by Mustapha Tachouct
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef GUIEDITBOXWITHSCROLLBAR_HEADER
  5. #define GUIEDITBOXWITHSCROLLBAR_HEADER
  6. #include "guiEditBox.h"
  7. class ISimpleTextureSource;
  8. class GUIEditBoxWithScrollBar : public GUIEditBox
  9. {
  10. public:
  11. //! constructor
  12. GUIEditBoxWithScrollBar(const wchar_t* text, bool border, IGUIEnvironment* environment,
  13. IGUIElement* parent, s32 id, const core::rect<s32>& rectangle,
  14. ISimpleTextureSource *tsrc, bool writable = true, bool has_vscrollbar = true);
  15. //! destructor
  16. virtual ~GUIEditBoxWithScrollBar() {}
  17. //! Sets whether to draw the background
  18. virtual void setDrawBackground(bool draw);
  19. //! draws the element and its children
  20. virtual void draw();
  21. //! Updates the absolute position, splits text if required
  22. virtual void updateAbsolutePosition();
  23. //! Change the background color
  24. virtual void setBackgroundColor(const video::SColor &bg_color);
  25. virtual bool isDrawBackgroundEnabled() const;
  26. virtual bool isDrawBorderEnabled() const;
  27. virtual void setCursorChar(const wchar_t cursorChar);
  28. virtual wchar_t getCursorChar() const;
  29. virtual void setCursorBlinkTime(irr::u32 timeMs);
  30. virtual irr::u32 getCursorBlinkTime() const;
  31. protected:
  32. //! Breaks the single text line.
  33. virtual void breakText();
  34. //! sets the area of the given line
  35. virtual void setTextRect(s32 line);
  36. //! calculates the current scroll position
  37. void calculateScrollPos();
  38. //! calculated the FrameRect
  39. void calculateFrameRect();
  40. //! create a Vertical ScrollBar
  41. void createVScrollBar();
  42. s32 getCursorPos(s32 x, s32 y);
  43. bool m_background;
  44. bool m_bg_color_used;
  45. video::SColor m_bg_color;
  46. ISimpleTextureSource *m_tsrc;
  47. };
  48. #endif // GUIEDITBOXWITHSCROLLBAR_HEADER