
SubPane subclass: #NoteCardPane
  instanceVariableNames: 
    'noteCardPane '
  classVariableNames: ''
  poolDictionaries: '' !

!NoteCardPane class methods !

example
    " NoteCardPane example "
    | myView |
myView := self new.
myView openOn: NoteCard new.! !


!NoteCardPane methods !

defaultDispatcherClass 
    "answer the default Dispatcher Class 
    NoteCard Dispatcher" 
^NoteCardDispatcher!

display
    "display my model NoteCard"
self model displayAt:(self frame origin)!

displaySection
"display the current Selection if any"
self dispatcher isThereAnItemSelected
    ifTrue: [self highlight: self dispatcher selectedItem]!

highlight: anInfoItem
"reverse the color of an infoitem, a form"
|rectangle |
rectangle := anInfoItem reverse.
rectangle displayOn: Display at: anInfoItem location.!

openOn: aNoteCard
    "create a TopPane plug a NoteCard into it
     and schedule it on the desktop"
    |topView|
topView := TopPane new.
topView label: 'NoteCard View'.
topView minimumSize: 300@200.
topView addSubpane: (noteCardPane := NoteCardPane new
                    menu: #noteCardMenu;
                    model: aNoteCard).
topView dispatcher open scheduleWindow!

performMenu 
        "Private - If the model has a menu creation 
         method defined, give it control, else ask the 
         dispatcher class for the menu." 
    | menu | 
    (model isNil or: [paneMenuSelector isNil]) 
        ifTrue: [menu := dispatcher class menu] 
        ifFalse: [menu := model perform: paneMenuSelector]. 
    self popUp: menu!

reframe: aRectangle 
        "Reframe the receiver window 
         according to aRectangle." 
    self resize: aRectangle!

resize: aRectangle 
        "Private - Change the size of the window 
         to aRectangle." 
    frame := aRectangle origin extent: 
        (aRectangle extent max: 
            LabelFont width * 7 + 10 @ 
                (LabelFont height * 2 + 8)).!

showWindow
        "Display the receiver pane
         and the selection."
    self display.
    self topPane dispatcher active
        ifFalse: [self graySelection]!

unHighlight: anInfoItem
"return to normal a deselected InfoItem"
self highlight: anInfoItem! !
