Grafoscopio/src/Grafoscopio/GrafoscopioReplace.class.st

99 lines
1.7 KiB
Smalltalk

"
I'm a tool for finding and replacing text ocurrences in notebook
nodes.
"
Class {
#name : #GrafoscopioReplace,
#superclass : #ComposableModel,
#instVars : [
'find',
'replace',
'ok',
'cancel'
],
#category : #'Grafoscopio-UI'
}
{ #category : #specs }
GrafoscopioReplace class >> defaultSpec [
^ SpecLayout composed
newColumn: [ :column |
column
add: #find;
add: #replace;
newRow: [ :row | row add: #ok; add: #cancel ] height: self toolbarHeight ];
yourself
]
{ #category : #accessing }
GrafoscopioReplace >> cancel [
^ cancel
]
{ #category : #accessing }
GrafoscopioReplace >> cancel: anObject [
cancel := anObject
]
{ #category : #accessing }
GrafoscopioReplace >> find [
^ find
]
{ #category : #accessing }
GrafoscopioReplace >> find: anObject [
find := anObject
]
{ #category : #initialization }
GrafoscopioReplace >> initializeWidgets [
find := self newTextInput
ghostText: 'Text to find...';
autoAccept: true.
replace := self newTextInput
ghostText: 'Text to replace...';
autoAccept: true.
ok := self newButton
label: 'OK';
action: [ Transcript show: self find getText ].
cancel := self newButton
label: 'Cancel';
action: [ super closeWindowAction ].
self focusOrder
add: find;
add: replace;
add: ok;
add: cancel.
self askOkToClose: true.
]
{ #category : #accessing }
GrafoscopioReplace >> ok [
^ ok
]
{ #category : #accessing }
GrafoscopioReplace >> ok: anObject [
ok := anObject
]
{ #category : #private }
GrafoscopioReplace >> okToChange [
^ false
]
{ #category : #accessing }
GrafoscopioReplace >> replace [
^ replace
]
{ #category : #accessing }
GrafoscopioReplace >> replace: anObject [
replace := anObject
]
{ #category : #api }
GrafoscopioReplace >> title [
^ 'Find & Replace'
]