Skip to content

Commit

Permalink
added choice selection
Browse files Browse the repository at this point in the history
  • Loading branch information
gitjannes committed Jun 17, 2024
1 parent 9a3caa0 commit 972abbf
Show file tree
Hide file tree
Showing 22 changed files with 148 additions and 7 deletions.
Binary file modified assets/playbutton.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
as yet unclassified
addChoices

self addMorph: (TCUChoice newFor: 'Anonymous Poll?' isExclusive: false);
addMorph: (TCUChoice newFor: 'Standard Poll' isExclusive: true);
addMorph: (TCUChoice newFor: 'Multiple Options' isExclusive: true);
addMorph: (TCUChoice newFor: 'Quiz' isExclusive: true).
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ as yet unclassified
addTypeOption

self typeOption: (RectangleMorph new
color: Color red;
extent: 300@300;
color: TCUDefaultValues colorLightBlue;
useRoundedCorners;
layoutPolicy: TableLayout new;
listDirection: #leftToRight;
wrapDirection: #topToBottom;
wrapCentering: #topLeft;
layoutInset: 2;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
cellInset: 8;
addMorph: (TCUChoice newFor: 'Anonymous Poll?' isExclusive: false);
addMorph: (TCUChoice newFor: 'Standard Poll' isExclusive: true);
addMorph: (TCUChoice newFor: 'Multiple Options' isExclusive: true);
addMorph: (TCUChoice newFor: 'Quiz' isExclusive: true);
yourself).

self addMorph: self typeOption.
self addMorphFront: self typeOption.
self typeOption center: self center.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ initialize
super initialize.

self
color: (TCUDefaultValues colorLightGray alpha: 0.5);
color: (TCUDefaultValues colorLightGray alpha: 0.8);
borderWidth: 0;
on: #mouseUp send: #hide to: self.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"class" : {
"newFor:withBounds:" : "jkon 6/17/2024 11:14" },
"instance" : {
"addTypeOption" : "jkon 6/17/2024 11:17",
"addChoices" : "jkon 6/17/2024 15:50",
"addTypeOption" : "jkon 6/17/2024 16:06",
"chat" : "jkon 6/17/2024 10:29",
"chat:" : "jkon 6/17/2024 10:29",
"initialize" : "jkon 6/17/2024 11:13",
"initialize" : "jkon 6/17/2024 15:58",
"typeOption" : "jkon 6/17/2024 11:03",
"typeOption:" : "jkon 6/17/2024 11:03" } }
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"commentStamp" : "",
"instvars" : [
"chat",
"typeOption" ],
"typeOption",
"selectionMorph",
"textMorph",
"isSelected" ],
"name" : "TCUChatPollEditor",
"pools" : [
],
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
as yet unclassified
newFor: aString isExclusive: aBoolean

^ (super new)
content: aString;
isExclusive: aBoolean;
addSelectionMorph;
addTextMorph;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
as yet unclassified
addSelectionMorph

self isExclusive
ifTrue: [selectionMorph := CircleMorph new]
ifFalse: [selectionMorph := RectangleMorph new].
selectionMorph
color: TCUDefaultValues colorLightBlue;
extent: 22@22.
self addMorph: selectionMorph.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
as yet unclassified
addTextMorph

|textMorph|

textMorph := TextMorph new
contents: self content;
hResizing: #spaceFill;
color: Color white;
position: 26@0;
readOnly: true;
lock;
yourself.
self addMorph: textMorph

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
content: aString

content := aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
content

^ content
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
as yet unclassified
initialize

super initialize.

self color: TCUDefaultValues colorLightBlue;
borderWidth: 0;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
on: #mouseDown send: #updateChoice to: self;
isSelected: false.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
isExclusive: aBoolean

isExclusive := aBoolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
isExclusive

^ isExclusive
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
isSelected: aBoolean

isSelected := aBoolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
isSelected

^ isSelected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
selectionMorph: aMorph

selectionMorph := aMorph
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
selectionMorph

^ selectionMorph
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
as yet unclassified
updateChoice

self isSelected
ifTrue: [selectionMorph color: TCUDefaultValues colorLightBlue.
self isSelected: false.]
ifFalse: [selectionMorph color: Color black.
self isSelected: true.]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"class" : {
"newFor:isExclusive:" : "jkon 6/17/2024 15:40" },
"instance" : {
"addSelectionMorph" : "jkon 6/17/2024 15:21",
"addTextMorph" : "jkon 6/17/2024 15:32",
"content" : "jkon 6/17/2024 15:32",
"content:" : "jkon 6/17/2024 15:32",
"initialize" : "jkon 6/17/2024 15:40",
"isExclusive" : "jkon 6/17/2024 15:16",
"isExclusive:" : "jkon 6/17/2024 15:17",
"isSelected" : "jkon 6/17/2024 14:52",
"isSelected:" : "jkon 6/17/2024 14:52",
"selectionMorph" : "jkon 6/17/2024 15:20",
"selectionMorph:" : "jkon 6/17/2024 15:20",
"updateChoice" : "jkon 6/17/2024 14:56" } }
17 changes: 17 additions & 0 deletions packages/TelegramClient-UI.package/TCUChoice.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"category" : "TelegramClient-UI",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"selectionMorph",
"isSelected",
"content",
"isExclusive" ],
"name" : "TCUChoice",
"pools" : [
],
"super" : "RectangleMorph",
"type" : "normal" }

0 comments on commit 972abbf

Please sign in to comment.