From: Duncan C. <dun...@us...> - 2005-08-25 01:16:25
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Multiline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv987/gtk/Graphics/UI/Gtk/Multiline Modified Files: TextBuffer.chs.pp TextIter.chs.pp TextTag.chs.pp TextView.chs.pp Log Message: Merge Gtk+ 2.8 updates. These are mostly documentation changes/additions and new functions. The code names of properties now use '-' as a word seperator by default rather than '_' (and using the right name saves some internal translation and allocation in glib). Index: TextIter.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Multiline/TextIter.chs.pp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- TextIter.chs.pp 1 Aug 2005 21:33:08 -0000 1.7 +++ TextIter.chs.pp 25 Aug 2005 01:16:15 -0000 1.8 @@ -130,6 +130,12 @@ textIterBackwardSearch, textIterEqual, textIterCompare, +#if GTK_CHECK_VERSION(2,8,0) + textIterForwardVisibleLine, + textIterBackwardVisibleLine, + textIterForwardVisibleLines, + textIterBackwardVisibleLines, +#endif -- * Attributes textIterVisibleLineOffset, @@ -795,6 +801,78 @@ (fromMaybe (TextIter nullForeignPtr) limit) return $ if found then Just (start,end) else Nothing +#if GTK_CHECK_VERSION(2,8,0) +-- | Moves @iter@ to the start of the next visible line. Returns @True@ if +-- there was a next line to move to, and @False@ if @iter@ was simply moved to +-- the end of the buffer and is now not dereferenceable, or if @iter@ was +-- already at the end of the buffer. +-- +-- * Available since Gtk+ version 2.8 +-- +textIterForwardVisibleLine :: TextIter + -> IO Bool -- ^ returns whether @iter@ can be dereferenced +textIterForwardVisibleLine self = + liftM toBool $ + {# call gtk_text_iter_forward_visible_line #} + self + +-- | Moves @iter@ to the start of the previous visible line. Returns @True@ if +-- @iter@ could be moved; i.e. if @iter@ was at character offset 0, this +-- function returns @False@. Therefore if @iter@ was already on line 0, but not +-- at the start of the line, @iter@ is snapped to the start of the line and the +-- function returns @True@. (Note that this implies that in a loop calling this +-- function, the line number may not change on every iteration, if your first +-- iteration is on line 0.) +-- +-- * Available since Gtk+ version 2.8 +-- +textIterBackwardVisibleLine :: TextIter + -> IO Bool -- ^ returns whether @iter@ moved +textIterBackwardVisibleLine self = + liftM toBool $ + {# call gtk_text_iter_backward_visible_line #} + self + +-- | Moves @count@ visible lines forward, if possible (if @count@ would move +-- past the start or end of the buffer, moves to the start or end of the +-- buffer). The return value indicates whether the iterator moved onto a +-- dereferenceable position; if the iterator didn't move, or moved onto the end +-- iterator, then @False@ is returned. If @count@ is 0, the function does +-- nothing and returns @False@. If @count@ is negative, moves backward by 0 - +-- @count@ lines. +-- +-- * Available since Gtk+ version 2.8 +-- +textIterForwardVisibleLines :: TextIter + -> Int -- ^ @count@ - number of lines to move forward + -> IO Bool -- ^ returns whether @iter@ moved and is dereferenceable +textIterForwardVisibleLines self count = + liftM toBool $ + {# call gtk_text_iter_forward_visible_lines #} + self + (fromIntegral count) + +-- | Moves @count@ visible lines backward, if possible (if @count@ would move +-- past the start or end of the buffer, moves to the start or end of the +-- buffer). The return value indicates whether the iterator moved onto a +-- dereferenceable position; if the iterator didn't move, or moved onto the end +-- iterator, then @False@ is returned. If @count@ is 0, the function does +-- nothing and returns @False@. If @count@ is negative, moves forward by 0 - +-- @count@ lines. +-- +-- * Available since Gtk+ version 2.8 +-- +textIterBackwardVisibleLines :: TextIter + -> Int -- ^ @count@ - number of lines to move backward + -> IO Bool -- ^ returns whether @iter@ moved and is dereferenceable +textIterBackwardVisibleLines self count = + liftM toBool $ + {# call gtk_text_iter_backward_visible_lines #} + self + (fromIntegral count) +#endif + + -- | Compare two 'TextIter' for equality. -- -- * 'TextIter' could be in class Eq and Ord if there is a guarantee Index: TextTag.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Multiline/TextTag.chs.pp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- TextTag.chs.pp 8 May 2005 12:23:10 -0000 1.8 +++ TextTag.chs.pp 25 Aug 2005 01:16:15 -0000 1.9 @@ -98,7 +98,10 @@ textTagStrikethrough, textTagUnderline, textTagWrapMode, +#if GTK_CHECK_VERSION(2,8,0) textTagInvisible, + textTagParagraphBackground, +#endif textTagPriority, ) where @@ -210,12 +213,12 @@ -- Default value: @False@ -- textTagBackgroundFullHeight :: TextTagClass self => Attr self Bool -textTagBackgroundFullHeight = newAttrFromBoolProperty "background_full_height" +textTagBackgroundFullHeight = newAttrFromBoolProperty "background-full-height" -- | Bitmap to use as a mask when drawing the text background. -- textTagBackgroundStipple :: (TextTagClass self, PixmapClass pixmap) => ReadWriteAttr self Pixmap pixmap -textTagBackgroundStipple = newAttrFromObjectProperty "background_stipple" +textTagBackgroundStipple = newAttrFromObjectProperty "background-stipple" -- | Foreground color as a string. -- @@ -227,7 +230,7 @@ -- | Bitmap to use as a mask when drawing the text foreground. -- textTagForegroundStipple :: (TextTagClass self, PixmapClass pixmap) => ReadWriteAttr self Pixmap pixmap -textTagForegroundStipple = newAttrFromObjectProperty "foreground_stipple" +textTagForegroundStipple = newAttrFromObjectProperty "foreground-stipple" -- | Text direction, e.g. right-to-left or left-to-right. -- @@ -314,7 +317,7 @@ -- Default value: 0 -- textTagSizePoints :: TextTagClass self => Attr self Double -textTagSizePoints = newAttrFromDoubleProperty "size_points" +textTagSizePoints = newAttrFromDoubleProperty "size-points" -- | Left, right, or center justification. -- @@ -339,7 +342,7 @@ -- Default value: 0 -- textTagLeftMargin :: TextTagClass self => Attr self Int -textTagLeftMargin = newAttrFromIntProperty "left_margin" +textTagLeftMargin = newAttrFromIntProperty "left-margin" -- | Width of the right margin in pixels. -- @@ -348,7 +351,7 @@ -- Default value: 0 -- textTagRightMargin :: TextTagClass self => Attr self Int -textTagRightMargin = newAttrFromIntProperty "right_margin" +textTagRightMargin = newAttrFromIntProperty "right-margin" -- | Amount to indent the paragraph, in pixels. -- @@ -372,7 +375,7 @@ -- Default value: 0 -- textTagPixelsAboveLines :: TextTagClass self => Attr self Int -textTagPixelsAboveLines = newAttrFromIntProperty "pixels_above_lines" +textTagPixelsAboveLines = newAttrFromIntProperty "pixels-above-lines" -- | Pixels of blank space below paragraphs. -- @@ -381,7 +384,7 @@ -- Default value: 0 -- textTagPixelsBelowLines :: TextTagClass self => Attr self Int -textTagPixelsBelowLines = newAttrFromIntProperty "pixels_below_lines" +textTagPixelsBelowLines = newAttrFromIntProperty "pixels-below-lines" -- | Pixels of blank space between wrapped lines in a paragraph. -- @@ -390,7 +393,7 @@ -- Default value: 0 -- textTagPixelsInsideWrap :: TextTagClass self => Attr self Int -textTagPixelsInsideWrap = newAttrFromIntProperty "pixels_inside_wrap" +textTagPixelsInsideWrap = newAttrFromIntProperty "pixels-inside-wrap" -- | Whether to strike through the text. -- @@ -412,15 +415,28 @@ -- Default value: 'WrapNone' -- textTagWrapMode :: TextTagClass self => Attr self WrapMode -textTagWrapMode = newAttrFromEnumProperty "wrap_mode" +textTagWrapMode = newAttrFromEnumProperty "wrap-mode" --- | Whether this text is hidden. Not implemented in Gtk+ 2.0. +#if GTK_CHECK_VERSION(2,8,0) +-- | Whether this text is hidden. +-- +-- Note that there may still be problems with the support for invisible +-- text, in particular when navigating programmatically inside a buffer +-- containing invisible segments. -- -- Default value: @False@ -- textTagInvisible :: TextTagClass self => Attr self Bool textTagInvisible = newAttrFromBoolProperty "invisible" +-- | The paragraph background color as a string. +-- +-- Default value: "" +-- +textTagParagraphBackground :: TextTagClass self => WriteAttr self String +textTagParagraphBackground = writeAttrFromStringProperty "paragraph-background" +#endif + -- | \'priority\' property. See 'textTagGetPriority' and 'textTagSetPriority' -- textTagPriority :: TextTagClass self => Attr self Int Index: TextBuffer.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- TextBuffer.chs.pp 23 Jul 2005 02:04:40 -0000 1.6 +++ TextBuffer.chs.pp 25 Aug 2005 01:16:15 -0000 1.7 @@ -143,6 +143,9 @@ -- * Attributes textBufferTagTable, +#if GTK_CHECK_VERSION(2,8,0) + textBufferText, +#endif textBufferModified, -- * Signals @@ -957,7 +960,17 @@ -- | Text Tag Table. -- textBufferTagTable :: (TextBufferClass self, TextTagTableClass textTagTable) => ReadWriteAttr self TextTagTable textTagTable -textBufferTagTable = newAttrFromObjectProperty "tag_table" +textBufferTagTable = newAttrFromObjectProperty "tag-table" + +#if GTK_CHECK_VERSION(2,8,0) +-- | The text content of the buffer. Without child widgets and images, see +-- 'textBufferGetText' for more information. +-- +-- Default value: \"\" +-- +textBufferText :: TextBufferClass self => Attr self String +textBufferText = newAttrFromStringProperty "text" +#endif -- | \'modified\' property. See 'textBufferGetModified' and -- 'textBufferSetModified' Index: TextView.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- TextView.chs.pp 7 May 2005 20:57:28 -0000 1.4 +++ TextView.chs.pp 25 Aug 2005 01:16:15 -0000 1.5 @@ -925,7 +925,7 @@ -- you have to convert those to buffer coordinates with -- 'textViewWindowToBufferCoords'. -- --- Note that this is diffferent from 'textViewGetIterAtLocation', which +-- Note that this is different from 'textViewGetIterAtLocation', which -- returns cursor locations, i.e. positions /between/ characters. -- -- * Available since Gtk+ version 2.6 @@ -934,7 +934,10 @@ -> Int -- ^ @x@ - x position, in buffer coordinates -> Int -- ^ @y@ - y position, in buffer coordinates -> IO (TextIter, Int) -- ^ @(iter, trailing)@ - returns the iterator and - -- a \"trailing\" value which is sadly undocumented + -- an integer indicating where in the grapheme the + -- user clicked. It will either be zero, or the + -- number of characters in the grapheme. 0 represents + -- the trailing edge of the grapheme. textViewGetIterAtPosition self x y = alloca $ \trailingPtr -> do iter <- makeEmptyTextIter @@ -1111,7 +1114,7 @@ -- | The buffer which is displayed. -- -textViewBuffer :: (TextViewClass self, TextBufferClass buffer) => ReadWriteAttr self TextBuffer buffer +textViewBuffer :: TextViewClass self => Attr self TextBuffer textViewBuffer = newAttr textViewGetBuffer textViewSetBuffer |