SmallSensePO.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 25 Jul 2013 11:34:26 +0100
changeset 39 748389119d0a
parent 34 5be71b1d52ec
permissions -rw-r--r--
Initial support for per-language edit support. Some work on Smalltalk edit support, namely on electric blocks. Works fine, but need more work to make it usable but not too intrusive.

"{ Package: 'jv:smallsense' }"

HierarchicalItem subclass:#SmallSensePO
	instanceVariableNames:'subject icon label name description'
	classVariableNames:''
	poolDictionaries:''
	category:'SmallSense-Interface-PO'
!


!SmallSensePO class methodsFor:'Instance Creation'!

name: name description:description

    ^ self new name:name; description:description.

    "Created: / 04-04-2011 / 13:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmallSensePO class methodsFor:'Instance creation'!

subject: anObject

    ^self new subject: anObject

    "Created: / 06-04-2011 / 21:01:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmallSensePO methodsFor:'accessing'!

cursorColumnAfterComplete

    "Answers a cursor column after completion. The number returned
     is relative to the start of the text being replaced"

    ^name size + 1

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

description
    ^ description
!

description:something
    description := something.
!

icon

    ^nil

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

label

    label ifNil:[label := name].
    ^label

    "Created: / 07-04-2011 / 09:55:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

name
    ^ name
!

name:something
    name := something.
!

stringToComplete

    "Answers a string to complete"

    ^name

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

subject
    ^ subject
!

subject:something
    subject := something.
! !

!SmallSensePO methodsFor:'displaying'!

displayLabel:aLabel h:lH on:aGC x:newX y:y h:h
    | cx checkedI subjectI app |

    cx := "x :=" newX.
"/    self displayCheckbox ifTrue:[
"/        app := self application.
"/        checkedI := self checked
"/                    ifTrue:[MenuPanel iconIndicationOn]
"/                    ifFalse:[MenuPanel iconIndicationOff].
"/        checkedI displayOn: aGC x: cx y: y + (h / 2) - (checkedI height / 2).
"/        cx := cx + 22."experimental value - this looks good"
"/    ] ifFalse:[
"/        (parent notNil and: [parent displayCheckbox]) ifTrue:[
"/            cx := cx + 22."experimental value - this looks good"
"/        ]
"/    ].

    subjectI := self icon.
    subjectI notNil ifTrue:[
        subjectI displayOn: aGC x: cx y: y + (h / 2) - (subjectI height / 2).
    ].
"/    (subjectI notNil or:[parent subjectIcon notNil]) ifTrue:[
        cx := cx + 16."experimental value - this looks good"
"/    ].

    super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h

    "Created: / 24-07-2013 / 00:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmallSensePO methodsFor:'new'!

name:nam description:desc 
    name := nam.
    description := desc.

    "Created: / 16-03-2011 / 16:31:13 / Jakub <zelenja7@fel.cvut.cz>"
! !

!SmallSensePO methodsFor:'printing & storing'!

printOn:aStream
    "append a printed representation if the receiver to the argument, aStream"

    super printOn:aStream.
    aStream nextPut:$(.
    name printOn:aStream.
    aStream nextPut:$).

    "Modified: / 04-04-2011 / 12:02:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmallSensePO methodsFor:'queries'!

startsWith: prefix

    ^self stringToComplete startsWith: prefix

    "Created: / 26-11-2011 / 19:25:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmallSensePO methodsFor:'testing'!

isSmallSenseClassPO
    ^ false
!

isSmallSenseConstantPO
    ^ false
!

isSmallSenseMethodPO
    ^ false
!

isSmallSenseSnippetPO
    ^ false
!

isSmallSenseVariablePO
    ^ false
! !

!SmallSensePO class methodsFor:'documentation'!

version_HG

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

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