deprecate SCViewHolder-layRight
[supercollider.git] / SCClassLibrary / Common / GUI / viewExtensions.sc
blob5d98acef885c8e2d409358740e9b57c87f53417a
2 + FlowView {
4         // place a FlowView on this FlowView
5         flow { arg func,bounds;
6                 var f,consumed,b;
7                 if(bounds.notNil,{
8                         f = FlowView(this,bounds);
9                         func.value(f);
10                         ^f
11                 });
12                 f = FlowView(this,this.allocateRemaining);
13                 func.value(f);
14                 consumed = f.resizeToFit;
15                 // did we exceed ?
16                 if(this.decorator.bounds.containsRect(consumed).not,{
17                         // yes
18                         // pretend I just consumed nothing
19                         this.didUseAllocated(consumed.resizeTo(0,0));
21                         // goto the next line
22                         this.decorator.nextLine; // don't put a StartRow in there, the decorator should auto-flow on resize
23                         // take everything
24                         b = this.allocateRemaining;
25                         // and if its too big for that then it will just have to jutt or scroll over
26                         // that's what you asked for.
27                         // move the last object there
28                         f.bounds = b;
29                         // reflow the sub view
30                         f.reflowAll.resizeToFit;
31                         this.didUseAllocated(f.bounds);
32                 },{
33                         this.didUseAllocated(consumed);
34                 });
35                 ^f
36         }
38         horz { arg func,bounds,spacing;
39                 var comp;
40                 comp = GUI.hLayoutView.new(this,bounds ?? { this.indentedRemaining });
41                 try { // not on Qt
42                         comp.spacing = spacing ? GUI.skin.gap.x;
43                 };
44                 func.value(comp);
45                 ^comp
46         }
47         vert { arg func,bounds,spacing;
48                 var comp;
49                 comp = GUI.vLayoutView.new(this,bounds ?? { this.indentedRemaining });
50                 try { // not on Qt
51                         comp.spacing = spacing ? GUI.skin.gap.y;
52                 };
53                 func.value(comp);
54                 ^comp
55         }
56         comp { arg func,bounds;
57                 var comp;
58                 comp = GUI.compositeView.new(this,bounds ?? { this.indentedRemaining });
59                 func.value(comp);
60                 ^comp
61         }
62         scroll { arg func,bounds,
63                                 autohidesScrollers=true,autoScrolls=true,
64                                 hasHorizontalScroller=true,hasVerticalScroller=true;
65                 var comp;
66                 comp = GUI.scrollView.new(this,bounds ?? { this.bounds });
67                 comp.autohidesScrollers = autohidesScrollers;
68                 try { // not on Qt
69                         comp.autoScrolls = autoScrolls;
70                 };
71                 comp.hasHorizontalScroller = hasHorizontalScroller;
72                 comp.hasVerticalScroller = hasVerticalScroller;
73                 func.value(comp);
74                 ^comp
75         }