| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
GI.Gtk.Declarative.CustomWidget
Description
While you can instantiate Patchable and EventSource for your
 own data types, it's a bit complicated. The CustomWidget data
 type takes care of some lower-level detail, so that you can focus
 on the custom behavior of your widget. You still need to think
 about and implement a patching function, but in an easier way.
Synopsis
- data CustomPatch widget internalState- = CustomReplace
- | CustomModify (widget -> IO internalState)
- | CustomKeep
 
- data CustomWidget widget params internalState event = CustomWidget {- customWidget :: ManagedPtr widget -> widget
- customCreate :: params -> IO (widget, internalState)
- customPatch :: params -> params -> internalState -> CustomPatch widget internalState
- customSubscribe :: params -> internalState -> widget -> (event -> IO ()) -> IO Subscription
- customAttributes :: Vector (Attribute widget event)
- customParams :: params
 
Documentation
data CustomPatch widget internalState Source #
Similar to Patch, describing a possible action to perform on a
 Widget, decided by customPatch.
Constructors
| CustomReplace | |
| CustomModify (widget -> IO internalState) | |
| CustomKeep | 
data CustomWidget widget params internalState event Source #
A custom widget specification, with all functions needed to
 instantiate Patchable and EventSource. A custom widget:
- is based on a top widget
- can use internalStateas a way of keeping an internal state value threaded through updates, which is often useful for passing references to child widgets used in a custom widget
- emits events of type event
Constructors
| CustomWidget | |
| Fields 
 | |
Instances
| Functor (CustomWidget widget params internalState) Source # | |
| Defined in GI.Gtk.Declarative.CustomWidget Methods fmap :: (a -> b) -> CustomWidget widget params internalState a -> CustomWidget widget params internalState b # (<$) :: a -> CustomWidget widget params internalState b -> CustomWidget widget params internalState a # | |
| (Typeable widget, Typeable internalState, IsWidget widget) => Patchable (CustomWidget widget params internalState) Source # | |
| Defined in GI.Gtk.Declarative.CustomWidget Methods create :: CustomWidget widget params internalState e -> IO SomeState Source # patch :: SomeState -> CustomWidget widget params internalState e1 -> CustomWidget widget params internalState e2 -> Patch Source # | |
| (Typeable internalState, GObject widget) => EventSource (CustomWidget widget params internalState) Source # | |
| Defined in GI.Gtk.Declarative.CustomWidget Methods subscribe :: CustomWidget widget params internalState event -> SomeState -> (event -> IO ()) -> IO Subscription Source # | |