UISelectionPanel.st
changeset 2486 a5d389685ab7
parent 2476 a8dbbb7aa571
child 2487 1bd0d0b7671c
equal deleted inserted replaced
2485:59ecb1305177 2486:a5d389685ab7
    76     "Modified: / 8.12.1997 / 18:53:06 / cg"
    76     "Modified: / 8.12.1997 / 18:53:06 / cg"
    77 ! !
    77 ! !
    78 
    78 
    79 !UISelectionPanel class methodsFor:'accessing'!
    79 !UISelectionPanel class methodsFor:'accessing'!
    80 
    80 
       
    81 userClass
       
    82     "return the class which provides the user defined gallery specs."
       
    83 
       
    84     ^ UserClass
       
    85 
       
    86     "Created: / 5.12.1997 / 15:12:50 / cg"
       
    87 !
       
    88 
       
    89 userClass:aClass specSelector:aSpecAccessSelector labelSelector:aLabelListAccessSelector
       
    90     "change the class which provides the user defined gallery specs."
       
    91 
       
    92     UserClass := aClass.
       
    93     UserSpecs := aSpecAccessSelector.
       
    94     UserLabels := aLabelListAccessSelector.
       
    95 
       
    96     "
       
    97      UISelectionPanel 
       
    98         userClass:UISelectionPanel::VariableUserDefinedGallery
       
    99         specSelector:#listOfSelectors
       
   100         labelSelector:#listOfLabels
       
   101     "
       
   102 
       
   103     "Modified: / 5.12.1997 / 13:54:47 / cg"
       
   104     "Created: / 5.12.1997 / 13:56:10 / cg"
       
   105 ! !
       
   106 
       
   107 !UISelectionPanel class methodsFor:'classAccess'!
       
   108 
       
   109 galleryClass
       
   110 
       
   111     ^ UserDefinedGallery
       
   112 ! !
       
   113 
       
   114 !UISelectionPanel class methodsFor:'interface - standard specifications'!
       
   115 
    81 specifications
   116 specifications
    82 
   117 
    83     ^ #(
   118     ^ #(
    84         #( 'Standard'  #( 
   119         #( 'Standard'  #( 
    85                             #('Buttons' standardButtons)
   120                             #('Buttons' standardButtons)
    86                             #('Menus'   standardMenus)
   121                             #('Menus'   standardMenus)
    87                             #('Text'    standardTexts)
   122                             #('Text'    standardTexts)
    88                             #('Lists'   standardLists)
   123                             #('Lists'   standardLists)
    89                             #('Trees'   standardTrees)
   124                             #('Trees'   standardTrees)
    90                             #('Groups'  standardGroups)
   125                             #('Groups'  standardGroups)
    91                             #('Embed'   standardEmbed)
   126                             #('Embed'       standardEmbed)
       
   127                             #('Geometric'   standardMorphs1)
    92                             #('Misc'    standardMisc)
   128                             #('Misc'    standardMisc)
    93                          )
   129                          )
    94          )
   130          )
    95 
   131 
    96         #( 'Clipboard'  #(
   132         #( 'Clipboard'  #(
   101         #( 'User Def.'   #userDefined )
   137         #( 'User Def.'   #userDefined )
   102      )
   138      )
   103 
   139 
   104     "Modified: / 21.4.1998 / 12:04:22 / cg"
   140     "Modified: / 21.4.1998 / 12:04:22 / cg"
   105 !
   141 !
   106 
       
   107 userClass
       
   108     "return the class which provides the user defined gallery specs."
       
   109 
       
   110     ^ UserClass
       
   111 
       
   112     "Created: / 5.12.1997 / 15:12:50 / cg"
       
   113 !
       
   114 
       
   115 userClass:aClass specSelector:aSpecAccessSelector labelSelector:aLabelListAccessSelector
       
   116     "change the class which provides the user defined gallery specs."
       
   117 
       
   118     UserClass := aClass.
       
   119     UserSpecs := aSpecAccessSelector.
       
   120     UserLabels := aLabelListAccessSelector.
       
   121 
       
   122     "
       
   123      UISelectionPanel 
       
   124         userClass:UISelectionPanel::VariableUserDefinedGallery
       
   125         specSelector:#listOfSelectors
       
   126         labelSelector:#listOfLabels
       
   127     "
       
   128 
       
   129     "Modified: / 5.12.1997 / 13:54:47 / cg"
       
   130     "Created: / 5.12.1997 / 13:56:10 / cg"
       
   131 ! !
       
   132 
       
   133 !UISelectionPanel class methodsFor:'classAccess'!
       
   134 
       
   135 galleryClass
       
   136 
       
   137     ^ UserDefinedGallery
       
   138 ! !
       
   139 
       
   140 !UISelectionPanel class methodsFor:'interface - standard specifications'!
       
   141 
   142 
   142 standardButtons
   143 standardButtons
   143     "This resource specification was automatically generated
   144     "This resource specification was automatically generated
   144      by the UIPainter of ST/X."
   145      by the UIPainter of ST/X."
   145 
   146 
  1057          
  1058          
  1058         )
  1059         )
  1059       )
  1060       )
  1060 !
  1061 !
  1061 
  1062 
       
  1063 standardMorphs1
       
  1064     "This resource specification was automatically generated
       
  1065      by the UIPainter of ST/X."
       
  1066 
       
  1067     "Do not manually edit this!! If it is corrupted,
       
  1068      the UIPainter may not be able to read the specification."
       
  1069 
       
  1070     "
       
  1071      UIPainter new openOnClass:UISelectionPanel andSelector:#standardMorphs1
       
  1072      UISelectionPanel new openInterface:#standardMorphs1
       
  1073     "
       
  1074 
       
  1075     <resource: #canvas>
       
  1076 
       
  1077     ^ 
       
  1078      #(FullSpec
       
  1079         name: standardMorphs1
       
  1080         window: 
       
  1081        (WindowSpec
       
  1082           label: 'Morphs'
       
  1083           name: 'Morphs'
       
  1084           min: (Point 10 10)
       
  1085           bounds: (Rectangle 0 0 441 218)
       
  1086         )
       
  1087         component: 
       
  1088        (SpecCollection
       
  1089           collection: (
       
  1090            (ArcMorphSpec
       
  1091               name: 'Arc'
       
  1092               layout: (LayoutFrame 2 0 3 0 80 0 80 0)
       
  1093             )
       
  1094            (ArcMorphSpec
       
  1095               name: 'Circle'
       
  1096               layout: (LayoutFrame 84 0 3 0 163 0 80 0)
       
  1097             )
       
  1098            (ArcMorphSpec
       
  1099               name: 'FilledArc'
       
  1100               layout: (LayoutFrame 168 0 3 0 247 0 80 0)
       
  1101             )
       
  1102            (ArcMorphSpec
       
  1103               name: 'FilledCircle'
       
  1104               layout: (LayoutFrame 251 0 3 0 330 0 80 0)
       
  1105             )
       
  1106            )
       
  1107          
       
  1108         )
       
  1109       )
       
  1110 !
       
  1111 
  1062 standardTexts
  1112 standardTexts
  1063     "This resource specification was automatically generated
  1113     "This resource specification was automatically generated
  1064      by the UIPainter of ST/X."
  1114      by the UIPainter of ST/X."
  1065 
  1115 
  1066     "Do not manually edit this!! If it is corrupted,
  1116     "Do not manually edit this!! If it is corrupted,
  1469         ]
  1519         ]
  1470     ].
  1520     ].
  1471 !
  1521 !
  1472 
  1522 
  1473 paste:something
  1523 paste:something
  1474     "paste something at a point
  1524     "paste something at a point"
  1475     "
  1525 
  1476     |coll specs point device ext spec|
  1526     |coll specs point device ext spec|
  1477 
  1527 
  1478     clipBoardSpec isNil ifTrue:[
  1528     clipBoardSpec isNil ifTrue:[
  1479         clipBoardSpec := SpecCollection new.
  1529         clipBoardSpec := SpecCollection new.
  1480         clipBoardSpec collection:(OrderedCollection new).
  1530         clipBoardSpec collection:(OrderedCollection new).
  1506 
  1556 
  1507     "Modified: / 10.10.2001 / 14:14:36 / cg"
  1557     "Modified: / 10.10.2001 / 14:14:36 / cg"
  1508 !
  1558 !
  1509 
  1559 
  1510 raiseMenu
  1560 raiseMenu
  1511     "can open menu
  1561     "can open menu"
  1512     "
  1562 
  1513     |spec menu value paste|
  1563     |spec menu value paste|
  1514 
  1564 
  1515     spec := self clientSpec value.
  1565     spec := self clientSpec value.
  1516 
  1566 
  1517     spec notNil ifTrue:[
  1567     spec notNil ifTrue:[
  1568     ^ gallery model
  1618     ^ gallery model
  1569 
  1619 
  1570 !
  1620 !
  1571 
  1621 
  1572 majorChannel
  1622 majorChannel
  1573     "automatically generated by UIPainter ..."
       
  1574 
       
  1575     |holder|
  1623     |holder|
  1576 
  1624 
  1577     (holder := builder bindingAt:#majorChannel) isNil ifTrue:[
  1625     (holder := builder bindingAt:#majorChannel) isNil ifTrue:[
  1578         holder := AspectAdaptor new subject:self; forAspect:#majorSelection.
  1626         holder := AspectAdaptor new subject:self; forAspect:#majorSelection.
  1579         builder aspectAt:#majorChannel put:holder.
  1627         builder aspectAt:#majorChannel put:holder.
  1580     ].
  1628     ].
  1581     ^ holder
  1629     ^ holder
  1582 !
  1630 !
  1583 
  1631 
  1584 majorList
  1632 majorList
  1585     "automatically generated by UIPainter ...
  1633     ^ self class specifications collect:[:el| el first]
  1586     "
       
  1587   ^ self class specifications collect:[:el| el first]
       
  1588 !
  1634 !
  1589 
  1635 
  1590 minorKeys
  1636 minorKeys
  1591     ^ gallery minorKeysHolder
  1637     ^ gallery minorKeysHolder
  1592 ! !
  1638 ! !
  1593 
  1639 
  1594 !UISelectionPanel methodsFor:'change & update'!
  1640 !UISelectionPanel methodsFor:'change & update'!
  1595 
  1641 
  1596 update:something with:aParameter from:changedObject
  1642 update:something with:aParameter from:changedObject
  1597     "one of my models changed its value
  1643     "one of my models changed its value"
  1598     "
  1644 
  1599     |label|
  1645     |label|
  1600 
  1646 
  1601     changedObject == self clientSpec  ifTrue:[
  1647     changedObject == self clientSpec  ifTrue:[
  1602         (label := changedObject value) notNil ifTrue:[
  1648         (label := changedObject value) notNil ifTrue:[
  1603             label := 'Widget Gallery: ' , label name.
  1649             label := 'Widget Gallery: ' , label name.
  1665 ! !
  1711 ! !
  1666 
  1712 
  1667 !UISelectionPanel methodsFor:'queries'!
  1713 !UISelectionPanel methodsFor:'queries'!
  1668 
  1714 
  1669 canPaste:something
  1715 canPaste:something
  1670     "returns true if something could be paste
  1716     "returns true if something could be paste"
  1671     "
  1717 
  1672     (self isClipBoard and:[something notNil]) ifTrue:[
  1718     (self isClipBoard and:[something notNil]) ifTrue:[
  1673         something isCollection ifTrue:[
  1719         something isCollection ifTrue:[
  1674             something notEmpty ifTrue:[
  1720             something notEmpty ifTrue:[
  1675                 ^ (something at:1) isKindOf:UISpecification
  1721                 ^ (something at:1) isKindOf:UISpecification
  1676             ]
  1722             ]
  1677         ] ifFalse:[
  1723         ] ifFalse:[
  1678             ^ something isKindOf:UISpecification
  1724             ^ something isKindOf:UISpecification
  1679         ]
  1725         ]
  1680     ].
  1726     ].
  1681     ^ false
  1727     ^ false
  1682 
       
  1683 !
  1728 !
  1684 
  1729 
  1685 isClipBoard
  1730 isClipBoard
  1686     "returns true if current view is clip board
  1731     "returns true if current view is clip board"
  1687     "
  1732 
  1688     majorSelection ~~ 0 ifTrue:[
  1733     majorSelection ~~ 0 ifTrue:[
  1689         ^ (self majorList at:majorSelection) startsWith:'Clip'
  1734         ^ (self majorList at:majorSelection) startsWith:'Clip'
  1690     ].
  1735     ].
  1691   ^ false
  1736     ^ false
  1692 !
  1737 !
  1693 
  1738 
  1694 isUserBoard
  1739 isUserBoard
  1695     "returns true if current view is clip board
  1740     "returns true if current view is clip board"
  1696     "
  1741 
  1697     majorSelection ~~ 0 ifTrue:[
  1742     majorSelection ~~ 0 ifTrue:[
  1698         ^ (self majorList at:majorSelection) startsWith:'User'
  1743         ^ (self majorList at:majorSelection) startsWith:'User'
  1699     ].
  1744     ].
  1700   ^ false
  1745     ^ false
  1701 ! !
  1746 ! !
  1702 
  1747 
  1703 !UISelectionPanel methodsFor:'selection'!
  1748 !UISelectionPanel methodsFor:'selection'!
  1704 
  1749 
  1705 majorSelection
  1750 majorSelection
  1777 
  1822 
  1778 userDefinedHelpText
  1823 userDefinedHelpText
  1779 
  1824 
  1780 ^ '
  1825 ^ '
  1781 no user defined specifications are configured yet. To assign
  1826 no user defined specifications are configured yet. To assign
  1782 user defined specifications to the gallery press the middle
  1827 user defined specifications to the gallery, press the middle
  1783 button of your mouse to open a dialog.
  1828 button of your mouse to open a dialog.
  1784 '
  1829 '
  1785 !
  1830 !
  1786 
  1831 
  1787 userDefinedSpec
  1832 userDefinedSpec