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.9 date: 2021/01/20 14:36:18
user: cg
file: DrawAdaptor.st directory: libview2
module: stx stc-classLibrary: libview2

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

copyright

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

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

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
(comment from inherited method)
return the width of the receiver, if it is to be displayed on 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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:46:37 GMT