blob: dfeb9018bf756c6d6fa2c7f13738f33d93b1be0e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
implementation module Gtk.Widgets
import StdEnv
import StdMaybe
import Control.Monad
import Control.Monad.Identity
import Control.Monad.State
import System._Pointer
import qualified Gtk.Internal as I
import Gtk.State
:: GtkWidget :== Int
:: GtkWindow :== Int
instance gtkWidget GtkWidget
where
gtkWidget w = w
gtkPtr w = w
instance gtkWidget GtkWindow
where
gtkWidget w = w
gtkPtr w = w
newPopup :: !String !(Maybe (Int,Int)) -> State GtkState GtkWindow
newPopup title size = new_window_or_popup True title size
newWindow :: !String !(Maybe (Int,Int)) -> State GtkState GtkWindow
newWindow title size = new_window_or_popup False title size
new_window_or_popup :: !Bool !String !(Maybe (Int,Int)) -> State GtkState GtkWindow
new_window_or_popup is_popup title size =
toStateR ('I'.gtk_window_new is_popup) >>= \window ->
toState ('I'.gtk_window_set_title window title) >>|
(case size of
Nothing -> pure ()
Just (h,v) -> toState ('I'.gtk_widget_set_size_request window h v)) >>|
toState ('I'.gtk_widget_show_all window) >>|
pure window
|