97 ) |
99 ) |
98 ) |
100 ) |
99 |
101 |
100 #( 'User Def.' #userDefined ) |
102 #( 'User Def.' #userDefined ) |
101 ) |
103 ) |
|
104 ! |
|
105 |
|
106 userClass |
|
107 "return the class which provides the user defined gallery specs." |
|
108 |
|
109 ^ UserClass |
|
110 |
|
111 "Created: / 5.12.1997 / 15:12:50 / cg" |
|
112 ! |
|
113 |
|
114 userClass:aClass specSelector:aSpecAccessSelector labelSelector:aLabelListAccessSelector |
|
115 "change the class which provides the user defined gallery specs." |
|
116 |
|
117 UserClass := aClass. |
|
118 UserSpecs := aSpecAccessSelector. |
|
119 UserLabels := aLabelListAccessSelector. |
|
120 |
|
121 " |
|
122 UISelectionPanel |
|
123 userClass:UISelectionPanel::VariableUserDefinedGallery |
|
124 specSelector:#listOfSelectors |
|
125 labelSelector:#listOfLabels |
|
126 " |
|
127 |
|
128 "Modified: / 5.12.1997 / 13:54:47 / cg" |
|
129 "Created: / 5.12.1997 / 13:56:10 / cg" |
102 ! ! |
130 ! ! |
103 |
131 |
104 !UISelectionPanel class methodsFor:'interface specification'! |
132 !UISelectionPanel class methodsFor:'interface specification'! |
105 |
133 |
106 nameAndSelectorSpec |
134 nameAndSelectorSpec |
1660 ] |
1688 ] |
1661 ]. |
1689 ]. |
1662 ^ nil |
1690 ^ nil |
1663 ! ! |
1691 ! ! |
1664 |
1692 |
1665 !UISelectionPanel::ExampleUserDefinedGallery class methodsFor:'user defined gallery'! |
1693 !UISelectionPanel::UserDefinedGallery class methodsFor:'class initialization'! |
|
1694 |
|
1695 initialize |
|
1696 "initialize my default user-def from the superclasses specs. |
|
1697 I.e. provide a clocks entry" |
|
1698 |
|
1699 LabelList := self defaultListOfLabels asOrderedCollection. |
|
1700 SelectorList := self defaultListOfSelectors asOrderedCollection. |
|
1701 HolderList := OrderedCollection new grow:(SelectorList size). |
|
1702 NextUniqueNumber := 1. |
|
1703 |
|
1704 UISelectionPanel |
|
1705 userClass:self |
|
1706 specSelector:#listOfSelectors |
|
1707 labelSelector:#listOfLabels. |
|
1708 |
|
1709 " |
|
1710 self initialize |
|
1711 " |
|
1712 |
|
1713 "Modified: / 5.12.1997 / 14:25:22 / cg" |
|
1714 "Created: / 8.12.1997 / 18:49:42 / cg" |
|
1715 ! ! |
|
1716 |
|
1717 !UISelectionPanel::UserDefinedGallery class methodsFor:'defaults'! |
|
1718 |
|
1719 defaultListOfLabels |
|
1720 ^ #( 'clocks' ) |
|
1721 |
|
1722 "Created: / 8.12.1997 / 18:50:06 / cg" |
|
1723 ! |
|
1724 |
|
1725 defaultListOfSelectors |
|
1726 ^ #( clocksSpec ) |
|
1727 |
|
1728 "Modified: / 5.12.1997 / 14:03:55 / cg" |
|
1729 "Created: / 8.12.1997 / 18:50:21 / cg" |
|
1730 ! ! |
|
1731 |
|
1732 !UISelectionPanel::UserDefinedGallery class methodsFor:'documentation'! |
|
1733 |
|
1734 copyright |
|
1735 " |
|
1736 COPYRIGHT (c) 1997 by eXept Software AG |
|
1737 All Rights Reserved |
|
1738 |
|
1739 This software is furnished under a license and may be used |
|
1740 only in accordance with the terms of that license and with the |
|
1741 inclusion of the above copyright notice. This software may not |
|
1742 be provided or otherwise made available to, or used by, any |
|
1743 other person. No title to or ownership of the software is |
|
1744 hereby transferred. |
|
1745 " |
|
1746 |
|
1747 |
|
1748 |
|
1749 ! |
|
1750 |
|
1751 documentation |
|
1752 " |
|
1753 The standard user-defined selectionPanel entry. |
|
1754 Here, a single item named 'clocks' is provided, containing |
|
1755 an analog and digital clock. |
|
1756 This is a dump example; the actual user-defined panel may be |
|
1757 extended dynamically. |
|
1758 |
|
1759 Frameworks which provide additional widgets may dynamically |
|
1760 add more entries, by sending #addUserSpecHolder:label: |
|
1761 or #removeUserSpecWithLabel:. |
|
1762 Typically, this is done when a framework is loaded, by one of the |
|
1763 frameworks class-initialization methods. |
|
1764 |
|
1765 [start with:] |
|
1766 UISelectionPanel open |
|
1767 |
|
1768 [author:] |
|
1769 Claus Gittinger |
|
1770 Claus Atzkern |
|
1771 |
|
1772 [see also:] |
|
1773 TabView |
|
1774 NoteBookView |
|
1775 UIGalleryView |
|
1776 UIPainter |
|
1777 |
|
1778 " |
|
1779 |
|
1780 |
|
1781 ! ! |
|
1782 |
|
1783 !UISelectionPanel::UserDefinedGallery class methodsFor:'installation / deinstallation'! |
|
1784 |
|
1785 addUserSpecHolder:aValueHolder label:aLabelString |
|
1786 "add a new entry with the given label. |
|
1787 The specHolder is typically either a spec, a valueHolder or a block. |
|
1788 In any case, it should return a valid spec from the #value message. |
|
1789 This spec is installed under that label." |
|
1790 |
|
1791 |syntheticSelector idx| |
|
1792 |
|
1793 syntheticSelector := ('userSpec' , NextUniqueNumber printString) asSymbol. |
|
1794 NextUniqueNumber := NextUniqueNumber + 1. |
|
1795 |
|
1796 idx := LabelList indexOf:aLabelString. |
|
1797 idx ~~ 0 ifTrue:[ |
|
1798 SelectorList at:idx put:syntheticSelector. |
|
1799 HolderList at:idx put:aValueHolder |
|
1800 ] ifFalse:[ |
|
1801 LabelList addLast:aLabelString. |
|
1802 SelectorList addLast:syntheticSelector. |
|
1803 HolderList addLast:aValueHolder |
|
1804 ] |
|
1805 |
|
1806 "Modified: / 5.12.1997 / 14:13:17 / cg" |
|
1807 "Created: / 8.12.1997 / 18:50:55 / cg" |
|
1808 ! |
|
1809 |
|
1810 removeUserSpecWithLabel:aLabelString |
|
1811 "remove the spec which was previously installed under the given label" |
|
1812 |
|
1813 |idx| |
|
1814 |
|
1815 idx := LabelList indexOf:aLabelString. |
|
1816 idx ~~ 0 ifTrue:[ |
|
1817 LabelList removeIndex:idx. |
|
1818 SelectorList removeIndex:idx. |
|
1819 HolderList removeIndex:idx |
|
1820 ]. |
|
1821 |
|
1822 "Modified: / 5.12.1997 / 14:13:45 / cg" |
|
1823 "Created: / 8.12.1997 / 18:51:03 / cg" |
|
1824 ! ! |
|
1825 |
|
1826 !UISelectionPanel::UserDefinedGallery class methodsFor:'user defined gallery'! |
1666 |
1827 |
1667 clocksSpec |
1828 clocksSpec |
1668 "this window spec was automatically generated by the ST/X UIPainter" |
1829 "this window spec was automatically generated by the ST/X UIPainter" |
1669 |
1830 |
1670 "do not manually edit this - the painter/builder may not be able to |
1831 "do not manually edit this - the painter/builder may not be able to |
1707 ) |
1868 ) |
1708 ) |
1869 ) |
1709 ) |
1870 ) |
1710 ) |
1871 ) |
1711 |
1872 |
1712 "Modified: 4.10.1997 / 15:12:27 / cg" |
1873 "Modified: / 4.10.1997 / 15:12:27 / cg" |
1713 ! |
1874 "Created: / 8.12.1997 / 18:40:22 / cg" |
1714 |
|
1715 funSpec |
|
1716 "this window spec was automatically generated by the ST/X UIPainter" |
|
1717 |
|
1718 "do not manually edit this - the painter/builder may not be able to |
|
1719 handle the specification if its corrupted." |
|
1720 |
|
1721 " |
|
1722 UIPainter new openOnClass:UISelectionPanel::ExampleUserDefinedGallery andSelector:#funSpec |
|
1723 UISelectionPanel::ExampleUserDefinedGallery new openInterface:#funSpec |
|
1724 " |
|
1725 |
|
1726 <resource: #canvas> |
|
1727 |
|
1728 ^ |
|
1729 |
|
1730 #(#FullSpec |
|
1731 #'window:' |
|
1732 #(#WindowSpec |
|
1733 #'name:' 'uIPainterView' |
|
1734 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
1735 #'label:' 'Interface Builder' |
|
1736 #'bounds:' #(#Rectangle 0 0 393 182) |
|
1737 ) |
|
1738 #'component:' |
|
1739 #(#SpecCollection |
|
1740 #'collection:' |
|
1741 #( |
|
1742 #(#ArbitraryComponentSpec |
|
1743 #'name:' 'arbitraryComponent1' |
|
1744 #'layout:' #(#LayoutFrame 54 0 27 0 287 0 145 0) |
|
1745 #'hasHorizontalScrollBar:' false |
|
1746 #'hasVerticalScrollBar:' false |
|
1747 #'hasBorder:' false |
|
1748 #'miniScrollerHorizontal:' false |
|
1749 #'miniScrollerVertical:' false |
|
1750 ) |
|
1751 ) |
|
1752 ) |
|
1753 ) |
|
1754 ! |
1875 ! |
1755 |
1876 |
1756 listOfLabels |
1877 listOfLabels |
1757 ^ #( 'clocks' 'fun') |
1878 ^ LabelList |
1758 |
1879 |
1759 |
1880 "Created: / 5.12.1997 / 13:43:03 / cg" |
|
1881 "Modified: / 8.12.1997 / 18:51:20 / cg" |
1760 ! |
1882 ! |
1761 |
1883 |
1762 listOfSelectors |
1884 listOfSelectors |
1763 ^ #( clocksSpec funSpec ) |
1885 ^ SelectorList |
1764 |
1886 |
1765 |
1887 "Created: / 5.12.1997 / 13:43:13 / cg" |
|
1888 "Modified: / 8.12.1997 / 18:51:28 / cg" |
|
1889 ! ! |
|
1890 |
|
1891 !UISelectionPanel::UserDefinedGallery class methodsFor:'user spec access'! |
|
1892 |
|
1893 doesNotUnderstand:aMessage |
|
1894 "catch queries for a userSpec" |
|
1895 |
|
1896 |sel idx| |
|
1897 |
|
1898 ((sel := aMessage selector) startsWith:'userSpec') ifTrue:[ |
|
1899 idx := SelectorList indexOf:sel. |
|
1900 idx ~~ 0 ifTrue:[ |
|
1901 ^ (HolderList at:idx) value |
|
1902 ] |
|
1903 ]. |
|
1904 ^ super doesNotUnderstand:aMessage |
|
1905 |
|
1906 "Modified: / 5.12.1997 / 14:23:24 / cg" |
|
1907 "Created: / 8.12.1997 / 18:51:50 / cg" |
|
1908 ! |
|
1909 |
|
1910 respondsTo:aSelector |
|
1911 "catch queries for a userSpec" |
|
1912 |
|
1913 |idx| |
|
1914 |
|
1915 (aSelector startsWith:'userSpec') ifTrue:[ |
|
1916 idx := Number fromString:(aSelector copyFrom:9). |
|
1917 idx := SelectorList indexOf:aSelector. |
|
1918 idx ~~ 0 ifTrue:[^ true]. |
|
1919 ]. |
|
1920 ^ super respondsTo:aSelector |
|
1921 |
|
1922 "Modified: / 5.12.1997 / 14:19:55 / cg" |
|
1923 "Created: / 8.12.1997 / 18:51:57 / cg" |
1766 ! ! |
1924 ! ! |
1767 |
1925 |
1768 !UISelectionPanel class methodsFor:'documentation'! |
1926 !UISelectionPanel class methodsFor:'documentation'! |
1769 |
1927 |
1770 version |
1928 version |