Package com.diffplug.common.swt
Class SwtRx
java.lang.Object
com.diffplug.common.swt.SwtRx
Utilities that convert SWT events into Rx-friendly Observables.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic kotlinx.coroutines.flow.Flow<Event>
addListener
(Widget widget, int... events) Subscribes to the given widget and pipes the events to anFlow
<Event
>.static kotlinx.coroutines.flow.Flow<Event>
addListener
(Widget widget, Collection<Integer> events) Subscribes to the given widget and pipes the events to anFlow
<Event
>.static kotlinx.coroutines.flow.Flow<Event>
addListener
(Widget widget, Stream<Integer> events) Subscribes to the given widget and pipes the events to anFlow
<Event
>.static Chit
chit
(com.diffplug.common.swt.ControlWrapper wrapper) Wraps the givenControlWrapper
in anChit
.static Chit
static <T> RxBox<T>
combo
(Combo combo, ImmutableList<T> values, Function<T, String> converter) Populates a Combo returns an `RxBox` which is bidirectionally bound to the given combo. static <T> void
Populates a Combo and bidirectionally binds it to an `RxBox`. static kotlinx.coroutines.flow.Flow<Point>
rightClickGlobal
(Control ctl) Returns anFlow
<Point
> of the right-click mouse-up on the given control, in global coordinates.static kotlinx.coroutines.flow.Flow<Point>
rightClickLocal
(Control ctl) Returns anFlow
<Point
> of the right-click mouse-up on the given control, in local coordinates.textConfirmed
(Text text) Returns an RxBoxwhich contains the content of the text box only when it has been confirmed by: programmer setting the RxBox user hitting enter focus leaving the text textImmediate
(Text text) Returns an RxBoxwhich contains the content of the text box. Returns an `RxBox` for the toggle state of the given button as an RxBox.
-
Constructor Details
-
SwtRx
public SwtRx()
-
-
Method Details
-
addListener
Subscribes to the given widget and pipes the events to anFlow
<Event
>. -
addListener
public static kotlinx.coroutines.flow.Flow<Event> addListener(Widget widget, Collection<Integer> events) Subscribes to the given widget and pipes the events to anFlow
<Event
>. -
addListener
public static kotlinx.coroutines.flow.Flow<Event> addListener(Widget widget, Stream<Integer> events) Subscribes to the given widget and pipes the events to anFlow
<Event
>. -
rightClickGlobal
Returns anFlow
<Point
> of the right-click mouse-up on the given control, in global coordinates. -
rightClickLocal
Returns anFlow
<Point
> of the right-click mouse-up on the given control, in local coordinates. -
textImmediate
Returns an RxBoxwhich contains the content of the text box. -
textConfirmed
Returns an RxBoxwhich contains the content of the text box only when it has been confirmed by: - programmer setting the RxBox
- user hitting enter
- focus leaving the text
-
toggle
Returns an `RxBox` for the toggle state of the given button as an RxBox. Applicable to SWT.TOGGLE, SWT.CHECK, and SWT.RADIO.
-
combo
public static <T> RxBox<T> combo(Combo combo, ImmutableList<T> values, Function<T, String> converter) Populates a Combo returns an `RxBox` which is bidirectionally bound to the given combo. - Parameters:
combo
- The combo which is being bound.values
- The values which the RxBox can take on. Must match combo.getItems().- Returns:
- An `RxBox
` which is bound bidirectionally to the given combo.
-
combo
public static <T> void combo(Combo combo, ImmutableList<T> values, Function<T, String> converter, RxBox<T> box) Populates a Combo and bidirectionally binds it to an `RxBox`. - Parameters:
combo
- The combo which is being bound.values
- The values which the RxBox can take on.converter
- A function for mapping values to strings.values
- The values which the RxBox can take on.
-
chit
Wraps the givenControlWrapper
in anChit
. -
chit
-