7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
|
12 |
|
13 "{ Package: 'stx:libwidg2' }" |
12 |
14 |
13 ListEntry subclass:#ColoredListEntry |
15 ListEntry subclass:#ColoredListEntry |
14 instanceVariableNames:'color string bgColor' |
16 instanceVariableNames:'color string bgColor' |
15 classVariableNames:'' |
17 classVariableNames:'' |
16 poolDictionaries:'' |
18 poolDictionaries:'' |
37 " |
39 " |
38 Instances of ColoredListEntry can be used in place of strings |
40 Instances of ColoredListEntry can be used in place of strings |
39 as entries of the list in a ListView or SelectionInListView. |
41 as entries of the list in a ListView or SelectionInListView. |
40 |
42 |
41 Notice: this is a historic leftOver from times when the Text class |
43 Notice: this is a historic leftOver from times when the Text class |
42 was not available. |
44 was not available. |
43 Please do no longer use it (use Text right away). |
45 Please do no longer use it (use Text right away). |
44 |
46 |
45 [author:] |
47 [author:] |
46 Claus Gittinger |
48 Claus Gittinger |
47 |
49 |
48 [see also:] |
50 [see also:] |
49 Text |
51 Text |
50 ListView |
52 ListView |
51 ListEntry |
53 ListEntry |
52 String Color |
54 String Color |
53 " |
55 " |
54 ! |
56 ! |
55 |
57 |
56 examples |
58 examples |
57 " |
59 " |
58 putting colored entries into a SelectionInListView |
60 putting colored entries into a SelectionInListView |
59 (instead of strings)' |
61 (instead of strings)' |
60 [exBegin] |
62 [exBegin] |
61 |v e myList tabs| |
63 |v e myList tabs| |
62 |
64 |
63 myList := OrderedCollection new. |
65 myList := OrderedCollection new. |
64 |
66 |
65 myList add:(ColoredListEntry string:'red' color:Color red). |
67 myList add:(ColoredListEntry string:'red' color:Color red). |
66 myList add:(ColoredListEntry string:'green' color:Color green). |
68 myList add:(ColoredListEntry string:'green' color:Color green). |
67 myList add:(ColoredListEntry string:'blue' color:Color blue). |
69 myList add:(ColoredListEntry string:'blue' color:Color blue). |
68 myList add:(ColoredListEntry string:'white' color:Color white). |
70 myList add:(ColoredListEntry string:'white' color:Color white). |
69 myList add:(ColoredListEntry string:'black' color:Color black). |
71 myList add:(ColoredListEntry string:'black' color:Color black). |
70 myList add:(ColoredListEntry string:'yellow' color:Color yellow). |
72 myList add:(ColoredListEntry string:'yellow' color:Color yellow). |
71 |
73 |
72 v := SelectionInListView new. |
74 v := SelectionInListView new. |
73 v setList:myList expandTabs:false. |
75 v setList:myList expandTabs:false. |
74 v open |
76 v open |
75 [exEnd] |
77 [exEnd] |
76 |
78 |
77 |
79 |
78 in a popUpList (sorry, Labels do not (yet) know how to display |
80 in a popUpList (sorry, Labels do not (yet) know how to display |
79 non-strings. |
81 non-strings. |
80 [exBegin] |
82 [exBegin] |
81 |v e myList selList tabs| |
83 |v e myList selList tabs| |
82 |
84 |
83 myList := OrderedCollection new. |
85 myList := OrderedCollection new. |
84 |
86 |
85 myList add:(ColoredListEntry string:'red' color:Color red). |
87 myList add:(ColoredListEntry string:'red' color:Color red). |
86 myList add:(ColoredListEntry string:'green' color:Color green). |
88 myList add:(ColoredListEntry string:'green' color:Color green). |
87 myList add:(ColoredListEntry string:'blue' color:Color blue). |
89 myList add:(ColoredListEntry string:'blue' color:Color blue). |
88 myList add:(ColoredListEntry string:'white' color:Color white). |
90 myList add:(ColoredListEntry string:'white' color:Color white). |
89 myList add:(ColoredListEntry string:'black' color:Color black). |
91 myList add:(ColoredListEntry string:'black' color:Color black). |
90 myList add:(ColoredListEntry string:'yellow' color:Color yellow). |
92 myList add:(ColoredListEntry string:'yellow' color:Color yellow). |
91 |
93 |
92 selList := SelectionInList new list:myList. |
94 selList := SelectionInList new list:myList. |
93 |
95 |
94 v := PopUpList on:selList. |
96 v := PopUpList on:selList. |
95 v open |
97 v open |
96 [exEnd] |
98 [exEnd] |
97 " |
99 " |
98 ! ! |
100 ! ! |
99 |
101 |
100 !ColoredListEntry class methodsFor:'instance creation'! |
102 !ColoredListEntry class methodsFor:'instance creation'! |
101 |
103 |
109 ! |
111 ! |
110 |
112 |
111 string:aString foregroundColor:fgColor backgroundColor:bgColor |
113 string:aString foregroundColor:fgColor backgroundColor:bgColor |
112 self obsoleteMethodWarning:'use Text>>emphasis:'. |
114 self obsoleteMethodWarning:'use Text>>emphasis:'. |
113 |
115 |
114 ^ Text |
116 ^ Text |
115 string:aString |
117 string:aString |
116 emphasis:(Array with:(#color->fgColor) |
118 emphasis:(Array with:(#color->fgColor) |
117 with:(#backgroundColor->bgColor)) |
119 with:(#backgroundColor->bgColor)) |
118 |
120 |
119 "/ ^ self new string:aString foregroundColor:fgColor backgroundColor:bgColor |
121 "/ ^ self new string:aString foregroundColor:fgColor backgroundColor:bgColor |
120 |
122 |
121 "Modified: 12.5.1996 / 19:48:27 / cg" |
123 "Modified: 12.5.1996 / 19:48:27 / cg" |
122 ! ! |
124 ! ! |