diff options
author | Camil Staps | 2019-10-29 17:29:09 +0100 |
---|---|---|
committer | Camil Staps | 2019-10-29 17:29:09 +0100 |
commit | cf8252abf24fa76c0a6eba362f66b1f1f3358fa3 (patch) | |
tree | c6e15e96c2a1da9ced93de41082bb02aa0de2461 /src/Gtk/Widgets.icl | |
parent | Fix toInt and fromInt for GtkResponse (diff) |
Add general instance tune w GtkSizeRequest | gtkWidget w, remove size parameter on windows and popups
Diffstat (limited to 'src/Gtk/Widgets.icl')
-rw-r--r-- | src/Gtk/Widgets.icl | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Gtk/Widgets.icl b/src/Gtk/Widgets.icl index 9500b5f..b59006e 100644 --- a/src/Gtk/Widgets.icl +++ b/src/Gtk/Widgets.icl @@ -534,22 +534,26 @@ where toState (gtk_widget_add_accelerator w "activate" ag (gdk_keyval_from_name key) (toInt mask) 1) >>| pure widget +instance tune w GtkSizeRequest | gtkWidget w +where + tune (GtkSizeRequest (width,height)) widget = + let (GtkWidget w) = gtkWidget widget in + toState (gtk_widget_set_size_request w width height) >>| + pure widget + instance gtkWidget GtkWindow where gtkWidget (GtkWindow w) = GtkWidget w instance gtkContainer GtkWindow where gtkContainer (GtkWindow w) = GtkContainer w instance gtkWindow GtkWindow where gtkWindow w = w -newPopup :: !(Maybe (Int,Int)) -> GtkM GtkWindow -newPopup size = new_window_or_popup True size +newPopup :: -> GtkM GtkWindow +newPopup = new_window_or_popup True -newWindow :: !(Maybe (Int,Int)) -> GtkM GtkWindow -newWindow size = new_window_or_popup False size +newWindow :: GtkM GtkWindow +newWindow = new_window_or_popup False -new_window_or_popup :: !Bool !(Maybe (Int,Int)) -> GtkM GtkWindow -new_window_or_popup is_popup size = +new_window_or_popup :: !Bool -> GtkM GtkWindow +new_window_or_popup is_popup = toStateR (gtk_window_new is_popup) >>= \w -> - (case size of - Nothing -> pure () - Just (h,v) -> toState (gtk_widget_set_size_request w h v)) >>| show (GtkWindow w) instance tune w GtkTitle | gtkWindow w |