-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from ElvinPero/ICelv
Toggleable class method + triangle LED
- Loading branch information
Showing
5 changed files
with
344 additions
and
6 deletions.
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,48 @@ | ||
Class { | ||
#name : 'TbHorizontalSwitch', | ||
#superclass : 'TbSwitch', | ||
#category : 'CoypuIDE-Acid', | ||
#package : 'CoypuIDE', | ||
#tag : 'Acid' | ||
} | ||
|
||
{ #category : 'initialization' } | ||
TbHorizontalSwitch >> initializeSwitch [ | ||
|s| | ||
self switch: (BlElement new | ||
geometry:(BlRoundedRectangleGeometry cornerRadius: 4); | ||
background: self switchOnColor; | ||
transformDo: [ :t| | ||
t translateBy: 0@ -4 ]; | ||
effect: (BlGaussianShadowEffect color: (self shadowColor) offset: 0@ 4 width: 10); | ||
size: 60@35 ; | ||
margin: (BlInsets all: 10); | ||
layout: BlFrameLayout new; | ||
constraintsDo: [ :c | | ||
c frame horizontal alignCenter. | ||
c frame vertical alignCenter. | ||
]). | ||
s:= BlElement new | ||
geometry: (BlRoundedRectangleGeometry cornerRadius: 4); | ||
background: self switchOffColor; | ||
size: 55@25 ; | ||
margin: (BlInsets all: 2); | ||
constraintsDo: [ :c | | ||
c frame horizontal alignCenter. | ||
c frame vertical alignTop. | ||
]. | ||
switch addChild: s. | ||
self addChild:self switch. | ||
] | ||
|
||
{ #category : 'initialization' } | ||
TbHorizontalSwitch >> initializeWidget [ | ||
self size: widgetSize. | ||
self background: (Color gray alpha:0.0). | ||
self layout: BlFrameLayout new. | ||
] | ||
|
||
{ #category : 'initialization' } | ||
TbHorizontalSwitch >> initializeWidgetSize [ | ||
widgetSize:= 70@50. | ||
] |
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,128 @@ | ||
Class { | ||
#name : 'TbOnOffSwitch', | ||
#superclass : 'TbSwitch', | ||
#category : 'CoypuIDE-Acid', | ||
#package : 'CoypuIDE', | ||
#tag : 'Acid' | ||
} | ||
|
||
{ #category : 'initialization' } | ||
TbOnOffSwitch >> initializeSwitch [ | ||
|s l1 l2 l3| | ||
self switch: (BlElement new | ||
geometry:(BlRoundedRectangleGeometry cornerRadius: 4); | ||
background: (self switchOnColor ); | ||
transformDo: [ :t| | ||
t translateBy: 0@ -4 ]; | ||
effect: (BlGaussianShadowEffect color: (self shadowColor) offset: 0@ 4 width: 10); | ||
size: 60@30 ; | ||
margin: (BlInsets all: 10); | ||
layout: BlFrameLayout new; | ||
constraintsDo: [ :c | | ||
c frame horizontal alignCenter. | ||
c frame vertical alignCenter. | ||
]). | ||
s:= BlElement new | ||
geometry: (BlRoundedRectangleGeometry cornerRadius: 4); | ||
background: self switchOffColor; | ||
layout: BlFrameLayout new; | ||
size: 30@25 ; | ||
margin: (BlInsets all: 2); | ||
padding: (BlInsets all: 5); | ||
constraintsDo: [ :c | | ||
c frame horizontal alignLeft. | ||
c frame vertical alignCenter. | ||
]. | ||
l1:= BlElement new | ||
geometry: (BlRoundedRectangleGeometry cornerRadius: 2); | ||
background: self lineColor; | ||
layout: BlFrameLayout new; | ||
size: 3@15; | ||
margin: (BlInsets all: 2); | ||
constraintsDo: [ :c | | ||
c frame horizontal alignLeft. | ||
c frame vertical alignCenter. | ||
]. | ||
l2:= BlElement new | ||
geometry: (BlRoundedRectangleGeometry cornerRadius: 2); | ||
background: self lineColor; | ||
layout: BlFrameLayout new; | ||
size: 3@15 ; | ||
margin: (BlInsets all: 2); | ||
constraintsDo: [ :c | | ||
c frame horizontal alignCenter. | ||
c frame vertical alignCenter. | ||
]. | ||
l3:= BlElement new | ||
geometry: (BlRoundedRectangleGeometry cornerRadius: 2); | ||
background: self lineColor; | ||
layout: BlFrameLayout new; | ||
size: 3@15 ; | ||
margin: (BlInsets all: 2); | ||
constraintsDo: [ :c | | ||
c frame horizontal alignRight. | ||
c frame vertical alignCenter. | ||
]. | ||
s addChildren: { l1. l2. l3 }. | ||
switch addChild: s. | ||
self addChild:self switch. | ||
] | ||
|
||
{ #category : 'initialization' } | ||
TbOnOffSwitch >> initializeWidget [ | ||
self size: widgetSize. | ||
self background: (Color gray alpha:0.0). | ||
self layout: BlFrameLayout new. | ||
] | ||
|
||
{ #category : 'initialization' } | ||
TbOnOffSwitch >> initializeWidgetSize [ | ||
widgetSize:= 70@50. | ||
] | ||
|
||
{ #category : 'initialization' } | ||
TbOnOffSwitch >> lineColor [ | ||
^ (Color r:166 g:136 b:108 range:255). | ||
|
||
|
||
] | ||
|
||
{ #category : 'initialization' } | ||
TbOnOffSwitch >> switchOnColor [ | ||
^ (Color r:110 g:90 b:70 range:255). | ||
] | ||
|
||
{ #category : 'initialization' } | ||
TbOnOffSwitch >> toggle [ | ||
self toggleValue. | ||
self value = 1 | ||
ifTrue: [ | ||
"On Mode" | ||
|
||
switch background: (self switchOnColor alpha: 1.0); | ||
childrenDo: [ :i| | ||
i constraintsDo: [ :c | | ||
c frame horizontal alignRight. | ||
c frame vertical alignCenter. | ||
]. | ||
|
||
]. | ||
] | ||
ifFalse: [ | ||
"Off Mode" | ||
|
||
|
||
switch background: (self switchOnColor alpha: 1.0); | ||
childrenDo: [ :i| | ||
i constraintsDo: [ :c | | ||
c frame horizontal alignLeft. | ||
c frame vertical alignCenter. | ||
]. | ||
|
||
]. | ||
|
||
|
||
|
||
|
||
]. | ||
] |
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
Oops, something went wrong.