UILayoutTool.st
changeset 1826 25ddfdfe0bf9
parent 1804 0c4b026a7add
child 1858 4a73301e4eb4
equal deleted inserted replaced
1825:58bcec422efd 1826:25ddfdfe0bf9
    44 	privateIn:UILayoutTool
    44 	privateIn:UILayoutTool
    45 !
    45 !
    46 
    46 
    47 UILayoutTool::AnyLayout subclass:#LayoutFrame
    47 UILayoutTool::AnyLayout subclass:#LayoutFrame
    48 	instanceVariableNames:''
    48 	instanceVariableNames:''
    49 	classVariableNames:''
    49 	classVariableNames:'DefaultFixPartHeight'
    50 	poolDictionaries:''
    50 	poolDictionaries:''
    51 	privateIn:UILayoutTool
    51 	privateIn:UILayoutTool
    52 !
    52 !
    53 
    53 
    54 UILayoutTool::AnyLayout subclass:#LayoutOrigin
    54 UILayoutTool::AnyLayout subclass:#LayoutOrigin
   536     layoutView := aView.
   536     layoutView := aView.
   537     layoutSpec := aSpec.
   537     layoutSpec := aSpec.
   538 
   538 
   539     (self aspectFor:#defaultExtentEnabled) value:(aSpec class ==  WindowSpec) not.
   539     (self aspectFor:#defaultExtentEnabled) value:(aSpec class ==  WindowSpec) not.
   540 
   540 
   541     aTypeOrNil notNil ifTrue:[
   541     aTypeOrNil notNil ifTrue:[ 
   542         self class slices findFirst:[:e|
   542         self class slices findFirst:[:e|
   543             e last == aTypeOrNil ifTrue:[name := e first. true]
   543             e last == aTypeOrNil ifTrue:[name := e first. true]
   544         ].
   544         ].
   545         list := Array with:name
   545         list := Array with:name with: 'Frame'.
   546     ] ifFalse:[
   546     ] ifFalse:[
   547         (type := UIPainterView layoutType:layoutView) notNil ifTrue:[
   547         (type := UIPainterView layoutType:layoutView) notNil ifTrue:[
   548             self class slices findFirst:[:e|
   548             self class slices findFirst:[:e|
   549                 e last == type ifTrue:[name := e first. true]
   549                 e last == type ifTrue:[name := e first. true]
   550             ].
   550             ].
   551             list := tabList.
   551             list := tabList.
   552 
   552             type == #Extent ifTrue:[ 
   553             type == #Extent ifTrue:[
       
   554                 aView superView specClass isLayoutContainer ifTrue:[
   553                 aView superView specClass isLayoutContainer ifTrue:[
   555                     list := Array with:name
   554                     list := Array with:name
   556                 ] ifFalse:[
   555                 ] ifFalse:[
   557                     list := list copyWith:name
   556                     list := list copyWith:name
   558                 ]
   557                 ]
  1562   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset)   value) ? 0)
  1561   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset)   value) ? 0)
  1563                      y:(((self aspectFor:#rightOffset)  value) ? 0)
  1562                      y:(((self aspectFor:#rightOffset)  value) ? 0)
  1564 
  1563 
  1565 ! !
  1564 ! !
  1566 
  1565 
       
  1566 !UILayoutTool::LayoutFrame class methodsFor:'defaults'!
       
  1567 
       
  1568 defaultFixPartHeight
       
  1569     ^ DefaultFixPartHeight ? 30
       
  1570 ! !
       
  1571 
  1567 !UILayoutTool::LayoutFrame class methodsFor:'help specs'!
  1572 !UILayoutTool::LayoutFrame class methodsFor:'help specs'!
  1568 
  1573 
  1569 helpSpec
  1574 helpSpec
  1570     "This resource specification was automatically generated
  1575     "This resource specification was automatically generated
  1571      by the UIHelpTool of ST/X."
  1576      by the UIHelpTool of ST/X."
  2198               layout: (LayoutFrame 6 0.0 255 0 -4 1.0 287 0)
  2203               layout: (LayoutFrame 6 0.0 255 0 -4 1.0 287 0)
  2199               level: 0
  2204               level: 0
  2200               tabable: true
  2205               tabable: true
  2201               menu: commonFrameLayoutsMenu2
  2206               menu: commonFrameLayoutsMenu2
  2202               textDefault: true
  2207               textDefault: true
       
  2208             )
       
  2209            #(#MenuPanelSpec
       
  2210               #name: 'commonLayoutToolBar3'
       
  2211               #layout: #(LayoutFrame 6 0.0 295 0 -4 1.0 327 0)
       
  2212               #level: 0
       
  2213               #tabable: true
       
  2214               #menu: #commonFrameLayoutsMenu3
       
  2215               #textDefault: true
       
  2216 
       
  2217 
       
  2218 
       
  2219 
       
  2220 
       
  2221 
       
  2222 
       
  2223 
  2203             )
  2224             )
  2204            )
  2225            )
  2205          
  2226          
  2206         )
  2227         )
  2207       )
  2228       )
  2425           )
  2446           )
  2426          )
  2447          )
  2427         nil
  2448         nil
  2428         nil
  2449         nil
  2429       )
  2450       )
       
  2451 !
       
  2452 
       
  2453 commonFrameLayoutsMenu3
       
  2454     "This resource specification was automatically generated
       
  2455      by the MenuEditor of ST/X."
       
  2456 
       
  2457     "Do not manually edit this!! If it is corrupted,
       
  2458      the MenuEditor may not be able to read the specification."
       
  2459 
       
  2460     "
       
  2461      MenuEditor new openOnClass:UILayoutTool::LayoutFrame andSelector:#commonFrameLayoutsMenu2
       
  2462      (Menu new fromLiteralArrayEncoding:(UILayoutTool::LayoutFrame commonFrameLayoutsMenu2)) startUp
       
  2463     "
       
  2464 
       
  2465     <resource: #menu>
       
  2466 
       
  2467     ^ 
       
  2468      #(#Menu
       
  2469         #(
       
  2470          #(#MenuItem
       
  2471             #label: 'setScreenFrame'
       
  2472             #translateLabel: true
       
  2473             #isButton: true
       
  2474             #nameKey: #setScreenFrame
       
  2475             #value: #setScreenFrame
       
  2476             #activeHelpKey: #screenFrameLayout
       
  2477             #enabled: true
       
  2478             #labelImage: #(#ResourceRetriever #'UILayoutTool::LayoutFrame' #setScreenIcon)
       
  2479           )
       
  2480          )
       
  2481         nil
       
  2482         nil
       
  2483       )
  2430 ! !
  2484 ! !
  2431 
  2485 
  2432 !UILayoutTool::LayoutFrame methodsFor:'accessing'!
  2486 !UILayoutTool::LayoutFrame methodsFor:'accessing'!
  2433 
  2487 
  2434 fetch:aView spec:aSpec
  2488 fetch:aView spec:aSpec
       
  2489 
  2435     |layout|
  2490     |layout|
  2436 
  2491 
  2437     layout  := UIPainterView asLayoutFrameFromView:aView.
  2492     aSpec class == WindowSpec ifTrue:[
  2438 
  2493          (layout := aSpec layout) isNil ifTrue:[
       
  2494              layout := aSpec bounds asLayout.
       
  2495          ] 
       
  2496     ] ifFalse: [
       
  2497          layout  := UIPainterView asLayoutFrameFromView:aView.
       
  2498     ].
  2439     (self aspectFor:#leftOffset)     value:(layout leftOffset).
  2499     (self aspectFor:#leftOffset)     value:(layout leftOffset).
  2440     (self aspectFor:#leftFraction)   value:(layout leftFraction).
  2500     (self aspectFor:#leftFraction)   value:(layout leftFraction).
  2441     (self aspectFor:#topOffset)      value:(layout topOffset).
  2501     (self aspectFor:#topOffset)      value:(layout topOffset).
  2442     (self aspectFor:#topFraction)    value:(layout topFraction).
  2502     (self aspectFor:#topFraction)    value:(layout topFraction).
  2443     (self aspectFor:#rightOffset)    value:(layout rightOffset).
  2503     (self aspectFor:#rightOffset)    value:(layout rightOffset).
  2471 
  2531 
  2472 setBigBottomFixPartFrame
  2532 setBigBottomFixPartFrame
  2473     self
  2533     self
  2474         setFrameLeft:0   offset:0 
  2534         setFrameLeft:0   offset:0 
  2475         right:1          offset:0 
  2535         right:1          offset:0 
  2476         top:0            offset:30 
  2536         top:0            offset:(self class defaultFixPartHeight) 
  2477         bottom:1         offset:0
  2537         bottom:1         offset:0
  2478 !
  2538 !
  2479 
  2539 
  2480 setBigHorizontalFixPartFrame
  2540 setBigHorizontalFixPartFrame
  2481     self
  2541     self
  2482         setFrameLeft:0   offset:0 
  2542         setFrameLeft:0   offset:0 
  2483         right:1          offset:0 
  2543         right:1          offset:0 
  2484         top:0            offset:30 
  2544         top:0            offset:(self class defaultFixPartHeight) 
  2485         bottom:1         offset:-30
  2545         bottom:1         offset:(self class defaultFixPartHeight negated)
  2486 !
  2546 !
  2487 
  2547 
  2488 setBigTopFixPartFrame
  2548 setBigTopFixPartFrame
  2489     self
  2549     self
  2490         setFrameLeft:0   offset:0 
  2550         setFrameLeft:0   offset:0 
  2491         right:1          offset:0 
  2551         right:1          offset:0 
  2492         top:0            offset:0 
  2552         top:0            offset:0 
  2493         bottom:1         offset:-30
  2553         bottom:1         offset:(self class defaultFixPartHeight negated)
  2494 !
  2554 !
  2495 
  2555 
  2496 setBottomFixPartFrame
  2556 setBottomFixPartFrame
  2497     self
  2557     self
  2498         setFrameLeft:0   offset:0 
  2558         setFrameLeft:0   offset:0 
  2499         right:1          offset:0 
  2559         right:1          offset:0 
  2500         top:1            offset:-30 
  2560         top:1            offset:(self class defaultFixPartHeight negated) 
  2501         bottom:1         offset:0
  2561         bottom:1         offset:0
  2502 !
  2562 !
  2503 
  2563 
  2504 setBottomHalfFrame
  2564 setBottomHalfFrame
  2505     self
  2565     self
  2547 
  2607 
  2548 setHorizontalFixPartFrame
  2608 setHorizontalFixPartFrame
  2549     self
  2609     self
  2550         setFrameLeft:0   offset:0 
  2610         setFrameLeft:0   offset:0 
  2551         right:1          offset:0 
  2611         right:1          offset:0 
  2552         top:0.5          offset:-15 
  2612         top:0.5          offset:(self class defaultFixPartHeight negated // 2) 
  2553         bottom:0.5       offset:15
  2613         bottom:0.5       offset:(self class defaultFixPartHeight // 2)
  2554 !
  2614 !
  2555 
  2615 
  2556 setLeftFixPartFrame
  2616 setLeftFixPartFrame
  2557     self
  2617     self
  2558         setFrameLeft:0   offset:0 
  2618         setFrameLeft:0   offset:0 
  2559         right:0          offset:30 
  2619         right:0          offset:(self class defaultFixPartHeight) 
  2560         top:0            offset:0 
  2620         top:0            offset:0 
  2561         bottom:1         offset:0
  2621         bottom:1         offset:0
  2562 !
  2622 !
  2563 
  2623 
  2564 setLeftHalfFrame
  2624 setLeftHalfFrame
  2569         bottom:1        offset:0
  2629         bottom:1        offset:0
  2570 !
  2630 !
  2571 
  2631 
  2572 setRightFixPartFrame
  2632 setRightFixPartFrame
  2573     self
  2633     self
  2574         setFrameLeft:1   offset:-30 
  2634         setFrameLeft:1   offset:(self class defaultFixPartHeight negated) 
  2575         right:1          offset:0 
  2635         right:1          offset:0 
  2576         top:0            offset:0 
  2636         top:0            offset:0 
  2577         bottom:1         offset:0
  2637         bottom:1         offset:0
  2578 !
  2638 !
  2579 
  2639 
  2588 setTopFixPartFrame
  2648 setTopFixPartFrame
  2589     self
  2649     self
  2590         setFrameLeft:0   offset:0 
  2650         setFrameLeft:0   offset:0 
  2591         right:1          offset:0 
  2651         right:1          offset:0 
  2592         top:0            offset:0 
  2652         top:0            offset:0 
  2593         bottom:0         offset:30
  2653         bottom:0         offset:(self class defaultFixPartHeight)
  2594 !
  2654 !
  2595 
  2655 
  2596 setTopHalfFrame
  2656 setTopHalfFrame
  2597     self
  2657     self
  2598         setFrameLeft:0   offset:0 
  2658         setFrameLeft:0   offset:0 
  2617         bottom:0.5       offset:0
  2677         bottom:0.5       offset:0
  2618 !
  2678 !
  2619 
  2679 
  2620 setVerticalFixPartFrame
  2680 setVerticalFixPartFrame
  2621     self
  2681     self
  2622         setFrameLeft:0.5   offset:-15 
  2682         setFrameLeft:0.5   offset:(self class defaultFixPartHeight negated // 2 )
  2623         right:0.5          offset:15 
  2683         right:0.5          offset:(self class defaultFixPartHeight // 2 ) 
  2624         top:0          offset:0 
  2684         top:0          offset:0 
  2625         bottom:1       offset:0
  2685         bottom:1       offset:0
  2626 ! !
  2686 ! !
  2627 
  2687 
  2628 !UILayoutTool::LayoutOrigin class methodsFor:'interface specs'!
  2688 !UILayoutTool::LayoutOrigin class methodsFor:'interface specs'!