ASPiK SDK
crowcolumnview.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __crowcolumnview__
6 #define __crowcolumnview__
7 
8 #include "cviewcontainer.h"
9 
10 namespace VSTGUI {
11 
12 // a container view which automatically layout its child views
16 {
17 public:
18  explicit CAutoLayoutContainerView (const CRect& size);
19 
20  virtual void layoutViews () = 0;
21 
22  bool attached (CView* parent) override;
23  void setViewSize (const CRect& rect, bool invalid = true) override;
24  bool addView (CView* pView) override;
25  bool addView (CView* pView, const CRect& mouseableArea, bool mouseEnabled = true) override;
26  bool addView (CView* pView, CView* pBefore) override;
27  bool removeView (CView* pView, bool withForget = true) override;
28  bool changeViewZOrder (CView* view, uint32_t newIndex) override;
29 
30  CLASS_METHODS_VIRTUAL(CAutoLayoutContainerView, CViewContainer)
31 };
32 
33 
34 //-----------------------------------------------------------------------------
35 // CRowColumnView Declaration
39 //-----------------------------------------------------------------------------
41 {
42 public:
43  enum Style
44  {
47  };
48 
50  {
55  };
56 
57  CRowColumnView (const CRect& size, Style style = kRowStyle, LayoutStyle layoutStyle = kLeftTopEqualy, CCoord spacing = 0., const CRect& margin = CRect (0., 0., 0., 0.));
58 
59  Style getStyle () const { return style; }
60  void setStyle (Style style);
61 
62  CCoord getSpacing () const { return spacing; }
63  void setSpacing (CCoord spacing);
64 
65  const CRect& getMargin () const { return margin; }
66  void setMargin (const CRect& margin);
67 
68  bool isAnimateViewResizing () const;
69  void setAnimateViewResizing (bool state);
70 
71  uint32_t getViewResizeAnimationTime () const { return viewResizeAnimationTime; }
72  void setViewResizeAnimationTime (uint32_t ms) { viewResizeAnimationTime = ms; }
73 
74  bool hideClippedSubviews () const;
75  void setHideClippedSubviews (bool state);
76 
77  LayoutStyle getLayoutStyle () const { return layoutStyle; }
78  void setLayoutStyle (LayoutStyle style);
79 
80  void layoutViews () override;
81  bool sizeToFit () override;
82  CMessageResult notify (CBaseObject* sender, IdStringPtr message) override;
83 
84  CLASS_METHODS(CRowColumnView, CAutoLayoutContainerView)
85 protected:
86  void getMaxChildViewSize (CPoint& maxSize);
87  void layoutViewsEqualSize ();
88  void resizeSubView (CView* view, const CRect& newSize);
89 
90  enum {
91  kAnimateViewResizing = 1 << 0,
92  kHideClippedSubViews = 1 << 1,
93  };
94 
95  Style style;
96  LayoutStyle layoutStyle;
97  CCoord spacing;
98  CRect margin;
99  int32_t flags;
100  bool layoutGuard;
101  uint32_t viewResizeAnimationTime;
102 };
103 
104 } // namespace
105 
106 #endif // __crowcolumnview__
subviews are centered to each other
Definition: crowcolumnview.h:52
void invalid() override
mark whole view as invalid
Definition: cviewcontainer.cpp:618
Container Class of CView objects.
Definition: cviewcontainer.h:52
bool sizeToFit() override
resize view to optimal size
Definition: crowcolumnview.cpp:204
Rect structure.
Definition: crect.h:17
LayoutStyle
Definition: crowcolumnview.h:49
subviews have the same left or top position (default)
Definition: crowcolumnview.h:51
Definition: crowcolumnview.h:15
subviews are arranged as rows (top to bottom)
Definition: crowcolumnview.h:45
a view container which layouts its subview as rows or columns
Definition: crowcolumnview.h:40
Definition: customcontrols.cpp:8
subviews have the same right or bottom position
Definition: crowcolumnview.h:53
bool attached(CView *parent) override
view is attached to a parent view
Definition: crowcolumnview.cpp:267
Base Class of all view objects.
Definition: cview.h:44
bool removeView(CView *pView, bool withForget=true) override
remove a child view
Definition: crowcolumnview.cpp:322
bool addView(CView *pView) override
add a child view
Definition: crowcolumnview.cpp:286
Style
Definition: crowcolumnview.h:43
stretch subviews to the same width and height
Definition: crowcolumnview.h:54
subviews are arranged as columns (left to right)
Definition: crowcolumnview.h:46
bool changeViewZOrder(CView *view, uint32_t newIndex) override
change view z order position
Definition: crowcolumnview.cpp:334
void setViewSize(const CRect &rect, bool invalid=true) override
set views size
Definition: crowcolumnview.cpp:278