Skip to content

Commit

Permalink
Merge pull request #189 from pharo-graphics/dev
Browse files Browse the repository at this point in the history
Updating Master from Dev
  • Loading branch information
plantec authored Aug 30, 2024
2 parents 1062dc5 + 17adaae commit e5332e8
Show file tree
Hide file tree
Showing 182 changed files with 3,630 additions and 2,278 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

# Toplo

Toplo is a widget framework for [Pharo](https://www.pharo.org) on top of [Bloc](https://github.com/pharo-graphics/Bloc).
Toplo is a widget framework for [Pharo](https://www.pharo.org) on top of [Bloc](https://github.com/pharo-graphics/Bloc).
Toplo is in development. You want to contribute ? A cool way to start to contribute is to use it and add issues with tests.


## Documentation
Expand All @@ -19,7 +20,6 @@ The project can be loaded as usual via Metacello, using the `BaselineOfToplo` sp


## Branches & Contributions

We describe our contribution workflow & branch name convention in [this wiki page](../../wiki/Branches-and-versions).


Expand Down
6 changes: 3 additions & 3 deletions src/Toplo-Demo/ToploDemoPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ ToploDemoPresenter >> demo2 [

<demo>
| list colorAssociations |
(list := ToListElement new) nodeBuilder: [ :node :holder |
(list := ToListElement new) nodeBuilder: [ :node :dataItem :holder |
node addChild: (ToLabeledIcon new
label: (ToLabel new
text: holder dataItem key;
text: dataItem key;
yourself);
icon: (ToElement new
size: 50 @ 20;
background: holder dataItem value;
background: dataItem value;
yourself);
startInterspace: 3;
yourself) ].
Expand Down
6 changes: 6 additions & 0 deletions src/Toplo-Examples/ToIconDescExample.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Class {
#category : #'Toplo-Examples'
}

{ #category : #converting }
ToIconDescExample >> asString [

^ style prefix, ' ', name
]

{ #category : #accessing }
ToIconDescExample >> icon [

Expand Down
5 changes: 3 additions & 2 deletions src/Toplo-Examples/ToListElementStresser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,11 @@ ToListElementStresser >> nextProcessPriorityForListNumber: aNumber [
{ #category : #accessing }
ToListElementStresser >> nextSizeForListNumber: aNumber [

^ aNumber even
"^ aNumber even
ifTrue: [ rand nextIntegerBetween: 1 and: self minListSize ]
ifFalse: [
rand nextIntegerBetween: self minListSize and: self maxListSize ]
rand nextIntegerBetween: self minListSize and: self maxListSize ]"
^ 2000
]

{ #category : #running }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,7 @@ ToListElementStresserWithAdditionalSelecters >> newListElement [

| l |
l := ToListElement new
withHiddenSelecter;
withUnselectableSelecter;
withDisabledSelecter;
nodeBuilder: [ :node :holder :dataItem |
nodeBuilder: [ :node :dataItem :holder |
| lab |
lab := ToLabel text: dataItem.
node addChild: lab.
Expand All @@ -164,8 +161,15 @@ ToListElementStresserWithAdditionalSelecters >> newListElement [
holder isDisabled ifTrue: [
node background: (Color veryLightGray alpha: 0.5) ] ];
yourself.
"l newDisabledSelectionMode onInstalledIn: l.
l newUnselectableSelectionMode onInstalledIn: l."
"
l newDisabledSelectionMode onInstalledIn: l.
l newUnselectableSelectionMode onInstalledIn: l.
l withHiddenSelecter.
"
l
withHiddenSelecter;
withUnselectableSelecter;
withDisabledSelecter.

^ l
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ToListSelectionHistoryEventHandlerExample >> addWholeSelectionCommand: aCommand
{ #category : #'api - accessing' }
ToListSelectionHistoryEventHandlerExample >> eventsToHandle [

^ { ToSelectionCommandAppliedEvent }
^ { ToListSelectionCommandAppliedEvent }
]

{ #category : #accessing }
Expand All @@ -54,6 +54,17 @@ ToListSelectionHistoryEventHandlerExample >> historyList: aList [
historyList := aList
]

{ #category : #'event handling' }
ToListSelectionHistoryEventHandlerExample >> listSelectionCommandAppliedEvent: aCommandAppliedEvent [

currentTarget := aCommandAppliedEvent currentTarget.
" check that the command is applied on the primary selection model "
aCommandAppliedEvent selectionModel = currentTarget selectionModel
ifFalse: [ ^ self ].
aCommandAppliedEvent command applyWithOperator: self.
currentTarget := nil
]

{ #category : #'event handling' }
ToListSelectionHistoryEventHandlerExample >> removeIndexesSelectionCommand: aCommand [

Expand All @@ -74,14 +85,3 @@ ToListSelectionHistoryEventHandlerExample >> removeWholeSelectionCommand: aComma

historyList dataAccessor removeAll
]

{ #category : #'event handling' }
ToListSelectionHistoryEventHandlerExample >> selectionCommandAppliedEvent: aCommandAppliedEvent [

currentTarget := aCommandAppliedEvent currentTarget.
" check that the command is applied on the primary selection model "
aCommandAppliedEvent command selectionModel
= currentTarget selectionModel ifFalse: [ ^ self ].
aCommandAppliedEvent command applyWithOperator: self.
currentTarget := nil
]
16 changes: 8 additions & 8 deletions src/Toplo-Examples/ToMiniBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ ToMiniBrowser >> newClassPane [
classes := ToListElement new
nodeFactory: [ ToClassNameViewExample new ];
id: #classes;
nodeBuilder: [ :node :holder |
node class: holder dataItem position: holder position ].
nodeBuilder: [ :node :dataItem :holder |
node class: dataItem position: holder position ].

classes addEventHandler: (BlEventHandler
on: ToListPrimarySelectionChangedEvent
Expand Down Expand Up @@ -161,9 +161,9 @@ ToMiniBrowser >> newPackagePane [

packages := ToListElement new
id: #packages;
nodeBuilder: [ :node :holder |
nodeBuilder: [ :node :dataItem :holder |
node addChild: (ToLabel new
text: holder dataItem name;
text: dataItem name;
hMatchParent;
yourself) ].

Expand Down Expand Up @@ -236,9 +236,9 @@ ToMiniBrowser >> newProtocolPane [

protocols := ToListElement new
id: #protocols;
nodeBuilder: [ :node :holder |
nodeBuilder: [ :node :dataItem :holder |
node addChild: (ToLabel new
text: holder dataItem value name;
text: dataItem value name;
hMatchParent) ].

protocols addEventHandler: (BlEventHandler
Expand All @@ -252,9 +252,9 @@ ToMiniBrowser >> newSelectorPane [

selectors := ToListElement new
id: #selectors;
nodeBuilder: [ :node :holder |
nodeBuilder: [ :node :dataItem :holder |
node addChild:
(ToLabel text: holder dataItem value asString)
(ToLabel text: dataItem value asString)
hMatchParent ].

selectors addEventHandler: (BlEventHandler
Expand Down
30 changes: 3 additions & 27 deletions src/Toplo-Examples/ToPaneNodeExample.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,8 @@ Class {
#category : #'Toplo-Examples'
}

{ #category : #'t - list node - initialization' }
ToPaneNodeExample >> defaultEventHandler [
{ #category : #skin }
ToPaneNodeExample >> newRawSkin [

^ ToPaneNodeExampleEventHandler new
]

{ #category : #initialization }
ToPaneNodeExample >> initialize [

| p1 p2 p3 |
super initialize.
self beHorizontal.
self
clipChildren: false;
outskirts: BlOutskirts outside;
geometry: (BlRoundedRectangleGeometry cornerRadius: 4);
margin: (BlInsets all: 6);
padding: (BlInsets all: 6).

p1 := ToPane vertical background: Color blue; width: 50; yourself.
p2 := ToPane vertical background: (Color blue alpha: 0.6); width: 100; yourself.
p3 := ToPane vertical background: (Color blue alpha: 0.3); hMatchParent; yourself.
self addChildren: { p1. p2. p3 }.
self height: 60.
self hMatchParent.
self addEventHandler: self defaultEventHandler


^ ToPaneNodeExampleSkin new
]
50 changes: 0 additions & 50 deletions src/Toplo-Examples/ToPaneNodeExampleEventHandler.class.st

This file was deleted.

82 changes: 82 additions & 0 deletions src/Toplo-Examples/ToPaneNodeExampleSkin.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Class {
#name : #ToPaneNodeExampleSkin,
#superclass : #ToRawSkin,
#instVars : [
'nodeButton'
],
#category : #'Toplo-Examples'
}

{ #category : #'event handling' }
ToPaneNodeExampleSkin >> createNodeButton [

| label |
label := ToLabel text: 'Do something'.
" ensure that the button label skin will not receive selected skin event "
label addStamp: #unselectable.
nodeButton := ToButton new
label: label;
yourself.
nodeButton whenClickedDo: [ :event |
event consume.
self inform: 'CLICK' ].
nodeButton constraintsDo: [ :c |
c ignoreByLayout.
c ignored horizontal alignRight ].
nodeButton position: 0 @ -5
]

{ #category : #'event handling' }
ToPaneNodeExampleSkin >> hoveredSkinEvent: anEvent [

super hoveredSkinEvent: anEvent.
anEvent elementDo: [ :e |
" hovered skin can be dispatched whereas no leaved look event has been dispatched
(in case of click event as an example)"
nodeButton ifNil: [
self createNodeButton.
e addChild: nodeButton ] ]
]

{ #category : #'event handling' }
ToPaneNodeExampleSkin >> installSkinEvent: anEvent [

super installSkinEvent: anEvent.
anEvent elementDo: [ :e |
| p1 p2 p3 |
e beHorizontal.
e
clipChildren: false;
outskirts: BlOutskirts outside;
geometry: (BlRoundedRectangleGeometry cornerRadius: 4);
margin: (BlInsets all: 6);
padding: (BlInsets all: 6).

p1 := ToPane vertical
background: Color blue;
width: 50;
yourself.
p2 := ToPane vertical
background: (Color blue alpha: 0.6);
width: 100;
yourself.
p3 := ToPane vertical
background: (Color blue alpha: 0.3);
hMatchParent;
yourself.
e addChildren: {
p1.
p2.
p3 }.
e height: 60.
e hMatchParent ]
]

{ #category : #'event handling' }
ToPaneNodeExampleSkin >> leavedSkinEvent: anEvent [

super leavedSkinEvent: anEvent.
nodeButton ifNotNil: [
nodeButton removeFromParent.
nodeButton := nil ]
]
Loading

0 comments on commit e5332e8

Please sign in to comment.