wrapsizer.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wrapsizer.h
  3. // Purpose: interface of wxWrapSizer
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. // flags for wxWrapSizer
  8. enum
  9. {
  10. wxEXTEND_LAST_ON_EACH_LINE,
  11. wxREMOVE_LEADING_SPACES,
  12. wxWRAPSIZER_DEFAULT_FLAGS
  13. };
  14. /**
  15. @class wxWrapSizer
  16. A wrap sizer lays out its items in a single line, like a box sizer -- as long
  17. as there is space available in that direction.
  18. Once all available space in the primary direction has been used, a new line
  19. is added and items are added there.
  20. So a wrap sizer has a primary orientation for adding items, and adds lines
  21. as needed in the secondary direction.
  22. @library{wxcore}
  23. @category{winlayout}
  24. @see wxBoxSizer, wxSizer, @ref overview_sizer
  25. */
  26. class wxWrapSizer : public wxBoxSizer
  27. {
  28. public:
  29. /**
  30. Constructor for a wxWrapSizer.
  31. @a orient determines the primary direction of the sizer (the most common
  32. case being @c wxHORIZONTAL). The flags parameter can be a combination of
  33. the values @c wxEXTEND_LAST_ON_EACH_LINE which will cause the last item
  34. on each line to use any remaining space on that line and @c wxREMOVE_LEADING_SPACES
  35. which removes any spacer elements from the beginning of a row.
  36. Both of these flags are on by default.
  37. */
  38. wxWrapSizer(int orient = wxHORIZONTAL,
  39. int flags = wxWRAPSIZER_DEFAULT_FLAGS);
  40. /**
  41. Not used by an application.
  42. This is the mechanism by which sizers can inform sub-items of the first
  43. determined size component.
  44. The sub-item can then better determine its size requirements.
  45. Returns @true if the information was used (and the sub-item min size was
  46. updated).
  47. */
  48. virtual bool InformFirstDirection(int direction, int size,
  49. int availableOtherDir);
  50. virtual void RecalcSizes();
  51. virtual wxSize CalcMin();
  52. protected:
  53. /**
  54. Can be overridden in the derived classes to treat some normal items as
  55. spacers.
  56. This method is used to determine whether the given @a item should be
  57. considered to be a spacer for the purposes of @c wxREMOVE_LEADING_SPACES
  58. implementation. By default only returns @true for the real spacers.
  59. */
  60. virtual bool IsSpaceItem(wxSizerItem *item) const;
  61. };