|
Class: DrawAdaptor
Object
|
+--DrawAdaptor
- Package:
- stx:libview2
- Category:
- Views-Support
- Version:
- rev:
1.9
date: 2021/01/20 14:36:18
- user: cg
- file: DrawAdaptor.st directory: libview2
- module: stx stc-classLibrary: libview2
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:]
copyrightCOPYRIGHT (c) 2008 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
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
-
(comment from inherited method)
when displayed via displayOn:, some objects assume that the given y coordinate
is the baseline (strings, text etc. do), while others assume that the topY
coordinate is given by y.
In other words: some draw above the given y coordinate.
This method returns the number of pixels by which the receiver will draw above
the given y coordinate.
-
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
-
(comment from inherited method)
return the width of the receiver, if it is to be displayed on 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.
|
|