📄 layout.js
字号:
/*
* Isomorphic SmartClient
* Version 6.5 (2008-04-30)
* Copyright(c) 1998-2007 Isomorphic Software, Inc. All rights reserved.
* "SmartClient" is a trademark of Isomorphic Software, Inc.
*
* licensing@smartclient.com
*
* http://smartclient.com/license
*/
//> @class Layout//// A subclass of Canvas that automatically arranges other Canvases according to a layout policy.// <br><br>// A Layout manages a set of "member" Canvases initialized via the "members" property. Layouts// can have both "members", which are managed by the Layout, and normal Canvas children, which// are unmanaged.// <br><br>// Rather than using the Layout class directly, use the HLayout, VLayout, HStack and VStack// classes, which are subclasses of Layout preconfigured for horizontal or vertical stacking,// with the "fill" (VLayout) or "none" (VStack) +link{type:LayoutPolicy,policies} already set.// <br><br>// Layouts and Stacks may be nested to create arbitrarily complex layouts.// <br><br>// To show a resizer bar after (to the right or bottom of) a layout member, set showResizeBar to// true on that member component (not on the HLayout or VLayout). Resizer bars override// membersMargin spacing.// <br><br> // Like other Canvas subclasses, Layout and Stack components may have % width and height// values. To create a dynamically-resizing layout that occupies the entire page (or entire// parent component), set width and height to "100%".//// @see type:LayoutPolicy for available policies// @see class:VLayout// @see class:HLayout// @see class:VStack// @see class:HStack// @see class:LayoutSpacer// @treeLocation Client Reference/Layout// @visibility external//<isc.ClassFactory.defineClass("Layout","Canvas");isc.Layout.addClassProperties({ //> @type Orientation // @group orientation // @visibility external // @value isc.Layout.VERTICAL members laid out vertically // @value isc.Layout.HORIZONTAL members laid out horizontally //< //VERTICAL:"vertical", // NOTE: constant declared by Canvas //HORIZONTAL:"horizontal", // NOTE: constant declared by Canvas //> @type LayoutPolicy // Policy controlling how the Layout will manage member sizes on this axis. // <P> // See also +link{layout.overflow}. // // @value Layout.NONE // Layout does not try to size members on the axis at all, merely stacking them (length // axis) and leaving them at default breadth. // // @value Layout.FILL // Layout sizes members so that they fill the specified size of the layout. The rules // are: // <ul> // <li> Any component given an initial pixel size, programmatically resized to a specific // pixel size, or drag resized by user action is left at that exact size // <li> Any component that +link{button.autoFit,autofits} is given exactly the space it // needs, never forced to take up more. // <li> All other components split the remaining space equally, or according to their // relative percentages. // </ul> // // @visibility external FILL:"fill" //< //NONE:"none", // NOTE: constant declared by Canvas});isc.Layout.addProperties({ //> @attr layout.members (array : null : [IRW]) // An array of canvases that will be contained within this layout. You can set the // following properties on these canvases (in addition to the standard component // properties): // <ul> // <li>layoutAlign--specifies the member's alignment along the breadth axis; valid // values are "top", "center" and "bottom" for a horizontal layout and "left", "center" // and "right" for a vertical layout (see +link{layout.defaultLayoutAlign} for default // implementation.) // <li>showResizeBar--set to true to show a resize bar (default is false) // </ul> // Height and width settings found on members are interpreted by the Layout according to // the +link{layout.vPolicy,layout policy}. // @visibility external //< // Policy // --------------------------------------------------------------------------------------- //> @attr layout.overflow (Overflow : "visible" : IR) // Normal +link{type:Overflow} settings can be used on layouts, for example, an // overflow:auto Layout will scroll if members exceed its specified size, whereas an // overflow:visible Layout will grow to accomodate members. // // @group layoutPolicy // @visibility external //< //> @attr layout.orientation (Orientation : "horizontal" : AIRW) // Orientation of this layout. // @group layoutPolicy // @visibility external //< orientation:"horizontal", //> @attr layout.vPolicy (LayoutPolicy : "fill" : IRWA) // Sizing policy applied to members on vertical axis // @group layoutPolicy // @visibility external //< vPolicy:isc.Layout.FILL, //> @attr layout.hPolicy (LayoutPolicy : "fill" : IRWA) // Sizing policy applied to members on horizonal axis // @group layoutPolicy // @visibility external //< hPolicy:isc.Layout.FILL, //> @attr layout.enforcePolicy (boolean : true : IRWA) // Whether the layout policy is continuously enforced as new members are added or removed // and as members are resized. // <p> // This setting implies that any member that resizes larger, or any added member, will take // space from other members in order to allow the overall layout to stay the same size. // @group layoutPolicy // @visibility external //< enforcePolicy:true, //> @attr layout.defaultLayoutAlign (Alignment or VerticalAlignment : null : IR) // Specifies the default alignment for layout members on the breadth axis. Can be overridden // on a per-member basis by setting +link{canvas.layoutAlign}.<br> // If unset, default member layout alignment will be "top" for a horizontal layout, and // left for a vertical layout. // @group layoutMember // @group layoutPolicy // @visibility external //< //> @attr layout.align (Alignment or VerticalAlignment : null : IRW) // Alignment of all members in this Layout on the length axis. Defaults to "top" for // vertical Layouts, and "left" for horizontal Layouts. // @group layoutPolicy // @visibility external //< //align:null, // NB: you can achieve the same effect with a LayoutSpacer in the first slot, but that // throws off member numbering //> @attr layout.reverseOrder (boolean : false : IRW) // Reverse the order of stacking for this Layout, so that the last member is shown first. // <P> // Requires a manual call to <code>reflow()</code> if changed on the fly. // <P> // In RTL mode, for horizontal Layouts the value of this flag will be flipped during // initialization. // @group layoutPolicy // @visibility external //< // Margins and Spacing // --------------------------------------------------------------------------------------- //> @attr layout.paddingAsLayoutMargin (boolean : true : IRWA) // If this widget has padding specified (as +link{canvas.padding, this.padding} or in the // CSS style applied to this layout), should it show up as space outside the members, // similar to layoutMargin? // <P> // If this setting is false, padding will not affect member positioning (as CSS padding // normally does not affect absolutely positioned children). Leaving this setting true // allows a designer to more effectively control layout purely from CSS. // <P> // Note that +link{layout.layoutMargin} if specified, takes precidence over this value. // @group layoutMargin // @visibility external //< paddingAsLayoutMargin:true, _suppressOuterDivPadding:true, //> @attr layout.layoutMargin (integer : null : [IRW]) // Space outside of all members. This attribute, along with +link{layout.layoutLeftMargin} // and related properties does not have a true setter method.<br> // It may be assigned directly at runtime. After setting the property, // +link{layout.setLayoutMargin()} may be called with no arguments to reflow the layout. // @see layoutLeftMargin // @see layoutRightMargin // @see layoutBottomMargin // @see layoutTopMargin // @see paddingAsLayoutMargin // @setter none (see +link{layout.setLayoutMargin()}) // @group layoutMargin // @visibility external // @example userSizing //<// layoutMargin:null, //> @attr layout.layoutLeftMargin (integer : null : [IRW]) // Space outside of all members, on the left-hand side. Defaults to +link{layoutMargin}. // <P> // Requires a manual call to <code>setLayoutMargin()</code> if changed on the fly. // @group layoutMargin // @visibility external //< //> @attr layout.layoutRightMargin (integer : null : [IRW]) // Space outside of all members, on the right-hand side. Defaults to +link{layoutMargin}. // <P> // Requires a manual call to <code>setLayoutMargin()</code> if changed on the fly. // @group layoutMargin // @visibility external //< //> @attr layout.layoutTopMargin (integer : null : [IRW]) // Space outside of all members, on the top side. Defaults to +link{layoutMargin}. // <P> // Requires a manual call to <code>setLayoutMargin()</code> if changed on the fly. // @group layoutMargin // @visibility external //< //> @attr layout.layoutBottomMargin (integer : null : [IRW]) // Space outside of all members, on the bottom side. Defaults to +link{layoutMargin}. // <P> // Requires a manual call to <code>setLayoutMargin()</code> if changed on the fly. // @group layoutMargin // @visibility external //< //> @attr layout.membersMargin (integer : 0 : [IRW]) // Space between each member of the layout. // <P> // Requires a manual call to <code>reflow()</code> if changed on the fly. // @group layoutMargin // @visibility external // @example userSizing //< membersMargin:0, //> @attr layout.leaveScrollbarGap (boolean : false : IR) // Whether to leave a gap for a vertical scrollbar even when one is not actually present. // <P> // This setting avoids the layout resizing all members when the vertical scrollbar is // introduced or removed, which can avoid unnecessary screen shifting and improve // performance. // // @visibility external //< //> @attr layout.memberOverlap (positiveInteger : 0 : IR) // Number of pixels by which each member should overlap the preceding member, used for // creating an "stack of cards" appearance for the members of a Layout. // <P> // <code>memberOverlap</code> can be used in conjunction with +link{stackZIndex} to create // a particular visual stacking order. // <P> // Note that overlap of individual members can be accomplished with a negative setting for // +link{canvas.extraSpace}. // // @group layoutMember // @visibility external //< // ResizeBars // --------------------------------------------------------------------------------------- //> @attr layout.resizeBarClass (String : "Splitbar" : AIRW) // Class to use for creating resizeBars. // <P> // A resize bar will be created for any Layout member that specifies // +link{canvas.showResizeBar,<code>showResizeBar:true</code>}. // Resize bars will be instances of the class specified by this property, and will // automatically be sized to the member's breadth and to the thickness // given by +link{layout.resizeBarSize}.<br> // Classes that are valid by default are +link{Splitbar} and +link{ImgSplitbar}. // <P> // To customize the appearance or behavior of resizeBars within some layout a custom // resize bar class can be created by subclassing +link{Splitbar} or +link{ImgSplitbar} and // setting this property on your layout to use your new class. // <P> // Resize bars will automatically be sized to the member's breadth and to the thickness // given by <code>layout.resizeBarSize</code>. The built-in Splitbar class supports // drag resizing of its target member, and clicking on the bar to hide the target member. // // @see class:Splitbar // @see class:ImgSplitbar // @see attr:layout.resizeBarSize // @visibility external //< resizeBarClass:"Splitbar", //> @attr layout.resizeBarSize (integer : 7 : AIRW) // Thickness of the resizeBars in pixels // @visibility external //<
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -