Skip to content

Commit

Permalink
Replace focused by isFocused in BlSpace, BlElement and BlElementVisuals.
Browse files Browse the repository at this point in the history
Deprecate with transform rule the old name.
  • Loading branch information
tinchodias committed Jan 31, 2024
1 parent e54f93e commit c12428c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 16 deletions.
11 changes: 6 additions & 5 deletions src/Bloc/BlCustomVisuals.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ BlCustomVisuals >> focusability: aBlFocusability [
focusability := aBlFocusability
]

{ #category : 'accessing' }
BlCustomVisuals >> focused [
^ focused ifNil: [ self defaultFocused ]
]

{ #category : 'accessing' }
BlCustomVisuals >> focused: aBoolean [
"Change focused state and return new visuals to be used instead of the previous one (not necessarily a new instance)"
Expand All @@ -152,6 +147,12 @@ BlCustomVisuals >> geometry: aBlElementGeometry [
geometry := aBlElementGeometry
]

{ #category : 'testing' }
BlCustomVisuals >> isFocused [

^ focused ifNil: [ self defaultFocused ]
]

{ #category : 'accessing' }
BlCustomVisuals >> mouseCursor [
^ mouseCursor ifNil: [ self defaultMouseCursor ]
Expand Down
11 changes: 6 additions & 5 deletions src/Bloc/BlDefaultVisuals.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ BlDefaultVisuals >> focusability: aBlFocusability [
^ BlCustomVisuals new focusability: aBlFocusability
]

{ #category : 'accessing' }
BlDefaultVisuals >> focused [
^ self defaultFocused
]

{ #category : 'accessing' }
BlDefaultVisuals >> focused: aBoolean [
"Change focused state and return new visuals to be used instead of the previous one (not necessarily a new instance)"
Expand All @@ -183,6 +178,12 @@ BlDefaultVisuals >> geometry: aBlElementGeometry [
^ BlCustomVisuals new geometry: aBlElementGeometry
]

{ #category : 'testing' }
BlDefaultVisuals >> isFocused [

^ self defaultFocused
]

{ #category : 'accessing' }
BlDefaultVisuals >> mouseCursor [
^ self defaultMouseCursor
Expand Down
6 changes: 3 additions & 3 deletions src/Bloc/BlElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2221,12 +2221,12 @@ BlElement >> isFocusable [
and: [ self focusability ~= BlFocusability ignore ] ] ]
]

{ #category : 'focus testing' }
{ #category : 'private - accessing' }
BlElement >> isFocused [
"Returns true if I am focused, false otherwise.
Note: It is possible that an element has focus but is not focused by itself"
Note: It is possible that an element has focus but is not focused by itself."

^ self focused
^ visuals isFocused
]

{ #category : 'testing' }
Expand Down
13 changes: 12 additions & 1 deletion src/Bloc/BlElementVisuals.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,12 @@ BlElementVisuals >> focusability: aBlFocusability [

{ #category : 'accessing' }
BlElementVisuals >> focused [
^ self subclassResponsibility

self
deprecated: 'Use isFocused instead of current one'
transformWith: '`@rcv focused' -> '`@rcv isFocused'.

^ self isFocused
]

{ #category : 'accessing' }
Expand All @@ -239,6 +244,12 @@ BlElementVisuals >> geometry: aBlElementGeometry [
^ self subclassResponsibility
]

{ #category : 'testing' }
BlElementVisuals >> isFocused [

^ self subclassResponsibility
]

{ #category : 'accessing' }
BlElementVisuals >> mouseCursor [
^ self subclassResponsibility
Expand Down
12 changes: 10 additions & 2 deletions src/Bloc/BlSpace.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -967,11 +967,16 @@ BlSpace >> focusProcessor: aFocusProcessor [
{ #category : 'window - properties' }
BlSpace >> focused [

self
deprecated: 'Use isFocused instead of current one'
transformWith: '`@rcv focused' -> '`@rcv isFocused'.

^ focused
]

{ #category : 'window - properties' }
BlSpace >> focused: aBoolean [

focused := aBoolean
]

Expand Down Expand Up @@ -1023,6 +1028,7 @@ BlSpace >> fullsize: aBoolean [

{ #category : 'focus managing' }
BlSpace >> grabFocus [

self focused: true
]

Expand Down Expand Up @@ -1278,9 +1284,10 @@ BlSpace >> isBorderless [
ifAbsent: [ borderless ]
]

{ #category : 'testing' }
{ #category : 'window - properties' }
BlSpace >> isFocused [
^ self focused

^ focused
]

{ #category : 'window - properties' }
Expand Down Expand Up @@ -1732,6 +1739,7 @@ BlSpace >> topMostParent [

{ #category : 'focus managing' }
BlSpace >> ungrabFocus [

self focused: false
]

Expand Down
1 change: 1 addition & 0 deletions src/Bloc/BlSpaceEventListener.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ BlSpaceEventListener >> spaceEventsProcessedEvent: anEvent [

{ #category : 'window handlers' }
BlSpaceEventListener >> spaceFocusInEvent: anEvent [

self focusProcessor processWindowFocusIn: anEvent
]

Expand Down

0 comments on commit c12428c

Please sign in to comment.