Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-mt.175.mcz ==================== Summary ==================== Name: ToolBuilder-Morphic-mt.175 Author: mt Time: 31 July 2016, 11:22:46.85449 am UUID: 2aeb6aa3-4498-394f-90dc-d8192d0e8ef9 Ancestors: ToolBuilder-Morphic-mt.174 *** Widget Refactorings and UI Themes (Part 6 of 11) *** Some fixes and refactorings for lists, trees, text boxes --- including added support for UI theming. =============== Diff against ToolBuilder-Morphic-mt.174 =============== Item was changed: ----- Method: MorphicToolBuilder>>buildPluggableList: (in category 'widgets required') ----- buildPluggableList: aSpec | widget listClass getIndex setIndex | aSpec getSelected ifNil:[ listClass := self listClass. getIndex := aSpec getIndex. setIndex := aSpec setIndex. ] ifNotNil:[ listClass := self listByItemClass. getIndex := aSpec getSelected. setIndex := aSpec setSelected. ]. widget := listClass on: aSpec model list: aSpec list selected: getIndex changeSelected: setIndex menu: aSpec menu keystroke: aSpec keyPress. self register: widget id: aSpec name. "Override default scroll bar policies if needed. Widget will use preference values otherwise." aSpec hScrollBarPolicy ifNotNil: [:policy | policy caseOf: { [#always] -> [widget alwaysShowHScrollBar]. [#never] -> [widget hideHScrollBarIndefinitely]. [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded]. } ]. aSpec vScrollBarPolicy ifNotNil: [:policy | policy caseOf: { [#always] -> [widget alwaysShowVScrollBar]. [#never] -> [widget hideVScrollBarIndefinitely]. [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded]. } ]. widget getListElementSelector: aSpec listItem. widget getListSizeSelector: aSpec listSize. widget getIconSelector: aSpec icon. widget getHelpSelector: aSpec helpItem. widget doubleClickSelector: aSpec doubleClick. widget dragItemSelector: aSpec dragItem. widget dropItemSelector: aSpec dropItem. widget wantsDropSelector: aSpec dropAccept. widget dragStartedSelector: aSpec dragStarted. widget autoDeselect: aSpec autoDeselect. widget keystrokePreviewSelector: aSpec keystrokePreview. + aSpec color ifNotNil: [:c | widget color: c]. - widget - borderWidth: 1; - borderColor: Color lightGray; - color: (aSpec color - ifNil: [Color white] - ifNotNil: [aSpec color]). - self buildHelpFor: widget spec: aSpec. self setFrame: aSpec frame in: widget. self setLayoutHintsFor: widget spec: aSpec. parent ifNotNil:[self add: widget to: parent]. panes ifNotNil:[ aSpec list ifNotNil:[panes add: aSpec list]. ]. ^widget! Item was changed: ----- Method: MorphicToolBuilder>>buildPluggableScrollPane: (in category 'widgets optional') ----- buildPluggableScrollPane: spec | widget panel | widget := self scrollPaneClass new. widget model: spec model. self register: widget id: spec name. spec children ifNotNil: [:obj | "Create panel morph to scroll it." panel := self pluggablePanelSpec new model: spec model; children: obj; layout: spec layout; horizontalResizing: (spec layout == #proportional ifTrue: [#rigid] ifFalse: [#shrinkWrap]); verticalResizing: (spec layout == #proportional ifTrue: [#rigid] ifFalse: [#shrinkWrap]); buildWith: self. widget morph: panel. ] ifNil: [spec morph ifNotNil: [:m | widget morph: m] ifNil: [widget morphClass: spec morphClass]]. self setFrame: spec frame in: widget. self setLayoutHintsFor: widget spec: spec. parent ifNotNil: [self add: widget to: parent]. + spec borderWidth ifNotNil: [:w | widget borderWidth: w]. - widget borderWidth: spec borderWidth. "Override default scroll bar policies if needed. Widget will use preference values otherwise." spec hScrollBarPolicy ifNotNil: [:policy | policy caseOf: { [#always] -> [widget alwaysShowHScrollBar]. [#never] -> [widget hideHScrollBarIndefinitely]. [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded]}]. spec vScrollBarPolicy ifNotNil: [:policy | policy caseOf: { [#always] -> [widget alwaysShowVScrollBar]. [#never] -> [widget hideVScrollBarIndefinitely]. [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded]}]. ^ widget! Item was changed: ----- Method: MorphicToolBuilder>>buildPluggableText: (in category 'widgets required') ----- buildPluggableText: aSpec | widget | widget := self textPaneClass new. aSpec stylerClass ifNotNil: [:c | widget styler: (c new view: widget)]. widget on: aSpec model text: aSpec getText accept: aSpec setText readSelection: aSpec selection menu: aSpec menu. aSpec font ifNotNil: [:f | widget font: f]. widget readOnly: aSpec readOnly. widget editTextSelector: aSpec editText. widget wantsFrameAdornments: aSpec indicateUnacceptedChanges. widget askBeforeDiscardingEdits: aSpec askBeforeDiscardingEdits. widget setProperty: #alwaysAccept toValue: aSpec askBeforeDiscardingEdits not. aSpec softLineWrap ifNotNil: [:b | widget wrapFlag: b]. widget isAutoFit ifTrue: [widget hideHScrollBarIndefinitely] ifFalse: [widget showHScrollBarOnlyWhenNeeded]. self register: widget id: aSpec name. widget getColorSelector: aSpec color. self buildHelpFor: widget spec: aSpec. self setFrame: aSpec frame in: widget. self setLayoutHintsFor: widget spec: aSpec. parent ifNotNil:[self add: widget to: parent]. - widget borderColor: Color lightGray. - widget color: Color white. ^widget! Item was changed: ----- Method: PluggableTextMorphPlus>>drawBalloonTextOn: (in category 'drawing') ----- drawBalloonTextOn: aCanvas "Show balloon text in the text morph if it has no contents." textMorph contents ifNotEmpty: [ ^ self ]. ([ self balloonText ] on: Error do: [ : err | 'error in balloonText' ]) ifNotNil: [ : text | aCanvas drawString: text in: (self innerBounds insetBy: (5 @ 2 corner: 0 @ 0)) + font: (self userInterfaceTheme balloonTextFont ifNil: [TextStyle defaultFont]) + color: (self userInterfaceTheme balloonTextColor ifNil: [Color gray: 0.7]) ]! - font: textMorph textStyle defaultFont "I want italic here" - color: (Color gray: 0.7) ]! |
Free forum by Nabble | Edit this page |