summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2019-10-29 19:39:13 +0100
committerCamil Staps2019-10-29 22:19:53 +0100
commit8e4c06ed5e4572d7e9c1655b1d3442d4467f2997 (patch)
treed1088d8536e7e55d2bca1c5a0a0d46a58ed105f7
parentAdd functions to set/check row visibility of GtkSheets (diff)
Add GtkSearchEntry
-rw-r--r--src/Gtk/Internal.dcl2
-rw-r--r--src/Gtk/Internal.icl5
-rw-r--r--src/Gtk/Signal.dcl12
-rw-r--r--src/Gtk/Signal.icl24
-rw-r--r--src/Gtk/Widgets.dcl12
-rw-r--r--src/Gtk/Widgets.icl18
6 files changed, 57 insertions, 16 deletions
diff --git a/src/Gtk/Internal.dcl b/src/Gtk/Internal.dcl
index 7a70d85..2122531 100644
--- a/src/Gtk/Internal.dcl
+++ b/src/Gtk/Internal.dcl
@@ -106,6 +106,8 @@ gtk_paned_set_wide_handle :: !Pointer !Bool !.a -> .a
gtk_scrolled_window_new :: !Pointer !Pointer !.a -> (!Pointer, !.a)
gtk_scrolled_window_set_policy :: !Pointer !Int !Int !.a -> .a
+gtk_search_entry_new :: !.a -> (!Pointer, !.a)
+
gtk_separator_menu_item_new :: !.a -> (!Pointer, !.a)
gtk_separator_new :: !Bool !.a -> (!Pointer, !.a)
diff --git a/src/Gtk/Internal.icl b/src/Gtk/Internal.icl
index db2ef5a..95b4b2a 100644
--- a/src/Gtk/Internal.icl
+++ b/src/Gtk/Internal.icl
@@ -482,6 +482,11 @@ gtk_scrolled_window_set_policy window hpolicy vpolicy env = code {
ccall gtk_scrolled_window_set_policy "pII:V:A"
}
+gtk_search_entry_new :: !.a -> (!Pointer, !.a)
+gtk_search_entry_new env = code {
+ ccall gtk_search_entry_new ":p:A"
+}
+
gtk_separator_menu_item_new :: !.a -> (!Pointer, !.a)
gtk_separator_menu_item_new env = code {
ccall gtk_separator_menu_item_new ":p:A"
diff --git a/src/Gtk/Signal.dcl b/src/Gtk/Signal.dcl
index 0f90c1b..5ed6ac8 100644
--- a/src/Gtk/Signal.dcl
+++ b/src/Gtk/Signal.dcl
@@ -15,10 +15,14 @@ where
:: SignalHandler = E.h: SignalHandler h & signalHandler h
:: GSignalHandler
- = ActivateHandler !(GtkM ())
- | ChangedHandler !(GtkM ())
- | ClickedHandler !(GtkM ())
- | DestroyHandler !(GtkM ())
+ = ActivateHandler !(GtkM ())
+ | ChangedHandler !(GtkM ())
+ | ClickedHandler !(GtkM ())
+ | DestroyHandler !(GtkM ())
+ | NextMatchHandler !(GtkM ())
+ | PreviousMatchHandler !(GtkM ())
+ | SearchChangedHandler !(GtkM ())
+ | StopSearchHandler !(GtkM ())
instance signalHandler GSignalHandler
diff --git a/src/Gtk/Signal.icl b/src/Gtk/Signal.icl
index 26fcc7f..e97f2ab 100644
--- a/src/Gtk/Signal.icl
+++ b/src/Gtk/Signal.icl
@@ -14,15 +14,23 @@ import Gtk.Internal
instance signalHandler GSignalHandler
where
signalName h = case h of
- ActivateHandler _ -> "activate"
- ChangedHandler _ -> "changed"
- ClickedHandler _ -> "clicked"
- DestroyHandler _ -> "destroy"
+ ActivateHandler _ -> "activate"
+ ChangedHandler _ -> "changed"
+ ClickedHandler _ -> "clicked"
+ DestroyHandler _ -> "destroy"
+ NextMatchHandler _ -> "next-match"
+ PreviousMatchHandler _ -> "previous-match"
+ SearchChangedHandler _ -> "search-changed"
+ StopSearchHandler _ -> "stop-search"
signalHandler h = case h of
- ActivateHandler f -> SHI_Void f
- ChangedHandler f -> SHI_Void f
- ClickedHandler f -> SHI_Void f
- DestroyHandler f -> SHI_Void f
+ ActivateHandler f -> SHI_Void f
+ ChangedHandler f -> SHI_Void f
+ ClickedHandler f -> SHI_Void f
+ DestroyHandler f -> SHI_Void f
+ NextMatchHandler f -> SHI_Void f
+ PreviousMatchHandler f -> SHI_Void f
+ SearchChangedHandler f -> SHI_Void f
+ StopSearchHandler f -> SHI_Void f
installSignalHandler :: !h !w -> GtkM w | signalHandler h & gtkWidget w
installSignalHandler handler widget =
diff --git a/src/Gtk/Widgets.dcl b/src/Gtk/Widgets.dcl
index d604e9b..e33eb89 100644
--- a/src/Gtk/Widgets.dcl
+++ b/src/Gtk/Widgets.dcl
@@ -75,10 +75,14 @@ newMessageDialog :: !GtkWindow !GtkMessageType !GtkButtonsType !String -> GtkM G
getFileWithDialog :: !GtkWindow !GtkFileChooserAction !(Maybe String) -> GtkM (Maybe FilePath)
:: GtkEntry =: GtkEntry Pointer
+
+class gtkEntry a :: !a -> GtkEntry
+
instance gtkWidget GtkEntry
+instance gtkEntry GtkEntry
newEntry :: GtkM GtkEntry
-getText :: !GtkEntry -> GtkM String
+getText :: !e -> GtkM String | gtkEntry e
instance tune GtkEntry GtkText
@@ -172,6 +176,12 @@ newScrolledWindow :: GtkM GtkScrolledWindow
instance tune GtkScrolledWindow (GtkScrollbarPolicy, GtkScrollbarPolicy)
+:: GtkSearchEntry =: GtkSearchEntry Pointer
+instance gtkWidget GtkSearchEntry
+instance gtkEntry GtkSearchEntry
+
+newSearchEntry :: GtkM GtkSearchEntry
+
:: GtkSeparator =: GtkSeparator Pointer
instance gtkWidget GtkSeparator
diff --git a/src/Gtk/Widgets.icl b/src/Gtk/Widgets.icl
index cf11914..e457ee8 100644
--- a/src/Gtk/Widgets.icl
+++ b/src/Gtk/Widgets.icl
@@ -146,18 +146,22 @@ where
pure Nothing
instance gtkWidget GtkEntry where gtkWidget (GtkEntry e) = GtkWidget e
+instance gtkEntry GtkEntry where gtkEntry e = e
newEntry :: GtkM GtkEntry
newEntry =
toStateR gtk_entry_new >>= \e ->
show (GtkEntry e)
-getText :: !GtkEntry -> GtkM String
-getText (GtkEntry e) = toStateR (gtk_entry_get_text e)
+getText :: !e -> GtkM String | gtkEntry e
+getText entry =
+ let (GtkEntry e) = gtkEntry entry in
+ toStateR (gtk_entry_get_text e)
instance tune GtkEntry GtkText
where
- tune (Text text) entry=:(GtkEntry e) =
+ tune (Text text) entry =
+ let (GtkEntry e) = gtkEntry entry in
toState (gtk_entry_set_text e text) >>|
pure entry
@@ -354,6 +358,14 @@ where
toState (gtk_scrolled_window_set_policy sw (toInt hp) (toInt vp)) >>|
pure window
+instance gtkWidget GtkSearchEntry where gtkWidget (GtkSearchEntry se) = GtkWidget se
+instance gtkEntry GtkSearchEntry where gtkEntry (GtkSearchEntry se) = GtkEntry se
+
+newSearchEntry :: GtkM GtkSearchEntry
+newSearchEntry =
+ toStateR gtk_search_entry_new >>= \se ->
+ show (GtkSearchEntry se)
+
instance gtkWidget GtkSeparator where gtkWidget (GtkSeparator s) = GtkWidget s
newSeparator :: !GtkOrientation -> GtkM GtkSeparator