-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We now use an `effect` block to use Signals.
- Loading branch information
Showing
8 changed files
with
85 additions
and
40 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
api/src/main/kotlin/com/mattmx/ktgui/components/EffectBlock.kt
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,16 @@ | ||
package com.mattmx.ktgui.components | ||
|
||
import com.mattmx.ktgui.components.screen.GuiScreen | ||
import com.mattmx.ktgui.components.signal.SignalListener | ||
import com.mattmx.ktgui.components.signal.SignalOwner | ||
|
||
class EffectBlock<T : GuiScreen>( | ||
val owner: T, | ||
val block: (T) -> Unit | ||
) : SignalListener<Any> { | ||
override fun onChange(value: Any) { | ||
block(owner) | ||
// todo we might want to keep track of what buttons are used exactly inside of the effect block | ||
owner.refresh() | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
api/src/main/kotlin/com/mattmx/ktgui/components/button/SignalButton.kt
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
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
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
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