IGUITabControl.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 __I_GUI_TAB_CONTROL_H_INCLUDED__
  5. #define __I_GUI_TAB_CONTROL_H_INCLUDED__
  6. #include "IGUIElement.h"
  7. #include "SColor.h"
  8. #include "IGUISkin.h"
  9. namespace irr
  10. {
  11. namespace gui
  12. {
  13. //! A tab-page, onto which other gui elements could be added.
  14. /** IGUITab refers to the page itself, not to the tab in the tabbar of an IGUITabControl. */
  15. class IGUITab : public IGUIElement
  16. {
  17. public:
  18. //! constructor
  19. IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
  20. : IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}
  21. //! Returns zero based index of tab if in tabcontrol.
  22. /** Can be accessed later IGUITabControl::getTab() by this number.
  23. Note that this number can change when other tabs are inserted or removed .
  24. */
  25. virtual s32 getNumber() const = 0;
  26. //! sets if the tab should draw its background
  27. virtual void setDrawBackground(bool draw=true) = 0;
  28. //! sets the color of the background, if it should be drawn.
  29. virtual void setBackgroundColor(video::SColor c) = 0;
  30. //! returns true if the tab is drawing its background, false if not
  31. virtual bool isDrawingBackground() const = 0;
  32. //! returns the color of the background
  33. virtual video::SColor getBackgroundColor() const = 0;
  34. //! sets the color of the text
  35. virtual void setTextColor(video::SColor c) = 0;
  36. //! gets the color of the text
  37. virtual video::SColor getTextColor() const = 0;
  38. };
  39. //! A standard tab control
  40. /** \par This element can create the following events of type EGUI_EVENT_TYPE:
  41. \li EGET_TAB_CHANGED
  42. */
  43. class IGUITabControl : public IGUIElement
  44. {
  45. public:
  46. //! constructor
  47. IGUITabControl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
  48. : IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {}
  49. //! Adds a tab
  50. virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1) = 0;
  51. //! Insert the tab at the given index
  52. /** \return The tab on success or NULL on failure. */
  53. virtual IGUITab* insertTab(s32 idx, const wchar_t* caption, s32 id=-1) = 0;
  54. //! Removes a tab from the tabcontrol
  55. virtual void removeTab(s32 idx) = 0;
  56. //! Clears the tabcontrol removing all tabs
  57. virtual void clear() = 0;
  58. //! Returns amount of tabs in the tabcontrol
  59. virtual s32 getTabCount() const = 0;
  60. //! Returns a tab based on zero based index
  61. /** \param idx: zero based index of tab. Is a value betwenn 0 and getTabcount()-1;
  62. \return Returns pointer to the Tab. Returns 0 if no tab
  63. is corresponding to this tab. */
  64. virtual IGUITab* getTab(s32 idx) const = 0;
  65. //! Brings a tab to front.
  66. /** \param idx: number of the tab.
  67. \return Returns true if successful. */
  68. virtual bool setActiveTab(s32 idx) = 0;
  69. //! Brings a tab to front.
  70. /** \param tab: pointer to the tab.
  71. \return Returns true if successful. */
  72. virtual bool setActiveTab(IGUITab *tab) = 0;
  73. //! Returns which tab is currently active
  74. virtual s32 getActiveTab() const = 0;
  75. //! get the the id of the tab at the given absolute coordinates
  76. /** \return The id of the tab or -1 when no tab is at those coordinates*/
  77. virtual s32 getTabAt(s32 xpos, s32 ypos) const = 0;
  78. //! Set the height of the tabs
  79. virtual void setTabHeight( s32 height ) = 0;
  80. //! Get the height of the tabs
  81. /** return Returns the height of the tabs */
  82. virtual s32 getTabHeight() const = 0;
  83. //! set the maximal width of a tab. Per default width is 0 which means "no width restriction".
  84. virtual void setTabMaxWidth(s32 width ) = 0;
  85. //! get the maximal width of a tab
  86. virtual s32 getTabMaxWidth() const = 0;
  87. //! Set the alignment of the tabs
  88. /** Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT */
  89. virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0;
  90. //! Get the alignment of the tabs
  91. /** return Returns the alignment of the tabs */
  92. virtual gui::EGUI_ALIGNMENT getTabVerticalAlignment() const = 0;
  93. //! Set the extra width added to tabs on each side of the text
  94. virtual void setTabExtraWidth( s32 extraWidth ) = 0;
  95. //! Get the extra width added to tabs on each side of the text
  96. /** return Returns the extra width of the tabs */
  97. virtual s32 getTabExtraWidth() const = 0;
  98. };
  99. } // end namespace gui
  100. } // end namespace irr
  101. #endif