UIPreferredSize.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #include "UIPreferredSize.h"
  2. namespace Atomic
  3. {
  4. UIPreferredSize::UIPreferredSize(int w, int h) :
  5. preferredSize_(w, h)
  6. {
  7. preferredSize_.max_w = w == 0 ? 10000 : w;
  8. preferredSize_.max_h = h == 0 ? 10000 : h;
  9. }
  10. UIPreferredSize::~UIPreferredSize()
  11. {
  12. }
  13. int UIPreferredSize::GetMinWidth() const
  14. {
  15. return preferredSize_.min_w;
  16. }
  17. int UIPreferredSize::GetMinHeight() const
  18. {
  19. return preferredSize_.min_h;
  20. }
  21. int UIPreferredSize::GetMaxWidth() const
  22. {
  23. return preferredSize_.max_w;
  24. }
  25. int UIPreferredSize::GetMaxHeight() const
  26. {
  27. return preferredSize_.max_h;
  28. }
  29. int UIPreferredSize::GetPrefWidth() const
  30. {
  31. return preferredSize_.pref_w;
  32. }
  33. int UIPreferredSize::GetPrefHeight() const
  34. {
  35. return preferredSize_.pref_h;
  36. }
  37. UI_SIZE_DEP UIPreferredSize::GetSizeDep() const
  38. {
  39. return (UI_SIZE_DEP) preferredSize_.size_dependency;
  40. }
  41. void UIPreferredSize::SetMinWidth(int w)
  42. {
  43. preferredSize_.min_w = w;
  44. }
  45. void UIPreferredSize::SetMinHeight(int h)
  46. {
  47. preferredSize_.min_h = h;
  48. }
  49. void UIPreferredSize::SetMaxWidth(int w)
  50. {
  51. preferredSize_.max_w = w;
  52. }
  53. void UIPreferredSize::SetMaxHeight(int h)
  54. {
  55. preferredSize_.max_h = h;
  56. }
  57. void UIPreferredSize::SetPrefWidth(int w)
  58. {
  59. preferredSize_.pref_w = w;
  60. }
  61. void UIPreferredSize::SetPrefHeight(int h)
  62. {
  63. preferredSize_.pref_h = h;
  64. }
  65. void UIPreferredSize::SetSizeDep(UI_SIZE_DEP dep)
  66. {
  67. preferredSize_.size_dependency = (tb::SIZE_DEP) dep;
  68. }
  69. }