|
Class: DrawAdaptor
Object
|
+--DrawAdaptor
- Package:
- stx:libview2
- Category:
- Views-Support
- Version:
- rev:
1.8
date: 2017/02/22 18:11:27
- user: cg
- file: DrawAdaptor.st directory: libview2
- module: stx stc-classLibrary: libview2
- Author:
- Stefan Vogel (stefan@zwerg)
DrawAdaptor constains to values:
- any Object
- a replacement Object to be used only for draw operations.
Use this class whenever you want to show something different for a given object -
e.g. to show some language specific text instead of a symbol or any object in ComboBoxes/PopUpLists.
[instance variables:]
value Object the original object
drawValue Object the replacement object used for draw operations
[class variables:]
instance creation
-
collection: aCollectionOfObjects withResources: resourcePack
-
create a collection of DrawAdaptors from aCollectionOfObjects (usually strings or symbols).
Use resourcePack to do the translation
usage example(s):
self collection:#(a File c) withResources:Launcher classResources
|
-
value: value
-
-
value: value drawValue: drawValue
-
-
value: anObject withResources: resourcePack
-
Create a DrawAdaptor for anObject,
Resolved via the translations in resourcePack
usage example(s):
self value:#Hello withResources:Launcher classResources
|
accessing
-
asString
-
-
drawValue
-
-
drawValue: something
-
-
realValue
-
-
realValue: something
-
-
string
-
-
value: valueArg drawValue: drawValueArg
-
comparing
-
= anObject
-
two TranslatedSymbols are equal, if they have the same symbol
usage example(s):
(self value:#hash drawValue:'x') = #hash
(self value:#hash drawValue:'x') = 1
(self value:#hash drawValue:'x') = (self value:#hash drawValue:'y')
|
-
hash
-
equal, if they have the same realObject
delegation drawing
-
ascentOn: aGc
-
-
displayOn: aGCOrStream
-
what a kludge - Dolphin and Squeak mean: printOn: a stream;
-
displayOn: aGc x: x y: y opaque: opaque
-
copied from object, but do the ascent handling here
-
heightOn: aGC
-
return the height of the receiver, if it is to be displayed on aGC
-
printOn: aStream
-
this hast to be redefined to allow access from ComboLists via pressing the first character key
-
widthFrom: startIndex to: endIndex on: aGC
-
return the width of the receiver, if it is to be displayed on aGC
-
widthOn: aGc
-
misc
-
rebindWith: resources
-
|labelList top comboList|
labelList := DrawAdaptor collection:#(File Classes System Windows)
withResources:Launcher classResources.
top := StandardSystemView new.
top extent:(300 @ 200).
comboList := ComboListView in:top.
comboList origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
comboList bottomInset:(comboList preferredExtent y negated).
comboList list:labelList.
comboList contents:labelList first.
comboList action:[:selected | Transcript showCR:selected realValue].
top open.
|
|