-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Close windows from taskbar thumbnail #17477
Open
iglosiggio
wants to merge
2
commits into
pharo-project:Pharo13
Choose a base branch
from
iglosiggio:iglosiggio/CloseWindowsFromTaskbarThumbnail
base: Pharo13
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
" | ||
I am the helpful little window that appear when you hover a taskbar button. I show a recent screenshot of the window in question and an easy way to close that window. | ||
" | ||
Class { | ||
#name : 'TaskbarThumbnailMorph', | ||
#superclass : 'PanelMorph', | ||
#instVars : [ | ||
'window', | ||
'taskbarButton', | ||
'deleteAt', | ||
'taskbar' | ||
], | ||
#category : 'Polymorph-Widgets-Themes', | ||
#package : 'Polymorph-Widgets', | ||
#tag : 'Themes' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
TaskbarThumbnailMorph class >> for: aWindow taskbarButton: aButton theme: aTheme [ | ||
^ self new | ||
window: aWindow; | ||
button: aButton; | ||
theme: aTheme; | ||
initializeAppearance; | ||
yourself. | ||
] | ||
|
||
{ #category : 'fading' } | ||
TaskbarThumbnailMorph >> aboutToBeDeleted [ | ||
deleteAt := DateAndTime now + 150 milliSeconds | ||
] | ||
|
||
{ #category : 'accessing' } | ||
TaskbarThumbnailMorph >> button: aButton [ | ||
self assert: taskbarButton isNil description: 'Do not change the taskbar button after creation'. | ||
taskbarButton := aButton. | ||
taskbar := aButton owner. | ||
|
||
taskbarButton | ||
on: #mouseEnter | ||
send: #isNotBeingDeleted | ||
to: self; | ||
|
||
on: #mouseLeave | ||
send: #aboutToBeDeleted | ||
to: self | ||
] | ||
|
||
{ #category : 'submorphs - add/remove' } | ||
TaskbarThumbnailMorph >> delete [ | ||
"NOTE: We should only remove it if we are the current thumbnail" | ||
taskbar removeProperty: #taskbarThumbnail. | ||
super delete | ||
] | ||
|
||
{ #category : 'event handling' } | ||
TaskbarThumbnailMorph >> handlesMouseOver: evt [ | ||
|
||
^true | ||
] | ||
|
||
{ #category : 'initialization' } | ||
TaskbarThumbnailMorph >> initializeAppearance [ | ||
| thumb closeButton labelAndButton | | ||
thumb := window taskbarThumbnail. | ||
closeButton := (self theme | ||
newCloseControlIn: window | ||
for: window | ||
action: [window closeBoxHit. self delete] | ||
help: 'Close this window' translated) | ||
extent: window boxExtent. | ||
labelAndButton := PanelMorph new. | ||
labelAndButton | ||
layoutPolicy: RowLayout new; | ||
hResizing: #shrinkWrap; | ||
vResizing: #shrinkWrap; | ||
addMorphBack: closeButton; | ||
addMorphBack: (self theme | ||
buttonLabelForText: (window labelString truncateWithElipsisTo: 50)). | ||
self | ||
hResizing: #shrinkWrap; | ||
vResizing: #shrinkWrap; | ||
changeTableLayout; | ||
layoutInset: 8 scaledByDisplayScaleFactor; | ||
cellInset: 4 scaledByDisplayScaleFactor; | ||
addMorphBack: thumb; | ||
addMorphBack: labelAndButton; | ||
extent: self minExtent; | ||
fillStyle: (self theme taskListFillStyleFor: self); | ||
borderStyle: (self theme taskbarThumbnailNormalBorderStyleFor: self); | ||
cornerStyle: (self theme taskbarThumbnailCornerStyleFor: self). | ||
] | ||
|
||
{ #category : 'fading' } | ||
TaskbarThumbnailMorph >> isNotBeingDeleted [ | ||
deleteAt := nil | ||
] | ||
|
||
{ #category : 'event handling' } | ||
TaskbarThumbnailMorph >> mouseEnter: evt [ | ||
self isNotBeingDeleted | ||
] | ||
|
||
{ #category : 'event handling' } | ||
TaskbarThumbnailMorph >> mouseLeave: evt [ | ||
self aboutToBeDeleted | ||
] | ||
|
||
{ #category : 'stepping and presenter' } | ||
TaskbarThumbnailMorph >> step [ | ||
deleteAt ifNil: [^self]. | ||
|
||
(self containsPoint: self activeHand position) ifTrue: [ | ||
self isNotBeingDeleted. | ||
^self]. | ||
|
||
deleteAt < DateAndTime now ifTrue: [self delete] | ||
] | ||
|
||
{ #category : 'stepping and presenter' } | ||
TaskbarThumbnailMorph >> stepTime [ | ||
^ 50 | ||
] | ||
|
||
{ #category : 'stepping and presenter' } | ||
TaskbarThumbnailMorph >> wantsSteps [ | ||
^ true | ||
] | ||
|
||
{ #category : 'accessing' } | ||
TaskbarThumbnailMorph >> window [ | ||
^ window | ||
] | ||
|
||
{ #category : 'accessing' } | ||
TaskbarThumbnailMorph >> window: aWindow [ | ||
window := aWindow | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3391,27 +3391,10 @@ UITheme >> newTaskbarButtonIn: aTaskbar for: aWindow [ | |
] | ||
|
||
{ #category : 'morph creation' } | ||
UITheme >> newTaskbarThumbnailIn: aThemedMorph for: aWindow [ | ||
UITheme >> newTaskbarThumbnailFor: aWindow taskbarButton: aButton [ | ||
"Answer a taskbar thumbnail morph for the given window." | ||
|
||
|answer thumb| | ||
thumb := aWindow taskbarThumbnail. | ||
answer := PanelMorph new | ||
hResizing: #shrinkWrap; | ||
vResizing: #shrinkWrap; | ||
changeTableLayout; | ||
layoutInset: 8 scaledByDisplayScaleFactor; | ||
cellInset: 4 scaledByDisplayScaleFactor; | ||
addMorphBack: thumb; | ||
addMorphBack: ((self | ||
buttonLabelForText: (aWindow labelString truncateWithElipsisTo: 50)) | ||
color: Color white). | ||
answer | ||
extent: answer minExtent; | ||
fillStyle: (self taskListFillStyleFor: answer); | ||
borderStyle: (self taskbarThumbnailNormalBorderStyleFor: aWindow); | ||
cornerStyle: (self taskbarThumbnailCornerStyleFor: answer). | ||
^answer | ||
^ TaskbarThumbnailMorph for: aWindow taskbarButton: aButton theme: self | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice |
||
] | ||
|
||
{ #category : 'morph creation' } | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!!!