eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'DrawAdaptor':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: DrawAdaptor


Inheritance:

   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)

Description:


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:]


Related information:



Class protocol:

instance creation
o  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

o  value: value

o  value: value drawValue: drawValue

o  value: anObject withResources: resourcePack
Create a DrawAdaptor for anObject,
Resolved via the translations in resourcePack
usage example(s):
      self value:#Hello withResources:Launcher classResources


Instance protocol:

accessing
o  asString

o  drawValue

o  drawValue: something

o  realValue

o  realValue: something

o  string

o  value: valueArg drawValue: drawValueArg

comparing
o  = 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')

o  hash
equal, if they have the same realObject

delegation drawing
o  ascentOn: aGc

o  displayOn: aGCOrStream
what a kludge - Dolphin and Squeak mean: printOn: a stream;

o  displayOn: aGc x: x y: y opaque: opaque
copied from object, but do the ascent handling here

o  heightOn: aGC
return the height of the receiver, if it is to be displayed on aGC

o  printOn: aStream
this hast to be redefined to allow access from ComboLists via pressing the first character key

o  widthFrom: startIndex to: endIndex on: aGC
return the width of the receiver, if it is to be displayed on aGC

o  widthOn: aGc

misc
o  rebindWith: resources


Examples:


    |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.


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Thu, 15 Nov 2018 12:45:42 GMT