Skip to content

Commit

Permalink
Merge pull request #1685 from pharo-spec/dev-3.0
Browse files Browse the repository at this point in the history
default "ok" button in dialogs needs to be set to "ok"
  • Loading branch information
Ducasse authored Jan 7, 2025
2 parents 86d4d59 + 9a9ebea commit 9834312
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Spec2-Core/SpAbstractPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ SpAbstractPresenter >> initializeDialogWindow: aDialogWindowPresenter [
presenter close ];
addDefaultButton: 'Ok' do: [ :presenter |
presenter triggerOkAction.
presenter beOk.
presenter close ]
]

Expand Down
52 changes: 52 additions & 0 deletions src/Spec2-ListView/SpColumnViewPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,58 @@ SpColumnViewPresenter class >> exampleWithIcons [
open
]

{ #category : 'examples' }
SpColumnViewPresenter class >> exampleWithIconsAndButtons [

^ SpColumnViewPresenter new
addColumn: (SpColumnViewColumn new
title: 'Class';
setup: [ :aPresenter |
| presenter |
(presenter := aPresenter newPresenter)
layout: (SpBoxLayout newHorizontal
spacing: 5;
add: presenter newImage expand: false;
add: presenter newLabel;
yourself);
yourself ];
bind: [ :aPresenter :aClass |
| icon image label |
icon := Smalltalk ui icons iconNamed: aClass systemIconName.
image := aPresenter layout children first.
image image: icon.
label := aPresenter layout children second.
label label: aClass name ];
yourself);
addColumn: (SpColumnViewColumn new
title: 'Actions';
width: 60;
setup: [ :aPresenter | | presenter |
(presenter := aPresenter newPresenter)
layout: (SpBoxLayout newHorizontal
hAlignCenter;
add: (presenter newButton
addStyle: 'small';
yourself);
add: (presenter newButton
addStyle: 'small';
icon: (presenter iconNamed: #smallDelete);
yourself);
yourself);
yourself ];
bind: [ :aPresenter :aClass | | button1 button2 |
button1 := aPresenter layout children first.
button1
icon: (aPresenter iconNamed: aClass systemIconName);
action: [ Object inform: aClass name ].
button2 := aPresenter layout children second.
button2
action: [ Object inform: 'Will remove ', aClass name ] ];
yourself);
items: Smalltalk allClassesAndTraits;
open
]

{ #category : 'api' }
SpColumnViewPresenter >> addColumn: aColumn [
"Add a column to the table. A column should be an instance of `SpTableColumn`"
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-ListView/SpDropDownPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ SpDropDownPresenter class >> example [
items: self environment allClasses;
setup: [ :aPresenter | aPresenter newLabel ];
bind: [ :aPresenter :aClass | aPresenter label: aClass name ];
display: [ :aClass | aClass name ];
open
]

Expand All @@ -49,7 +48,7 @@ SpDropDownPresenter class >> exampleWithIcons [
| presenter |
(presenter := aPresenter newPresenter)
layout: (SpBoxLayout newHorizontal
"spacing: 5;"
spacing: 5;
add: presenter newImage expand: false;
add: presenter newLabel;
yourself);
Expand All @@ -72,7 +71,6 @@ SpDropDownPresenter class >> exampleWithSelectedItem [
items: self environment allClassesAndTraits;
setup: [ :aPresenter | aPresenter newLabel ];
bind: [ :aPresenter :aClass | aPresenter label: aClass name ];
display: [ :aClass | aClass name ];
selectItem: Object;
whenSelectionChangedDo: [ :aSelection | aSelection selectedItem crTrace ];
open
Expand Down

0 comments on commit 9834312

Please sign in to comment.