Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.1KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef DGL_LAYOUT_HPP_INCLUDED
  17. #define DGL_LAYOUT_HPP_INCLUDED
  18. #include "Geometry.hpp"
  19. #include <list>
  20. START_NAMESPACE_DGL
  21. class SubWidget;
  22. // --------------------------------------------------------------------------------------------------------------------
  23. // NOTE: under development, API to be finalized and documented soon
  24. enum SizeHint {
  25. Expanding,
  26. Fixed
  27. };
  28. struct SubWidgetWithSizeHint {
  29. SubWidget* widget;
  30. SizeHint sizeHint;
  31. };
  32. template<bool horizontal>
  33. struct Layout
  34. {
  35. std::list<SubWidgetWithSizeHint> widgets;
  36. uint setAbsolutePos(int x, int y, uint padding);
  37. void setSize(uint size, uint padding);
  38. };
  39. typedef Layout<true> HorizontalLayout;
  40. typedef Layout<false> VerticalLayout;
  41. struct HorizontallyStackedVerticalLayout
  42. {
  43. std::list<VerticalLayout*> items;
  44. Size<uint> adjustSize(uint padding); // TODO
  45. void setAbsolutePos(int x, int y, uint padding);
  46. };
  47. struct VerticallyStackedHorizontalLayout
  48. {
  49. std::list<HorizontalLayout*> items;
  50. Size<uint> adjustSize(uint padding);
  51. void setAbsolutePos(int x, int y, uint padding);
  52. };
  53. // --------------------------------------------------------------------------------------------------------------------
  54. END_NAMESPACE_DGL
  55. #endif // DGL_LAYOUT_HPP_INCLUDED