clean up indentation and spacing
[supercollider.git] / SCClassLibrary / Common / GUI / Base / EZPopUpMenu.sc
blob5ac8aadbae66d63dfd0668056928354469ab32ea
1 EZPopUpMenu : EZLists{
3         initViews{ arg parentView, bounds, label, labelWidth,labelHeight,arglayout;
4                 var labelBounds, listBounds;
6                 labelWidth = labelWidth ? 80;
7                 layout=arglayout ? \horz;
8                 labelSize=labelWidth@labelHeight;
10                 bounds.isNil.if{bounds= 160@20};
12                 // if no parent, then pop up window
13                 # view,bounds = this.prMakeView( parentView,bounds);
15                 // calcualate bounds
16                 # labelBounds,listBounds = this.prSubViewBounds(innerBounds, label.notNil);
18                 // insert the views
20                 label.notNil.if{ //only add a label if desired
21                         if (layout==\vert){
22                                 labelView = GUI.staticText.new(view, labelBounds).resize_(2);
23                                 labelView.align = \left;
24                                 }{
25                                 labelView = GUI.staticText.new(view, labelBounds);
26                                 labelView.align = \right;
27                                 };
28                         labelView.string = label;
29                 };
31                 widget = GUI.popUpMenu.new(view, listBounds).resize_(5);
32         }
34         menu {^ widget}
36         setColors{arg stringBackground, stringColor, menuBackground,  menuStringColor,background ;
38                         stringBackground.notNil.if{
39                                 labelView.notNil.if{labelView.background_(stringBackground)};};
40                         stringColor.notNil.if{
41                                 labelView.notNil.if{labelView.stringColor_(stringColor)};};
42                         menuBackground.notNil.if{
43                                 this.menu.background_(menuBackground);};
44                         menuStringColor.notNil.if{
45                                 this.menu.stringColor_(menuStringColor);};
46                         background.notNil.if{
47                                 view.background=background;};
48         }