gi-gtk-declarative-0.6.0: Declarative GTK+ programming in Haskell

Safe HaskellNone
LanguageHaskell2010

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

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 internalState as 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 # 
Instance details

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 # 
Instance details

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 # 
Instance details

Defined in GI.Gtk.Declarative.CustomWidget

Methods

subscribe :: CustomWidget widget params internalState event -> SomeState -> (event -> IO ()) -> IO Subscription Source #