SmallSense__MethodPO.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 24 Aug 2013 22:15:09 +0100
changeset 64 2257d7223898
child 67 020b7461b15e
permissions -rw-r--r--
All classes moved to namespace SmallSense.

"{ Package: 'jv:smallsense' }"

"{ NameSpace: SmallSense }"

PO subclass:#MethodPO
	instanceVariableNames:'class'
	classVariableNames:''
	poolDictionaries:''
	category:'SmallSense-Interface-PO'
!


!MethodPO class methodsFor:'Instance creation'!

name:name description:description class:class 
    ^ (self new)
        name:name;
        description:description;
        class:class.

    "Created: / 06-04-2011 / 16:50:05 / Jakub <zelenja7@fel.cvut.cz>"
! !

!MethodPO methodsFor:'accessing'!

class:something
    class := something.

    "Created: / 06-04-2011 / 16:51:42 / Jakub <zelenja7@fel.cvut.cz>"
!

cursorColumnAfterComplete

    | idx |
    idx := name indexOf: $:.
    ^idx == 0 ifTrue:[name size + 1] ifFalse:[idx + 1].

    "Created: / 05-04-2011 / 17:08:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

label

    ^super label

"/    label ifNil:
"/        [label := name asText ,  ((' [' , class name , ']') asText colorizeAllWith: Color gray).
"/        ].
"/    ^label

    "Created: / 07-04-2011 / 09:56:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 21-05-2011 / 10:59:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

stringToComplete

    ^String 
        fromStringCollection: (name tokensBasedOn: $:)
        separatedBy: ':  '.

    "Created: / 05-04-2011 / 16:51:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!MethodPO methodsFor:'displaying'!

displayOn:aGC x:x y:y opaque:opaque

    | lw cn cnw fg |

    super displayOn:aGC x:x y:y opaque:opaque.
    lw :=  x + 16 + (self label widthOn: aGC).
    cn := class nameWithoutPrefix.
    cnw := aGC widthOfString: cn.

    (aGC width > (lw + cnw + 5)) ifTrue:
        [fg := aGC paint.
        aGC paint: Color gray .
        aGC displayString: cn x: aGC width - cnw - 5 y: y.
        aGC paint: fg.
        ]

    "Created: / 21-05-2011 / 11:02:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!MethodPO methodsFor:'testing'!

isSmallSenseMethodPO
    ^ true
! !

!MethodPO class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '$Id: SmallSenseMethod.st 7825 2011-11-26 18:32:31Z vranyj1 $'
! !