Andreas Raab uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-rww.68.mcz ==================== Summary ==================== Name: ToolBuilder-Morphic-rww.68 Author: rww Time: 11 September 2010, 4:14:22.865 pm UUID: aec2aa16-a008-1046-a13f-022964858636 Ancestors: ToolBuilder-Morphic-rww.67 I added PluggableDropDownListMorph and the infrastructure to build one. PluggableDropDownListMorph>>#installDropDownList is the method that builds the Morphs. I am currently building a label with a button. There is no drop down list. I was thinking a Menu would work, but a list would be better. =============== Diff against ToolBuilder-Morphic-ar.66 =============== Item was added: + ----- Method: MorphicToolBuilder>>buildPluggableCheckBox: (in category 'pluggable widgets') ----- + buildPluggableCheckBox: spec + + | widget label state action | + label := spec label. + state := spec state. + action := spec action. + widget := self checkBoxClass on: spec model + getState: (state isSymbol ifTrue:[state]) + action: (action isSymbol ifTrue:[action]) + label: (label isSymbol ifTrue:[label]). + self register: widget id: spec name. + + widget installButton. + " widget getColorSelector: spec color. + widget offColor: Color white.. + self buildHelpFor: widget spec: spec. + (label isSymbol or:[label == nil]) ifFalse:[widget label: label]. + " self setFrame: spec frame in: widget. + parent ifNotNil:[self add: widget to: parent]. + ^widget! Item was added: + ----- Method: MorphicToolBuilder>>buildPluggableDropDownList: (in category 'pluggable widgets') ----- + buildPluggableDropDownList: spec + + | widget model listSelector selectionSelector selectionSetter | + model := spec model. + listSelector := spec listSelector. + selectionSelector := spec selectionSelector. + selectionSetter := spec selectionSetter. + widget := self dropDownListClass new + model: model; + listSelector: listSelector; + selectionSelector: selectionSelector; + selectionSetter: selectionSetter; + yourself. + self register: widget id: spec name. + + widget installDropDownList. + self setFrame: spec frame in: widget. + parent ifNotNil:[self add: widget to: parent]. + ^widget! Item was added: + ----- Method: MorphicToolBuilder>>checkBoxClass (in category 'widget classes') ----- + checkBoxClass + ^ PluggableCheckBoxMorph! Item was added: + ----- Method: MorphicToolBuilder>>dropDownListClass (in category 'widget classes') ----- + dropDownListClass + ^ PluggableDropDownListMorph! Item was added: + AlignmentMorph subclass: #PluggableCheckBoxMorph + instanceVariableNames: 'model actionSelector valueSelector label' + classVariableNames: '' + poolDictionaries: '' + category: 'ToolBuilder-Morphic'! Item was added: + ----- Method: PluggableCheckBoxMorph classSide>>on:getState:action:label: (in category 'as yet unclassified') ----- + on: anObject getState: getStateSel action: actionSel label: labelSel + + ^ self new + on: anObject + getState: getStateSel + action: actionSel + label: labelSel + menu: nil + ! Item was added: + ----- Method: PluggableCheckBoxMorph>>actionSelector (in category 'accessing') ----- + actionSelector + "Answer the value of actionSelector" + + ^ actionSelector! Item was added: + ----- Method: PluggableCheckBoxMorph>>actionSelector: (in category 'accessing') ----- + actionSelector: anObject + "Set the value of actionSelector" + + actionSelector := anObject! Item was added: + ----- Method: PluggableCheckBoxMorph>>basicPanel (in category 'installing') ----- + basicPanel + ^BorderedMorph new + beTransparent; + extent: 0@0; + borderWidth: 0; + layoutInset: 0; + cellInset: 0; + layoutPolicy: TableLayout new; + listCentering: #topLeft; + cellPositioning: #center; + hResizing: #spaceFill; + vResizing: #shrinkWrap; + yourself! Item was added: + ----- Method: PluggableCheckBoxMorph>>horizontalPanel (in category 'installing') ----- + horizontalPanel + ^self basicPanel + cellPositioning: #center; + listDirection: #leftToRight; + yourself.! Item was added: + ----- Method: PluggableCheckBoxMorph>>installButton (in category 'installing') ----- + installButton + + | aButton aLabel | + aButton := UpdatingThreePhaseButtonMorph checkBox + target: self model; + actionSelector: self actionSelector; + getSelector: self valueSelector; + yourself. + aLabel := (StringMorph contents: self label translated + font: (StrikeFont familyName: TextStyle defaultFont familyName + size: TextStyle defaultFont pointSize - 1)). + self addMorph: (self horizontalPanel + addMorphBack: aButton; + addMorphBack: aLabel; + yourself).! Item was added: + ----- Method: PluggableCheckBoxMorph>>label (in category 'accessing') ----- + label + "Answer the value of label" + + ^ label! Item was added: + ----- Method: PluggableCheckBoxMorph>>label: (in category 'accessing') ----- + label: anObject + "Set the value of label" + + label := anObject! Item was added: + ----- Method: PluggableCheckBoxMorph>>model (in category 'accessing') ----- + model + "Answer the value of model" + + ^ model. + ! Item was added: + ----- Method: PluggableCheckBoxMorph>>model: (in category 'accessing') ----- + model: anObject + "Set the value of model" + + model := anObject! Item was added: + ----- Method: PluggableCheckBoxMorph>>on:getState:action:label:menu: (in category 'initialization') ----- + on: anObject getState: getStateSel action: actionSel label: labelSel menu: menuSel + + self model: anObject. + self valueSelector: getStateSel. + self actionSelector: actionSel. + self label: (self model perform: labelSel). + ! Item was added: + ----- Method: PluggableCheckBoxMorph>>valueSelector (in category 'accessing') ----- + valueSelector + "Answer the value of valueSelector" + + ^ valueSelector! Item was added: + ----- Method: PluggableCheckBoxMorph>>valueSelector: (in category 'accessing') ----- + valueSelector: anObject + "Set the value of valueSelector" + + valueSelector := anObject! Item was added: + AlignmentMorph subclass: #PluggableDropDownListMorph + instanceVariableNames: 'model listSelector selectionSelector selectionSetter' + classVariableNames: '' + poolDictionaries: '' + category: 'ToolBuilder-Morphic'! Item was added: + ----- Method: PluggableDropDownListMorph>>basicPanel (in category 'drawing') ----- + basicPanel + ^BorderedMorph new + beTransparent; + extent: 0@0; + borderWidth: 0; + layoutInset: 0; + cellInset: 0; + layoutPolicy: TableLayout new; + listCentering: #topLeft; + cellPositioning: #center; + hResizing: #spaceFill; + vResizing: #shrinkWrap; + yourself! Item was added: + ----- Method: PluggableDropDownListMorph>>currentSelection (in category 'accessing') ----- + currentSelection + + ^ self model perform: selectionSelector! Item was added: + ----- Method: PluggableDropDownListMorph>>currentSelection: (in category 'accessing') ----- + currentSelection: obj + + ^ self model perform: selectionSetter with: obj! Item was added: + ----- Method: PluggableDropDownListMorph>>horizontalPanel (in category 'drawing') ----- + horizontalPanel + ^self basicPanel + cellPositioning: #center; + listDirection: #leftToRight; + yourself.! Item was added: + ----- Method: PluggableDropDownListMorph>>installDropDownList (in category 'drawing') ----- + installDropDownList + + | aButton aLabel | + aButton := PluggableButtonMorph on: self model getState: nil action: nil. + aLabel := (StringMorph contents: self model currentRemoteVatId translated + font: (StrikeFont familyName: TextStyle defaultFont familyName + size: TextStyle defaultFont pointSize - 1)). + self addMorph: (self horizontalPanel + addMorphBack: aLabel; + addMorphBack: aButton; + yourself).! Item was added: + ----- Method: PluggableDropDownListMorph>>list (in category 'accessing') ----- + list + "Answer the value of list" + + ^ self model perform: self listSelector. + ! Item was added: + ----- Method: PluggableDropDownListMorph>>listSelector (in category 'accessing') ----- + listSelector + "Answer the value of listSelector" + + ^ listSelector! Item was added: + ----- Method: PluggableDropDownListMorph>>listSelector: (in category 'accessing') ----- + listSelector: anObject + "Set the value of listSelector" + + listSelector := anObject! Item was added: + ----- Method: PluggableDropDownListMorph>>model (in category 'accessing') ----- + model + ^ model! Item was added: + ----- Method: PluggableDropDownListMorph>>model: (in category 'accessing') ----- + model: anObject + "Set the value of model" + + model := anObject! Item was added: + ----- Method: PluggableDropDownListMorph>>selectionSelector (in category 'accessing') ----- + selectionSelector + "Answer the value of selectionSelector" + + ^ selectionSelector! Item was added: + ----- Method: PluggableDropDownListMorph>>selectionSelector: (in category 'accessing') ----- + selectionSelector: anObject + "Set the value of selectionSelector" + + selectionSelector := anObject! Item was added: + ----- Method: PluggableDropDownListMorph>>selectionSetter (in category 'accessing') ----- + selectionSetter + "Answer the value of selectionSetter" + + ^ selectionSetter! Item was added: + ----- Method: PluggableDropDownListMorph>>selectionSetter: (in category 'accessing') ----- + selectionSetter: anObject + "Set the value of selectionSetter" + + selectionSetter := anObject! |
Free forum by Nabble | Edit this page |