diff options
Diffstat (limited to 'src/Gtk/Widgets.icl')
-rw-r--r-- | src/Gtk/Widgets.icl | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/Gtk/Widgets.icl b/src/Gtk/Widgets.icl index ef1f0bc..ba0cb16 100644 --- a/src/Gtk/Widgets.icl +++ b/src/Gtk/Widgets.icl @@ -47,6 +47,7 @@ addToContainer container widget = instance gtkWidget GtkDialog where gtkWidget d = d instance gtkContainer GtkDialog where gtkContainer d = d +instance gtkWindow GtkDialog where gtkWindow w = w instance gtkDialog GtkDialog where gtkDialog d = d instance ptr GtkDialog @@ -72,6 +73,15 @@ runDialog dialog = fromInt <$> toStateR (gtk_dialog_run (gtkDialog dialog)) getContentArea :: !d -> GtkBox | gtkDialog d getContentArea dialog = gtk_dialog_get_content_area (gtkDialog dialog) +newMessageDialog :: !GtkWindow !GtkMessageType !GtkButtonsType !String -> GtkM GtkDialog +newMessageDialog window type buttons text = + toStateR (gtk_message_dialog_new_with_markup + window + 1 /* DESTROY_WITH_PARENT */ + (toInt type) + (toInt buttons) + text) + getFileWithDialog :: !GtkWindow !GtkFileChooserAction !(Maybe String) -> GtkM (Maybe FilePath) getFileWithDialog window action title = toStateR (gtk_file_chooser_dialog_new title window (toInt action) buttons) >>= \dialog -> @@ -334,22 +344,28 @@ setMargins {left,top,right,bottom} widget` = instance gtkWidget GtkWindow where gtkWidget w = w instance gtkContainer GtkWindow where gtkContainer w = w +instance gtkWindow GtkWindow where gtkWindow w = w -newPopup :: !String !(Maybe (Int,Int)) -> GtkM GtkWindow -newPopup title size = new_window_or_popup True title size +newPopup :: !(Maybe (Int,Int)) -> GtkM GtkWindow +newPopup size = new_window_or_popup True size -newWindow :: !String !(Maybe (Int,Int)) -> GtkM GtkWindow -newWindow title size = new_window_or_popup False title size +newWindow :: !(Maybe (Int,Int)) -> GtkM GtkWindow +newWindow size = new_window_or_popup False size -new_window_or_popup :: !Bool !String !(Maybe (Int,Int)) -> GtkM GtkWindow -new_window_or_popup is_popup title size = +new_window_or_popup :: !Bool !(Maybe (Int,Int)) -> GtkM GtkWindow +new_window_or_popup is_popup size = toStateR (gtk_window_new is_popup) >>= \window -> - toState (gtk_window_set_title window title) >>| (case size of Nothing -> pure () Just (h,v) -> toState (gtk_widget_set_size_request window h v)) >>| show window +instance tune w GtkTitle | gtkWindow w +where + tune (Title s) window = + toState (gtk_window_set_title (gtkWindow window) s) >>| + pure window + // NB: it is also possible to attach CSS to one widget in particular (excluding // children widgets). You then use gtk_widget_get_style_context and gtk_style_ // context_add_provider instead of gtk_widget_get_screen and gtk_style_context_ |