diff options
Diffstat (limited to 'src/Gtk/Widgets.dcl')
-rw-r--r-- | src/Gtk/Widgets.dcl | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/src/Gtk/Widgets.dcl b/src/Gtk/Widgets.dcl index 957838b..bc1e0af 100644 --- a/src/Gtk/Widgets.dcl +++ b/src/Gtk/Widgets.dcl @@ -12,12 +12,6 @@ definition module Gtk.Widgets * example, all subclasses of `GtkWidget` implement the `gtkWidget` class, and * common methods of the `GtkWidget` class correspond to overloaded functions * in Clean. - * - * NB: The types of widgets are exported here because (1) newtypes cannot be - * abstract and (2) they must be able to implement `TC` so that they can be - * shared (see `Gtk.Shares`). When the compiler supports abstract newtypes and - * `TC` instantiation of hidden types, the implementation of these types may - * be removed from the definition module; do not rely on it! */ from StdMaybe import :: Maybe @@ -41,7 +35,7 @@ from Gtk.Types import * A `GtkAccelGroup` is needed for a `GtkAccelerator`. 'Accelerator' is Gtk's * term for what most people call shortcuts, i.e. `Ctrl`-`S`, etc. */ -:: GtkAccelGroup =: GtkAccelGroup Pointer +:: GtkAccelGroup (=: GtkAccelGroup Pointer) newAccelGroup :: !w -> GtkM GtkAccelGroup | gtkWindow w @@ -54,7 +48,7 @@ newAccelGroup :: !w -> GtkM GtkAccelGroup | gtkWindow w :: GtkAccelerator = Accelerator !GtkAccelGroup !String ![GdkModifier] //* An action bar typically holds a number of buttons. -:: GtkActionBar =: GtkActionBar Pointer +:: GtkActionBar (=: GtkActionBar Pointer) instance gtkWidget GtkActionBar newActionBar :: GtkM GtkActionBar @@ -63,7 +57,7 @@ newActionBar :: GtkM GtkActionBar packActionBar :: !GtkActionBar !GtkDirection !w -> GtkM w | gtkWidget w //* A box holds a number of child widgets in some direction with spacing. -:: GtkBox =: GtkBox Pointer +:: GtkBox (=: GtkBox Pointer) instance gtkWidget GtkBox instance gtkContainer GtkBox instance gtkOrientable GtkBox @@ -79,7 +73,7 @@ packBox :: !GtkBox !GtkDirection !GtkExpand !w -> GtkM w | gtkWidget w instance tune GtkBox GtkSpacing -:: GtkButton =: GtkButton Pointer +:: GtkButton (=: GtkButton Pointer) instance gtkWidget GtkButton /** @@ -90,17 +84,19 @@ instance gtkWidget GtkButton */ newButtonFromIconName :: !String -> GtkM GtkButton -:: GtkContainer =: GtkContainer Pointer +:: GtkContainer (=: GtkContainer Pointer) class gtkContainer a :: !a -> GtkContainer instance gtkWidget GtkContainer instance gtkContainer GtkContainer +unsafeToContainer :: !Pointer -> GtkContainer + addToContainer :: !c !w -> GtkM w | gtkWidget w & gtkContainer c //* A dialog is a popup window. -:: GtkDialog =: GtkDialog Pointer +:: GtkDialog (=: GtkDialog Pointer) class gtkDialog a :: !a -> GtkDialog @@ -142,13 +138,15 @@ newMessageDialog :: !GtkWindow !GtkMessageType !GtkButtonsType !String -> GtkM G getFileWithDialog :: !GtkWindow !GtkFileChooserAction !(Maybe String) -> GtkM (Maybe FilePath) //* An entry is a simple text field. Subclasses allow more advanced input. -:: GtkEntry =: GtkEntry Pointer +:: GtkEntry (=: GtkEntry Pointer) class gtkEntry a :: !a -> GtkEntry instance gtkWidget GtkEntry instance gtkEntry GtkEntry +unsafeToEntry :: !Pointer -> GtkEntry + newEntry :: GtkM GtkEntry getText :: !e -> GtkM String | gtkEntry e @@ -163,7 +161,7 @@ instance tune GtkEntry GtkEntryCompletion * `GtkListStore` that is filtered with the default match function. It is * possible to tune the completion method with a `GtkCompletionMode`, however. */ -:: GtkEntryCompletion =: GtkEntryCompletion Pointer +:: GtkEntryCompletion (=: GtkEntryCompletion Pointer) newEntryCompletion :: GtkM GtkEntryCompletion @@ -174,7 +172,7 @@ instance tune GtkEntryCompletion GtkListStore instance tune GtkEntryCompletion GtkCompletionMode //* A frame holds a single child, with a border and an optional title. -:: GtkFrame =: GtkFrame Pointer +:: GtkFrame (=: GtkFrame Pointer) instance gtkWidget GtkFrame instance gtkContainer GtkFrame @@ -187,7 +185,7 @@ framed :: !GtkTitle !(GtkM w) -> GtkM (w, GtkFrame) | gtkWidget w * A grid is a generalized table, allowing outlining child widget positions to * each other. */ -:: GtkGrid =: GtkGrid Pointer +:: GtkGrid (=: GtkGrid Pointer) instance gtkWidget GtkGrid newGrid :: GtkM GtkGrid @@ -200,7 +198,7 @@ newGrid :: GtkM GtkGrid attachGrid :: !GtkGrid !(!Int,!Int) !(!Int,!Int) !w -> GtkM w | gtkWidget w //* A label is used to display a small or medium amount of text. -:: GtkLabel =: GtkLabel Pointer +:: GtkLabel (=: GtkLabel Pointer) instance gtkWidget GtkLabel newLabel :: GtkM GtkLabel @@ -210,7 +208,7 @@ instance tune GtkLabel GtkText * A list store holds values in a list. It is used in several places, like for * `GtkEntryCompletion` and `GtkTreeView`. */ -:: GtkListStore =: GtkListStore Pointer +:: GtkListStore (=: GtkListStore Pointer) //* Create a new list store where rows are lists of values of the given types. newListStore :: ![GType] -> GtkM GtkListStore @@ -228,7 +226,7 @@ swapItems :: !Int !Int !GtkListStore -> GtkM Bool * A menu provides actions to the user. `GtkMenu` by itself is useful to create * sub-menus (see `setSubMenu`). For a top-level menu, see `GtkMenuBar`. */ -:: GtkMenu =: GtkMenu Pointer +:: GtkMenu (=: GtkMenu Pointer) instance gtkWidget GtkMenu newMenu :: GtkM GtkMenu @@ -237,7 +235,7 @@ newMenu :: GtkM GtkMenu * A menu bar is usually placed at the top of a window, providing actions to * the user. */ -:: GtkMenuBar =: GtkMenuBar Pointer +:: GtkMenuBar (=: GtkMenuBar Pointer) instance gtkWidget GtkMenuBar newMenuBar :: GtkM GtkMenuBar @@ -246,7 +244,7 @@ newMenuBar :: GtkM GtkMenuBar * A menu item is an item in a menu. Attach an `ActivateHandler` or set a * sub-menu with `setSubMenu`. */ -:: GtkMenuItem =: GtkMenuItem Pointer +:: GtkMenuItem (=: GtkMenuItem Pointer) class gtkMenuItem a :: !a -> GtkMenuItem @@ -259,7 +257,7 @@ newMenuItem :: !String -> GtkM GtkMenuItem setSubMenu :: !mi !GtkMenu -> GtkM GtkMenu | gtkMenuItem mi //* A check menu item is a menu item with a checkbox. -:: GtkCheckMenuItem =: GtkCheckMenuItem Pointer +:: GtkCheckMenuItem (=: GtkCheckMenuItem Pointer) instance gtkWidget GtkCheckMenuItem instance gtkMenuItem GtkCheckMenuItem @@ -272,14 +270,14 @@ isActive :: !GtkCheckMenuItem -> GtkM Bool setActive :: !Bool !GtkCheckMenuItem -> GtkM GtkCheckMenuItem //* A separator menu item draws as a simple line to group other items together. -:: GtkSeparatorMenuItem =: GtkSeparatorMenuItem Pointer +:: GtkSeparatorMenuItem (=: GtkSeparatorMenuItem Pointer) instance gtkWidget GtkSeparatorMenuItem instance gtkMenuItem GtkSeparatorMenuItem newSeparatorMenuItem :: GtkM GtkSeparatorMenuItem //* This is an interface for widgets that hold a collection of menu items. -:: GtkMenuShell =: GtkMenuShell Pointer +:: GtkMenuShell (=: GtkMenuShell Pointer) instance gtkWidget GtkMenuShell class gtkMenuShell a :: !a -> GtkMenuShell @@ -288,14 +286,14 @@ instance gtkMenuShell GtkMenu, GtkMenuBar, GtkMenuShell appendToMenuShell :: !s !mi -> GtkM mi | gtkMenuShell s & gtkMenuItem mi //* This is an interface for widgets of which the children can be oriented. -:: GtkOrientable =: GtkOrientable Pointer +:: GtkOrientable (=: GtkOrientable Pointer) class gtkOrientable a :: !a -> GtkOrientable instance tune o GtkOrientation | gtkOrientable o //* A paned holds two children, with a (usually moveable) handle in between. -:: GtkPaned =: GtkPaned Pointer +:: GtkPaned (=: GtkPaned Pointer) instance gtkWidget GtkPaned instance gtkContainer GtkPaned @@ -307,7 +305,7 @@ packPane2 :: !GtkPaned !GtkResize !GtkShrink !w -> GtkM w | gtkWidget w * A scrolled window holds a single child and uses a scrollbar if it does not * fit in the outer dimensions. */ -:: GtkScrolledWindow =: GtkScrolledWindow Pointer +:: GtkScrolledWindow (=: GtkScrolledWindow Pointer) instance gtkWidget GtkScrolledWindow instance gtkContainer GtkScrolledWindow @@ -317,20 +315,20 @@ instance tune GtkScrolledWindow (GtkScrollbarPolicy, GtkScrollbarPolicy) where tune :: !(!GtkScrollbarPolicy, !GtkScrollbarPolicy) !GtkScrolledWindow -> GtkM GtkScrolledWindow //* A search entry is a special entry with a search icon and clear button. -:: GtkSearchEntry =: GtkSearchEntry Pointer +:: GtkSearchEntry (=: GtkSearchEntry Pointer) instance gtkWidget GtkSearchEntry instance gtkEntry GtkSearchEntry newSearchEntry :: GtkM GtkSearchEntry //* A separator is a simple line, allowing for separation between widgets. -:: GtkSeparator =: GtkSeparator Pointer +:: GtkSeparator (=: GtkSeparator Pointer) instance gtkWidget GtkSeparator newSeparator :: !GtkOrientation -> GtkM GtkSeparator //* A spinner is an animated widget signaling indefinite progress. -:: GtkSpinner =: GtkSpinner Pointer +:: GtkSpinner (=: GtkSpinner Pointer) instance gtkWidget GtkSpinner newSpinner :: GtkM GtkSpinner @@ -338,14 +336,14 @@ startSpinner :: !GtkSpinner -> GtkM GtkSpinner stopSpinner :: !GtkSpinner -> GtkM GtkSpinner //* A text buffer is viewed by a `GtkTextView`; updates occur on this type. -:: GtkTextBuffer =: GtkTextBuffer Pointer +:: GtkTextBuffer (=: GtkTextBuffer Pointer) instance tune GtkTextBuffer GtkText instance tune GtkTextBuffer GtkMarkup insertAtCursor :: !String !GtkTextBuffer -> GtkM GtkTextBuffer //* A text view holds a larger amount of text than a `GtkLabel`. -:: GtkTextView =: GtkTextView Pointer +:: GtkTextView (=: GtkTextView Pointer) instance gtkWidget GtkTextView instance gtkContainer GtkTextView @@ -355,7 +353,7 @@ getTextBuffer :: !GtkTextView -> GtkTextBuffer instance tune GtkTextView GtkWrapMode //* A tree view is a view on a `GtkListStore` with customizable columns. -:: GtkTreeView =: GtkTreeView Pointer +:: GtkTreeView (=: GtkTreeView Pointer) instance gtkWidget GtkTreeView newTreeView :: !GtkListStore -> GtkM GtkTreeView @@ -381,12 +379,15 @@ getPathToSelection :: !GtkTreeView -> GtkM (Maybe [Int]) selectPath :: ![Int] !GtkTreeView -> GtkM Bool //* This is an abstract class; every GUI element is a widget. -:: GtkWidget =: GtkWidget Pointer +:: GtkWidget (=: GtkWidget Pointer) class gtkWidget a :: !a -> GtkWidget instance gtkWidget GtkWidget +toPtr :: !w -> Pointer | gtkWidget w +unsafeToWidget :: !Pointer -> GtkWidget + show :: !w -> GtkM w | gtkWidget w hide :: !w -> GtkM w | gtkWidget w @@ -412,7 +413,7 @@ instance tune w GtkAccelerator | gtkWidget w instance tune w GtkSizeRequest | gtkWidget w //* A window is a top-level element, holding a single child widget. -:: GtkWindow =: GtkWindow Pointer +:: GtkWindow (=: GtkWindow Pointer) class gtkWindow a :: !a -> GtkWindow |