BsGUIScrollBarHorz.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #include "BsGUIScrollBarHorz.h"
  2. #include "BsGUIElementStyle.h"
  3. #include "BsGUISkin.h"
  4. #include "BsGUIWidget.h"
  5. #include "BsGUILayoutOptions.h"
  6. #include "BsGUILayout.h"
  7. #include "CmException.h"
  8. using namespace CamelotFramework;
  9. namespace BansheeEngine
  10. {
  11. GUIScrollBarHorz::GUIScrollBarHorz(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
  12. :GUIElement(parent, style, layoutOptions), mLayout(nullptr)
  13. {
  14. // TODO - Init mLayout
  15. }
  16. GUIScrollBarHorz::~GUIScrollBarHorz()
  17. {
  18. }
  19. UINT32 GUIScrollBarHorz::getNumRenderElements() const
  20. {
  21. return 0;
  22. }
  23. const HMaterial& GUIScrollBarHorz::getMaterial(UINT32 renderElementIdx) const
  24. {
  25. CM_EXCEPT(InternalErrorException, "Invalid render element index. This class has no render elements.");
  26. }
  27. UINT32 GUIScrollBarHorz::getNumQuads(UINT32 renderElementIdx) const
  28. {
  29. return 0;
  30. }
  31. void GUIScrollBarHorz::updateRenderElementsInternal()
  32. { }
  33. UINT32 GUIScrollBarHorz::_getOptimalWidth() const
  34. {
  35. return mLayout->_getOptimalWidth();
  36. }
  37. UINT32 GUIScrollBarHorz::_getOptimalHeight() const
  38. {
  39. return mLayout->_getOptimalHeight();
  40. }
  41. void GUIScrollBarHorz::fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads,
  42. UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const
  43. { }
  44. GUIScrollBarHorz* GUIScrollBarHorz::create(GUIWidget& parent, const GUIElementStyle* style)
  45. {
  46. if(style == nullptr)
  47. {
  48. const GUISkin* skin = parent.getSkin();
  49. style = skin->getStyle(getGUITypeName());
  50. }
  51. return new (cm_alloc<GUIScrollBarHorz, PoolAlloc>()) GUIScrollBarHorz(parent, style, getDefaultLayoutOptions(style));
  52. }
  53. GUIScrollBarHorz* GUIScrollBarHorz::create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style)
  54. {
  55. if(style == nullptr)
  56. {
  57. const GUISkin* skin = parent.getSkin();
  58. style = skin->getStyle(getGUITypeName());
  59. }
  60. return new (cm_alloc<GUIScrollBarHorz, PoolAlloc>()) GUIScrollBarHorz(parent, style, layoutOptions);
  61. }
  62. const String& GUIScrollBarHorz::getGUITypeName()
  63. {
  64. static String typeName = "ScrollBarHorz";
  65. return typeName;
  66. }
  67. }