From: Axel S. <si...@co...> - 2009-09-26 15:13:18
|
Thu Sep 24 20:34:44 EDT 2009 Andy Stewart <laz...@gm...> * Binding for VTE 2.0 library Ignore-this: 4d04c0c8aeddbc984358b55dd54843ec hunk ./Makefile.am 50 + mkdir $(distdir)/vte/Graphics/UI/Gtk/Vte + touch $(distdir)/vte/Graphics/UI/Gtk/Vte/.keep hunk ./Makefile.am 78 +if ENABLE_VTE +pkglib_LIBRARIES += libHSvte.a +endif hunk ./Makefile.am 1124 +# +## vte package +# +################################################################################## + +if ENABLE_VTE + +vte_PKGNAME = libHSvte_a + +libHSvte_a_NAME = vte +libHSvte_a_CONFIG = vte/vte.package.conf +libHSvte_a_EXTERNALDEPS = base-$(PKG_BASE_VERSION) +libHSvte_a_INTERNALDEPS = gtk glib +libHSvte_a_HEADER = vte/vte.h +libHSvte_a_PRECOMP = vte/vte.precomp +libHSvte_a_LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(VTE_LIBS) +libHSvte_a_HCFLAGS = $(FFI) +libHSvte_a_CFLAGS = $(filter-out -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(VTE_CFLAGS)) [_$_] +libHSvte_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(VTE_CFLAGS)) + + +libHSvte_a_SOURCESDIRS = vte + +libHSvte_a_GENERATEDSOURCES = \ + vte/Graphics/UI/Gtk/Vte/Types.chs + +nodist_libHSvte_a_SOURCES = $(libHSvte_a_GENERATEDSOURCES) + +libHSvte_a_SOURCES = \ + vte/Graphics/UI/Gtk/Vte/Vte.chs + +htmldoc_HSFILES_HIDDEN += $(libHSvte_a_GENERATEDSOURCES:.chs=.hs) + +vte_Graphics_UI_Gtk_Vte_Types_hs_HCFLAGS = -fglasgow-exts [_$_] + +vte/Graphics/UI/Gtk/Vte/Types.chs : $(srcdir)/tools/hierarchyGen/hierarchy.list \ + $(srcdir)/tools/hierarchyGen/TypeGenerator$(EXEEXT) \ + $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template + $(strip $(srcdir)/tools/hierarchyGen/TypeGenerator$(EXEEXT) \ + $(srcdir)/tools/hierarchyGen/hierarchy.list \ + $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template \ + $@ --tag=vte --lib=vte --prefix=vte \ + --modname=Graphics.UI.Gtk.Vte.Types \ + --parentname=Graphics.UI.Gtk.Types) + +libHSvte_a_ALLSOURCES = $(libHSvte_a_SOURCES) $(nodist_libHSvte_a_SOURCES) + +am_libHSvte_a_OBJECTS = \ + $(addsuffix .$(OBJEXT),$(basename $(basename $(libHSvte_a_ALLSOURCES)))) + +libHSvte_a_HSPPFILES = $(filter %.hs.pp, $(libHSvte_a_ALLSOURCES)) +libHSvte_a_CHSPPFILES = $(filter %.chs.pp,$(libHSvte_a_ALLSOURCES)) +libHSvte_a_CHSFILES = \ + $(filter %.chs,$(libHSvte_a_ALLSOURCES:.chs.pp=.chs)) +libHSvte_a_CHSFILES_HS = $(libHSvte_a_CHSFILES:.chs=.hs) +libHSvte_a_HSCFILES = $(filter %.hsc, $(libHSvte_a_ALLSOURCES)) +libHSvte_a_HSCFILES_HS = $(libHSvte_a_HSCFILES:.hsc=.hs) +libHSvte_a_BUILDSOURCES = \ + $(libHSvte_a_HSPPFILES:.hs.pp=.hs) \ + $(libHSvte_a_CHSPPFILES:.chs.pp=.chs) \ + $(libHSvte_a_CHSFILES_HS) \ + $(libHSvte_a_HSCFILES_HS) \ + $(libHSvte_a_GENERATEDSOURCES) +libHSvte_a_HSFILES = \ + $(filter %.hs,$(libHSvte_a_BUILDSOURCES)) \ + $(filter %.hs,$(libHSvte_a_ALLSOURCES)) + +nobase_hi_DATA += $(libHSvte_a_HSFILES:.hs=.hi) + +vte_MOSTLYCLEANFILES = $(am_libHSvte_a_OBJECTS) +vte_MOSTLYCLEANFILES += $(libHSvte_a_HSFILES:.hs=.hi) +vte_MOSTLYCLEANFILES += $(libHSvte_a_CHSFILES:.chs=.chi) +vte_CLEANFILES = $(libHSvte_a_BUILDSOURCES) +vte_CLEANFILES += $(libHSvte_a_CHSFILES_HS:.hs=.dep) +vte_CLEANFILES += \ + $(libHSvte_a_HSCFILES:.hsc=_hsc_make$(EXEEXT)) \ + $(libHSvte_a_HSCFILES:.hsc=_hsc_make.c) \ + $(libHSvte_a_HSCFILES:.hsc=_hsc_make.o) + +vte/libHSvte_a.deps: $(libHSvte_a_HSFILES) | \ + $(foreach pkg,$(libHSvte_a_INTERNALDEPS),$(pkg)/libHS$(pkg)_a.deps) +$(libHSvte_a_CHSFILES:.chs=.dep): \ + $(foreach pkg,vte $(libHSglib_a_INTERNALDEPS),$(libHS$(pkg)_a_CHSFILES)) +$(libHSvte_a_CHSFILES_HS): $(libHSvte_a_PRECOMP) +$(libHSvte_a_OBJECTS) : \ + $(foreach pkg,$(libHSvte_a_INTERNALDEPS),$(libHS$(pkg)_a_OBJECTS)) + +EARLY_DEPS += $(libHSvte_a_CHSFILES:.chs=.dep) + +ifeq (,$(DONT_USE_DEPS)) +-include $(libHSvte_a_CHSFILES:.chs=.dep) vte/libHSvte_a.deps + endif + +if ENABLE_SPLITOBJS +libHSvte_a_AR = $(srcdir)/mk/link-splitobjs.sh +vte_CLEANFILES_SPLIT = $(libHSvte_a_HSFILES:.hs=_split/) +else +libHSvte_a_AR = $(AR) $(ARFLAGS) +endif + +libHSvte_a_DEPENDENCIES = HSvte.o +pkglib_DATA += HSvte.o +HSvte.o : $(libHSvte_a_OBJECTS) + $(LD) -r $(LD_X) -o $@ $(libHSvte_a_OBJECTS) $(libHSvte_a_LIBADD) + +if ENABLE_PROFILING +libHSvte_a_DEPENDENCIES += libHSvte_p.a +pkglib_DATA += libHSvte_p.a +libHSvte_p.a : $(libHSvte_a_HSFILES:.hs=.p_o) \ + $(libHSvte_a_LIBADD:.o=.p_o) + $(AR) $(ARFLAGS) $@ $^ + +ifeq (,$(DONT_USE_DEPS)) +-include vte/libHSvte_a.p_deps + endif + +nobase_hi_DATA += $(libHSvte_a_HSFILES:.hs=.p_hi) +vte_MOSTLYCLEANFILES += $(libHSvte_a_HSFILES:.hs=.p_hi) +vte_MOSTLYCLEANFILES += $(libHSvte_a_HSFILES:.hs=.p_o) +vte_MOSTLYCLEANFILES += $(libHSvte_a_LIBADD:.o=.p_o) +endif + +endif #ENABLE_VTE + hunk ./configure.ac 321 +GTKHS_PKG_CHECK(vte, vte, VTE, [vte >= 0.20], [GLIB GTK], + [build vte package (default=auto)], + [vte library requirement not met. Perhaps you need to install vte or vte-devel]) + hunk ./configure.ac 444 + GTKHS_GLIBC_PTHREAD_HACK(VTE_LIBS) hunk ./configure.ac 617 +GTKHS_PACKAGE_FILTER_CFLAGS([VTE_CFLAGS], [$GLIB_CFLAGS $GTK_CFLAGS], [$VTE_CFLAGS]) +GTKHS_PACKAGE_FILTER_LIBS([VTE_LIBS], [$GLIB_LIBS $GTK_LIBS], [$VTE_LIBS]) + hunk ./configure.ac 697 +GTKHS_REFORMAT_PACKAGE_CFLAGS(VTE_CFLAGS, VTE_CFLAGS_CQ) +GTKHS_REFORMAT_PACKAGE_LIBS(VTE_LIBS, VTE_LIBS_CQ, + VTE_LIBDIR_CQ, VTE_LIBEXTRA_CQ) +AC_SUBST(VTE_CFLAGS_CQ) +AC_SUBST(VTE_LIBS_CQ) +AC_SUBST(VTE_LIBDIR_CQ) +AC_SUBST(VTE_LIBEXTRA_CQ) + hunk ./configure.ac 946 + vte/vte.package.conf vte/vte.cabal hunk ./configure.ac 971 +echo "* vte : ${ENABLE_VTE} " adddir ./demo/vte addfile ./demo/vte/Makefile hunk ./demo/vte/Makefile 1 + +PROG = vte [_$_] +SOURCES = Vte.hs + +$(PROG) : $(SOURCES) + $(HC) --make $< -o $@ $(HCFLAGS) -XForeignFunctionInterface + +clean: + rm -f $(SOURCES:.hs=.hi) $(SOURCES:.hs=.o) $(PROG) + +HC=ghc addfile ./demo/vte/Vte.hs hunk ./demo/vte/Vte.hs 1 + -- A simple program to demonstrate Vte Binding by Cjacker Huang +module Main where + +import Graphics.UI.Gtk +import Graphics.UI.Gtk.Vte.Vte +import Graphics.UI.Gtk.Pango.Font + +main = do + initGUI + window <- windowNew + onDestroy window mainQuit + widgetSetSizeRequest window 640 480 + + scrolled <- scrolledWindowNew Nothing Nothing + scrolledWindowSetPolicy scrolled PolicyAutomatic PolicyAutomatic + vte <- terminalNew + terminalForkCommand vte Nothing Nothing Nothing Nothing False False False + font <- fontDescriptionFromString "DejaVu Sans Mono 10" + terminalSetFont vte font + containerAdd scrolled vte + containerAdd window scrolled + on vte childExited $ mainQuit + + widgetShowAll window + + mainGUI hunk ./tools/callbackGen/gtkmarshal.list 125 +# for Vte +VOID:STRING,INT hunk ./tools/hierarchyGen/hierarchy.list 99 + VteTerminal as Terminal if vte adddir ./vte adddir ./vte/Graphics adddir ./vte/Graphics/UI adddir ./vte/Graphics/UI/Gtk adddir ./vte/Graphics/UI/Gtk/Vte addfile ./vte/Graphics/UI/Gtk/Vte/.keep hunk ./vte/Graphics/UI/Gtk/Vte/.keep 1 +keep dir addfile ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) widget for VTE +-- +-- Author : Andy Stewart +-- +-- Created: 20 Sep 2009 +-- +-- Copyright (C) 2009 Andy Stewart <laz...@gm...> +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- TODO: +-- +-- ** Finish functions binding: +-- 'terminalGetText', 'terminalGetTextIncludeTrailingSpaces' +-- 'terminalGetTextRange', 'SelectionFunc', 'terminalMatchAddGregex' +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- A VTE widget for terminal +-- [_$_] +----------------------------------------------------------------------------- +-- [_$_] +module Graphics.UI.Gtk.Vte.Vte ( +-- * Types + Terminal, + +-- * Constructors + terminalNew, + +-- * Methods + TerminalEraseBinding(..), + TerminalAntiAlias(..), + TerminalCursorShape(..), + TerminalCursorBlinkMode(..), + terminalImAppendMenuitems, + terminalForkCommand, + terminalForkpty, + terminalSetPty, + terminalGetPty, + terminalFeed, + terminalFeedChild, + terminalFeedChildBinary, + terminalGetChildExitStatus, + terminalSelectAll, + terminalSelectNone, + terminalCopyClipboard, + terminalPasteClipboard, + terminalCopyPrimary, + terminalPastePrimary, + terminalSetSize, + terminalSetAudibleBell, + terminalGetAudibleBell, + terminalSetVisibleBell, + terminalGetVisibleBell, + terminalSetAllowBold, + terminalGetAllowBold, + terminalSetScrollOnOutput, + terminalSetScrollOnKeystroke, + terminalSetColorBold, + terminalSetColorForeground, + terminalSetColorBackground, + terminalSetColorDim, + terminalSetColorCursor, + terminalSetColorHighlight, + terminalSetColors, + terminalSetDefaultColors, + terminalSetOpacity, + terminalSetBackgroundImage, + terminalSetBackgroundImageFile, + terminalSetBackgroundSaturation, + terminalSetBackgroundTransparent, + terminalSetBackgroundTintColor, + terminalSetScrollBackground, + terminalSetCursorShape, + terminalGetCursorShape, + terminalSetCursorBlinks, + terminalSetCursorBlinkMode, + terminalGetCursorBlinkMode, + terminalSetScrollbackLines, + terminalSetFont, + terminalSetFontFromString, + terminalSetFontFromStringFull, + terminalSetFontFull, + terminalGetFont, + terminalGetUsingXft, + terminalGetHasSelection, + terminalSetWordChars, + terminalIsWordChar, + terminalSetBackspaceBinding, + terminalSetDeleteBinding, + terminalSetMouseAutohide, + terminalGetMouseAutohide, + terminalReset, + -- terminalGetText, + -- terminalGetTextIncludeTrailingSpaces, + -- terminalGetTextRange, + -- SelectionFunc, + terminalGetCursorPosition, + terminalMatchClearAll, + terminalMatchAdd, + -- terminalMatchAddGregex, + terminalMatchRemove, + terminalMatchCheck, + terminalMatchSetCursor, + terminalMatchSetCursorName, + terminalSetEmulation, + terminalGetEmulation, + terminalGetDefaultEmulation, + terminalSetEncoding, + terminalGetEncoding, + terminalGetStatusLine, + terminalGetPadding, + terminalGetAdjustment, + terminalGetCharAscent, + terminalGetCharDescent, + terminalGetCharHeight, + terminalGetCharWidth, + terminalGetColumnCount, + terminalGetRowCount, + terminalGetIconTitle, + terminalGetWindowTitle, + +-- * Attributes + terminalAllowBold, + terminalAudibleBell, + terminalBackgroundImageFile, + terminalBackgroundImagePixbuf, + terminalBackgroundOpacity, + terminalBackgroundSaturation, + terminalBackgroundTintColor, + terminalBackgroundTransparent, + terminalBackspaceBinding, + terminalCursorBlinkMode, + terminalCursorShape, + terminalDeleteBinding, + terminalEmulation, + terminalEncoding, + terminalFontDesc, + terminalIconTitle, + terminalPointerAutohide, + terminalPty, + terminalScrollBackground, + terminalScrollOnKeystroke, + terminalScrollOnOutput, + terminalScrollbackLines, + terminalVisibleBell, + terminalWindowTitle, + terminalWordChars, + +-- * Signals + beep, + charSizeChanged, + childExited, + commit, + contentsChanged, + copyClipboard, + cursorMoved, + decreaseFontSize, + deiconifyWindow, + emulationChanged, + encodingChanged, + eof, + iconTitleChanged, + iconifyWindow, + increaseFontSize, + lowerWindow, + maximizeWindow, + moveWindow, + pasteClipboard, + raiseWindow, + refreshWindow, + resizeWidnow, + restoreWindow, + selectionChanged, + setScrollAdjustments, + statusLineChanged, + textDeleted, + textInserted, + textModified, + textScrolled, + windowTitleChanged, + ) where + +import Control.Monad (liftM) +import Data.Char +import Data.Word + +import System.Posix.Types +import System.Glib.Attributes +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Properties +import System.Glib.GList +import System.Glib.GError [_$_] +import Graphics.UI.Gtk.Gdk.GC +import Graphics.UI.Gtk.Gdk.Cursor +import Graphics.UI.Gtk.Pango.Font + +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Signals#} +{#import Graphics.UI.Gtk.Vte.Types#} +{#import Graphics.UI.Gtk.Pango.Types#} +{#import System.Glib.GObject#} + +{#context lib= "vte" prefix= "vte"#} + +{#enum VteTerminalEraseBinding as TerminalEraseBinding {underscoreToCase}#} +{#enum VteTerminalCursorShape as TerminalCursorShape {underscoreToCase}#} +{#enum VteTerminalCursorBlinkMode as TerminalCursorBlinkMode {underscoreToCase}#} +{#enum VteTerminalAntiAlias as TerminalAntiAlias {underscoreToCase}#} + +-------------------- +-- Constructors + +-- | Create a new terminal widget. +terminalNew :: IO Terminal +terminalNew = [_$_] + makeNewObject mkTerminal $ liftM castPtr {#call terminal_new#} + +-------------------- +-- Methods + +-- |Appends menu items for various input methods to the given menu. [_$_] +-- The user can select one of these items to modify the input method used by the terminal. +terminalImAppendMenuitems :: [_$_] + TerminalClass self => self + -> MenuShell -- ^ @menushell@ - a menu shell of 'MenuShell' + -> IO () [_$_] +terminalImAppendMenuitems terminal menushell = + {#call terminal_im_append_menuitems#} (toTerminal terminal) menushell + +-- | Starts the specified command under a newly-allocated controlling pseudo-terminal. [_$_] +terminalForkCommand :: [_$_] + TerminalClass self => self + -> (Maybe String) -- ^ @command@ - the name of a binary to run, or @Nothing@ to get user's shell [_$_] + -> (Maybe [String]) -- ^ @argv@ - the argument list to be passed to command, or @Nothing@ + -> (Maybe [String]) -- ^ @envv@ - a list of environment variables to be added to the environment before starting command, or @Nothing@ + -> (Maybe String) -- ^ @directory@ - the name of a directory the command should start in, or @Nothing@ [_$_] + -> Bool -- ^ @lastlog@ - @True@ if the session should be logged to the lastlog + -> Bool -- ^ @utmp@ - @True@ if the session should be logged to the utmp/utmpx log [_$_] + -> Bool -- ^ @wtmp@ - @True@ if the session should be logged to the wtmp/wtmpx log [_$_] + -> IO Int -- ^ return the ID of the new process +terminalForkCommand terminal command argv envv directory lastlog utmp wtmp = + liftM fromIntegral $ + maybeWith withUTFString command $ \commandPtr -> + maybeWith withUTFString directory $ \dirPtr -> + maybeWith withUTFStringArray argv $ \argvPtrPtr -> + maybeWith withUTFStringArray envv $ \envvPtrPtr -> + {#call terminal_fork_command#} [_$_] + (toTerminal terminal) [_$_] + commandPtr + argvPtrPtr + envvPtrPtr + dirPtr + (fromBool lastlog) [_$_] + (fromBool utmp) + (fromBool wtmp) + +-- | Starts a new child process under a newly-allocated controlling pseudo-terminal. [_$_] +-- +-- * Available since Vte version 0.11.11 +-- [_$_] +terminalForkpty :: [_$_] + TerminalClass self => self + -> (Maybe [String]) -- ^ @envv@ - a list of environment variables to be added to the environment before starting returning in the child process, or @Nothing@ + -> (Maybe String) -- ^ @directory@ - the name of a directory the child process should change to, or @Nothing@ [_$_] + -> Bool -- ^ @lastlog@ - @True@ if the session should be logged to the lastlog [_$_] + -> Bool -- ^ @utmp@ - @True@ if the session should be logged to the utmp/utmpx log [_$_] + -> Bool -- ^ @wtmp@ - @True@ if the session should be logged to the wtmp/wtmpx log [_$_] + -> IO Int -- ^ return the ID of the new process in the parent, 0 in the child, and -1 if there was an error [_$_] +terminalForkpty terminal envv directory lastlog utmp wtmp = + liftM fromIntegral $ + maybeWith withUTFString directory $ \dirPtr -> + maybeWith withUTFStringArray envv $ \envvPtrPtr -> + {#call terminal_forkpty#} [_$_] + (toTerminal terminal) + envvPtrPtr + dirPtr + (fromBool lastlog) + (fromBool utmp) + (fromBool wtmp) + +-- | Attach an existing PTY master side to the terminal widget. [_$_] +-- Use instead of 'terminalForkCommand' or 'terminalForkpty'. +-- +-- * Available since Vte version 0.12.1 +-- +terminalSetPty :: [_$_] + TerminalClass self => self [_$_] + -> Int -- ^ @ptyMaster@ - a file descriptor of the master end of a PTY [_$_] + -> IO () +terminalSetPty terminal ptyMaster = + {#call terminal_set_pty#} (toTerminal terminal) (fromIntegral ptyMaster) + +-- | Returns the file descriptor of the master end of terminal's PTY. +-- +-- * Available since Vte version 0.19.1 +-- +terminalGetPty :: + TerminalClass self => self + -> IO Int -- ^ return the file descriptor, or -1 if the terminal has no PTY. [_$_] +terminalGetPty terminal = [_$_] + liftM fromIntegral $ [_$_] + {#call terminal_get_pty#} (toTerminal terminal) + +-- | Interprets data as if it were data received from a child process. [_$_] +-- This can either be used to drive the terminal without a child process, or just to mess with your users. +terminalFeed :: [_$_] + TerminalClass self => self [_$_] + -> String -- ^ @string@ - a string in the terminal's current encoding [_$_] + -> Int -- ^ @len@ - the length of the string [_$_] + -> IO () +terminalFeed terminal string len = + withUTFString string $ \strPtr -> + {#call terminal_feed#} (toTerminal terminal) strPtr (fromIntegral len) + +-- | Sends a block of UTF-8 text to the child as if it were entered by the user at the keyboard. +terminalFeedChild :: [_$_] + TerminalClass self => self [_$_] + -> String -- ^ @string@ - data to send to the child [_$_] + -> Int -- ^ @len@ - length of text in bytes, or -1 if text is NUL-terminated [_$_] + -> IO () +terminalFeedChild terminal string len = + withUTFString string $ \strPtr -> + {#call terminal_feed_child#} (toTerminal terminal) strPtr (fromIntegral len) + +-- | Sends a block of binary data to the child. +-- +-- * Available since Vte version 0.12.1 +-- +terminalFeedChildBinary :: [_$_] + TerminalClass self => self [_$_] + -> String -- ^ @string@ - data to send to the child [_$_] + -> Int -- ^ @len@ - length of data [_$_] + -> IO () +terminalFeedChildBinary terminal string len = + withUTFString string $ \strPtr -> + {#call terminal_feed_child_binary#} (toTerminal terminal) strPtr (fromIntegral len) + [_$_] +-- | Gets the exit status of the command started by 'terminalForkCommand'. [_$_] +-- +-- * Available since Vte version 0.19.1 +-- +terminalGetChildExitStatus :: + TerminalClass self => self [_$_] + -> IO Int -- ^ return the child's exit status [_$_] +terminalGetChildExitStatus terminal = + liftM fromIntegral $ + {#call terminal_get_child_exit_status#} (toTerminal terminal) + +-- | Selects all text within the terminal (including the scrollback buffer). +-- +-- * Available since Vte version 0.16 +-- +terminalSelectAll :: TerminalClass self => self -> IO () [_$_] +terminalSelectAll terminal = + {#call terminal_select_all#} (toTerminal terminal) + [_$_] +-- | Clears the current selection. +-- +-- * Available since Vte version 0.16 +-- +terminalSelectNone :: TerminalClass self => self -> IO () [_$_] +terminalSelectNone terminal = + {#call terminal_select_none#} (toTerminal terminal) + +-- | Places the selected text in the terminal in the GDK_SELECTION_CLIPBOARD selection. +terminalCopyClipboard :: TerminalClass self => self -> IO () +terminalCopyClipboard terminal = [_$_] + {#call terminal_copy_clipboard#} (toTerminal terminal) + [_$_] +-- | Sends the contents of the GDK_SELECTION_CLIPBOARD selection to the terminal's child. [_$_] +-- If necessary, the data is converted from UTF-8 to the terminal's current encoding. [_$_] +-- It's called on paste menu item, or when user presses Shift+Insert. +terminalPasteClipboard :: TerminalClass self => self -> IO () +terminalPasteClipboard terminal = + {#call terminal_paste_clipboard#} (toTerminal terminal) + +-- | Places the selected text in the terminal in the GDK_SELECTION_PRIMARY selection. +terminalCopyPrimary :: TerminalClass self => self -> IO () +terminalCopyPrimary terminal = + {#call terminal_copy_primary#} (toTerminal terminal) + +-- | Sends the contents of the GDK_SELECTION_PRIMARY selection to the terminal's child. [_$_] +-- If necessary, the data is converted from UTF-8 to the terminal's current encoding. [_$_] +-- The terminal will call also paste the GDK_SELECTION_PRIMARY selection when the user clicks with the the second mouse button. +terminalPastePrimary :: TerminalClass self => self -> IO () +terminalPastePrimary terminal = + {#call terminal_paste_primary#} (toTerminal terminal) + [_$_] +-- | Attempts to change the terminal's size in terms of rows and columns. [_$_] +-- If the attempt succeeds, the widget will resize itself to the proper size. +terminalSetSize :: [_$_] + TerminalClass self => self [_$_] + -> Int -- ^ @columns@ - the desired number of columns [_$_] + -> Int -- ^ @rows@ - the desired number of rows [_$_] + -> IO () +terminalSetSize terminal columns rows = + {#call terminal_set_size#} [_$_] + (toTerminal terminal) + (fromIntegral columns) + (fromIntegral rows) + [_$_] +-- | Controls whether or not the terminal will beep when the child outputs the "bl" sequence. +terminalSetAudibleBell :: [_$_] + TerminalClass self => self [_$_] + -> Bool -- ^ @isAudible@ - @True@ if the terminal should beep [_$_] + -> IO () [_$_] +terminalSetAudibleBell terminal isAudible = + {#call terminal_set_audible_bell#} (toTerminal terminal) (fromBool isAudible) + [_$_] +-- | Checks whether or not the terminal will beep when the child outputs the "bl" sequence. +terminalGetAudibleBell :: [_$_] + TerminalClass self => self [_$_] + -> IO Bool -- ^ return @True@ if audible bell is enabled, FALSE if not [_$_] +terminalGetAudibleBell terminal = + liftM toBool $ + {#call terminal_get_audible_bell#} (toTerminal terminal) + [_$_] +-- | Controls whether or not the terminal will present a visible bell to the user when the child outputs the "bl" sequence. [_$_] +-- The terminal will clear itself to the default foreground color and then repaint itself. +terminalSetVisibleBell :: [_$_] + TerminalClass self => self [_$_] + -> Bool -- ^ @isVisible@ - @True@ if the terminal should flash [_$_] + -> IO () [_$_] +terminalSetVisibleBell terminal isVisible = + {#call terminal_set_visible_bell#} (toTerminal terminal) (fromBool isVisible) + [_$_] +-- | Checks whether or not the terminal will present a visible bell to the user when the child outputs the "bl" sequence. [_$_] +-- The terminal will clear itself to the default foreground color and then repaint itself. +terminalGetVisibleBell :: [_$_] + TerminalClass self => self [_$_] + -> IO Bool -- ^ return @True@ if visible bell is enabled, FALSE if not [_$_] +terminalGetVisibleBell terminal = + liftM toBool $ + {#call terminal_get_visible_bell#} (toTerminal terminal) + [_$_] +-- | Controls whether or not the terminal will attempt to draw bold text, either by using a bold font variant or by repainting text with a different offset. +terminalSetAllowBold :: [_$_] + TerminalClass self => self [_$_] + -> Bool -- ^ @allowBold@ - @True@ if the terminal should attempt to draw bold text [_$_] + -> IO () [_$_] +terminalSetAllowBold terminal allowBold = + {#call terminal_set_allow_bold#} (toTerminal terminal) (fromBool allowBold) + [_$_] +-- | Checks whether or not the terminal will attempt to draw bold text by repainting text with a one-pixel offset. +terminalGetAllowBold :: [_$_] + TerminalClass self => self [_$_] + -> IO Bool -- ^ return @True@ if bolding is enabled, FALSE if not [_$_] +terminalGetAllowBold terminal = + liftM toBool $ + {#call terminal_get_allow_bold#} (toTerminal terminal) + [_$_] +-- | Controls whether or not the terminal will forcibly scroll to the bottom of the viewable history when the new data is received from the child. +terminalSetScrollOnOutput :: [_$_] + TerminalClass self => self [_$_] + -> Bool -- ^ @scroll@ - @True@ if the terminal should scroll on output [_$_] + -> IO () [_$_] +terminalSetScrollOnOutput terminal scroll = + {#call terminal_set_scroll_on_output#} (toTerminal terminal) (fromBool scroll) + [_$_] +-- | Controls whether or not the terminal will forcibly scroll to the bottom of the viewable history when the user presses a key. [_$_] +-- Modifier keys do not trigger this behavior. +terminalSetScrollOnKeystroke :: [_$_] + TerminalClass self => self [_$_] + -> Bool -- ^ @scroll@ - @True@ if the terminal should scroll on keystrokes [_$_] + -> IO () +terminalSetScrollOnKeystroke terminal scroll = + {#call terminal_set_scroll_on_keystroke#} (toTerminal terminal) (fromBool scroll) + [_$_] +-- | Sets the color used to draw bold text in the default foreground color. +terminalSetColorBold :: [_$_] + TerminalClass self => self [_$_] + -> Color -- ^ @bold@ - the new bold color [_$_] + -> IO () +terminalSetColorBold terminal bold = + with bold $ \boldPtr -> + {#call terminal_set_color_bold#} (toTerminal terminal) (castPtr boldPtr) + +-- | Sets the foreground color used to draw normal text +terminalSetColorForeground :: [_$_] + TerminalClass self => self [_$_] + -> Color -- ^ @foreground@ - the new foreground color [_$_] + -> IO () +terminalSetColorForeground terminal foreground = + with foreground $ \fgPtr -> [_$_] + {#call terminal_set_color_foreground#} (toTerminal terminal) (castPtr fgPtr) + +-- | Sets the background color for text which does not have a specific background color assigned. [_$_] +-- Only has effect when no background image is set and when the terminal is not transparent. +terminalSetColorBackground :: [_$_] + TerminalClass self => self [_$_] + -> Color -- ^ @background@ - the new background color [_$_] + -> IO () +terminalSetColorBackground terminal background = + with background $ \bgPtr -> + {#call terminal_set_color_background#} (toTerminal terminal) (castPtr bgPtr) + +-- | Sets the color used to draw dim text in the default foreground color. +terminalSetColorDim :: [_$_] + TerminalClass self => self [_$_] + -> Color -- ^ @dim@ - the nw dim color + -> IO () +terminalSetColorDim terminal dim = + with dim $ \dimPtr -> [_$_] + {#call terminal_set_color_dim#} (toTerminal terminal) (castPtr dimPtr) + +-- | Sets the background color for text which is under the cursor. [_$_] +-- If @Nothing@, text under the cursor will be drawn with foreground and background colors reversed. +-- +-- * Available since Vte version 0.11.11 +-- +terminalSetColorCursor :: [_$_] + TerminalClass self => self [_$_] + -> Color -- ^ @cursor@ - the new color to use for the text cursor [_$_] + -> IO () +terminalSetColorCursor terminal cursor = + with cursor $ \cursorPtr -> [_$_] + {#call terminal_set_color_cursor#} (toTerminal terminal) (castPtr cursorPtr) + +-- | Sets the background color for text which is highlighted. [_$_] +-- If @Nothing@, highlighted text (which is usually highlighted because it is selected) will be drawn with foreground and background colors reversed. +-- +-- * Available since Vte version 0.11.11 +-- +terminalSetColorHighlight :: [_$_] + TerminalClass self => self [_$_] + -> Color -- ^ @highlight@ - the new color to use for highlighted text [_$_] + -> IO () +terminalSetColorHighlight terminal highlight = + with highlight $ \hlPtr -> [_$_] + {#call terminal_set_color_highlight#} (toTerminal terminal) (castPtr hlPtr) + +-- | The terminal widget uses a 28-color model comprised of the default foreground and background colors, [_$_] +-- the bold foreground color, the dim foreground color, an eight color palette, [_$_] +-- bold versions of the eight color palette, and a dim version of the the eight color palette. palette_size must be either 0, 8, 16, or 24. [_$_] +-- If foreground is @Nothing@ and palette_size is greater than 0, the new foreground color is taken from palette[7]. [_$_] +-- If background is @Nothing@ and palette_size is greater than 0, the new background color is taken from palette[0]. [_$_] +-- If palette_size is 8 or 16, the third (dim) and possibly the second (bold) 8-color palettes are extrapolated from the new background color and the items in palette. +terminalSetColors :: [_$_] + TerminalClass self => self [_$_] + -> Color -- ^ @foreground@ - the new foreground color, or @Nothing@ [_$_] + -> Color -- ^ @background@ - the new background color, or @Nothing@ [_$_] + -> Color -- ^ @palette@ - the color palette [_$_] + -> Int -- ^ @size@ - the number of entries in palette [_$_] + -> IO () +terminalSetColors terminal foreground background palette size = + with foreground $ \fPtr -> + with background $ \bPtr -> + with palette $ \pPtr -> + {#call terminal_set_colors#} [_$_] + (toTerminal terminal) [_$_] + (castPtr fPtr) + (castPtr bPtr) + (castPtr pPtr) + (fromIntegral size) + +-- | Reset the terminal palette to reasonable compiled-in defaults. +terminalSetDefaultColors :: TerminalClass self => self -> IO () +terminalSetDefaultColors terminal = + {#call terminal_set_default_colors#} (toTerminal terminal) + [_$_] +-- | Sets the opacity of the terminal background, were 0 means completely transparent and 65535 means completely opaque. +terminalSetOpacity :: [_$_] + TerminalClass self => self + -> Int -- ^ @opacity@ - the new opacity [_$_] + -> IO () +terminalSetOpacity terminal opacity = + {#call terminal_set_opacity#} (toTerminal terminal) (fromIntegral opacity) + +-- | Sets a background image for the widget. [_$_] +-- Text which would otherwise be drawn using the default background color will instead be drawn over the specified image. [_$_] +-- If necessary, the image will be tiled to cover the widget's entire visible area. [_$_] +-- If specified by 'terminalSetBackgroundSaturation' the terminal will tint its in-memory copy of the image before applying it to the terminal. +terminalSetBackgroundImage :: [_$_] + TerminalClass self => self + -> Pixbuf -- ^ @image@ - a 'Pixbuf' to use, or @Nothing@ to cancel [_$_] + -> IO () +terminalSetBackgroundImage terminal image = + {#call terminal_set_background_image#} (toTerminal terminal) image + [_$_] +-- | Sets a background image for the widget. [_$_] +-- If specified by 'terminalSetBackgroundSaturation', the terminal will tint its in-memory copy of the image before applying it to the terminal. +terminalSetBackgroundImageFile :: [_$_] + TerminalClass self => self + -> String -- ^ @path@ - path to an image file [_$_] + -> IO () +terminalSetBackgroundImageFile terminal path = + withUTFString path $ \pathPtr -> + {#call terminal_set_background_image_file#} (toTerminal terminal) pathPtr + [_$_] +-- | If a background image has been set using 'terminalSetBackgroundImage', 'terminalSetBackgroundImageFile', or 'terminalSetBackgroundTransparent', and the saturation value is less than 1.0, the terminal will adjust the colors of the image before drawing the image. [_$_] +-- To do so, the terminal will create a copy of the background image (or snapshot of the root window) and modify its pixel values. +terminalSetBackgroundSaturation :: [_$_] + TerminalClass self => self + -> Double -- ^ @saturation@ - a floating point value between 0.0 and 1.0. [_$_] + -> IO () [_$_] +terminalSetBackgroundSaturation terminal saturation = + {#call terminal_set_background_saturation#} (toTerminal terminal) (realToFrac saturation) + [_$_] +-- | Sets the terminal's background image to the pixmap stored in the root window, adjusted so that if there are no windows below your application, the widget will appear to be transparent. +terminalSetBackgroundTransparent :: [_$_] + TerminalClass self => self + -> Bool -- ^ @transparent@ - @True@ if the terminal should fake transparency [_$_] + -> IO () +terminalSetBackgroundTransparent terminal transparent = + {#call terminal_set_background_transparent#} (toTerminal terminal) (fromBool transparent) + [_$_] +-- | If a background image has been set using 'terminalSetBackgroundImage', 'terminalSetBackgroundImageFile', or 'terminalSetBackgroundTransparent', and the value set by 'terminalSetBackgroundSaturation' is less than one, the terminal will adjust the color of the image before drawing the image. [_$_] +-- To do so, the terminal will create a copy of the background image (or snapshot of the root window) and modify its pixel values. The initial tint color is black. +-- +-- * Available since Vte version 0.11 +-- +terminalSetBackgroundTintColor :: [_$_] + TerminalClass self => self + -> Color -- ^ @color@ - a color which the terminal background should be tinted to if its saturation is not 1.0. [_$_] + -> IO () +terminalSetBackgroundTintColor terminal color = + with color $ \cPtr -> + {#call terminal_set_background_tint_color#} (toTerminal terminal) (castPtr cPtr) + +-- | Controls whether or not the terminal will scroll the background image (if one is set) when the text in the window must be scrolled. +-- +-- * Available since Vte version 0.11 +-- +terminalSetScrollBackground :: [_$_] + TerminalClass self => self + -> Bool -- ^ @scroll@ - @True@ if the terminal should scroll the background image along with text. [_$_] + -> IO () +terminalSetScrollBackground terminal scroll = + {#call terminal_set_scroll_background#} (toTerminal terminal) (fromBool scroll) + [_$_] +-- | Sets the shape of the cursor drawn. +-- +-- * Available since Vte version 0.19.1 +-- +terminalSetCursorShape :: + TerminalClass self => self [_$_] + -> TerminalCursorShape -- ^ @shape@ - the 'TerminalCursorShape' to use [_$_] + -> IO () +terminalSetCursorShape terminal shape = [_$_] + {#call terminal_set_cursor_shape#} (toTerminal terminal) $fromIntegral (fromEnum shape) + +-- | Returns the currently set cursor shape. +-- +-- * Available since Vte version 0.17.6 +-- +terminalGetCursorShape :: + TerminalClass self => self + -> IO TerminalCursorShape -- ^ return cursor shape +terminalGetCursorShape terminal = [_$_] + liftM (toEnum.fromIntegral) $ + {#call terminal_get_cursor_shape#} (toTerminal terminal) + +-- | Sets whether or not the cursor will blink. +-- WARNING: 'terminalSetCursorBlinks' is deprecated and should not be used in newly-written code. 0.17.1 +-- Use 'terminalSetCursorBlinkMode' instead. +terminalSetCursorBlinks :: [_$_] + TerminalClass self => self + -> Bool -- ^ @blink@ - @True@ if the cursor should blink [_$_] + -> IO () +terminalSetCursorBlinks terminal blink = + {#call terminal_set_cursor_blinks#} (toTerminal terminal) (fromBool blink) + [_$_] +-- | Returns the currently set cursor blink mode. +-- +-- * Available since Vte version 0.17.1 +-- +terminalGetCursorBlinkMode :: [_$_] + TerminalClass self => self + -> IO TerminalCursorBlinkMode -- ^ return cursor blink mode. [_$_] +terminalGetCursorBlinkMode terminal = [_$_] + liftM (toEnum.fromIntegral) $ + {#call terminal_get_cursor_blink_mode#} (toTerminal terminal) + +-- | Sets whether or not the cursor will blink. [_$_] +-- +-- * Available since Vte version 0.17.1 +-- +terminalSetCursorBlinkMode :: [_$_] + TerminalClass self => self + -> TerminalCursorBlinkMode -- ^ @mode@ - the 'TerminalCursorBlinkMode' to use [_$_] + -> IO () +terminalSetCursorBlinkMode terminal mode = + {#call terminal_set_cursor_blink_mode#} (toTerminal terminal) $fromIntegral (fromEnum mode) + +-- | Sets the length of the scrollback buffer used by the terminal. [_$_] +-- The size of the scrollback buffer will be set to the larger of this value and the number of visible rows the widget can display, so 0 can safely be used to disable scrollback. [_$_] +-- Note that this setting only affects the normal screen buffer. [_$_] +-- For terminal types which have an alternate screen buffer, no scrollback is allowed on the alternate screen buffer. +terminalSetScrollbackLines :: [_$_] + TerminalClass self => self + -> Int -- ^ @lines@ - the length of the history buffer [_$_] + -> IO () +terminalSetScrollbackLines terminal lines = + {#call terminal_set_scrollback_lines#} (toTerminal terminal) (fromIntegral lines) + +-- | Sets the font used for rendering all text displayed by the terminal, overriding any fonts set using 'widgetModifyFont'. +-- The terminal will immediately attempt to load the desired font, retrieve its metrics, and attempt to resize itself to keep the same number of rows and columns. +terminalSetFont :: [_$_] + TerminalClass self => self + -> FontDescription -- ^ @fontDesc@ - the 'FontDescription' of the desired font. [_$_] + -> IO () +terminalSetFont terminal fontDesc = + {#call terminal_set_font#} (toTerminal terminal) fontDesc + +-- | A convenience function which converts name into a FontDescription and passes it to 'terminalSetFont'. +terminalSetFontFromString :: [_$_] + TerminalClass self => self + -> String -- ^ @name@ - a string describing the font. [_$_] + -> IO () +terminalSetFontFromString terminal name = + withUTFString name $ \namePtr -> [_$_] + {#call terminal_set_font_from_string#} (toTerminal terminal) namePtr + [_$_] +-- | A convenience function which converts name into a 'FontDescription' and passes it to 'terminalSetFontFull'. +-- WARNING: 'terminalSetFontFromStringFull' is deprecated and should not be used in newly-written code. 0.19.1 +-- +-- * Available since Vte version 0.11.11 +-- +terminalSetFontFromStringFull :: [_$_] + TerminalClass self => self + -> String -- ^ @name@ - A string describing the font. [_$_] + -> TerminalAntiAlias -- ^ @antialias@ - Whether or not to antialias the font (if possible). [_$_] + -> IO () +terminalSetFontFromStringFull terminal name antialias = + withUTFString name $ \namePtr -> + {#call terminal_set_font_from_string_full#} (toTerminal terminal) namePtr $ fromIntegral (fromEnum antialias) + +-- | Sets the font used for rendering all text displayed by the terminal, overriding any fonts set using 'widgetModifyFont'. [_$_] +-- The terminal will immediately attempt to load the desired font, retrieve its metrics, and attempt to resize itself to keep the same number of rows and columns. +-- WARNING: terminalSetFontFull' is deprecated and should not be used in newly-written code. 0.19.1 +-- +-- * Available since Vte version 0.11.11 +-- +terminalSetFontFull :: [_$_] + TerminalClass self => self + -> FontDescription -- ^ @fontDesc@ - the 'FontDescription' of the desired font. [_$_] + -> TerminalAntiAlias -- ^ @antialias@ - specify if anti aliasing of the fonts is to be used or not. [_$_] + -> IO () +terminalSetFontFull terminal fontDesc antialias = + {#call terminal_set_font_full#} (toTerminal terminal) fontDesc $fromIntegral (fromEnum antialias) + +-- | Queries the terminal for information about the fonts which will be used to draw text in the terminal. +terminalGetFont :: [_$_] + TerminalClass self => self + -> IO FontDescription -- ^ return a 'FontDescription' describing the font the terminal is currently using to render text. [_$_] +terminalGetFont terminal = do + fdPtr <- {#call unsafe terminal_get_font#} (toTerminal terminal) [_$_] + makeNewFontDescription fdPtr [_$_] + +-- | A 'Terminal' can use multiple methods to draw text. [_$_] +-- This function allows an application to determine whether or not the current method uses fontconfig to find fonts. [_$_] +-- This setting cannot be changed by the caller, but in practice usually matches the behavior of GTK+ itself. +terminalGetUsingXft :: [_$_] + TerminalClass self => self + -> IO Bool -- ^ return @True@ is use xft font. +terminalGetUsingXft terminal = + liftM toBool $ + {#call terminal_get_using_xft#} (toTerminal terminal) + +-- | Checks if the terminal currently contains selected text. [_$_] +-- Note that this is different from determining if the terminal is the owner of any GtkClipboard items. +terminalGetHasSelection :: [_$_] + TerminalClass self => self + -> IO Bool -- ^ return @True@ if part of the text in the terminal is selected. [_$_] +terminalGetHasSelection terminal = + liftM toBool $ + {#call terminal_get_has_selection#} (toTerminal terminal) + [_$_] +-- | When the user double-clicks to start selection, the terminal will extend the selection on word boundaries. [_$_] +-- It will treat characters included in spec as parts of words, and all other characters as word separators. [_$_] +-- Ranges of characters can be specified by separating them with a hyphen. +-- As a special case, if @spec@ is the empty string, the terminal will treat all graphic non-punctuation non-space characters as word characters. +terminalSetWordChars :: [_$_] + TerminalClass self => self + -> String -- ^ @spec@ - a specification [_$_] + -> IO () [_$_] +terminalSetWordChars terminal spec = + withUTFString spec $ \specPtr -> + {#call terminal_set_word_chars#} (toTerminal terminal) specPtr + [_$_] +-- | Checks if a particular character is considered to be part of a word or not, based on the values last passed to 'terminalSetWordChars'. +terminalIsWordChar :: [_$_] + TerminalClass self => self + -> Char -- ^ @c@ - a candidate Unicode code point [_$_] + -> IO Bool -- ^ return @True@ if the character is considered to be part of a word [_$_] +terminalIsWordChar terminal c = + liftM toBool $ + {#call terminal_is_word_char#} (toTerminal terminal) (fromIntegral $ ord c) + +-- | Modifies the terminal's backspace key binding, which controls what string or control sequence the terminal sends to its child when the user presses the backspace key. +terminalSetBackspaceBinding :: [_$_] + TerminalClass self => self + -> TerminalEraseBinding -- ^ @binding@ - a 'TerminalEraseBinding' for the backspace key [_$_] + -> IO () +terminalSetBackspaceBinding terminal binding = + {#call terminal_set_backspace_binding#} (toTerminal terminal) (fromIntegral (fromEnum binding)) + +-- | Modifies the terminal's delete key binding, which controls what string or control sequence the terminal sends to its child when the user presses the delete key. +terminalSetDeleteBinding :: [_$_] + TerminalClass self => self + -> TerminalEraseBinding -- ^ @bindign@ - a 'TerminalEraseBinding' for the delete key [_$_] + -> IO () +terminalSetDeleteBinding terminal binding = + {#call terminal_set_delete_binding#} (toTerminal terminal) (fromIntegral (fromEnum binding)) + [_$_] +-- | Changes the value of the terminal's mouse autohide setting. [_$_] +-- When autohiding is enabled, the mouse cursor will be hidden when the user presses a key and shown when the user moves the mouse. [_$_] +-- This setting can be read using 'terminalGetMouseAutohide'. +terminalSetMouseAutohide :: [_$_] + TerminalClass self => self + -> Bool -- ^ @autohide@ - @True@ if the autohide should be enabled [_$_] + -> IO () +terminalSetMouseAutohide terminal autohide = + {#call terminal_set_mouse_autohide#} (toTerminal terminal) (fromBool autohide) + [_$_] +-- | Determines the value of the terminal's mouse autohide setting. [_$_] +-- When autohiding is enabled, the mouse cursor will be hidden when the user presses a key and shown when the user moves the mouse. [_$_] +-- This setting can be changed using 'terminalSetMouseAutohide'. +terminalGetMouseAutohide :: TerminalClass self => self -> IO Bool +terminalGetMouseAutohide terminal = + liftM toBool $ + {#call terminal_get_mouse_autohide#} (toTerminal terminal) + [_$_] +-- | Resets as much of the terminal's internal state as possible, discarding any unprocessed input data, resetting character attributes, cursor state, national character set state, status line, terminal modes (insert/delete), selection state, and encoding. +terminalReset :: [_$_] + TerminalClass self => self + -> Bool -- ^ @full@ - @True@ to reset tabstops [_$_] + -> Bool -- ^ @clearHistory@ - @True@ to empty the terminal's scrollback buffer [_$_] + -> IO () +terminalReset terminal full clearHistory = + {#call terminal_reset#} (toTerminal terminal) (fromBool full) (fromBool clearHistory) + [_$_] +-- | Extracts a view of the visible part of the terminal. If is_selected is not NULL, characters will only be read if is_selected returns TRUE after being passed the column and row, respectively. [_$_] +-- A 'CharAttributes' structure is added to attributes for each byte added to the returned string detailing the character's position, colors, and other characteristics. +-- TODO: +-- terminalGetText + +-- | Extracts a view of the visible part of the terminal. [_$_] +-- If is_selected is not NULL, characters will only be read if is_selected returns TRUE after being passed the column and row, respectively. [_$_] +-- A 'CharAttributes' structure is added to attributes for each byte added to the returned string detailing the character's position, colors, and other characteristics. [_$_] +-- This function differs from 'terminalGetText' in that trailing spaces at the end of lines are included. +-- +-- * Available since Vte version 0.11.11 +-- +-- TODO: +-- terminalGetTextIncludeTrailingSpaces + +-- | Extracts a view of the visible part of the terminal. [_$_] +-- If is_selected is not NULL, characters will only be read if is_selected returns TRUE after being passed the column and row, respectively. [_$_] +-- A 'CharAttributes' structure is added to attributes for each byte added to the returned string detailing the character's position, colors, and other characteristics. [_$_] +-- The entire scrollback buffer is scanned, so it is possible to read the entire contents of the buffer using this function. +-- TODO: +-- terminalGetTextRange + +-- | Specifies the type of a selection function used to check whether a cell has to be selected or not. +-- TODO: +-- SelectionFunc + +-- | Reads the location of the insertion cursor and returns it. The row coordinate is absolute. +terminalGetCursorPosition :: [_$_] + TerminalClass self => self + -> IO (Int -- ^ return column of cursor + ,Int) -- ^ return row of cursor +terminalGetCursorPosition terminal = do + alloca $ \cPtr -> + alloca $ \rPtr -> do + {#call terminal_get_cursor_position#} (toTerminal terminal) cPtr rPtr + column <- peek cPtr + row <- peek rPtr + return (fromIntegral column,fromIntegral row) + +-- | Clears the list of regular expressions the terminal uses to highlight text when the user moves the mouse cursor. +terminalMatchClearAll :: TerminalClass self => self -> IO () +terminalMatchClearAll terminal = + {#call terminal_match_clear_all#} (toTerminal terminal) + [_$_] +-- | Adds a regular expression to the list of matching expressions. [_$_] +-- When the user moves the mouse cursor over a section of displayed text which matches this expression, the text will be highlighted. +-- WARNING: 'terminalMatchAdd' is deprecated and should not be used in newly-written code. +terminalMatchAdd :: [_$_] + TerminalClass self => self + -> String -- ^ @match@ - a regular expression [_$_] + -> IO Int -- ^ return an integer associated with this expression Deprecated: 0.17.1 [_$_] +terminalMatchAdd terminal match = + liftM fromIntegral $ + withUTFString match $ \matchPtr -> + {#call terminal_match_add#} (toTerminal terminal) matchPtr + [_$_] +-- | Adds the regular expression regex to the list of matching expressions. [_$_] +-- When the user moves the mouse cursor over a section of displayed text which matches this expression, the text will be highlighted. +-- +-- * Available since Vte version 0.17.1 +-- +-- TODO: +-- terminalMatchAddGregex [_$_] + +-- | Removes the regular expression which is associated with the given tag from the list of expressions which the terminal will highlight when the user moves the mouse cursor over matching text. +terminalMatchRemove :: [_$_] + TerminalClass self => self + -> Int -- ^ @tag@ - the tag of the regex to remove [_$_] + -> IO () +terminalMatchRemove terminal tag = + {#call terminal_match_remove#} (toTerminal terminal) (fromIntegral tag) + +-- | Checks if the text in and around the specified position matches any of the regular expressions previously set using 'terminalMatchAdd'. [_$_] +-- If a match exists, the text string is returned and if tag is not @Nothing@, the number associated with the matched regular expression will be stored in tag. +-- If more than one regular expression has been set with 'terminalMatchAdd', then expressions are checked in the order in which they were added. +terminalMatchCheck :: [_$_] + TerminalClass self => self + -> Int -- ^ @column@ - the text column [_$_] + -> Int -- ^ @row@ - the text row [_$_] + -> IO (String -- ^ return pointer to an integer + ,Int) -- ^ return a string which matches one of the previously set regular expressions, and which must be freed by the caller. +terminalMatchCheck terminal column row = do + alloca $ \tagPtr -> + {#call terminal_match_check#} (toTerminal terminal) (fromIntegral column) (fromIntegral row) tagPtr >>= peekCString + >>= \str -> do + tag <- peek tagPtr + return (str,fromIntegral tag) + +-- | Sets which cursor the terminal will use if the pointer is over the pattern specified by tag. [_$_] +-- The terminal keeps a reference to cursor. +-- +-- * Available since Vte version 0.11 +-- +terminalMatchSetCursor :: [_$_] + TerminalClass self => self + -> Int -- ^ @tag@ - the tag of the regex which should use the specified cursor [_$_] + -> Cursor -- ^ @cursor@ - the 'Cursor' which the terminal should use when the pattern is highlighted [_$_] + -> IO () +terminalMatchSetCursor terminal tag (Cursor cur) = + with (unsafeForeignPtrToPtr cur) $ \curPtr -> + {#call terminal_match_set_cursor#} (toTerminal terminal) (fromIntegral tag) (castPtr curPtr) + +-- | Sets which cursor the terminal will use if the pointer is over the pattern specified by tag. +-- +-- * Available since Vte version 0.11.9 +-- +-- terminalMatchSetCursorType + +-- | Sets which cursor the terminal will use if the pointer is over the pattern specified by tag. +-- +-- * Available since Vte version 0.17.1 +-- +terminalMatchSetCursorName :: [_$_] + TerminalClass self => self + -> Int -- ^ @tag@ - the tag of the regex which should use the specified cursor [_$_] + -> String -- ^ @name@ - the name of the cursor [_$_] + -> IO () +terminalMatchSetCursorName terminal tag name = + withUTFString name $ \namePtr -> + {#call terminal_match_set_cursor_name#} (toTerminal terminal) (fromIntegral tag) namePtr + [_$_] +-- | Sets what type of terminal the widget attempts to emulate by scanning for control sequences defined in the system's termcap file. [_$_] +-- Unless you are interested in this feature, always use "xterm". +terminalSetEmulation :: [_$_] + TerminalClass self => self + -> String -- ^ @emulation@ - the name of a terminal description [_$_] + -> IO () [_$_] +terminalSetEmulation terminal emulation = + withUTFString emulation $ \emulationPtr -> + {#call terminal_set_emulation#} (toTerminal terminal) emulationPtr + [_$_] +-- | Queries the terminal for its current emulation, as last set by a call to 'terminalSetEmulation'. +terminalGetEmulation :: [_$_] + TerminalClass self => self + -> IO String -- ^ return the name of the terminal type the widget is attempting to emulate [_$_] +terminalGetEmulation terminal = + {#call terminal_get_emulation#} (toTerminal terminal) >>= peekCString + [_$_] +-- | Queries the terminal for its default emulation, which is attempted if the terminal type passed to 'terminalSetEmulation' emptry string. +-- +-- * Available since Vte version 0.11.11 +-- +terminalGetDefaultEmulation :: [_$_] + TerminalClass self => self + -> IO String -- ^ return the name of the default terminal type the widget attempts to emulate [_$_] +terminalGetDefaultEmulation terminal = + {#call terminal_get_default_emulation#} (toTerminal terminal) >>= peekCString + [_$_] +-- | Changes the encoding the terminal will expect data from the child to be encoded with. [_$_] +-- For certain terminal types, applications executing in the terminal can change the encoding. [_$_] +-- The default encoding is defined by the application's locale settings. +terminalSetEncoding :: + TerminalClass self => self + -> String -- ^ @codeset@ - a valid g_iconv target [_$_] + -> IO () [_$_] +terminalSetEncoding terminal codeset = + withUTFString codeset $ \codesetPtr -> + {#call terminal_set_encoding#} (toTerminal terminal) codesetPtr + [_$_] +-- | Determines the name of the encoding in which the terminal expects data to be encoded. +terminalGetEncoding :: [_$_] + TerminalClass self => self + -> IO String -- ^ return the current encoding for the terminal. [_$_] +terminalGetEncoding terminal = + {#call terminal_get_encoding#} (toTerminal terminal) >>= peekCString + [_$_] +-- | Some terminal emulations specify a status line which is separate from the main display area, and define a means for applications to move the cursor to the status line and back. +terminalGetStatusLine :: [_$_] + TerminalClass self => self + -> IO String -- ^ return the current contents of the terminal's status line. For terminals like "xterm", this will usually be the empty string. The string must not be modified or freed by the caller. +terminalGetStatusLine terminal = + {#call terminal_get_status_line#} (toTerminal terminal) >>= peekCString + [_$_] +-- | Determines the amount of additional space the widget is using to pad the edges of its visible area. [_$_] +-- This is necessary for cases where characters in the selected font don't themselves include a padding area and the text itself would otherwise be contiguous with the window border. [_$_] +-- Applications which use the widget's row_count, column_count, char_height, and char_width fields to set geometry hints using 'windowSetGeometryHints' will need to add this value to the base size. [_$_] +-- The values returned in xpad and ypad are the total padding used in each direction, and do not need to be doubled. +terminalGetPadding :: [_$_] + TerminalClass self => self + -> I... [truncated message content] |