packages feed

gtksourceview3 (empty) → 0.12.5.0

raw patch · 35 files changed

+6086/−0 lines, 35 filesdep +arraydep +basedep +containersbuild-type:Customsetup-changed

Dependencies added: array, base, containers, glib, gtk3, mtl

Files

+ COPYING view
@@ -0,0 +1,504 @@+		  GNU LESSER GENERAL PUBLIC LICENSE+		       Version 2.1, February 1999++ Copyright (C) 1991, 1999 Free Software Foundation, Inc.+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA+ Everyone is permitted to copy and distribute verbatim copies+ of this license document, but changing it is not allowed.++[This is the first released version of the Lesser GPL.  It also counts+ as the successor of the GNU Library Public License, version 2, hence+ the version number 2.1.]++			    Preamble++  The licenses for most software are designed to take away your+freedom to share and change it.  By contrast, the GNU General Public+Licenses are intended to guarantee your freedom to share and change+free software--to make sure the software is free for all its users.++  This license, the Lesser General Public License, applies to some+specially designated software packages--typically libraries--of the+Free Software Foundation and other authors who decide to use it.  You+can use it too, but we suggest you first think carefully about whether+this license or the ordinary General Public License is the better+strategy to use in any particular case, based on the explanations below.++  When we speak of free software, we are referring to freedom of use,+not price.  Our General Public Licenses are designed to make sure that+you have the freedom to distribute copies of free software (and charge+for this service if you wish); that you receive source code or can get+it if you want it; that you can change the software and use pieces of+it in new free programs; and that you are informed that you can do+these things.++  To protect your rights, we need to make restrictions that forbid+distributors to deny you these rights or to ask you to surrender these+rights.  These restrictions translate to certain responsibilities for+you if you distribute copies of the library or if you modify it.++  For example, if you distribute copies of the library, whether gratis+or for a fee, you must give the recipients all the rights that we gave+you.  You must make sure that they, too, receive or can get the source+code.  If you link other code with the library, you must provide+complete object files to the recipients, so that they can relink them+with the library after making changes to the library and recompiling+it.  And you must show them these terms so they know their rights.++  We protect your rights with a two-step method: (1) we copyright the+library, and (2) we offer you this license, which gives you legal+permission to copy, distribute and/or modify the library.++  To protect each distributor, we want to make it very clear that+there is no warranty for the free library.  Also, if the library is+modified by someone else and passed on, the recipients should know+that what they have is not the original version, so that the original+author's reputation will not be affected by problems that might be+introduced by others.++  Finally, software patents pose a constant threat to the existence of+any free program.  We wish to make sure that a company cannot+effectively restrict the users of a free program by obtaining a+restrictive license from a patent holder.  Therefore, we insist that+any patent license obtained for a version of the library must be+consistent with the full freedom of use specified in this license.++  Most GNU software, including some libraries, is covered by the+ordinary GNU General Public License.  This license, the GNU Lesser+General Public License, applies to certain designated libraries, and+is quite different from the ordinary General Public License.  We use+this license for certain libraries in order to permit linking those+libraries into non-free programs.++  When a program is linked with a library, whether statically or using+a shared library, the combination of the two is legally speaking a+combined work, a derivative of the original library.  The ordinary+General Public License therefore permits such linking only if the+entire combination fits its criteria of freedom.  The Lesser General+Public License permits more lax criteria for linking other code with+the library.++  We call this license the "Lesser" General Public License because it+does Less to protect the user's freedom than the ordinary General+Public License.  It also provides other free software developers Less+of an advantage over competing non-free programs.  These disadvantages+are the reason we use the ordinary General Public License for many+libraries.  However, the Lesser license provides advantages in certain+special circumstances.++  For example, on rare occasions, there may be a special need to+encourage the widest possible use of a certain library, so that it becomes+a de-facto standard.  To achieve this, non-free programs must be+allowed to use the library.  A more frequent case is that a free+library does the same job as widely used non-free libraries.  In this+case, there is little to gain by limiting the free library to free+software only, so we use the Lesser General Public License.++  In other cases, permission to use a particular library in non-free+programs enables a greater number of people to use a large body of+free software.  For example, permission to use the GNU C Library in+non-free programs enables many more people to use the whole GNU+operating system, as well as its variant, the GNU/Linux operating+system.++  Although the Lesser General Public License is Less protective of the+users' freedom, it does ensure that the user of a program that is+linked with the Library has the freedom and the wherewithal to run+that program using a modified version of the Library.++  The precise terms and conditions for copying, distribution and+modification follow.  Pay close attention to the difference between a+"work based on the library" and a "work that uses the library".  The+former contains code derived from the library, whereas the latter must+be combined with the library in order to run.++		  GNU LESSER GENERAL PUBLIC LICENSE+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION++  0. This License Agreement applies to any software library or other+program which contains a notice placed by the copyright holder or+other authorized party saying it may be distributed under the terms of+this Lesser General Public License (also called "this License").+Each licensee is addressed as "you".++  A "library" means a collection of software functions and/or data+prepared so as to be conveniently linked with application programs+(which use some of those functions and data) to form executables.++  The "Library", below, refers to any such software library or work+which has been distributed under these terms.  A "work based on the+Library" means either the Library or any derivative work under+copyright law: that is to say, a work containing the Library or a+portion of it, either verbatim or with modifications and/or translated+straightforwardly into another language.  (Hereinafter, translation is+included without limitation in the term "modification".)++  "Source code" for a work means the preferred form of the work for+making modifications to it.  For a library, complete source code means+all the source code for all modules it contains, plus any associated+interface definition files, plus the scripts used to control compilation+and installation of the library.++  Activities other than copying, distribution and modification are not+covered by this License; they are outside its scope.  The act of+running a program using the Library is not restricted, and output from+such a program is covered only if its contents constitute a work based+on the Library (independent of the use of the Library in a tool for+writing it).  Whether that is true depends on what the Library does+and what the program that uses the Library does.+  +  1. You may copy and distribute verbatim copies of the Library's+complete source code as you receive it, in any medium, provided that+you conspicuously and appropriately publish on each copy an+appropriate copyright notice and disclaimer of warranty; keep intact+all the notices that refer to this License and to the absence of any+warranty; and distribute a copy of this License along with the+Library.++  You may charge a fee for the physical act of transferring a copy,+and you may at your option offer warranty protection in exchange for a+fee.++  2. You may modify your copy or copies of the Library or any portion+of it, thus forming a work based on the Library, and copy and+distribute such modifications or work under the terms of Section 1+above, provided that you also meet all of these conditions:++    a) The modified work must itself be a software library.++    b) You must cause the files modified to carry prominent notices+    stating that you changed the files and the date of any change.++    c) You must cause the whole of the work to be licensed at no+    charge to all third parties under the terms of this License.++    d) If a facility in the modified Library refers to a function or a+    table of data to be supplied by an application program that uses+    the facility, other than as an argument passed when the facility+    is invoked, then you must make a good faith effort to ensure that,+    in the event an application does not supply such function or+    table, the facility still operates, and performs whatever part of+    its purpose remains meaningful.++    (For example, a function in a library to compute square roots has+    a purpose that is entirely well-defined independent of the+    application.  Therefore, Subsection 2d requires that any+    application-supplied function or table used by this function must+    be optional: if the application does not supply it, the square+    root function must still compute square roots.)++These requirements apply to the modified work as a whole.  If+identifiable sections of that work are not derived from the Library,+and can be reasonably considered independent and separate works in+themselves, then this License, and its terms, do not apply to those+sections when you distribute them as separate works.  But when you+distribute the same sections as part of a whole which is a work based+on the Library, the distribution of the whole must be on the terms of+this License, whose permissions for other licensees extend to the+entire whole, and thus to each and every part regardless of who wrote+it.++Thus, it is not the intent of this section to claim rights or contest+your rights to work written entirely by you; rather, the intent is to+exercise the right to control the distribution of derivative or+collective works based on the Library.++In addition, mere aggregation of another work not based on the Library+with the Library (or with a work based on the Library) on a volume of+a storage or distribution medium does not bring the other work under+the scope of this License.++  3. You may opt to apply the terms of the ordinary GNU General Public+License instead of this License to a given copy of the Library.  To do+this, you must alter all the notices that refer to this License, so+that they refer to the ordinary GNU General Public License, version 2,+instead of to this License.  (If a newer version than version 2 of the+ordinary GNU General Public License has appeared, then you can specify+that version instead if you wish.)  Do not make any other change in+these notices.++  Once this change is made in a given copy, it is irreversible for+that copy, so the ordinary GNU General Public License applies to all+subsequent copies and derivative works made from that copy.++  This option is useful when you wish to copy part of the code of+the Library into a program that is not a library.++  4. You may copy and distribute the Library (or a portion or+derivative of it, under Section 2) in object code or executable form+under the terms of Sections 1 and 2 above provided that you accompany+it with the complete corresponding machine-readable source code, which+must be distributed under the terms of Sections 1 and 2 above on a+medium customarily used for software interchange.++  If distribution of object code is made by offering access to copy+from a designated place, then offering equivalent access to copy the+source code from the same place satisfies the requirement to+distribute the source code, even though third parties are not+compelled to copy the source along with the object code.++  5. A program that contains no derivative of any portion of the+Library, but is designed to work with the Library by being compiled or+linked with it, is called a "work that uses the Library".  Such a+work, in isolation, is not a derivative work of the Library, and+therefore falls outside the scope of this License.++  However, linking a "work that uses the Library" with the Library+creates an executable that is a derivative of the Library (because it+contains portions of the Library), rather than a "work that uses the+library".  The executable is therefore covered by this License.+Section 6 states terms for distribution of such executables.++  When a "work that uses the Library" uses material from a header file+that is part of the Library, the object code for the work may be a+derivative work of the Library even though the source code is not.+Whether this is true is especially significant if the work can be+linked without the Library, or if the work is itself a library.  The+threshold for this to be true is not precisely defined by law.++  If such an object file uses only numerical parameters, data+structure layouts and accessors, and small macros and small inline+functions (ten lines or less in length), then the use of the object+file is unrestricted, regardless of whether it is legally a derivative+work.  (Executables containing this object code plus portions of the+Library will still fall under Section 6.)++  Otherwise, if the work is a derivative of the Library, you may+distribute the object code for the work under the terms of Section 6.+Any executables containing that work also fall under Section 6,+whether or not they are linked directly with the Library itself.++  6. As an exception to the Sections above, you may also combine or+link a "work that uses the Library" with the Library to produce a+work containing portions of the Library, and distribute that work+under terms of your choice, provided that the terms permit+modification of the work for the customer's own use and reverse+engineering for debugging such modifications.++  You must give prominent notice with each copy of the work that the+Library is used in it and that the Library and its use are covered by+this License.  You must supply a copy of this License.  If the work+during execution displays copyright notices, you must include the+copyright notice for the Library among them, as well as a reference+directing the user to the copy of this License.  Also, you must do one+of these things:++    a) Accompany the work with the complete corresponding+    machine-readable source code for the Library including whatever+    changes were used in the work (which must be distributed under+    Sections 1 and 2 above); and, if the work is an executable linked+    with the Library, with the complete machine-readable "work that+    uses the Library", as object code and/or source code, so that the+    user can modify the Library and then relink to produce a modified+    executable containing the modified Library.  (It is understood+    that the user who changes the contents of definitions files in the+    Library will not necessarily be able to recompile the application+    to use the modified definitions.)++    b) Use a suitable shared library mechanism for linking with the+    Library.  A suitable mechanism is one that (1) uses at run time a+    copy of the library already present on the user's computer system,+    rather than copying library functions into the executable, and (2)+    will operate properly with a modified version of the library, if+    the user installs one, as long as the modified version is+    interface-compatible with the version that the work was made with.++    c) Accompany the work with a written offer, valid for at+    least three years, to give the same user the materials+    specified in Subsection 6a, above, for a charge no more+    than the cost of performing this distribution.++    d) If distribution of the work is made by offering access to copy+    from a designated place, offer equivalent access to copy the above+    specified materials from the same place.++    e) Verify that the user has already received a copy of these+    materials or that you have already sent this user a copy.++  For an executable, the required form of the "work that uses the+Library" must include any data and utility programs needed for+reproducing the executable from it.  However, as a special exception,+the materials to be distributed need not include anything that is+normally distributed (in either source or binary form) with the major+components (compiler, kernel, and so on) of the operating system on+which the executable runs, unless that component itself accompanies+the executable.++  It may happen that this requirement contradicts the license+restrictions of other proprietary libraries that do not normally+accompany the operating system.  Such a contradiction means you cannot+use both them and the Library together in an executable that you+distribute.++  7. You may place library facilities that are a work based on the+Library side-by-side in a single library together with other library+facilities not covered by this License, and distribute such a combined+library, provided that the separate distribution of the work based on+the Library and of the other library facilities is otherwise+permitted, and provided that you do these two things:++    a) Accompany the combined library with a copy of the same work+    based on the Library, uncombined with any other library+    facilities.  This must be distributed under the terms of the+    Sections above.++    b) Give prominent notice with the combined library of the fact+    that part of it is a work based on the Library, and explaining+    where to find the accompanying uncombined form of the same work.++  8. You may not copy, modify, sublicense, link with, or distribute+the Library except as expressly provided under this License.  Any+attempt otherwise to copy, modify, sublicense, link with, or+distribute the Library is void, and will automatically terminate your+rights under this License.  However, parties who have received copies,+or rights, from you under this License will not have their licenses+terminated so long as such parties remain in full compliance.++  9. You are not required to accept this License, since you have not+signed it.  However, nothing else grants you permission to modify or+distribute the Library or its derivative works.  These actions are+prohibited by law if you do not accept this License.  Therefore, by+modifying or distributing the Library (or any work based on the+Library), you indicate your acceptance of this License to do so, and+all its terms and conditions for copying, distributing or modifying+the Library or works based on it.++  10. Each time you redistribute the Library (or any work based on the+Library), the recipient automatically receives a license from the+original licensor to copy, distribute, link with or modify the Library+subject to these terms and conditions.  You may not impose any further+restrictions on the recipients' exercise of the rights granted herein.+You are not responsible for enforcing compliance by third parties with+this License.++  11. If, as a consequence of a court judgment or allegation of patent+infringement or for any other reason (not limited to patent issues),+conditions are imposed on you (whether by court order, agreement or+otherwise) that contradict the conditions of this License, they do not+excuse you from the conditions of this License.  If you cannot+distribute so as to satisfy simultaneously your obligations under this+License and any other pertinent obligations, then as a consequence you+may not distribute the Library at all.  For example, if a patent+license would not permit royalty-free redistribution of the Library by+all those who receive copies directly or indirectly through you, then+the only way you could satisfy both it and this License would be to+refrain entirely from distribution of the Library.++If any portion of this section is held invalid or unenforceable under any+particular circumstance, the balance of the section is intended to apply,+and the section as a whole is intended to apply in other circumstances.++It is not the purpose of this section to induce you to infringe any+patents or other property right claims or to contest validity of any+such claims; this section has the sole purpose of protecting the+integrity of the free software distribution system which is+implemented by public license practices.  Many people have made+generous contributions to the wide range of software distributed+through that system in reliance on consistent application of that+system; it is up to the author/donor to decide if he or she is willing+to distribute software through any other system and a licensee cannot+impose that choice.++This section is intended to make thoroughly clear what is believed to+be a consequence of the rest of this License.++  12. If the distribution and/or use of the Library is restricted in+certain countries either by patents or by copyrighted interfaces, the+original copyright holder who places the Library under this License may add+an explicit geographical distribution limitation excluding those countries,+so that distribution is permitted only in or among countries not thus+excluded.  In such case, this License incorporates the limitation as if+written in the body of this License.++  13. The Free Software Foundation may publish revised and/or new+versions of the Lesser General Public License from time to time.+Such new versions will be similar in spirit to the present version,+but may differ in detail to address new problems or concerns.++Each version is given a distinguishing version number.  If the Library+specifies a version number of this License which applies to it and+"any later version", you have the option of following the terms and+conditions either of that version or of any later version published by+the Free Software Foundation.  If the Library does not specify a+license version number, you may choose any version ever published by+the Free Software Foundation.++  14. If you wish to incorporate parts of the Library into other free+programs whose distribution conditions are incompatible with these,+write to the author to ask for permission.  For software which is+copyrighted by the Free Software Foundation, write to the Free+Software Foundation; we sometimes make exceptions for this.  Our+decision will be guided by the two goals of preserving the free status+of all derivatives of our free software and of promoting the sharing+and reuse of software generally.++			    NO WARRANTY++  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.++  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH+DAMAGES.++		     END OF TERMS AND CONDITIONS++           How to Apply These Terms to Your New Libraries++  If you develop a new library, and you want it to be of the greatest+possible use to the public, we recommend making it free software that+everyone can redistribute and change.  You can do so by permitting+redistribution under these terms (or, alternatively, under the terms of the+ordinary General Public License).++  To apply these terms, attach the following notices to the library.  It is+safest to attach them to the start of each source file to most effectively+convey the exclusion of warranty; and each file should have at least the+"copyright" line and a pointer to where the full notice is found.++    <one line to give the library's name and a brief idea of what it does.>+    Copyright (C) <year>  <name of author>++    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.++    You should have received a copy of the GNU Lesser General Public+    License along with this library; if not, write to the Free Software+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA++Also add information on how to contact you by electronic and paper mail.++You should also get your employer (if you work as a programmer) or your+school, if any, to sign a "copyright disclaimer" for the library, if+necessary.  Here is a sample; alter the names:++  Yoyodyne, Inc., hereby disclaims all copyright interest in the+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.++  <signature of Ty Coon>, 1 April 1990+  Ty Coon, President of Vice++That's all there is to it!++
+ Graphics/UI/Gtk/SourceView.hs view
@@ -0,0 +1,42 @@+{-# LANGUAGE CPP #-}+module Graphics.UI.Gtk.SourceView (+	module Graphics.UI.Gtk.SourceView.SourceBuffer,+	module Graphics.UI.Gtk.SourceView.SourceCompletion,+	module Graphics.UI.Gtk.SourceView.SourceCompletionContext,+	module Graphics.UI.Gtk.SourceView.SourceCompletionInfo,+	module Graphics.UI.Gtk.SourceView.SourceCompletionItem,+	module Graphics.UI.Gtk.SourceView.SourceCompletionProposal,+	module Graphics.UI.Gtk.SourceView.SourceCompletionProvider,+	module Graphics.UI.Gtk.SourceView.SourceGutter,+#if GTK_MAJOR_VERSION < 3+	module Graphics.UI.Gtk.SourceView.SourceIter,+#endif+	module Graphics.UI.Gtk.SourceView.SourceLanguage,+	module Graphics.UI.Gtk.SourceView.SourceLanguageManager,+	module Graphics.UI.Gtk.SourceView.SourceMark,+	module Graphics.UI.Gtk.SourceView.SourceStyle,+	module Graphics.UI.Gtk.SourceView.SourceStyleScheme,+	module Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager,+	module Graphics.UI.Gtk.SourceView.SourceUndoManager,+	module Graphics.UI.Gtk.SourceView.SourceView,+	) where++import Graphics.UI.Gtk.SourceView.SourceBuffer+import Graphics.UI.Gtk.SourceView.SourceCompletion+import Graphics.UI.Gtk.SourceView.SourceCompletionContext+import Graphics.UI.Gtk.SourceView.SourceCompletionInfo+import Graphics.UI.Gtk.SourceView.SourceCompletionItem+import Graphics.UI.Gtk.SourceView.SourceCompletionProposal+import Graphics.UI.Gtk.SourceView.SourceCompletionProvider+import Graphics.UI.Gtk.SourceView.SourceGutter+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.SourceView.SourceIter+#endif+import Graphics.UI.Gtk.SourceView.SourceLanguage+import Graphics.UI.Gtk.SourceView.SourceLanguageManager+import Graphics.UI.Gtk.SourceView.SourceMark+import Graphics.UI.Gtk.SourceView.SourceStyle+import Graphics.UI.Gtk.SourceView.SourceStyleScheme+import Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager+import Graphics.UI.Gtk.SourceView.SourceUndoManager+import Graphics.UI.Gtk.SourceView.SourceView
+ Graphics/UI/Gtk/SourceView/Enums.chs view
@@ -0,0 +1,59 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget Enums+--+--  Author : Andy Stewart+--+--  Created: 08 Aug 2010+--+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.Enums (+-- * Enums+   SourceCompletionActivation (..),+#if GTK_MAJOR_VERSION < 3+   SourceSearchFlags (..),+#endif+   SourceSmartHomeEndType (..),+   SourceDrawSpacesFlags (..),+   SourceViewGutterPosition (..)+) where++import Control.Monad	(liftM)++import System.Glib.FFI+import System.Glib.Flags++{# context lib="gtk" prefix="gtk" #}++{# enum SourceCompletionActivation {underscoreToCase} deriving(Eq,Bounded,Show,Read) #}++#if GTK_MAJOR_VERSION < 3+{# enum SourceSearchFlags {underscoreToCase} deriving(Eq,Bounded,Show,Read) #}++instance Flags SourceSearchFlags+#endif++{# enum SourceSmartHomeEndType {underscoreToCase} deriving (Eq, Bounded, Show, Read) #}++{# enum SourceDrawSpacesFlags {underscoreToCase} deriving (Eq, Bounded, Show, Read) #}++instance Flags SourceDrawSpacesFlags++{# enum SourceViewGutterPosition {underscoreToCase} deriving (Eq, Bounded, Show, Read) #}+
+ Graphics/UI/Gtk/SourceView/Signals.chs view
@@ -0,0 +1,179 @@+{-# OPTIONS_HADDOCK hide #-}+-- -*-haskell-*-+-- -------------------- automatically generated file - do not edit ------------+--  Callback installers for the GIMP Toolkit (GTK) Binding for Haskell+--+--  Author : Axel Simon+--+--  Created: 1 July 2000+--+--  Copyright (C) 2000-2005 Axel Simon+--+--  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.+--+-- #hide++-- These functions are used to connect signals to widgets. They are auto-+-- matically created through HookGenerator.hs which takes a list of possible+-- function signatures that are included in the GTK sources (gtkmarshal.list).+--+-- The object system in the second version of GTK is based on GObject from+-- GLIB. This base class is rather primitive in that it only implements+-- ref and unref methods (and others that are not interesting to us). If+-- the marshall list mentions OBJECT it refers to an instance of this +-- GObject which is automatically wrapped with a ref and unref call.+-- Structures which are not derived from GObject have to be passed as+-- BOXED which gives the signal connect function a possibility to do the+-- conversion into a proper ForeignPtr type. In special cases the signal+-- connect function use a PTR type which will then be mangled in the+-- user function directly. The latter is needed if a signal delivers a+-- pointer to a string and its length in a separate integer.+--+module Graphics.UI.Gtk.SourceView.Signals (+  module System.Glib.Signals,++  connect_NONE__NONE,+  connect_OBJECT__NONE,+  connect_BOXED_BOXED__NONE,+  connect_BOOL_INT__NONE,+  connect_BOXED_PTR__NONE,+  connect_OBJECT_BOXED_PTR__NONE,+  connect_OBJECT_BOXED_OBJECT__BOOL,+  connect_ENUM_INT__NONE,+  +  ) where++import Control.Monad	(liftM)++import System.Glib.FFI+import System.Glib.UTFString   (peekUTFString,maybePeekUTFString)+import System.Glib.GError      (failOnGError)+{#import System.Glib.Signals#}+{#import System.Glib.GObject#} +++{#context lib="gtk" prefix="gtk" #}+++-- Here are the generators that turn a Haskell function into+-- a C function pointer. The fist Argument is always the widget,+-- the last one is the user g_pointer. Both are ignored.+++connect_NONE__NONE :: +  GObjectClass obj => SignalName ->+  ConnectAfter -> obj ->+  (IO ()) ->+  IO (ConnectId obj)+connect_NONE__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> IO ()+        action _ =+          failOnGError $+          user++connect_OBJECT__NONE :: +  (GObjectClass a', GObjectClass obj) => SignalName ->+  ConnectAfter -> obj ->+  (a' -> IO ()) ->+  IO (ConnectId obj)+connect_OBJECT__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Ptr GObject -> IO ()+        action _ obj1 =+          failOnGError $+          makeNewGObject (GObject, objectUnref) (return obj1) >>= \obj1' ->+          user (unsafeCastGObject obj1')++connect_BOXED_BOXED__NONE :: +  GObjectClass obj => SignalName ->+  (Ptr a' -> IO a) -> (Ptr b' -> IO b) -> +  ConnectAfter -> obj ->+  (a -> b -> IO ()) ->+  IO (ConnectId obj)+connect_BOXED_BOXED__NONE signal boxedPre1 boxedPre2 after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Ptr () -> Ptr () -> IO ()+        action _ box1 box2 =+          failOnGError $+          boxedPre2 (castPtr box2) >>= \box2' ->+          boxedPre1 (castPtr box1) >>= \box1' ->+          user box1' box2'++connect_BOOL_INT__NONE :: +  GObjectClass obj => SignalName ->+  ConnectAfter -> obj ->+  (Bool -> Int -> IO ()) ->+  IO (ConnectId obj)+connect_BOOL_INT__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Bool -> Int -> IO ()+        action _ bool1 int2 =+          failOnGError $+          user bool1 int2++connect_BOXED_PTR__NONE :: +  GObjectClass obj => SignalName ->+  (Ptr a' -> IO a) -> +  ConnectAfter -> obj ->+  (a -> Ptr b -> IO ()) ->+  IO (ConnectId obj)+connect_BOXED_PTR__NONE signal boxedPre1 after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Ptr () -> Ptr () -> IO ()+        action _ box1 ptr2 =+          failOnGError $+          boxedPre1 (castPtr box1) >>= \box1' ->+          user box1' (castPtr ptr2)++connect_OBJECT_BOXED_PTR__NONE :: +  (GObjectClass a', GObjectClass obj) => SignalName ->+  (Ptr b' -> IO b) -> +  ConnectAfter -> obj ->+  (a' -> b -> Ptr c -> IO ()) ->+  IO (ConnectId obj)+connect_OBJECT_BOXED_PTR__NONE signal boxedPre2 after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Ptr GObject -> Ptr () -> Ptr () -> IO ()+        action _ obj1 box2 ptr3 =+          failOnGError $+          boxedPre2 (castPtr box2) >>= \box2' ->+          makeNewGObject (GObject, objectUnref) (return obj1) >>= \obj1' ->+          user (unsafeCastGObject obj1') box2' (castPtr ptr3)++connect_OBJECT_BOXED_OBJECT__BOOL :: +  (GObjectClass a', GObjectClass c', GObjectClass obj) => SignalName ->+  (Ptr b' -> IO b) -> +  ConnectAfter -> obj ->+  (a' -> b -> c' -> IO Bool) ->+  IO (ConnectId obj)+connect_OBJECT_BOXED_OBJECT__BOOL signal boxedPre2 after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Ptr GObject -> Ptr () -> Ptr GObject -> IO Bool+        action _ obj1 box2 obj3 =+          failOnGError $+          makeNewGObject (GObject, objectUnref) (return obj3) >>= \obj3' ->+          boxedPre2 (castPtr box2) >>= \box2' ->+          makeNewGObject (GObject, objectUnref) (return obj1) >>= \obj1' ->+          user (unsafeCastGObject obj1') box2' (unsafeCastGObject obj3')++connect_ENUM_INT__NONE :: +  (Enum a, GObjectClass obj) => SignalName ->+  ConnectAfter -> obj ->+  (a -> Int -> IO ()) ->+  IO (ConnectId obj)+connect_ENUM_INT__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Int -> Int -> IO ()+        action _ enum1 int2 =+          failOnGError $+          user (toEnum enum1) int2+
+ Graphics/UI/Gtk/SourceView/SourceBuffer.chs view
@@ -0,0 +1,453 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) SourceBuffer+--+--  Author : Peter Gavin, Andy Stewart+--  derived from sourceview bindings by Axel Simon and Duncan Coutts+--+--  Created: 18 December 2008+--+--  Copyright (C) 2003-2008 Peter Gavin, Duncan Coutts, Axel Simon+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceBuffer (+-- * Description+-- | The 'SourceBuffer' object is the model for 'SourceView' widgets. It extends the 'TextBuffer'+-- object by adding features useful to display and edit source code as syntax highlighting and bracket+-- matching. It also implements support for undo/redo operations.+-- +-- To create a 'SourceBuffer' use 'sourceBufferNew' or+-- 'sourceBufferNewWithLanguage'. The second form is just a convenience function which allows+-- you to initially set a 'SourceLanguage'.+-- +-- By default highlighting is enabled, but you can disable it with+-- 'sourceBufferSetHighlightSyntax'.++-- * Types+  SourceBuffer,+  SourceBufferClass,++-- * Methods+  castToSourceBuffer,+  sourceBufferNew,+  sourceBufferNewWithLanguage,+  sourceBufferSetHighlightSyntax,+  sourceBufferGetHighlightSyntax,+  sourceBufferSetLanguage,+  sourceBufferGetLanguage,+  sourceBufferSetHighlightMatchingBrackets,+  sourceBufferGetHighlightMatchingBrackets,+  sourceBufferSetStyleScheme,+  sourceBufferGetStyleScheme,+  sourceBufferSetMaxUndoLevels,+  sourceBufferGetMaxUndoLevels,+  sourceBufferGetCanUndo,+  sourceBufferGetCanRedo,+  sourceBufferUndo,+  sourceBufferRedo,+  sourceBufferBeginNotUndoableAction,+  sourceBufferEndNotUndoableAction,+  sourceBufferCreateSourceMark,+  sourceBufferGetSourceMarksAtLine,+  sourceBufferGetSourceMarksAtIter,+  sourceBufferRemoveSourceMarks,+  sourceBufferForwardIterToSourceMark,+  sourceBufferBackwardIterToSourceMark,+  sourceBufferEnsureHighlight,++-- * Attributes+  sourceBufferCanRedo,+  sourceBufferCanUndo,+  sourceBufferHighlightMatchingBrackets,+  sourceBufferHighlightSyntax,+  sourceBufferLanguage,+  sourceBufferSourceStyleScheme,+  sourceBufferMaxUndoLevels,+  sourceBufferUndoManager,++-- * Signals+  sourceBufferHighlightUpdated,+  sourceBufferRedoSignal,+  sourceBufferUndoSignal,+  sourceBufferSourceMarkUpdated,+  ) where++import Control.Monad	(liftM)+import Data.Maybe    (fromMaybe)++import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GList+import System.Glib.GObject              (wrapNewGObject, makeNewGObject)++{#import Graphics.UI.Gtk.Multiline.TextIter#}+{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.SourceMark#}+{#import Graphics.UI.Gtk.SourceView.Types#}+{#import System.Glib.Properties#}++{# context lib="gtk" prefix="gtk" #}++-- methods++-- | Create a new 'SourceBuffer', possibly+-- taking a 'TextTagTable'.+--+sourceBufferNew :: Maybe TextTagTable -> IO SourceBuffer+sourceBufferNew tt = wrapNewGObject mkSourceBuffer $+  {#call unsafe source_buffer_new#} +  (fromMaybe (TextTagTable nullForeignPtr) tt)++-- | Create a new 'SourceBuffer'+-- with a 'SourceLanguage'.+--+sourceBufferNewWithLanguage :: SourceLanguage -> IO SourceBuffer+sourceBufferNewWithLanguage lang = wrapNewGObject mkSourceBuffer $+  {#call unsafe source_buffer_new_with_language#} lang++-- | Controls whether syntax is highlighted in the buffer. If highlight is 'True', the text will be+-- highlighted according to the syntax patterns specified in the language set with+-- 'sourceBufferSetLanguage'. If highlight is 'False', syntax highlighting is disabled and all the+-- 'TextTag' objects that have been added by the syntax highlighting engine are removed from the+-- buffer.+sourceBufferSetHighlightSyntax :: SourceBufferClass buffer => buffer  -- ^ @buffer@    a 'SourceBuffer'.                                       +                               -> Bool  -- ^ @highlight@ 'True' to enable syntax highlighting, 'False' to disable it. +                               -> IO ()+sourceBufferSetHighlightSyntax sb newVal =+  {#call unsafe source_buffer_set_highlight_syntax#} +    (toSourceBuffer sb) +    (fromBool newVal)+  +-- | Determines whether syntax highlighting is activated in the source buffer.+sourceBufferGetHighlightSyntax :: SourceBufferClass buffer => buffer +                               -> IO Bool  -- ^ returns 'True' if syntax highlighting is enabled, 'False' otherwise. +sourceBufferGetHighlightSyntax sb = liftM toBool $+  {#call unsafe source_buffer_get_highlight_syntax#} +    (toSourceBuffer sb)++-- | Associate a 'SourceLanguage' with the source buffer. If language is not-'Nothing' and syntax+-- highlighting is enabled (see 'sourceBufferSetHighlightSyntax', the syntax patterns defined+-- in language will be used to highlight the text contained in the buffer. If language is 'Nothing', the+-- text contained in the buffer is not highlighted.+sourceBufferSetLanguage :: SourceBufferClass buffer => buffer +                        -> Maybe SourceLanguage  -- ^ @language@ a 'SourceLanguage' to set, or 'Nothing'. +                        -> IO ()+sourceBufferSetLanguage sb lang =+  {#call unsafe source_buffer_set_language#} +    (toSourceBuffer sb) +    (fromMaybe (SourceLanguage nullForeignPtr) lang)+  +-- | Returns the 'SourceLanguage' associated with the buffer, see 'sourceBufferSetLanguage'. +sourceBufferGetLanguage :: SourceBufferClass buffer => buffer +                        -> IO (Maybe SourceLanguage) -- ^ returns 'SourceLanguage' associated with the buffer, or 'Nothing'. +sourceBufferGetLanguage sb = +  maybeNull (makeNewGObject mkSourceLanguage) $+  {#call unsafe source_buffer_get_language#} (toSourceBuffer sb)++-- | Controls the bracket match highlighting function in the buffer. If activated, when you position your+-- cursor over a bracket character (a parenthesis, a square bracket, etc.) the matching opening or+-- closing bracket character will be highlighted. You can specify the style with the+-- 'sourceBufferSetBracketMatchStyle' function.+sourceBufferSetHighlightMatchingBrackets :: SourceBufferClass buffer => buffer +                                         -> Bool  -- ^ @highlight@ 'True' if you want matching brackets highlighted. +                                         -> IO ()+sourceBufferSetHighlightMatchingBrackets sb newVal =+  {#call unsafe source_buffer_set_highlight_matching_brackets#} (toSourceBuffer sb) (fromBool newVal)+  +-- | Determines whether bracket match highlighting is activated for the source buffer.+sourceBufferGetHighlightMatchingBrackets :: SourceBufferClass buffer => buffer +                                         -> IO Bool  -- ^ returns 'True' if the source buffer will highlight matching brackets. +sourceBufferGetHighlightMatchingBrackets sb = liftM toBool $+  {#call unsafe source_buffer_get_highlight_matching_brackets#} (toSourceBuffer sb)++-- | Sets style scheme used by the buffer. If scheme is 'Nothing' no style scheme is used.+sourceBufferSetStyleScheme :: SourceBufferClass buffer => buffer +                           -> Maybe SourceStyleScheme  -- ^ @scheme@ style scheme.      +                           -> IO ()+sourceBufferSetStyleScheme sb scheme =+    {#call unsafe source_buffer_set_style_scheme#} +      (toSourceBuffer sb)  +      (fromMaybe (SourceStyleScheme nullForeignPtr) scheme)++-- | Returns the 'SourceStyleScheme' currently used in buffer.+sourceBufferGetStyleScheme :: SourceBufferClass buffer => buffer +                           -> IO (Maybe SourceStyleScheme) -- ^ returns the 'SourceStyleScheme' set by 'sourceBufferSetStyleScheme', or 'Nothing'.+sourceBufferGetStyleScheme sb = +    maybeNull (makeNewGObject mkSourceStyleScheme) $+    {#call unsafe source_buffer_get_style_scheme#} (toSourceBuffer sb)++-- | Sets the number of undo levels for user actions the buffer will track. If the number of user actions+-- exceeds the limit set by this function, older actions will be discarded.+-- +-- If @maxUndoLevels@ is -1, no limit is set.+-- +-- A new action is started whenever the function 'textBufferBeginUserAction' is called. In+-- general, this happens whenever the user presses any key which modifies the buffer, but the undo+-- manager will try to merge similar consecutive actions, such as multiple character insertions into+-- one action. But, inserting a newline does start a new action.+sourceBufferSetMaxUndoLevels :: SourceBufferClass buffer => buffer +                             -> Int  -- ^ @maxUndoLevels@ the desired maximum number of undo levels. +                             -> IO ()+sourceBufferSetMaxUndoLevels sb newVal =+  {#call unsafe source_buffer_set_max_undo_levels#} (toSourceBuffer sb) (fromIntegral newVal)+  +-- | Determines the number of undo levels the buffer will track for buffer edits.+sourceBufferGetMaxUndoLevels :: SourceBufferClass buffer => buffer +                             -> IO Int -- ^ returns the maximum number of possible undo levels or -1 if no limit is set.+sourceBufferGetMaxUndoLevels sb = liftM fromIntegral $+  {#call unsafe source_buffer_get_max_undo_levels#} (toSourceBuffer sb)++-- | Determines whether a source buffer can undo the last action.+sourceBufferGetCanUndo :: SourceBufferClass buffer => buffer +                       -> IO Bool -- ^ returns 'True' if it's possible to undo the last action. +sourceBufferGetCanUndo sb = liftM toBool $+  {#call unsafe source_buffer_can_undo#} (toSourceBuffer sb)+  +-- | Determines whether a source buffer can redo the last action (i.e. if the last operation was an+-- undo).+sourceBufferGetCanRedo :: SourceBufferClass buffer => buffer +                       -> IO Bool -- ^ returns 'True' if a redo is possible. +sourceBufferGetCanRedo sb = liftM toBool $+  {#call unsafe source_buffer_can_redo#} (toSourceBuffer sb)++-- | Undoes the last user action which modified the buffer. Use 'sourceBufferCanUndo' to check+-- whether a call to this function will have any effect.+-- +-- Actions are defined as groups of operations between a call to 'textBufferBeginUserAction'+-- and 'textBufferEndUserAction' on the+-- same line.+sourceBufferUndo :: SourceBufferClass buffer => buffer -> IO ()+sourceBufferUndo sb =+  {#call source_buffer_undo#} (toSourceBuffer sb)+  +-- | Redoes the last undo operation. Use 'sourceBufferCanRedo' to check whether a call to this+-- function will have any effect.+sourceBufferRedo :: SourceBufferClass buffer => buffer -> IO ()+sourceBufferRedo sb =+  {#call source_buffer_redo#} (toSourceBuffer sb)++-- | Marks the beginning of a not undoable action on the buffer, disabling the undo manager. Typically+-- you would call this function before initially setting the contents of the buffer (e.g. when loading+-- a file in a text editor).+-- +-- You may nest 'sourceBufferBeginNotUndoableAction' /+-- 'sourceBufferEndNotUndoableAction' blocks.+sourceBufferBeginNotUndoableAction :: SourceBufferClass buffer => buffer -> IO ()+sourceBufferBeginNotUndoableAction sb =+  {#call source_buffer_begin_not_undoable_action#} (toSourceBuffer sb)+  +-- | Marks the end of a not undoable action on the buffer. When the last not undoable block is closed+-- through the call to this function, the list of undo actions is cleared and the undo manager is+-- re-enabled.+sourceBufferEndNotUndoableAction :: SourceBufferClass buffer => buffer -> IO ()+sourceBufferEndNotUndoableAction sb =+  {#call source_buffer_end_not_undoable_action#} (toSourceBuffer sb)++-- | Creates a marker in the buffer of the given type.+--+-- *  A marker is+--    semantically very similar to a 'Graphics.UI.Gtk.Multiline.TextMark',+--    except it has a type+--    which is used by the 'SourceView' displaying the buffer to show a+--    pixmap on the left margin, at the line the marker is in.  Because+--    of this, a marker is generally associated to a line and not a+--    character position.  Markers are also accessible through a position+--    or range in the buffer.+--+-- *  Markers are implemented using 'Graphics.UI.Gtk.Multiline.TextMark',+--    so all characteristics+--    and restrictions to marks apply to markers too.  These includes+--    life cycle issues and 'Graphics.UI.Gtk.Multiline.TextMark.onMarkSet'+--    and 'Graphics.UI.Gtk.Multiline.TextMark.onMarkDeleted' signal+--    emissions.+--+-- *  Like a 'Graphics.UI.Gtk.Multiline.TextMark', a 'SourceMarker'+--    can be anonymous if the+--    passed name is @Nothing@.  Also, the buffer owns the markers so you+--    shouldn't unreference it.++sourceBufferCreateSourceMark :: SourceBufferClass buffer => buffer -- the buffer+                         -> Maybe String -- the name of the mark+                         -> String -- the category of the mark+                         -> TextIter -> IO SourceMark+sourceBufferCreateSourceMark sb name category iter =+  makeNewGObject mkSourceMark $+  maybeWith withCString name       $ \strPtr1 ->+  withCString category $ \strPtr2 ->+  {#call source_buffer_create_source_mark#} (toSourceBuffer sb) strPtr1 strPtr2 iter++-- | Returns the list of marks of the given category at line. If category is empty, all marks at line are+-- returned.+sourceBufferGetSourceMarksAtLine :: SourceBufferClass buffer => buffer  -- ^ @buffer@   a 'SourceBuffer'.             +                                 -> Int -- ^ @line@     a line number.                 +                                 -> String -- ^ @category@ category to search for or empty +                                 -> IO [SourceMark]+sourceBufferGetSourceMarksAtLine buffer line category = +  withCString category $ \categoryPtr ->+  {#call gtk_source_buffer_get_source_marks_at_line #}+    (toSourceBuffer buffer) +    (fromIntegral line)+    categoryPtr+  >>= readGSList+  >>= mapM (\markPtr -> makeNewGObject mkSourceMark (return markPtr))++-- | Returns the list of marks of the given category at iter. If category is empty it returns all marks at+-- iter.+sourceBufferGetSourceMarksAtIter :: SourceBufferClass buffer => buffer -- ^ @buffer@   a 'SourceBuffer'.             +                                 -> TextIter -- ^ @iter@     an iterator.                   +                                 -> String -- ^ @category@ category to search for or empty+                                 -> IO [SourceMark]+sourceBufferGetSourceMarksAtIter buffer iter category =+  withCString category $ \categoryPtr ->+  {#call gtk_source_buffer_get_source_marks_at_iter #}+    (toSourceBuffer buffer)+    iter+    categoryPtr+  >>= readGSList+  >>= mapM (\markPtr -> makeNewGObject mkSourceMark (return markPtr))++-- | Remove all marks of category between start and end from the buffer. If category is empty, all marks+-- in the range will be removed.+sourceBufferRemoveSourceMarks :: SourceBufferClass buffer => buffer -- ^ @buffer@   a 'SourceBuffer'.             +                              -> TextIter -- ^ @start@    a 'TextIter'                  +                              -> TextIter -- ^ @end@      a 'TextIter'                  +                              -> String -- ^ @category@ category to search for or empty+                              -> IO ()+sourceBufferRemoveSourceMarks buffer start end category =+  withCString category $ \categoryPtr ->+  {#call gtk_source_buffer_remove_source_marks #}+     (toSourceBuffer buffer)+     start+     end+     categoryPtr++-- | Moves iter to the position of the next 'SourceMark' of the given category. Returns 'True' if iter was+-- moved. If category is empty, the next source mark can be of any category.+sourceBufferForwardIterToSourceMark :: SourceBufferClass buffer => buffer -- ^ @buffer@   a 'SourceBuffer'.             +                                    -> TextIter -- ^ @iter@     an iterator.                   +                                    -> String -- ^ @category@ category to search for or emtpy+                                    -> IO Bool -- ^ returns  whether iter moved.            +sourceBufferForwardIterToSourceMark buffer iter category =+  liftM toBool $+  withCString category $ \categoryPtr ->+  {#call gtk_source_buffer_forward_iter_to_source_mark #}+    (toSourceBuffer buffer)+    iter+    categoryPtr++-- | Moves iter to the position of the previous 'SourceMark' of the given category. Returns 'True' if iter+-- was moved. If category is empty, the previous source mark can be of any category.+sourceBufferBackwardIterToSourceMark :: SourceBufferClass buffer => buffer  -- ^ @buffer@   a 'SourceBuffer'.             +                                     -> TextIter -- ^ @iter@     an iterator.                   +                                     -> String -- ^ @category@ category to search for or emtpy+                                     -> IO Bool -- ^ returns  whether iter moved.            +sourceBufferBackwardIterToSourceMark buffer iter category =+  liftM toBool $+  withCString category $ \categoryPtr ->+  {#call gtk_source_buffer_backward_iter_to_source_mark #}+    (toSourceBuffer buffer)+    iter+    categoryPtr++-- | Forces buffer to analyze and highlight the given area synchronously.+-- +-- Note+-- +-- This is a potentially slow operation and should be used only when you need to make sure that some+-- text not currently visible is highlighted, for instance before printing.+sourceBufferEnsureHighlight :: SourceBufferClass buffer => buffer +                            -> TextIter  -- ^ @start@  start of the area to highlight. +                            -> TextIter  -- ^ @end@    end of the area to highlight.   +                            -> IO ()+sourceBufferEnsureHighlight sb start end =+    {#call source_buffer_ensure_highlight#} (toSourceBuffer sb) start end++-- | Whether Redo operation is possible.+-- +-- Default value: 'False'+-- +sourceBufferCanRedo :: SourceBufferClass buffer => ReadAttr buffer Bool+sourceBufferCanRedo = readAttrFromBoolProperty "can-redo"++-- | Whether Undo operation is possible.+-- +-- Default value: 'False'+sourceBufferCanUndo :: SourceBufferClass buffer => ReadAttr buffer Bool+sourceBufferCanUndo = readAttrFromBoolProperty "can-undo"++-- | Whether to highlight matching brackets in the buffer.+-- +-- Default value: 'True'+--+sourceBufferHighlightMatchingBrackets :: SourceBufferClass buffer => Attr buffer Bool+sourceBufferHighlightMatchingBrackets = newAttrFromBoolProperty "highlight-matching-brackets"++-- | Whether to highlight syntax in the buffer.+-- +-- Default value: 'True'+--+sourceBufferHighlightSyntax :: SourceBufferClass buffer => Attr buffer Bool+sourceBufferHighlightSyntax = newAttrFromBoolProperty "highlight-matching-brackets"++-- | Language object to get highlighting patterns from.+-- +sourceBufferLanguage :: SourceBufferClass buffer => Attr buffer (Maybe SourceLanguage)+sourceBufferLanguage = newAttrFromMaybeObjectProperty "language" gTypeSourceLanguage++-- | Number of undo levels for the buffer. -1 means no limit. This property will only affect the default+-- undo manager.+-- +-- Allowed values: >= GMaxulong+-- +-- Default value: 1000+--+sourceBufferMaxUndoLevels :: SourceBufferClass buffer => Attr buffer Int+sourceBufferMaxUndoLevels = newAttrFromIntProperty "max-undo-levels"++-- | Style scheme. It contains styles for syntax highlighting, optionally foreground, background, cursor+-- color, current line color, and matching brackets style.+-- +sourceBufferSourceStyleScheme :: SourceBufferClass buffer => Attr buffer (Maybe SourceStyleScheme)+sourceBufferSourceStyleScheme = newAttrFromMaybeObjectProperty "style-scheme" gTypeSourceStyleScheme++-- | The buffer undo manager.+sourceBufferUndoManager :: SourceBufferClass buffer => Attr buffer SourceUndoManager+sourceBufferUndoManager = newAttrFromObjectProperty "undo-manager"+                          {# call pure unsafe gtk_source_undo_manager_get_type #}++-- |+--+sourceBufferHighlightUpdated :: SourceBufferClass buffer => Signal buffer (TextIter -> TextIter -> IO ())+sourceBufferHighlightUpdated = Signal $ connect_BOXED_BOXED__NONE "highlight-updated" mkTextIterCopy mkTextIterCopy++-- |+--+sourceBufferRedoSignal :: SourceBufferClass buffer => Signal buffer (IO ())+sourceBufferRedoSignal = Signal $ connect_NONE__NONE "redo"++-- |+--+sourceBufferUndoSignal :: SourceBufferClass buffer => Signal buffer (IO ())+sourceBufferUndoSignal = Signal $ connect_NONE__NONE "undo"++-- | The 'sourceBufferMarkUpdated' signal is emitted each time a mark is added to, moved or removed from the+-- buffer.+--+sourceBufferSourceMarkUpdated :: SourceBufferClass buffer => Signal buffer (TextMark -> IO ())+sourceBufferSourceMarkUpdated = Signal $ connect_OBJECT__NONE "source-mark-updated" 
+ Graphics/UI/Gtk/SourceView/SourceCompletion.chs view
@@ -0,0 +1,289 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceCompletion+--+--  Author : Andy Stewart+--+--  Created: 08 Aug 2010+--+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceCompletion (+-- * Types+    SourceCompletion,+    SourceCompletionClass,++-- * Methods+    sourceCompletionAddProvider,+    sourceCompletionRemoveProvider,+    sourceCompletionGetProviders,+    sourceCompletionShow,+    sourceCompletionHide,+    sourceCompletionGetInfoWindow,+    sourceCompletionCreateContext,+    sourceCompletionMoveWindow,+    sourceCompletionBlockInteractive,+    sourceCompletionUnblockInteractive,++-- * Attributes+    sourceCompletionAccelerators,+    sourceCompletionAutoCompleteDelay,+    sourceCompletionProposalPageSize,+    sourceCompletionProviderPageSize,+    sourceCompletionRememberInfoVisibility,+    sourceCompletionSelectOnShow,+    sourceCompletionShowHeaders,+    sourceCompletionShowIcons,+    sourceCompletionView,++-- * Signals+    sourceCompletionActivateProposal,+    sourceCompletionHideSignal,+    sourceCompletionMoveCursor,+    sourceCompletionMovePage,+    sourceCompletionPopulateContext,+    sourceCompletionShowSignal,+) where++import Control.Monad	(liftM)+import Data.Maybe (fromMaybe)++import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)+import Graphics.UI.Gtk.General.Enums (ScrollStep (..))+import Graphics.UI.Gtk.Multiline.TextView (TextWindowType (..))+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GError+import System.Glib.GList		(fromGList, withGList)+import System.Glib.GObject	(makeNewGObject)+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- | Add a new 'SourceCompletionProvider' to the completion object. This will add a reference provider,+-- so make sure to unref your own copy when you no longer need it.+sourceCompletionAddProvider :: SourceCompletionClass sc => sc +                            -> SourceCompletionProvider+                            -> IO Bool -- ^ returns    'True' if provider was successfully added, otherwise if error is provided, it will be set with the error and     +sourceCompletionAddProvider sc provider = +  liftM toBool $+  propagateGError $ \gErrorPtr -> +      {# call gtk_source_completion_add_provider #}  +          (toSourceCompletion sc)+          provider+          gErrorPtr++-- | Remove provider from the completion.+sourceCompletionRemoveProvider :: SourceCompletionClass sc => sc +                               -> SourceCompletionProvider+                               -> IO Bool  -- ^ returns    'True' if provider was successfully removed, otherwise if error is provided, it will be set with the error and   +sourceCompletionRemoveProvider sc provider =+  liftM toBool $+  propagateGError $ \gErrorPtr -> +      {#call gtk_source_completion_remove_provider #}+         (toSourceCompletion sc)+         provider+         gErrorPtr+      +-- | Get list of providers registered on completion. The returned list is owned by the completion and+-- should not be freed.+sourceCompletionGetProviders :: SourceCompletionClass sc => sc -> IO [SourceCompletionProvider]+sourceCompletionGetProviders sc = do+  glist <- {#call gtk_source_completion_get_providers #} (toSourceCompletion sc)+  glistPtrs <- fromGList glist+  mapM (makeNewGObject mkSourceCompletionProvider . return) glistPtrs  ++-- | Starts a new completion with the specified 'SourceCompletionContext' and a list of potential+-- candidate providers for completion.+sourceCompletionShow :: SourceCompletionClass sc => sc+                     -> [SourceCompletionProvider] -- ^ @providers@  A list of 'SourceCompletionProvider' +                     -> SourceCompletionContext -- ^ @context@    The 'SourceCompletionContext' with which to start the completion+                     -> IO Bool -- ^ returns    'True' if it was possible to the show completion window.           +sourceCompletionShow sc providers context =+  liftM toBool $+  withForeignPtrs (map unSourceCompletionProvider providers) $ \providersPtr ->+  withGList providersPtr $ \glist ->+  {#call gtk_source_completion_show #}+    (toSourceCompletion sc)+    glist+    context++-- | Hides the completion if it is active (visible).+sourceCompletionHide :: SourceCompletionClass sc => sc -> IO ()+sourceCompletionHide sc =+  {#call gtk_source_completion_hide #} (toSourceCompletion sc)++-- | The info widget is the window where the completion displays optional extra information of the+-- proposal.+sourceCompletionGetInfoWindow :: SourceCompletionClass sc => sc -> IO SourceCompletionInfo+sourceCompletionGetInfoWindow sc =+  makeNewObject mkSourceCompletionInfo $+  {#call gtk_source_completion_get_info_window #}+    (toSourceCompletion sc)++-- | Create a new 'SourceCompletionContext' for completion. The position at which the completion using+-- the new context will consider completion can be provider by position. If position is 'Nothing', the+-- current cursor position will be used.+sourceCompletionCreateContext :: SourceCompletionClass sc => sc+                              -> Maybe TextIter+                              -> IO SourceCompletionContext+sourceCompletionCreateContext sc iter = +  makeNewGObject mkSourceCompletionContext $+  {#call gtk_source_completion_create_context #}+    (toSourceCompletion sc)+    (fromMaybe (TextIter nullForeignPtr) iter)++-- | Move the completion window to a specific iter.+sourceCompletionMoveWindow :: SourceCompletionClass sc => sc+                           -> TextIter +                           -> IO ()+sourceCompletionMoveWindow sc iter = +  {#call gtk_source_completion_move_window #}+    (toSourceCompletion sc)+    iter++-- | Block interactive completion. This can be used to disable interactive completion when inserting or+-- deleting text from the buffer associated with the completion. Use+-- 'sourceCompletionUnblockInteractive' to enable interactive completion again.+sourceCompletionBlockInteractive :: SourceCompletionClass sc => sc -> IO ()+sourceCompletionBlockInteractive sc =+  {#call gtk_source_completion_block_interactive #}+     (toSourceCompletion sc)++-- | Unblock interactive completion. This can be used after using 'sourceCompletionBlockInteractive'+-- to enable interactive completion again.+sourceCompletionUnblockInteractive :: SourceCompletionClass sc => sc -> IO ()+sourceCompletionUnblockInteractive sc =+  {#call gtk_source_completion_unblock_interactive #}+     (toSourceCompletion sc)++-- | Number of accelerators to show for the first proposals.+-- +-- Allowed values: <= 10+-- +-- Default value: 5+--+sourceCompletionAccelerators :: SourceCompletionClass sc => Attr sc Int+sourceCompletionAccelerators = newAttrFromIntProperty "accelerators"++-- | Determines the popup delay (in milliseconds) at which the completion will be shown for interactive+-- completion.+-- +-- Default value: 250+--+sourceCompletionAutoCompleteDelay :: SourceCompletionClass sc => Attr sc Int+sourceCompletionAutoCompleteDelay = newAttrFromIntProperty "auto-complete-delay"++-- | The scroll page size of the proposals in the completion window.+-- +-- Allowed values: >= 1+-- +-- Default value: 5+--+sourceCompletionProposalPageSize :: SourceCompletionClass sc => Attr sc Int+sourceCompletionProposalPageSize = newAttrFromIntProperty "proposal-page-size"++-- | The scroll page size of the provider pages in the completion window.+-- +-- Allowed values: >= 1+-- +-- Default value: 5+--+sourceCompletionProviderPageSize :: SourceCompletionClass sc => Attr sc Int+sourceCompletionProviderPageSize = newAttrFromIntProperty "provider-page-size"++-- | Determines whether the visibility of the info window should be saved when the completion is hidden,+-- and restored when the completion is shown again.+-- +-- Default value: 'False'+--+sourceCompletionRememberInfoVisibility :: SourceCompletionClass sc => Attr sc Bool+sourceCompletionRememberInfoVisibility = newAttrFromBoolProperty "remember-info-visibility"++-- | Determines whether the first proposal should be selected when the completion is first shown.+-- +-- Default value: 'True'+--+sourceCompletionSelectOnShow :: SourceCompletionClass sc => Attr sc Bool+sourceCompletionSelectOnShow = newAttrFromBoolProperty "select-on-show"++-- | Determines whether provider headers should be shown in the proposal list if there is more than one+-- provider with proposals.+-- +-- Default value: 'True'+sourceCompletionShowHeaders :: SourceCompletionClass sc => Attr sc Bool+sourceCompletionShowHeaders = newAttrFromBoolProperty "show-headers"++-- | Determines whether provider and proposal icons should be shown in the completion popup.+-- +-- Default value: 'True'+--+sourceCompletionShowIcons :: SourceCompletionClass sc => Attr sc Bool+sourceCompletionShowIcons = newAttrFromBoolProperty "show-icons"++-- | The 'SourceView' bound to the completion object.+--+sourceCompletionView :: SourceCompletionClass sc => Attr sc SourceView+sourceCompletionView = newAttrFromObjectProperty "view"+                       {#call pure unsafe gtk_source_view_get_type #}++-- | The 'activateProposal' signal is a keybinding signal which gets emitted when the user initiates a+-- proposal activation.+-- +-- Applications should not connect to it, but may emit it with @gSignalEmitByName@ if they need to+-- control the proposal activation programmatically.+sourceCompletionActivateProposal :: SourceCompletionClass sc => Signal sc (IO ())+sourceCompletionActivateProposal = +  Signal $ connect_NONE__NONE "activate-proposal"++-- | Emitted when the completion window is hidden. The default handler will actually hide the window.+sourceCompletionHideSignal :: SourceCompletionClass sc => Signal sc (IO ())+sourceCompletionHideSignal =+  Signal $ connect_NONE__NONE "hide"++-- | The 'moveCursor' signal is a keybinding signal which gets emitted when the user initiates a cursor+-- movement.+-- +-- Applications should not connect to it, but may emit it with @gSignalEmitByName@ if they need to+-- control the cursor programmatically.+sourceCompletionMoveCursor :: SourceCompletionClass sc => Signal sc (ScrollStep -> Int -> IO ())+sourceCompletionMoveCursor =+  Signal $ connect_ENUM_INT__NONE "move-cursor"++-- | The 'movePage' signal is a keybinding signal which gets emitted when the user initiates a page+-- movement (i.e. switches between provider pages).+-- +-- Applications should not connect to it, but may emit it with @gSignalEmitByName@ if they need to+-- control the page selection programmatically.+sourceCompletionMovePage :: SourceCompletionClass sc => Signal sc (ScrollStep -> Int -> IO ())+sourceCompletionMovePage =+  Signal $ connect_ENUM_INT__NONE "move-page"++-- | Emitted just before starting to populate the completion with providers. You can use this signal to+-- add additional attributes in the context.+sourceCompletionPopulateContext :: SourceCompletionClass sc => Signal sc (SourceCompletionContext -> IO ())+sourceCompletionPopulateContext = Signal $ connect_OBJECT__NONE "populate-context"++-- | Emitted when the completion window is shown. The default handler will actually show the window.+sourceCompletionShowSignal :: SourceCompletionClass sc => Signal sc (IO ())+sourceCompletionShowSignal =+  Signal $ connect_NONE__NONE "show"
+ Graphics/UI/Gtk/SourceView/SourceCompletionContext.chs view
@@ -0,0 +1,117 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceCompletionContext+--+--  Author : Andy Stewart+--+--  Created: 08 Aug 2010+--+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceCompletionContext (+-- * Types+   SourceCompletionContext,+   SourceCompletionContextClass,++-- * Enums+   SourceCompletionActivation,++-- * Methods+   sourceCompletionContextAddProposals,+   sourceCompletionContextGetIter,++-- * Attributes   +   sourceCompletionContextActivation,+   sourceCompletionContextCompletion,++-- * Signals   +   sourceCompletionContextCancelled,+) where++import Control.Monad	(liftM)++import Graphics.UI.Gtk.SourceView.Enums+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GList		(fromGList, withGList)+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- | Providers can use this function to add proposals to the completion. They can do so asynchronously by+-- means of the finished argument. Providers must ensure that they always call this function with+-- finished set to 'True' once each population (even if no proposals need to be added).+sourceCompletionContextAddProposals :: (SourceCompletionContextClass scc, SourceCompletionProviderClass scp) => scc+                                    -> scp+                                    -> [SourceCompletionProposal] -- ^ @proposals@ The list of proposals to add                      +                                    -> Bool -- ^ @finished@  Whether the provider is finished adding proposals +                                    -> IO ()+sourceCompletionContextAddProposals scc provider proposals finished = +    withForeignPtrs (map unSourceCompletionProposal proposals) $ \proposalsPtr ->+#ifdef MIN_VERSION_gtksourceview_3_0+#if MIN_VERSION_gtksourceview_3_0(3,6,0)+#else+    withForeignPtr (unSourceCompletionProvider $ toSourceCompletionProvider provider) $ \providerPtr ->+#endif+#else+    withForeignPtr (unSourceCompletionProvider $ toSourceCompletionProvider provider) $ \providerPtr ->+#endif+    withGList proposalsPtr $ \glist ->+    {#call gtk_source_completion_context_add_proposals #}+      (toSourceCompletionContext scc)+#ifdef MIN_VERSION_gtksourceview_3_0+#if MIN_VERSION_gtksourceview_3_0(3,6,0)+      (toSourceCompletionProvider provider)+#else+      (castPtr providerPtr)+#endif+#else+      (castPtr providerPtr)+#endif+      glist+      (fromBool finished)++-- | Get the iter at which the completion was invoked. Providers can use this to determine how and if to+-- match proposals.+sourceCompletionContextGetIter :: SourceCompletionContextClass scc => scc+                               -> IO TextIter+sourceCompletionContextGetIter scc = do+  iter <- makeEmptyTextIter+  {#call gtk_source_completion_context_get_iter #}+    (toSourceCompletionContext scc)+    iter+  return iter++-- | The completion activation+sourceCompletionContextActivation :: SourceCompletionContextClass scc => Attr scc SourceCompletionActivation+sourceCompletionContextActivation = newAttrFromEnumProperty "activation"+                                    {#call pure unsafe gtk_source_completion_activation_get_type #}++-- | The 'SourceCompletion' associated with the context.+sourceCompletionContextCompletion :: SourceCompletionContextClass scc => Attr scc SourceCompletion+sourceCompletionContextCompletion = newAttrFromObjectProperty "completion"+                                    {#call pure unsafe gtk_source_completion_get_type #}++-- | Emitted when the current population of proposals has been cancelled. Providers adding proposals+-- asynchronously should connect to this signal to know when to cancel running proposal queries.+sourceCompletionContextCancelled :: SourceCompletionContextClass scc => Signal scc (IO ())+sourceCompletionContextCancelled = Signal $ connect_NONE__NONE "cancelled"
+ Graphics/UI/Gtk/SourceView/SourceCompletionInfo.chs view
@@ -0,0 +1,165 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceCompletionInfo+--+--  Author : Andy Stewart+--+--  Created: 08 Aug 2010+--+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceCompletionInfo (+-- * Description+-- | This object can be used to show a calltip or help for the .* current completion proposal.++-- * Types+   SourceCompletionInfo,+   SourceCompletionInfoClass,++-- * Methods+   sourceCompletionInfoNew,+   sourceCompletionInfoMoveToIter,+#if GTK_MAJOR_VERSION < 3+   sourceCompletionInfoSetSizing,+#endif+   sourceCompletionInfoSetWidget,+   sourceCompletionInfoGetWidget,+#if GTK_MAJOR_VERSION < 3+   sourceCompletionInfoProcessResize,+#endif++-- * Attributes+   sourceCompletionInfoMaxHeight,+   sourceCompletionInfoMaxWidth,+   sourceCompletionInfoShrinkHeight,+   sourceCompletionInfoShrinkWidth,++-- * Signals+   sourceCompletionInfoBeforeShow,+) where+import Control.Monad	(liftM)+import Data.Maybe (fromMaybe)++import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- |+sourceCompletionInfoNew :: IO SourceCompletionInfo+sourceCompletionInfoNew = +  makeNewObject mkSourceCompletionInfo $+  {#call gtk_source_completion_info_new #}++-- | Moves the 'SourceCompletionInfo' to iter. If iter is 'Nothing' info is moved to the cursor+-- position. Moving will respect the 'Gravity' setting of the info window and will ensure the line at+-- iter is not occluded by the window.+sourceCompletionInfoMoveToIter :: SourceCompletionInfoClass info => info +                               -> TextView -- ^ @view@ A 'TextView' on which the info window should be positioned +                               -> Maybe TextIter -- ^ @iter@ A 'TextIter' or 'Nothing'+                               -> IO ()+sourceCompletionInfoMoveToIter info view iter =+  {#call gtk_source_completion_info_move_to_iter #}+    (toSourceCompletionInfo info)+    view+    (fromMaybe (TextIter nullForeignPtr) iter)++#if GTK_MAJOR_VERSION < 3+-- | Set sizing information for the info window. If @shrinkWidth@ or @shrinkHeight@ is 'True', the info+-- window will try to resize to fit the window contents, with a maximum size given by width and+-- height. Setting width or height to -1 removes the maximum size of respectively the width and height+-- of the window.+sourceCompletionInfoSetSizing :: SourceCompletionInfoClass info => info +                              -> Int -- ^ @width@         The maximum/requested width of the window (-1 to default)     +                              -> Int -- ^ @height@        The maximum/requested height of the window (-1 to default)    +                              -> Bool -- ^ @shrinkWidth@  Whether to shrink the width of the window to fit its contents +                              -> Bool -- ^ @shrinkHeight@ Whether to shrink the height of the window to fit its contents+                              -> IO ()+sourceCompletionInfoSetSizing info width height shrinkWidth shrinkHeight = +  {#call gtk_source_completion_info_set_sizing #}+     (toSourceCompletionInfo info)+     (fromIntegral width)+     (fromIntegral height)+     (fromBool shrinkWidth)+     (fromBool shrinkHeight)+#endif++-- | Sets the content widget of the info window. If widget does not fit within the size requirements of+-- the window, a 'ScrolledWindow' will automatically be created and added to the window.+sourceCompletionInfoSetWidget :: (SourceCompletionInfoClass info, WidgetClass widget) => info +                              -> widget+                              -> IO ()+sourceCompletionInfoSetWidget info widget =+  {#call gtk_source_completion_info_set_widget #}+    (toSourceCompletionInfo info)+    (toWidget widget)++-- | Get the current content widget.+sourceCompletionInfoGetWidget :: SourceCompletionInfoClass info => info +                              -> IO Widget -- ^ returns The current content widget. +sourceCompletionInfoGetWidget info =+  makeNewObject mkWidget $+  {#call gtk_source_completion_info_get_widget #}+     (toSourceCompletionInfo info)++#if GTK_MAJOR_VERSION < 3+-- |+sourceCompletionInfoProcessResize :: SourceCompletionInfoClass info => info +                                  -> IO ()+sourceCompletionInfoProcessResize info =+  {#call gtk_source_completion_info_process_resize #}+     (toSourceCompletionInfo info)+#endif++-- | The maximum allowed height.+-- +-- Allowed values: >= GMaxulong+-- +-- Default value: -1+sourceCompletionInfoMaxHeight :: SourceCompletionInfoClass info => Attr info Int+sourceCompletionInfoMaxHeight = newAttrFromIntProperty "max-height"++-- | The maximum allowed width.+-- +-- Allowed values: >= GMaxulong+-- +-- Default value: -1+sourceCompletionInfoMaxWidth :: SourceCompletionInfoClass info => Attr info Int+sourceCompletionInfoMaxWidth = newAttrFromIntProperty "max-width"++-- | Whether the window should shrink height to fit the contents.+-- +-- Default value: 'True'+sourceCompletionInfoShrinkHeight :: SourceCompletionInfoClass info => Attr info Bool+sourceCompletionInfoShrinkHeight = newAttrFromBoolProperty "shrink-height"++-- | Whether the window should shrink width to fit the contents.+-- +-- Default value: 'True'+sourceCompletionInfoShrinkWidth :: SourceCompletionInfoClass info => Attr info Bool+sourceCompletionInfoShrinkWidth = newAttrFromBoolProperty "shrink-width"++-- |+sourceCompletionInfoBeforeShow :: SourceCompletionInfoClass info => Signal info (IO ())+sourceCompletionInfoBeforeShow = Signal $ connect_NONE__NONE "before-show"
+ Graphics/UI/Gtk/SourceView/SourceCompletionItem.chs view
@@ -0,0 +1,143 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceCompletionItem+--+--  Author : Andy Stewart+--+--  Created: 08 Aug 2010+--+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceCompletionItem (+-- * Types+   SourceCompletionItem,+   SourceCompletionItemClass,++-- * Methods+   sourceCompletionItemNew,+   sourceCompletionItemNewWithMarkup,+   sourceCompletionItemNewFromStock,++-- * Attributes+   sourceCompletionItemIcon,+   sourceCompletionItemInfo,+   sourceCompletionItemLabel,+   sourceCompletionItemMarkup,+   sourceCompletionItemText,+) where++import Control.Monad	(liftM)+import Data.Maybe (fromMaybe)++import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GObject	(wrapNewGObject)+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- | Create a new 'SourceCompletionItem' with label label, icon icon and extra information info. Both+-- icon and info can be 'Nothing' in which case there will be no icon shown and no extra information+-- available.+sourceCompletionItemNew :: String -- ^ @label@   The item label                   +                        -> String -- ^ @text@    The item text                    +                        -> Maybe Pixbuf -- ^ @icon@    The item icon or 'Nothing'+                        -> String -- ^ @info@    The item extra information       +                        -> IO SourceCompletionItem+sourceCompletionItemNew label text icon info =+  wrapNewGObject mkSourceCompletionItem $+  withUTFString label $ \ labelPtr -> +  withUTFString text $ \ textPtr -> +  withUTFString info $ \ infoPtr -> +  {#call gtk_source_completion_item_new #}+    labelPtr+    textPtr+    (fromMaybe (Pixbuf nullForeignPtr) icon)+    infoPtr+  +  +-- | Create a new 'SourceCompletionItem' with markup label markup, icon icon and extra information+-- info. Both icon and info can be 'Nothing' in which case there will be no icon shown and no extra+-- information available.+sourceCompletionItemNewWithMarkup :: String+                                  -> String+                                  -> Maybe Pixbuf+                                  -> String+                                  -> IO SourceCompletionItem+sourceCompletionItemNewWithMarkup markup text icon info = +  wrapNewGObject mkSourceCompletionItem $ +  withUTFString markup $ \ markupPtr -> +  withUTFString text $ \ textPtr -> +  withUTFString info $ \ infoPtr -> +  {#call gtk_source_completion_item_new_with_markup #}+    markupPtr+    textPtr+    (fromMaybe (Pixbuf nullForeignPtr) icon)+    infoPtr+  +-- | Creates a new 'SourceCompletionItem' from a stock item. If label is 'Nothing', the stock label will be+-- used.+sourceCompletionItemNewFromStock :: Maybe String -- ^ @label@   The item label or 'Nothing'+                                 -> String -- ^ @text@    The item text                                  +                                 -> String -- ^ @stock@   The stock icon                                 +                                 -> String -- ^ @info@    The item extra information                     +                                 -> IO SourceCompletionItem+sourceCompletionItemNewFromStock label text stock info =+  wrapNewGObject mkSourceCompletionItem $+  maybeWith withUTFString label $ \ labelPtr -> +  withUTFString text $ \ textPtr -> +  withUTFString stock $ \ stockPtr -> +  withUTFString info $ \ infoPtr -> +  {#call gtk_source_completion_item_new_from_stock #}+    labelPtr+    textPtr+    stockPtr+    infoPtr+   +-- | Icon to be shown for this proposal.+sourceCompletionItemIcon :: SourceCompletionItemClass item => Attr item Pixbuf+sourceCompletionItemIcon = newAttrFromObjectProperty "icon"+                           {# call pure unsafe gdk_pixbuf_get_type #}++-- | Optional extra information to be shown for this proposal.+-- +-- Default value: \"\"+sourceCompletionItemInfo :: SourceCompletionItemClass item => Attr item String+sourceCompletionItemInfo = newAttrFromStringProperty "info"++-- | Optional extra labelrmation to be shown for this proposal.+-- +-- Default value: \"\"+sourceCompletionItemLabel :: SourceCompletionItemClass item => Attr item String+sourceCompletionItemLabel = newAttrFromStringProperty "label"++-- | Optional extra markuprmation to be shown for this proposal.+-- +-- Default value: \"\"+sourceCompletionItemMarkup :: SourceCompletionItemClass item => Attr item String+sourceCompletionItemMarkup = newAttrFromStringProperty "markup"++-- | Optional extra textrmation to be shown for this proposal.+-- +-- Default value: \"\"+sourceCompletionItemText :: SourceCompletionItemClass item => Attr item String+sourceCompletionItemText = newAttrFromStringProperty "text"
+ Graphics/UI/Gtk/SourceView/SourceCompletionProposal.chs view
@@ -0,0 +1,133 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceCompletionProposal+--+--  Author : Andy Stewart+--+--  Created: 08 Aug 2010+--+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceCompletionProposal (+-- * Description+-- | The proposal interface represents a completion item in the completion window. It provides+-- information on how to display the completion item and what action should be taken when the+-- completion item is activated.++-- * Types+   SourceCompletionProposal,+   SourceCompletionProposalClass,++-- * Methods+   sourceCompletionProposalGetLabel,+   sourceCompletionProposalGetMarkup,+   sourceCompletionProposalGetText,+   sourceCompletionProposalGetIcon,+   sourceCompletionProposalGetInfo,+   sourceCompletionProposalHash,+   sourceCompletionProposalEqual,++-- * Signals+   sourceCompletionProposalChanged,+) where++import Control.Monad	(liftM)++import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GObject	(wrapNewGObject)+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- | Gets the label of proposal. The label is shown in the list of proposals as plain text. If you need+-- any markup (such as bold or italic text), you have to implement+-- 'sourceCompletionProposalGetMarkup'.+sourceCompletionProposalGetLabel :: SourceCompletionProposalClass scp => scp+                                 -> IO String -- ^ returns  A new string containing the label of proposal. +sourceCompletionProposalGetLabel scp =+  {#call gtk_source_completion_proposal_get_label #}+    (toSourceCompletionProposal scp)+  >>= peekUTFString++-- | Gets the label of proposal with markup. The label is shown in the list of proposals and may contain+-- markup. This will be used instead of 'sourceCompletionProposalGetLabel' if implemented.+sourceCompletionProposalGetMarkup :: SourceCompletionProposalClass scp => scp+                                  -> IO String -- ^ returns  A new string containing the label of proposal with markup. +sourceCompletionProposalGetMarkup scp =+  {#call gtk_source_completion_proposal_get_markup #}+    (toSourceCompletionProposal scp)+  >>= peekUTFString++-- | Gets the text of proposal. The text that is inserted into the text buffer when the proposal is+-- activated by the default activation. You are free to implement a custom activation handler in the+-- provider and not implement this function.+sourceCompletionProposalGetText :: SourceCompletionProposalClass scp => scp+                                -> IO String -- ^ returns  A new string containing the text of proposal. +sourceCompletionProposalGetText scp =+  {#call gtk_source_completion_proposal_get_text #}+    (toSourceCompletionProposal scp)+  >>= peekUTFString++-- | Gets the icon of proposal.+sourceCompletionProposalGetIcon :: SourceCompletionProposalClass scp => scp+                                -> IO Pixbuf -- ^ returns  The icon of proposal.         +sourceCompletionProposalGetIcon scp =+  wrapNewGObject mkPixbuf $+  {#call gtk_source_completion_proposal_get_icon #}+    (toSourceCompletionProposal scp)++-- | Gets extra information associated to the proposal. This information will be used to present the user+-- with extra, detailed information about the selected proposal.+sourceCompletionProposalGetInfo :: SourceCompletionProposalClass scp => scp+                                -> IO String -- ^ returns  A new string containing extra information of proposal or empty if no extra information is associated to proposal.+sourceCompletionProposalGetInfo scp =+  {#call gtk_source_completion_proposal_get_info #}+    (toSourceCompletionProposal scp)+  >>= peekUTFString++-- | Get the hash value of proposal. This is used to (together with 'sourceCompletionProposalEqual')+-- to match proposals in the completion model. +sourceCompletionProposalHash :: SourceCompletionProposalClass scp => scp+                             -> IO Int  -- ^ returns  The hash value of proposal    +sourceCompletionProposalHash scp =+  liftM fromIntegral $+  {#call gtk_source_completion_proposal_hash #}+    (toSourceCompletionProposal scp)++-- | Get whether two proposal objects are the same. This is used to (together with+-- 'sourceCompletionProposalHash') to match proposals in the completion model. +sourceCompletionProposalEqual :: (SourceCompletionProposalClass scp1, SourceCompletionProposalClass scp2) +                              => scp1+                              -> scp2+                              -> IO Bool  -- ^ returns  'True' if proposal and object are the same proposal +sourceCompletionProposalEqual scp1 scp2 =+    liftM toBool $+    {#call gtk_source_completion_proposal_equal #}+      (toSourceCompletionProposal scp1)+      (toSourceCompletionProposal scp2)++-- | Emitted when the proposal has changed. The completion popup will react to this by updating the shown+-- information.+sourceCompletionProposalChanged :: SourceCompletionProposalClass scp => Signal scp (IO ())+sourceCompletionProposalChanged = Signal $ connect_NONE__NONE "changed"+
+ Graphics/UI/Gtk/SourceView/SourceCompletionProvider.chs view
@@ -0,0 +1,182 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceCompletionProvider+--+--  Author : Andy Stewart+--+--  Created: 08 Aug 2010+--+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceCompletionProvider (+-- * Description+-- | You must implement this interface to provide proposals to 'SourceCompletion'++-- * Types  +   SourceCompletionProvider,+   SourceCompletionProviderClass,++-- * Methods+   sourceCompletionProviderGetName,+   sourceCompletionProviderGetIcon,+   sourceCompletionProviderGetInteractiveDelay,+   sourceCompletionProviderGetPriority,+   sourceCompletionProviderGetInfoWidget,+   sourceCompletionProviderGetActivation,+   sourceCompletionProviderGetStartIter,+   sourceCompletionProviderMatch,+   sourceCompletionProviderUpdateInfo,+   sourceCompletionProviderPopulate,+   sourceCompletionProviderActivateProposal,+) where++import Control.Monad	(liftM)++import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)+import Graphics.UI.Gtk.SourceView.Enums+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GObject	(wrapNewGObject)+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- | Get the name of the provider. This should be a translatable name for display to the user. For+-- example: _("Document word completion provider"). +sourceCompletionProviderGetName :: SourceCompletionProviderClass scp => scp +                                -> IO String -- ^ returns  A new string containing the name of the provider. +sourceCompletionProviderGetName scp =+  {#call gtk_source_completion_provider_get_name #}+    (toSourceCompletionProvider scp)+  >>= peekUTFString++-- | Get the icon of the provider.+sourceCompletionProviderGetIcon :: SourceCompletionProviderClass scp => scp +                                -> IO (Maybe Pixbuf)+sourceCompletionProviderGetIcon scp =+  maybeNull (wrapNewGObject mkPixbuf) $+  {#call gtk_source_completion_provider_get_icon #}+    (toSourceCompletionProvider scp)++-- | Get the delay in milliseconds before starting interactive completion for this provider. A value of+-- -1 indicates to use the default value as set by 'autoCompleteDelay'.+sourceCompletionProviderGetInteractiveDelay :: SourceCompletionProviderClass scp => scp +                                            -> IO Int -- ^ returns  the interactive delay in milliseconds. +sourceCompletionProviderGetInteractiveDelay scp =+  liftM fromIntegral $+  {#call gtk_source_completion_provider_get_interactive_delay #}+     (toSourceCompletionProvider scp)++-- | Get the provider priority. The priority determines the order in which proposals appear in the+-- completion popup. Higher priorities are sorted before lower priorities. The default priority is 0.+sourceCompletionProviderGetPriority :: SourceCompletionProviderClass scp => scp +                                    -> IO Int -- ^ returns  the provider priority.          +sourceCompletionProviderGetPriority scp =+  liftM fromIntegral $+  {#call gtk_source_completion_provider_get_priority #}+    (toSourceCompletionProvider scp)+  +-- | Get a customized info widget to show extra information of a proposal. This allows for customized+-- widgets on a proposal basis, although in general providers will have the same custom widget for all+-- their proposals and proposal can be ignored.  The implementation of this function is optional. If+-- implemented, 'sourceCompletionProviderUpdateInfo' MUST also be implemented. If not+-- implemented, the default 'sourceCompletionProposalGetInfo' will be used to display extra+-- information about a 'SourceCompletionProposal'.+sourceCompletionProviderGetInfoWidget :: SourceCompletionProviderClass scp => scp+                                      -> SourceCompletionProposal -- ^ @proposal@ The currently selected 'SourceCompletionProposal'           +                                     -> IO Widget -- ^ returns  a custom 'Widget' to show extra information about proposal. +sourceCompletionProviderGetInfoWidget scp proposal =+  makeNewObject mkWidget $+  {#call gtk_source_completion_provider_get_info_widget #}+    (toSourceCompletionProvider scp)+    proposal++-- | Get with what kind of activation the provider should be activated.+sourceCompletionProviderGetActivation :: SourceCompletionProviderClass scp => scp+                                      -> IO SourceCompletionActivation+sourceCompletionProviderGetActivation scp =+    liftM (toEnum . fromIntegral) $+    {#call gtk_source_completion_provider_get_activation #}+      (toSourceCompletionProvider scp)++-- | Get the 'TextIter' at which the completion for proposal starts. When implemented, the completion+-- can use this information to position the completion window accordingly when a proposal is selected+-- in the completion window.+sourceCompletionProviderGetStartIter :: SourceCompletionProviderClass scp => scp+                                     -> SourceCompletionContext+                                     -> SourceCompletionProposal+                                     -> IO (Maybe TextIter)+sourceCompletionProviderGetStartIter scp context proposal = do+  iter <- makeEmptyTextIter+  success <- liftM toBool $ {#call gtk_source_completion_provider_get_start_iter #}+                (toSourceCompletionProvider scp)+                context+                proposal+                iter+  if success +     then return (Just iter)+     else return Nothing++-- | Get whether the provider match the context of completion detailed in context.+sourceCompletionProviderMatch :: SourceCompletionProviderClass scp => scp+                              -> SourceCompletionContext+                              -> IO Bool  -- ^ returns  'True' if provider matches the completion context, 'False' otherwise+sourceCompletionProviderMatch scp context =+  liftM toBool $+  {#call gtk_source_completion_provider_match #}+   (toSourceCompletionProvider scp)+   context++-- | Update extra information shown in info for proposal. This should be implemented if your provider+-- sets a custom info widget for proposal. This function MUST be implemented when+-- 'sourceCompletionProviderGetInfoWidget' is implemented.+sourceCompletionProviderUpdateInfo :: SourceCompletionProviderClass scp => scp+                                   -> SourceCompletionProposal+                                   -> SourceCompletionInfo+                                   -> IO ()+sourceCompletionProviderUpdateInfo scp proposal info =+  {#call gtk_source_completion_provider_update_info #}+    (toSourceCompletionProvider scp)+    proposal+    info++-- | Populate context with proposals from provider+sourceCompletionProviderPopulate :: SourceCompletionProviderClass scp => scp+                                 -> SourceCompletionContext+                                 -> IO ()+sourceCompletionProviderPopulate scp context =+  {#call gtk_source_completion_provider_populate #}+     (toSourceCompletionProvider scp)+     context++-- | Activate proposal at iter. When this functions returns 'False', the default activation of proposal+-- will take place which replaces the word at iter with the label of proposal.+sourceCompletionProviderActivateProposal :: SourceCompletionProviderClass scp => scp+                                         -> SourceCompletionProposal+                                         -> TextIter+                                         -> IO Bool -- ^ returns  'True' to indicate that the proposal activation has been handled, 'False' otherwise.+sourceCompletionProviderActivateProposal scp proposal iter =+  liftM toBool $+  {#call gtk_source_completion_provider_activate_proposal #}+    (toSourceCompletionProvider scp)+    proposal+    iter
+ Graphics/UI/Gtk/SourceView/SourceGutter.chs view
@@ -0,0 +1,214 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceGutter+--+--  Author : Andy Stewart+--+--  Created: 08 Aug 2010+--+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceGutter (+-- * Description+-- | The 'SourceGutter' object represents the left and right gutters of the text view. It is used by+-- 'SourceView' to draw the line numbers and category marks that might be present on a line. By+-- packing additional 'CellRenderer' objects in the gutter, you can extend the gutter with your own+-- custom drawings.+-- +-- The gutter works very much the same way as cells rendered in a 'TreeView'. The concept is similar,+-- with the exception that the gutter does not have an underlying 'TreeModel'. Instead, you should use+-- 'sourceGutterSetCellDataFunc' to set a callback to fill in any of the cell renderers+-- properties, given the line for which the cell is to be rendered. Renderers are inserted into the+-- gutter at a certain position. +-- The builtin line number renderer is at position+-- 'SourceViewGutterPositionLines (-30)' and the marks renderer is at+-- 'SourceViewGutterPositionMarks (-20)'. You can use these values to position custom renderers+-- accordingly. The width of a cell renderer can be specified as either fixed (using+-- 'cellRendererSetFixedSize') or dynamic, in which case you must set+-- 'sourceGutterSetCellSizeFunc'. This callback is used to set the properties of the renderer+-- such that @gtkCellRendererGetSize@ yields the maximum width of the cell.++-- * Types+    SourceGutter,+    SourceGutterClass,++-- * Methods+    sourceGutterGetWindow,+#if GTK_MAJOR_VERSION >= 3+    sourceGutterInsert,+    sourceGutterReorder,+    sourceGutterRemove,+    sourceGutterQueueDraw,+#endif+#if GTK_MAJOR_VERSION < 3+    sourceGutterSetCellDataFunc,+    sourceGutterSetCellSizeFunc,+#endif++-- * Attributes+    sourceGutterView,+    sourceGutterWindowType,++-- * Signals+    sourceGutterCellActivated,+    sourceGutterQueryTooltip,+) where++import Control.Monad	(liftM)+import Control.Monad.Reader ( runReaderT )++import Graphics.UI.Gtk.Gdk.EventM (EventM, EAny)+import Graphics.UI.Gtk.Multiline.TextView (TextWindowType (..))+import Graphics.UI.GtkInternals  ( TextIter, mkTextIterCopy )+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GObject	(makeNewGObject)+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_MAJOR_VERSION < 3+{#pointer SourceGutterDataFunc#}++foreign import ccall "wrapper" mkSourceGutterDataFunc ::+  (Ptr SourceGutter -> Ptr CellRenderer -> {#type gint#} -> {#type gboolean#} -> Ptr () -> IO ())+  -> IO SourceGutterDataFunc++{#pointer SourceGutterSizeFunc#}++foreign import ccall "wrapper" mkSourceGutterSizeFunc ::+  (Ptr SourceGutter -> Ptr CellRenderer -> Ptr () -> IO ())+  -> IO SourceGutterSizeFunc+#endif++-- | Get the 'Window' of the gutter. The window will only be available when the gutter has at least one,+-- non-zero width, cell renderer packed.+sourceGutterGetWindow :: SourceGutterClass sg => sg -> IO (Maybe DrawWindow)+sourceGutterGetWindow sb =+    maybeNull (makeNewGObject mkDrawWindow) $+    {#call gtk_source_gutter_get_window #} (toSourceGutter sb)++#if GTK_MAJOR_VERSION >= 3+-- | Inserts renderer into gutter at position.+sourceGutterInsert :: (SourceGutterRendererClass cell, SourceGutterClass sg) => sg+                   -> cell -- ^ @renderer@ a 'CellRenderer'      +                   -> Int -- ^ @position@ the renderers position +                   -> IO Int+sourceGutterInsert gutter renderer position =+  liftM fromIntegral $+  {#call gtk_source_gutter_insert #}+     (toSourceGutter gutter)+     (toSourceGutterRenderer renderer)+     (fromIntegral position)++-- | Reorders renderer in gutter to new position.+sourceGutterReorder :: (SourceGutterRendererClass cell, SourceGutterClass sg) => sg+                    -> cell -- ^ @renderer@ a 'CellRenderer'         +                    -> Int -- ^ @position@ the new renderer position +                    -> IO ()+sourceGutterReorder gutter renderer position =+  {#call gtk_source_gutter_reorder #}+     (toSourceGutter gutter)+     (toSourceGutterRenderer renderer)+     (fromIntegral position)++-- | Removes renderer from gutter.+sourceGutterRemove :: (SourceGutterRendererClass cell, SourceGutterClass sg) => sg+                   -> cell -- ^ @renderer@ a 'CellRenderer' +                   -> IO ()+sourceGutterRemove gutter renderer =+  {#call gtk_source_gutter_remove #}+     (toSourceGutter gutter)+     (toSourceGutterRenderer renderer)++-- | Invalidates the drawable area of the gutter. You can use this to force a redraw of the gutter if+-- something has changed and needs to be redrawn.+sourceGutterQueueDraw :: SourceGutterClass sg => sg -> IO ()+sourceGutterQueueDraw sb =+  {#call gtk_source_gutter_queue_draw #} (toSourceGutter sb)+#endif++#if GTK_MAJOR_VERSION < 3+-- | Sets the 'SourceGutterDataFunc' to use for renderer. This function is used to setup the cell+-- renderer properties for rendering the current cell.+sourceGutterSetCellDataFunc :: (SourceGutterClass sg, CellRendererClass cell)+                              => sg+                              -> cell+                              -> (CellRenderer -> Int -> Bool -> IO ())+                              -> IO ()+sourceGutterSetCellDataFunc gutter cell func = do+  funcPtr <- mkSourceGutterDataFunc $ \_ c line currentLine _ -> do+    func (toCellRenderer cell)+         (fromIntegral line)+         (toBool currentLine)+  {#call gtk_source_gutter_set_cell_data_func #}+     (toSourceGutter gutter)+     (toCellRenderer cell)+     funcPtr+     (castFunPtrToPtr funcPtr)+     destroyFunPtr++-- | Sets the 'SourceGutterSizeFunc' to use for renderer. This function is used to setup the cell+-- renderer properties for measuring the maximum size of the cell.+sourceGutterSetCellSizeFunc :: (SourceGutterClass gutter, CellRendererClass cell)+                              => gutter+                              -> cell+                              -> (CellRenderer -> IO ())+                              -> IO ()+sourceGutterSetCellSizeFunc gutter cell func = do+  funcPtr <- mkSourceGutterSizeFunc $ \ _ c _ -> do+    func (toCellRenderer cell)+  {#call gtk_source_gutter_set_cell_size_func #}+     (toSourceGutter gutter)+     (toCellRenderer cell)+     funcPtr+     (castFunPtrToPtr funcPtr)+     destroyFunPtr+#endif++-- | The 'SourceView' of the gutter+sourceGutterView :: SourceGutterClass sg => Attr sg SourceView+sourceGutterView = newAttrFromObjectProperty "view"+                   {#call pure unsafe gtk_source_view_get_type #}++-- | The text window type on which the window is placed+-- +-- Default value: 'TextWindowPrivate'+sourceGutterWindowType :: SourceGutterClass sg => Attr sg TextWindowType+sourceGutterWindowType = newAttrFromEnumProperty "window-type"+                         {#call pure unsafe gtk_text_window_type_get_type #}+                         +-- | Emitted when a cell has been activated (for instance when there was a button press on the cell). The+-- signal is only emitted for cells that have the activatable property set to 'True'.+sourceGutterCellActivated :: SourceGutterClass sg => Signal sg (CellRenderer -> TextIter -> EventM EAny ())                         +sourceGutterCellActivated =+  Signal (\after obj fun -> +           connect_OBJECT_BOXED_PTR__NONE "cell-activated" mkTextIterCopy after obj+                                   (\cr iter eventPtr -> runReaderT (fun cr iter) eventPtr)+         )++-- | Emitted when a tooltip is requested for a specific cell. Signal handlers can return 'True' to notify+-- the tooltip has been handled.+sourceGutterQueryTooltip :: SourceGutterClass sg => Signal sg (CellRenderer -> TextIter -> Tooltip -> IO Bool)+sourceGutterQueryTooltip = +    Signal $ connect_OBJECT_BOXED_OBJECT__BOOL "query-tooltip" mkTextIterCopy+
+ Graphics/UI/Gtk/SourceView/SourceIter.chs view
@@ -0,0 +1,97 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) SourceIter+--+--  Author : Peter Gavin+--  derived from sourceview bindings by Axel Simon and Duncan Coutts+--+--  Created: 18 December 2008+--+--  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+-- Adds extra useful methods for "TextIter" for searching forwards and+-- backwards within a region in the buffer and matching brackets.+--+-- * There is no SourceIter object, just extra methods for "TextIter"+--+module Graphics.UI.Gtk.SourceView.SourceIter (+#if GTK_MAJOR_VERSION < 3+-- * Enums+  SourceSearchFlags(..),++-- * Methods+  sourceIterForwardSearch,+  sourceIterBackwardSearch,+#endif+) where++#if GTK_MAJOR_VERSION < 3+import Control.Monad	(liftM)+import Data.Maybe    (fromMaybe)++import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)+import Graphics.UI.Gtk.SourceView.Enums+import System.Glib.FFI+import System.Glib.Flags		(Flags, fromFlags)+import System.Glib.UTFString++{#import Graphics.UI.Gtk.Multiline.TextIter#}+{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- methods++-- | Searches forward for str. Any match is returned by setting @matchStart@ to the first character of the+-- match and @matchEnd@ to the first character after the match. The search will not continue past+-- limit. Note that a search is a linear or O(n) operation, so you may wish to use limit to avoid+-- locking up your UI on large buffers.+-- +-- If the 'SourceSearchVisibleOnly' flag is present, the match may have invisible text+-- interspersed in str. i.e. str will be a possibly-noncontiguous subsequence of the matched+-- range. similarly, if you specify 'SourceSearchTextOnly', the match may have pixbufs or child+-- widgets mixed inside the matched range. If these flags are not given, the match must be exact; the+-- special 0xFFFC character in str will match embedded pixbufs or child widgets. If you specify the+-- 'SourceSearchCaseInsensitive' flag, the text will be matched regardless of what case it is in.+-- +-- Same as 'textIterForwardSearch', but supports case insensitive searching.+sourceIterForwardSearch :: TextIter -> String -> [SourceSearchFlags] -> +                           Maybe TextIter -> IO (Maybe (TextIter, TextIter))+sourceIterForwardSearch ti str flags limit = do+   start  <- makeEmptyTextIter+   end <- makeEmptyTextIter+   found <- liftM toBool $ withUTFString str $ \cStr ->+     {#call unsafe source_iter_forward_search#} ti cStr+       ((fromIntegral.fromFlags) flags) start end+       (fromMaybe (TextIter nullForeignPtr) limit)+   return $ if found then Just (start,end) else Nothing++-- | same as 'textIterForwardSearch' but allows+-- case insensitive search and possibly in the future regular expressions.+--+sourceIterBackwardSearch :: TextIter -> String -> [SourceSearchFlags] -> +                           Maybe TextIter -> IO (Maybe (TextIter, TextIter))+sourceIterBackwardSearch ti str flags limit = do+   start  <- makeEmptyTextIter+   end <- makeEmptyTextIter+   found <- liftM toBool $ withUTFString str $ \cStr ->+     {#call unsafe source_iter_backward_search#} ti cStr+       ((fromIntegral.fromFlags) flags) start end+       (fromMaybe (TextIter nullForeignPtr) limit)+   return $ if found then Just (start,end) else Nothing+#endif
+ Graphics/UI/Gtk/SourceView/SourceLanguage.chs view
@@ -0,0 +1,179 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceView+--+--  Author : Peter Gavin, Andy Stewart+--  derived from sourceview bindings by Axel Simon and Duncan Coutts+--+--  Created: 18 December 2008+--+--  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon+--  Copyright (C) Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceLanguage (+-- * Description+-- | 'SourceLanguage' encapsulates syntax and highlighting styles for a particular language. Use+-- 'SourceLanguageManager' to obtain a 'SourceLanguage' instance, and+-- 'sourceBufferSetLanguage' to apply it to a 'SourceBuffer'.++-- * Types+  SourceLanguage,+  SourceLanguageClass,++-- * Methods+  castToSourceLanguage,+  sourceLanguageGetId,+  sourceLanguageGetName,+  sourceLanguageGetSection,+  sourceLanguageGetHidden,+  sourceLanguageGetMetadata,+  sourceLanguageGetMimeTypes,+  sourceLanguageGetGlobs,+  sourceLanguageGetStyleName,+  sourceLanguageGetStyleIds,++-- * Attributes+  sourceLanguageHidden,+  sourceLanguageId,+  sourceLanguageName,+  sourceLanguageSection+  ) where++import Control.Monad	(liftM)+import Data.Maybe (fromMaybe)++import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.SourceStyleScheme#}+{#import Graphics.UI.Gtk.SourceView.Types#}+{#import System.Glib.Properties#}++{# context lib="gtk" prefix="gtk" #}++-- methods++-- | Returns the ID of the language. The ID is not locale-dependent.+--+sourceLanguageGetId :: SourceLanguageClass sl => sl+                    -> IO String -- ^ returns  the ID of language. The returned string is owned by language and should not be freed or modified.+sourceLanguageGetId sl =+  {#call unsafe source_language_get_id#} (toSourceLanguage sl) >>= peekUTFString++-- | Returns the localized name of the language.+--+sourceLanguageGetName :: SourceLanguageClass sl => sl +                      -> IO String -- ^ returns  the name of language. The returned string is owned by language and should not be freed or modified.+sourceLanguageGetName sl =+  {#call unsafe source_language_get_name#} (toSourceLanguage sl) >>= peekUTFString++-- | Returns the localized section of the language. Each language belong to a section (ex. HTML belogs to+-- the Markup section).+--+sourceLanguageGetSection :: SourceLanguageClass sl => sl +                         -> IO String -- ^ returns  the section of language. The returned string is owned by language and should not be freed or modified.+sourceLanguageGetSection sl =+  {#call unsafe source_language_get_section#} (toSourceLanguage sl) >>= peekUTFString++-- | Returns whether the language should be hidden from the user.+--+sourceLanguageGetHidden :: SourceLanguageClass sl => sl +                        -> IO Bool -- ^ returns  'True' if the language should be hidden, 'False' otherwise. +sourceLanguageGetHidden sl = liftM toBool $+  {#call unsafe source_language_get_hidden#} (toSourceLanguage sl)++-- |+--+sourceLanguageGetMetadata :: SourceLanguageClass sl => sl +                          -> String  -- ^ @name@     metadata property name.+                          -> IO String -- ^ returns  value of property name stored in the metadata of language or empty if language doesn't contain that metadata+sourceLanguageGetMetadata sl name = do+  withUTFString name ({#call unsafe source_language_get_metadata#} (toSourceLanguage sl)) >>= peekUTFString++-- | Returns the mime types associated to this language. This is just an utility wrapper around+-- 'sourceLanguageGetMetadata ' to retrieve the "mimetypes" metadata property and split it into+-- an array.+--+sourceLanguageGetMimeTypes :: SourceLanguageClass sl => sl +                           -> IO [String] -- ^ returns  an array containing the mime types or empty if no mime types are found. The        +sourceLanguageGetMimeTypes sl = do+  mimeTypesArray <- {#call unsafe source_language_get_mime_types#} (toSourceLanguage sl)+  mimeTypes <- liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 mimeTypesArray+  {# call g_strfreev #} mimeTypesArray+  return mimeTypes++-- | Returns the globs associated to this language. This is just an utility wrapper around+-- 'sourceLanguageGetMetadata' to retrieve the "globs" metadata property and split it into an+-- array.+--+sourceLanguageGetGlobs :: SourceLanguageClass sl => sl +                       -> IO [String] -- ^ returns  an array containing the globs or empty if no globs are found. +sourceLanguageGetGlobs sl = do+  globsArray <- {#call unsafe source_language_get_globs#} (toSourceLanguage sl)+  globs <- liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 globsArray+  {# call g_strfreev #} globsArray+  return globs++-- | Returns the name of the style with ID @styleId@ defined by this language.+sourceLanguageGetStyleName :: SourceLanguageClass sl => sl +                           -> String -- ^ @styleId@ a style ID+                           -> IO String  -- ^ returns the name of the style with ID @styleId@ defined by this language or empty if the style has no name or there is no style with ID @styleId@ defined by this language. The returned string is owned by the language and must not be modified.+sourceLanguageGetStyleName sl styleId =+    withUTFString styleId $ \styleIdPtr ->+    {#call gtk_source_language_get_style_name#}+       (toSourceLanguage sl)+       styleIdPtr+    >>= peekUTFString++-- | Returns the ids of the styles defined by this language.+sourceLanguageGetStyleIds :: SourceLanguageClass sl => sl +                          -> IO [String] -- ^ returns  an array containing ids of the styles defined by this language or empty if no style is defined. +sourceLanguageGetStyleIds sl = do+  globsArray <- {#call gtk_source_language_get_style_ids#} (toSourceLanguage sl)+  globs <- liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 globsArray+  {# call g_strfreev #} globsArray+  return globs++-- | Whether the language should be hidden from the user.+-- +-- Default value: 'False'+--+sourceLanguageHidden :: SourceLanguageClass sl => ReadAttr sl Bool+sourceLanguageHidden = readAttrFromBoolProperty "hidden"++-- | Language id.+-- +-- Default value: \"\"+--+sourceLanguageId :: SourceLanguageClass sl => ReadAttr sl String+sourceLanguageId = readAttrFromStringProperty "id"++-- | Language name.+-- +-- Default value: \"\"+--+sourceLanguageName :: SourceLanguageClass sl => ReadAttr sl String+sourceLanguageName = readAttrFromStringProperty "name"++-- | Language section.+-- +-- Default value: \"\"+--+sourceLanguageSection :: SourceLanguageClass sl => ReadAttr sl String+sourceLanguageSection = readAttrFromStringProperty "section"
+ Graphics/UI/Gtk/SourceView/SourceLanguageManager.chs view
@@ -0,0 +1,150 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceView+--+--  Author : Peter Gavin, Andy Stewart+--  derived from sourceview bindings by Axel Simon and Duncan Coutts+--+--  Created: 18 December 2008+--+--  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceLanguageManager (+-- * Description+-- | 'SourceLanguageManager' is an object which processes language description files and creates and+-- stores 'SourceLanguage' objects, and provides API to access them. Use+-- 'sourceLanguageManagerGetDefault' to retrieve the default instance of+-- 'SourceLanguageManager', and 'sourceLanguageManagerGuessLanguage' to get a+-- 'SourceLanguage' for given file name and content type.++-- * Types+  SourceLanguageManager,+  SourceLanguageManagerClass,++-- * Methods+  castToSourceLanguageManager,+  sourceLanguageManagerNew,+  sourceLanguageManagerGetDefault,+  sourceLanguageManagerSetSearchPath,+  sourceLanguageManagerGetSearchPath,+  sourceLanguageManagerGetLanguageIds,+  sourceLanguageManagerGetLanguage,+  sourceLanguageManagerGuessLanguage,++-- * Attributes+  sourceLanguageManagerLanguageIds,+  sourceLanguageManagerSearchPath,+  ) where++import Control.Monad	(liftM)+import Data.Maybe (fromMaybe)++import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GObject (wrapNewGObject, makeNewGObject)+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- | Creates a new language manager. If you do not need more than one language manager or a private+-- language manager instance then use 'sourceLanguageManagerGetDefault' instead.+--+sourceLanguageManagerNew :: IO SourceLanguageManager+sourceLanguageManagerNew = wrapNewGObject mkSourceLanguageManager $ liftM castPtr+  {#call unsafe source_language_manager_new#}++-- | Returns the default 'SourceLanguageManager' instance.+--+sourceLanguageManagerGetDefault :: IO SourceLanguageManager+sourceLanguageManagerGetDefault = wrapNewGObject mkSourceLanguageManager $ liftM castPtr+  {#call unsafe source_language_manager_get_default#}++-- | Sets the list of directories where the lm looks for language files. If dirs is 'Nothing', the search path+-- is reset to default.+-- +-- Note+-- +-- At the moment this function can be called only before the language files are loaded for the first+-- time. In practice to set a custom search path for a 'SourceLanguageManager', you have to call this+-- function right after creating it.+--+sourceLanguageManagerSetSearchPath :: SourceLanguageManagerClass slm => slm -> Maybe [String] -> IO ()+sourceLanguageManagerSetSearchPath slm dirs =+  maybeWith withUTFStringArray0 dirs $ \dirsPtr -> do+    {#call unsafe source_language_manager_set_search_path#} (toSourceLanguageManager slm) dirsPtr++-- | Gets the list directories where lm looks for language files.+--+sourceLanguageManagerGetSearchPath :: SourceLanguageManagerClass slm => slm -> IO [String]+sourceLanguageManagerGetSearchPath slm = do+  dirsPtr <- {#call unsafe source_language_manager_get_search_path#} (toSourceLanguageManager slm)+  liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 dirsPtr++-- | Returns the ids of the available languages.+--+sourceLanguageManagerGetLanguageIds :: SourceLanguageManagerClass slm => slm -> IO [String]+sourceLanguageManagerGetLanguageIds slm = do+  idsPtr <- {#call unsafe source_language_manager_get_language_ids#} (toSourceLanguageManager slm)+  liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 idsPtr++-- | Gets the 'SourceLanguage' identified by the given id in the language manager.+--+sourceLanguageManagerGetLanguage :: SourceLanguageManagerClass slm => slm +                                 -> String  -- ^ @id@      a language id.+                                 -> IO (Maybe SourceLanguage) -- ^ returns a 'SourceLanguage', or 'Nothing' if there is no language identified by the given id. +sourceLanguageManagerGetLanguage slm id = do+  slPtr <- liftM castPtr $+    withUTFString id ({#call unsafe source_language_manager_get_language#} (toSourceLanguageManager slm))+  if slPtr /= nullPtr+    then liftM Just $ makeNewGObject mkSourceLanguage $ return slPtr+    else return Nothing++-- | Picks a 'SourceLanguage' for given file name and content type, according to the information in lang+-- files. Either filename or @contentType@ may be 'Nothing'.+--+sourceLanguageManagerGuessLanguage :: SourceLanguageManagerClass slm => slm +                                   -> Maybe String  -- ^ @filename@     a filename in Glib filename encoding, or 'Nothing'.+                                   -> Maybe String  -- ^ @contentType@ a content type (as in GIO API), or 'Nothing'.+                                   -> IO (Maybe SourceLanguage) -- ^ returns      a 'SourceLanguage', or 'Nothing' if there is no suitable language for given filename and/or @contentType@. +sourceLanguageManagerGuessLanguage slm filename contentType =+  maybeWith withUTFString filename $ \cFilename ->+  maybeWith withUTFString contentType $ \cContentType -> do+    slPtr <- liftM castPtr $+      {#call unsafe source_language_manager_guess_language#} (toSourceLanguageManager slm) cFilename cContentType+    if slPtr /= nullPtr+      then liftM Just $ makeNewGObject mkSourceLanguage $ return slPtr+      else return Nothing++-- | List of the ids of the available languages.+--+sourceLanguageManagerLanguageIds :: SourceLanguageManagerClass slm => ReadAttr slm [String]+sourceLanguageManagerLanguageIds =+  readAttrFromBoxedOpaqueProperty (liftM (fromMaybe []) . maybePeek peekUTFStringArray0 . castPtr)+                                  "language-ids" {#call pure g_strv_get_type#}++-- | List of directories where the language specification files (.lang) are located.+--+sourceLanguageManagerSearchPath :: SourceLanguageManagerClass slm => ReadWriteAttr slm [String] (Maybe [String])+sourceLanguageManagerSearchPath =+  newAttr (objectGetPropertyBoxedOpaque (peekUTFStringArray0 . castPtr) gtype "search-path")+          (objectSetPropertyBoxedOpaque (\dirs f -> maybeWith withUTFStringArray0 dirs (f . castPtr)) gtype "search-path")+  where gtype = {#call pure g_strv_get_type#}
+ Graphics/UI/Gtk/SourceView/SourceMark.chs view
@@ -0,0 +1,123 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) SourceMark+--+--  Author : Duncan Coutts, Andy Stewart+--  derived from GtkTextView bindings by Axel Simon+--+--  Created: 26 October 2003+--+--  Copyright (C) 2003-2005 Duncan Coutts, Axel Simon+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceMark (+-- * Description+-- | A 'SourceMark' marks a position in the text where you want to display additional info. It is based+-- on 'TextMark' and thus is still valid after the text has changed though its position may change.+-- +-- 'SourceMarks' are organised in categories which you have to set when you create the mark. Each+-- category can have a pixbuf and a priority associated using @gtkSourceViewSetMarkCategoryPixbuf@+-- and @gtkSourceViewSetMarkCategoryPriority@. The pixbuf will be displayed in the margin at the+-- line where the mark residents if the 'showLineMarks' property is set to 'True'. If there are+-- multiple marks in the same line, the pixbufs will be drawn on top of each other. The mark with the+-- highest priority will be drawn on top.++-- * Types+  SourceMark,+  SourceMarkClass,++-- * Methods+  castToSourceMark,+  sourceMarkNew,+  sourceMarkGetCategory,+  sourceMarkNext,+  sourceMarkPrev,++-- * Attributes+  sourceMarkCategory+) where++import Control.Monad	(liftM)++import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GObject	(wrapNewGObject, makeNewGObject)+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- methods++-- | Creates a text mark. Add it to a buffer using 'textBufferAddMark'. If name is 'Nothing', the mark+-- is anonymous; otherwise, the mark can be retrieved by name using+-- 'textBufferGetMark'. Normally marks are created using the utility function+-- 'sourceBufferCreateMark'.+sourceMarkNew :: Maybe String -- ^ @name@     Name of the 'SourceMark', can be 'Nothing' when not using a name+              -> String  -- ^ @category@ is used to classify marks according to common characteristics (e.g. all the marks representing a bookmark could  +              -> IO SourceMark+sourceMarkNew name category = +  wrapNewGObject mkSourceMark $+  maybeWith withUTFString name $ \namePtr ->+  withUTFString category $ \categoryPtr ->+  {#call gtk_source_mark_new#}+    namePtr+    categoryPtr++-- | Returns the mark category+-- +sourceMarkGetCategory :: SourceMarkClass mark => mark+                      -> IO String -- ^ returns the category of the 'SourceMark' +sourceMarkGetCategory mark = do+  strPtr <- {#call unsafe source_mark_get_category#} (toSourceMark mark)+  markType <- peekUTFString strPtr+  {#call unsafe g_free#} (castPtr strPtr)+  return markType++-- | Returns the next 'SourceMark' in the buffer or 'Nothing' if the mark was not added to a buffer. If there+-- is no next mark, 'Nothing' will be returned.+-- +-- If category is 'Nothing', looks for marks of any category+-- +sourceMarkNext :: SourceMarkClass mark => mark +               -> Maybe String  -- ^ @category@ a string specifying the mark category or 'Nothing' +               -> IO (Maybe SourceMark) -- ^ returns  the next 'SourceMark' or 'Nothing'                +sourceMarkNext mark category = +    maybeNull (makeNewGObject mkSourceMark) $+    maybeWith withUTFString category $ {#call unsafe source_mark_next#} (toSourceMark mark)++-- | Returns the previous 'SourceMark' in the buffer or 'Nothing' if the mark was not added to a buffer. If+-- there is no previous mark, 'Nothing' is returned.+-- +-- If category is 'Nothing', looks for marks of any category+-- +sourceMarkPrev :: SourceMarkClass mark => mark +               -> Maybe String  -- ^ @category@ a string specifying the mark category or 'Nothing' +               -> IO (Maybe SourceMark) -- ^ returns  the previous 'SourceMark' or 'Nothing'            +sourceMarkPrev mark category = +    maybeNull (makeNewGObject mkSourceMark) $+    maybeWith withUTFString category $ {#call unsafe source_mark_prev#} (toSourceMark mark)++-- | The category of the 'SourceMark', classifies the mark and controls which pixbuf is used and with+-- which priority it is drawn.+-- Default value: \"\"+--+sourceMarkCategory :: SourceMarkClass mark => Attr mark String+sourceMarkCategory = newAttrFromStringProperty "category"
+ Graphics/UI/Gtk/SourceView/SourceStyle.hs view
@@ -0,0 +1,40 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceView+--+--  Author : Peter Gavin+--  derived from sourceview bindings by Axel Simon and Duncan Coutts+--+--  Created: 18 December 2008+--+--  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceStyle (+  SourceStyle(..),+  ) where++data SourceStyle =+  SourceStyle+  { sourceStyleBackground     :: Maybe String+  , sourceStyleBold           :: Maybe Bool+  , sourceStyleForeground     :: Maybe String+  , sourceStyleItalic         :: Maybe Bool+  , sourceStyleLineBackground :: Maybe String+  , sourceStyleStrikethrough  :: Maybe Bool+  , sourceStyleUnderline      :: Maybe Bool+  }
+ Graphics/UI/Gtk/SourceView/SourceStyle/Internal.chs view
@@ -0,0 +1,112 @@+{-# LANGUAGE CPP #-}+{-# OPTIONS_HADDOCK hide #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceView+--+--  Author : Peter Gavin+--  derived from sourceview bindings by Axel Simon and Duncan Coutts+--+--  Created: 18 December 2008+--+--  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon+--+--  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.+--+-- #hide++-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+module Graphics.UI.Gtk.SourceView.SourceStyle.Internal (+  sourceStyleFromObject,+  sourceStyleToObject+  ) where++import Control.Monad (liftM, sequence)+import Data.Maybe (catMaybes)++import Graphics.UI.Gtk.SourceView.SourceStyle+import System.Glib.FFI+import System.Glib.GType (GType)+import System.Glib.GValue (GValue, valueInit, allocaGValue)+import System.Glib.GValueTypes (valueSetString, valueSetBool)+import qualified System.Glib.GTypeConstants as GType++{#import Graphics.UI.Gtk.SourceView.Types#}+{#import System.Glib.GObject#}              (objectNew, constructNewGObject)+{#import System.Glib.Properties#}++{# context lib="gtk" prefix="gtk" #}++sourceStyleFromObject :: SourceStyleObject -> IO SourceStyle+sourceStyleFromObject obj = do+  background        <- objectGetPropertyMaybeString "background"          obj+  backgroundSet     <- objectGetPropertyBool        "background-set"      obj+  bold              <- objectGetPropertyBool        "bold"                obj+  boldSet           <- objectGetPropertyBool        "bold-set"            obj+  foreground        <- objectGetPropertyMaybeString "foreground"          obj+  foregroundSet     <- objectGetPropertyBool        "foreground-set"      obj+  italic            <- objectGetPropertyBool        "italic"              obj+  italicSet         <- objectGetPropertyBool        "italic-set"          obj+  lineBackground    <- objectGetPropertyMaybeString "line-background"     obj+  lineBackgroundSet <- objectGetPropertyBool        "line-background-set" obj+  strikethrough     <- objectGetPropertyBool        "strikethrough"       obj+  strikethroughSet  <- objectGetPropertyBool        "strikethrough-set"   obj+  underline         <- objectGetPropertyBool        "underline"           obj+  underlineSet      <- objectGetPropertyBool        "underline-set"       obj+  return $ SourceStyle+           { sourceStyleBackground     = if backgroundSet     then background         else Nothing+           , sourceStyleBold           = if boldSet           then Just bold          else Nothing+           , sourceStyleForeground     = if foregroundSet     then foreground         else Nothing+           , sourceStyleItalic         = if italicSet         then Just italic        else Nothing+           , sourceStyleLineBackground = if lineBackgroundSet then lineBackground     else Nothing+           , sourceStyleStrikethrough  = if strikethroughSet  then Just strikethrough else Nothing+           , sourceStyleUnderline      = if underlineSet      then Just underline     else Nothing+           }++sourceStyleToObject :: SourceStyle -> IO SourceStyleObject+sourceStyleToObject ss =+  allocaGValue $ \backgroundV ->+  allocaGValue $ \backgroundSetV ->+  allocaGValue $ \boldV ->+  allocaGValue $ \boldSetV ->+  allocaGValue $ \foregroundV ->+  allocaGValue $ \foregroundSetV ->+  allocaGValue $ \italicV ->+  allocaGValue $ \italicSetV ->+  allocaGValue $ \lineBackgroundV ->+  allocaGValue $ \lineBackgroundSetV ->+  allocaGValue $ \strikethroughV ->+  allocaGValue $ \strikethroughSetV ->+  allocaGValue $ \underlineV ->+  allocaGValue $ \underlineSetV -> do+    params <- liftM concat . sequence $+              [ makeParam "background"      sourceStyleBackground     backgroundSetV     backgroundV     GType.string valueSetString+              , makeParam "bold"            sourceStyleBold           boldSetV           boldV           GType.bool   valueSetBool+              , makeParam "foreground"      sourceStyleForeground     foregroundSetV     foregroundV     GType.string valueSetString+              , makeParam "italic"          sourceStyleItalic         italicSetV         italicV         GType.bool   valueSetBool+              , makeParam "line-background" sourceStyleLineBackground lineBackgroundSetV lineBackgroundV GType.string valueSetString+              , makeParam "strikethrough"   sourceStyleStrikethrough  strikethroughSetV  strikethroughV  GType.bool   valueSetBool+              , makeParam "underline"       sourceStyleUnderline      underlineSetV      underlineV      GType.bool   valueSetBool+              ]+    constructNewGObject mkSourceStyleObject (liftM castPtr $ objectNew gTypeSourceStyleObject params)+  where makeParam name field setV v gtype valueSet = do+            valueInit setV GType.bool+            case field ss of+               Just field' -> do+                  valueSetBool setV True+                  valueInit v gtype+                  valueSet v field'+                  return [(name ++ "-set", setV), (name, v)]+               Nothing -> do+                  valueSetBool setV False+                  return [(name ++ "-set", setV)]
+ Graphics/UI/Gtk/SourceView/SourceStyleScheme.chs view
@@ -0,0 +1,143 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) SourceStyleScheme+--+--  Author : Peter Gavin+--  derived from sourceview bindings by Axel Simon and Duncan Coutts+--+--  Created: 18 December 2008+--+--  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceStyleScheme (+-- * Description+-- | 'SourceStyleScheme' contains all the text styles to be used in 'SourceView' and+-- 'SourceBuffer'. For instance, it contains text styles for syntax highlighting, it may contain+-- foreground and background color for non-highlighted text, color for the line numbers, etc.+-- +-- Style schemes are stored in XML files. The format of a scheme file is the documented in the style+-- scheme reference.++-- * Types+  SourceStyleScheme,+  SourceStyleSchemeClass,++-- * Methods  +  castToSourceStyleScheme,+  sourceStyleSchemeGetId,+  sourceStyleSchemeGetName,+  sourceStyleSchemeGetDescription,+  sourceStyleSchemeGetAuthors,+  sourceStyleSchemeGetFilename,+  sourceStyleSchemeGetStyle,++-- * Attributes  +  sourceStyleSchemeDescription,+  sourceStyleSchemeFilename,+  sourceStyleSchemeId,+  sourceStyleSchemeName,+  ) where++import Control.Monad	(liftM)++import Graphics.UI.Gtk.SourceView.SourceStyle+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GObject	(makeNewGObject)+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.SourceStyle.Internal#}+{#import Graphics.UI.Gtk.SourceView.Types#}+{#import System.Glib.Properties#}++{# context lib="gtk" prefix="gtk" #}++-- methods++-- | +-- +sourceStyleSchemeGetId :: SourceStyleSchemeClass sss => sss+                       -> IO String -- ^ returns scheme id.              +sourceStyleSchemeGetId ss =+  {#call source_style_scheme_get_id#} (toSourceStyleScheme ss) >>= peekUTFString++-- | +-- +sourceStyleSchemeGetName :: SourceStyleSchemeClass sss => sss +                         -> IO String -- ^ returns scheme name.            +sourceStyleSchemeGetName ss =+  {#call source_style_scheme_get_name#} (toSourceStyleScheme ss) >>= peekUTFString++-- | +-- +sourceStyleSchemeGetDescription :: SourceStyleSchemeClass sss => sss +                                -> IO String -- ^ returns scheme description (if defined) or empty. +sourceStyleSchemeGetDescription ss =+  {#call source_style_scheme_get_description#} (toSourceStyleScheme ss) >>= peekUTFString++-- |+--+sourceStyleSchemeGetAuthors :: SourceStyleSchemeClass sss => sss +                            -> IO [String] -- ^ returns an array containing the scheme authors or empty if no author is specified by the style scheme.+sourceStyleSchemeGetAuthors ss =+  {#call source_style_scheme_get_authors#} (toSourceStyleScheme ss) >>= peekUTFStringArray0++-- | +-- +sourceStyleSchemeGetFilename :: SourceStyleSchemeClass sss => sss +                             -> IO String -- ^ returns scheme file name if the scheme was created parsing a style scheme file or empty in the other cases.+sourceStyleSchemeGetFilename ss =+  {#call source_style_scheme_get_filename#} (toSourceStyleScheme ss) >>= peekUTFString++-- | +-- +sourceStyleSchemeGetStyle :: SourceStyleSchemeClass sss => sss +                          -> String  -- ^ @styleId@ id of the style to retrieve.+                          -> IO SourceStyle -- ^ returns  style which corresponds to @styleId@ in the scheme+sourceStyleSchemeGetStyle ss id = do+  styleObj <- makeNewGObject mkSourceStyleObject $+              withUTFString id ({#call source_style_scheme_get_style#} (toSourceStyleScheme ss))+  sourceStyleFromObject styleObj++-- | Style scheme description.+-- +-- Default value: \"\"+--+sourceStyleSchemeDescription :: SourceStyleSchemeClass sss => ReadAttr sss String+sourceStyleSchemeDescription = readAttrFromStringProperty "description"++-- | Style scheme filename or 'Nothing'.+-- +-- Default value: \"\"+--+sourceStyleSchemeFilename :: SourceStyleSchemeClass sss => ReadAttr sss FilePath+sourceStyleSchemeFilename = readAttrFromStringProperty "filename"++-- | Style scheme id, a unique string used to identify the style scheme in 'SourceStyleSchemeManager'.+-- +-- Default value: \"\"+--+sourceStyleSchemeId :: SourceStyleSchemeClass sss => ReadAttr sss String+sourceStyleSchemeId = readAttrFromStringProperty "id"++-- | Style scheme name, a translatable string to present to user.+-- +-- Default value: \"\"+--+sourceStyleSchemeName :: SourceStyleSchemeClass sss => ReadAttr sss String+sourceStyleSchemeName = readAttrFromStringProperty "name"
+ Graphics/UI/Gtk/SourceView/SourceStyleSchemeManager.chs view
@@ -0,0 +1,145 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceView+--+--  Author : Peter Gavin+--  derived from sourceview bindings by Axel Simon and Duncan Coutts+--+--  Created: 18 December 2008+--+--  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager (+-- * Types+  SourceStyleSchemeManager,+  SourceStyleSchemeManagerClass,++-- * Methods  +  sourceStyleSchemeManagerNew,+  sourceStyleSchemeManagerGetDefault,+  sourceStyleSchemeManagerSetSearchPath,+  sourceStyleSchemeManagerAppendSearchPath,+  sourceStyleSchemeManagerPrependSearchPath,+  sourceStyleSchemeManagerGetSearchPath,+  sourceStyleSchemeManagerGetSchemeIds,+  sourceStyleSchemeManagerGetScheme,+  sourceStyleSchemeManagerForceRescan,++-- * Attributes+  sourceStyleSchemeManagerStyleIds,+  sourceStyleSchemeManagerSearchPath+  ) where++{# context lib="gtk" prefix="gtk" #}++import Control.Monad	(liftM)+import Data.Maybe (fromMaybe)++import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.GObject (wrapNewGObject, makeNewGObject)+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.SourceStyleScheme#}+{#import Graphics.UI.Gtk.SourceView.Types#}+{#import System.Glib.Properties#}++-- | Creates a new style manager. If you do not need more than one style manager then use+-- 'sourceStyleSchemeManagerGetDefault' instead.+--+sourceStyleSchemeManagerNew :: IO SourceStyleSchemeManager+sourceStyleSchemeManagerNew = wrapNewGObject mkSourceStyleSchemeManager $ liftM castPtr+  {#call unsafe source_style_scheme_manager_new#}++-- | Returns the default 'SourceStyleSchemeManager' instance.+--+sourceStyleSchemeManagerGetDefault :: IO SourceStyleSchemeManager -- ^ returns a 'SourceStyleSchemeManager'. Return value is owned by 'SourceView' library and must not be unref'ed.+sourceStyleSchemeManagerGetDefault = makeNewGObject mkSourceStyleSchemeManager $ liftM castPtr+  {#call unsafe source_style_scheme_manager_get_default#}++-- | Sets the list of directories where the manager looks for style scheme files. If dirs is 'Nothing', the+-- search path is reset to default.+--+sourceStyleSchemeManagerSetSearchPath :: SourceStyleSchemeManagerClass sssm => sssm -> Maybe [String] -> IO ()+sourceStyleSchemeManagerSetSearchPath ssm dirs =+  maybeWith withUTFStringArray0 dirs $ \dirsPtr -> do+    {#call unsafe source_style_scheme_manager_set_search_path#} (toSourceStyleSchemeManager ssm) dirsPtr++-- | Appends path to the list of directories where the manager looks for style scheme files. See+-- 'sourceStyleSchemeManagerSetSearchPath' for details.+--+sourceStyleSchemeManagerAppendSearchPath :: SourceStyleSchemeManagerClass sssm => sssm +                                         -> String  -- ^ @path@    a directory or a filename.     +                                         -> IO ()+sourceStyleSchemeManagerAppendSearchPath ssm dir =+  withUTFString dir $ {#call unsafe source_style_scheme_manager_append_search_path#} (toSourceStyleSchemeManager ssm)++-- | Prepends path to the list of directories where the manager looks for style scheme files. See+-- 'sourceStyleSchemeManagerSetSearchPath' for details.+--+sourceStyleSchemeManagerPrependSearchPath :: SourceStyleSchemeManagerClass sssm => sssm +                                          -> String  -- ^ @path@    a directory or a filename.     +                                          -> IO ()+sourceStyleSchemeManagerPrependSearchPath ssm dir =+  withUTFString dir $ {#call unsafe source_style_scheme_manager_prepend_search_path#} (toSourceStyleSchemeManager ssm)++-- | Returns the current search path for the manager. See+-- 'sourceStyleSchemeManagerSetSearchPath' for details.+--+sourceStyleSchemeManagerGetSearchPath :: SourceStyleSchemeManagerClass sssm => sssm +                                      -> IO [String]+sourceStyleSchemeManagerGetSearchPath ssm = do+  dirsPtr <- {#call unsafe source_style_scheme_manager_get_search_path#} (toSourceStyleSchemeManager ssm)+  peekUTFStringArray0 dirsPtr++-- | Returns the ids of the available style schemes.+--+sourceStyleSchemeManagerGetSchemeIds :: SourceStyleSchemeManagerClass sssm => sssm -> IO [String]+sourceStyleSchemeManagerGetSchemeIds ssm = do+  idsPtr <- {#call unsafe source_style_scheme_manager_get_scheme_ids#} (toSourceStyleSchemeManager ssm)+  liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 idsPtr++-- | Looks up style scheme by id.+--+sourceStyleSchemeManagerGetScheme :: SourceStyleSchemeManagerClass sssm => sssm +                                  -> String  -- ^ @schemeId@ style scheme id to find+                                  -> IO SourceStyleScheme+sourceStyleSchemeManagerGetScheme ssm id = makeNewGObject mkSourceStyleScheme $+  withUTFString id $ {#call unsafe source_style_scheme_manager_get_scheme#} (toSourceStyleSchemeManager ssm)++-- | Mark any currently cached information about the available style scehems as invalid. All the+-- available style schemes will be reloaded next time the manager is accessed.+--+sourceStyleSchemeManagerForceRescan :: SourceStyleSchemeManagerClass sssm => sssm -> IO ()+sourceStyleSchemeManagerForceRescan ssm =+  {#call unsafe source_style_scheme_manager_force_rescan#} (toSourceStyleSchemeManager ssm)++-- | List of the ids of the available style schemes.+--+sourceStyleSchemeManagerStyleIds :: SourceStyleSchemeManagerClass sssm => ReadAttr sssm [String]+sourceStyleSchemeManagerStyleIds =+  readAttrFromBoxedOpaqueProperty (liftM (fromMaybe []) . maybePeek peekUTFStringArray0 . castPtr)+                                  "style-ids" {#call pure g_strv_get_type#}++-- | List of directories and files where the style schemes are located.+--+sourceStyleSchemeManagerSearchPath :: SourceStyleSchemeManagerClass sssm => ReadWriteAttr sssm [String] (Maybe [String])+sourceStyleSchemeManagerSearchPath =+  newAttr (objectGetPropertyBoxedOpaque (peekUTFStringArray0 . castPtr) gtype "search-path")+          (objectSetPropertyBoxedOpaque (\dirs f -> maybeWith withUTFStringArray0 dirs (f . castPtr)) gtype "search-path")+  where gtype = {#call pure g_strv_get_type#}
+ Graphics/UI/Gtk/SourceView/SourceUndoManager.chs view
@@ -0,0 +1,110 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) SourceUndoManager+--+--  Author : Andy Stewart+--+--  Created: 08 Aug 2010+--+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceUndoManager (+-- * Description+-- | The 'SourceUndoManager' interface can be implemented to provide custom undo management to a+-- 'SourceBuffer'. Use 'sourceBufferSetUndoManager' to install a custom undo manager for a+-- particular source buffer.+-- +-- Use 'sourceUndoManagerCanUndoChanged' and 'sourceUndoManagerCanRedoChanged' when+-- respectively the undo state or redo state of the undo stack has changed.++-- * Types  +    SourceUndoManager,+    SourceUndoManagerClass,+  +-- * Methods  +    sourceUndoManagerCanUndo,+    sourceUndoManagerCanRedo,+    sourceUndoManagerUndo,+    sourceUndoManagerRedo,+    sourceUndoManagerBeginNotUndoableAction,+    sourceUndoManagerEndNotUndoableAction,++-- * Signals+    sourceUndoManagerCanRedoChanged,+    sourceUndoManagerCanUndoChanged,+) where++import Control.Monad	(liftM)++import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.Properties+import System.Glib.UTFString++{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.Types#}++{# context lib="gtk" prefix="gtk" #}++-- | Get whether there are undo operations available.+sourceUndoManagerCanUndo :: SourceUndoManagerClass sum => sum+                         -> IO Bool  -- ^ returns 'True' if there are undo operations available, 'False' otherwise +sourceUndoManagerCanUndo sm =+  liftM toBool $+  {#call gtk_source_undo_manager_can_undo #} (toSourceUndoManager sm)++-- | Get whether there are redo operations available.+sourceUndoManagerCanRedo :: SourceUndoManagerClass sum => sum+                         -> IO Bool  -- ^ returns 'True' if there are redo operations available, 'False' otherwise +sourceUndoManagerCanRedo sm =+  liftM toBool $+  {#call gtk_source_undo_manager_can_redo #} (toSourceUndoManager sm)++-- | Perform a single undo. Calling this function when there are no undo operations available is an+-- error. Use @gtkSourceUndoManagerCanUndo@ to find out if there are undo operations available.+sourceUndoManagerUndo :: SourceUndoManagerClass sum => sum -> IO ()+sourceUndoManagerUndo sm =+  {#call gtk_source_undo_manager_undo #} (toSourceUndoManager sm)++-- | Perform a single redo. Calling this function when there are no redo operations available is an+-- error. Use @gtkSourceUndoManagerCanRedo@ to find out if there are redo operations available.+sourceUndoManagerRedo :: SourceUndoManagerClass sum => sum -> IO ()+sourceUndoManagerRedo sm =+  {#call gtk_source_undo_manager_redo #} (toSourceUndoManager sm)++-- | Begin a not undoable action on the buffer. All changes between this call and the call to+-- @gtkSourceUndoManagerEndNotUndoableAction@ cannot be undone. This function should be+-- re-entrant.+sourceUndoManagerBeginNotUndoableAction :: SourceUndoManagerClass sum => sum -> IO ()+sourceUndoManagerBeginNotUndoableAction sm =+  {#call gtk_source_undo_manager_begin_not_undoable_action #} (toSourceUndoManager sm)++-- | Ends a not undoable action on the buffer.+sourceUndoManagerEndNotUndoableAction :: SourceUndoManagerClass sum => sum -> IO ()+sourceUndoManagerEndNotUndoableAction sm =+  {#call gtk_source_undo_manager_end_not_undoable_action #} (toSourceUndoManager sm)++-- | Emitted when the ability to redo has changed.+--+sourceUndoManagerCanRedoChanged :: SourceUndoManagerClass sum => Signal sum (IO ())+sourceUndoManagerCanRedoChanged = Signal $ connect_NONE__NONE "can-redo-changed"++-- | Emitted when the ability to undo has changed.+--+sourceUndoManagerCanUndoChanged :: SourceUndoManagerClass sum => Signal sum (IO ())+sourceUndoManagerCanUndoChanged = Signal $ connect_NONE__NONE "can-undo-changed"
+ Graphics/UI/Gtk/SourceView/SourceView.chs view
@@ -0,0 +1,577 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+--  GIMP Toolkit (GTK) Widget SourceView+--+--  Author : Peter Gavin+--  derived from sourceview bindings by Axel Simon and Duncan Coutts+--+--  Created: 18 December 2008+--+--  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon+--  Copyright (C) 2010 Andy Stewart+--+--  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.+--+-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.SourceView.SourceView (+-- * Description+-- | 'SourceView' is the main object of the gtksourceview library. It provides a text view which syntax+-- highlighting, undo/redo and text marks. Use a 'SourceBuffer' to display text with a 'SourceView'.++-- * Types+  SourceView,+  SourceViewClass,++-- * Enums+  SourceSmartHomeEndType(..),+  SourceDrawSpacesFlags(..),+  SourceViewGutterPosition (..),++-- * Methods  +  castToSourceView,+  sourceViewNew,+  sourceViewNewWithBuffer,+  sourceViewSetAutoIndent,+  sourceViewGetAutoIndent,+  sourceViewSetIndentOnTab,+  sourceViewGetIndentOnTab,+  sourceViewSetIndentWidth,+  sourceViewGetIndentWidth,+  sourceViewSetInsertSpacesInsteadOfTabs,+  sourceViewGetInsertSpacesInsteadOfTabs,+  sourceViewSetSmartHomeEnd,+  sourceViewGetSmartHomeEnd,+#if GTK_MAJOR_VERSION < 3+  sourceViewSetMarkCategoryPriority,+  sourceViewGetMarkCategoryPriority,+  sourceViewSetMarkCategoryIconFromPixbuf,+  sourceViewSetMarkCategoryIconFromStock,+  sourceViewSetMarkCategoryIconFromIconName,+  sourceViewSetMarkCategoryBackground,+  sourceViewGetMarkCategoryBackground,+#endif+  sourceViewSetHighlightCurrentLine,+  sourceViewGetHighlightCurrentLine,+  sourceViewSetShowLineMarks,+  sourceViewGetShowLineMarks,+  sourceViewSetShowLineNumbers,+  sourceViewGetShowLineNumbers,+  sourceViewSetShowRightMargin,+  sourceViewGetShowRightMargin,+  sourceViewSetRightMarginPosition,+  sourceViewGetRightMarginPosition,+  sourceViewSetTabWidth,+  sourceViewGetTabWidth,+  sourceViewSetDrawSpaces,+  sourceViewGetDrawSpaces,+  sourceViewGetGutter,++-- * Attributes  +  sourceViewAutoIndent,+  sourceViewCompletion,+  sourceViewDrawSpaces,+  sourceViewHighlightCurrentLine,+  sourceViewIndentOnTab,+  sourceViewIndentWidth,+  sourceViewInsertSpacesInsteadOfTabs,+  sourceViewRightMarginPosition,+  sourceViewShowLineNumbers,+  sourceViewShowRightMargin,+  sourceViewSmartHomeEnd,+  sourceViewTabWidth,++-- * Signals+  sourceViewUndo,+  sourceViewRedo,+  sourceViewMoveLines,+  sourceViewShowCompletion,+  sourceViewLineMarkActivated,++-- * Deprecated+#if GTK_MAJOR_VERSION < 3+#ifndef DISABLE_DEPRECATED+  sourceViewSetMarkCategoryPixbuf,+  sourceViewGetMarkCategoryPixbuf,+#endif+#endif+  ) where++import Control.Monad	(liftM)+import Control.Monad.Reader ( runReaderT )+import Data.Maybe    (fromMaybe)++import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Widget (Color)+import Graphics.UI.Gtk.Gdk.EventM (EventM, EAny)+import Graphics.UI.Gtk.Multiline.TextView (TextWindowType (..))+import Graphics.UI.Gtk.SourceView.Enums+import Graphics.UI.GtkInternals  ( TextIter, mkTextIterCopy )+import System.Glib.GObject	(wrapNewGObject, makeNewGObject)+import System.Glib.Attributes+import System.Glib.FFI++{#import Graphics.UI.Gtk.SourceView.Signals#}+{#import Graphics.UI.Gtk.SourceView.Types#}+{#import System.Glib.Properties#}++{# context lib="gtk" prefix="gtk" #}++-- | Create a new 'SourceView' widget with a default 'SourceBuffer'.+--+sourceViewNew :: IO SourceView+sourceViewNew = makeNewObject mkSourceView $ liftM castPtr+  {#call unsafe source_view_new#}++-- | Create a new 'SourceView'+-- widget with the given 'SourceBuffer'.+--+sourceViewNewWithBuffer :: SourceBuffer -> IO SourceView+sourceViewNewWithBuffer sb = makeNewObject mkSourceView $ liftM castPtr $+  {#call source_view_new_with_buffer#} sb++-- | If 'True' auto indentation of text is enabled.+--+sourceViewSetAutoIndent :: SourceViewClass sv => sv +                        -> Bool  -- ^ @enable@ whether to enable auto indentation. +                        -> IO ()+sourceViewSetAutoIndent sv enable =+  {#call source_view_set_auto_indent#} (toSourceView sv) (fromBool enable)+  +-- | Returns whether auto indentation of text is enabled.+--+sourceViewGetAutoIndent :: SourceViewClass sv => sv +                        -> IO Bool  -- ^ returns 'True' if auto indentation is enabled. +sourceViewGetAutoIndent sv = liftM toBool $+  {#call unsafe source_view_get_auto_indent#} (toSourceView sv)++-- | If 'True', when the tab key is pressed and there is a selection, the selected text is indented of one+-- level instead of being replaced with the \t characters. Shift+Tab unindents the selection.+--+sourceViewSetIndentOnTab :: SourceViewClass sv => sv +                         -> Bool  -- ^ @enable@ whether to indent a block when tab is pressed. +                         -> IO ()+sourceViewSetIndentOnTab sv enable =+  {#call source_view_set_indent_on_tab#} (toSourceView sv) (fromBool enable)+  +-- | Returns whether when the tab key is pressed the current selection should get indented instead of+-- replaced with the \t character.+--+sourceViewGetIndentOnTab :: SourceViewClass sv => sv +                         -> IO Bool  -- ^ returns 'True' if the selection is indented when tab is pressed. +sourceViewGetIndentOnTab sv = liftM toBool $+  {#call unsafe source_view_get_indent_on_tab#} (toSourceView sv)++-- | Sets the number of spaces to use for each step of indent. If width is -1, the value of the+-- 'tabWidth' property will be used.+--+sourceViewSetIndentWidth :: SourceViewClass sv => sv +                         -> Int  -- ^ @width@ indent width in characters. +                         -> IO ()+sourceViewSetIndentWidth sv width =+  {#call source_view_set_indent_width#} (toSourceView sv) (fromIntegral width)++-- | Returns the number of spaces to use for each step of indent. See 'sourceViewSetIndentWidth'+-- for details.+--+sourceViewGetIndentWidth :: SourceViewClass sv => sv +                         -> IO Int -- ^ returns indent width.    +sourceViewGetIndentWidth sv = liftM fromIntegral $+  {#call unsafe source_view_get_indent_width#} (toSourceView sv)++-- | If 'True' any tabulator character inserted is replaced by a group of space characters.+--+sourceViewSetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv +                                       -> Bool  -- ^ @enable@ whether to insert spaces instead of tabs. +                                       -> IO ()+sourceViewSetInsertSpacesInsteadOfTabs sv enable =+  {#call source_view_set_insert_spaces_instead_of_tabs#} (toSourceView sv) (fromBool enable)+  +-- | Returns whether when inserting a tabulator character it should be replaced by a group of space+-- characters.+--+sourceViewGetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv +                                       -> IO Bool  -- ^ returns 'True' if spaces are inserted instead of tabs. +sourceViewGetInsertSpacesInsteadOfTabs sv = liftM toBool $+  {#call unsafe source_view_get_insert_spaces_instead_of_tabs#} (toSourceView sv)++-- | Set the desired movement of the cursor when HOME and END keys are pressed.+--+sourceViewSetSmartHomeEnd :: SourceViewClass sv => sv +                          -> SourceSmartHomeEndType  -- ^ @smartHe@ the desired behavior among 'SourceSmartHomeEndType'. +                          -> IO ()+sourceViewSetSmartHomeEnd sv newVal =+  {#call source_view_set_smart_home_end#} (toSourceView sv) (fromIntegral $ fromEnum newVal)+  +-- | Returns a 'SourceSmartHomeEndType' end value specifying how the cursor will move when HOME and END+-- keys are pressed.+--+sourceViewGetSmartHomeEnd :: SourceViewClass sv => sv +                          -> IO SourceSmartHomeEndType -- ^ returns a 'SourceSmartHomeEndTypeend' value. +sourceViewGetSmartHomeEnd sv = liftM (toEnum . fromIntegral) $+  {#call unsafe source_view_get_smart_home_end#} (toSourceView sv)++-- | If show is 'True' the current line is highlighted.+--+sourceViewSetHighlightCurrentLine :: SourceViewClass sv => sv +                                  -> Bool  -- ^ @show@ whether to highlight the current line +                                  -> IO ()+sourceViewSetHighlightCurrentLine sv newVal =+  {#call source_view_set_highlight_current_line#} (toSourceView sv) (fromBool newVal)+  +-- | Returns whether the current line is highlighted+--+sourceViewGetHighlightCurrentLine :: SourceViewClass sv => sv +                                  -> IO Bool  -- ^ returns 'True' if the current line is highlighted. +sourceViewGetHighlightCurrentLine sv = liftM toBool $+  {#call unsafe source_view_get_highlight_current_line#} (toSourceView sv)++-- | If 'True' line marks will be displayed beside the text.+--+sourceViewSetShowLineMarks :: SourceViewClass sv => sv +                           -> Bool  -- ^ @show@ whether line marks should be displayed. +                           -> IO ()+sourceViewSetShowLineMarks sv newVal =+  {#call source_view_set_show_line_marks#} (toSourceView sv) (fromBool newVal)+  +-- | Returns whether line marks are displayed beside the text.+--+sourceViewGetShowLineMarks :: SourceViewClass sv => sv +                           -> IO Bool  -- ^ returns 'True' if the line marks are displayed. +sourceViewGetShowLineMarks sv = liftM toBool $+  {#call unsafe source_view_get_show_line_marks#} (toSourceView sv)++-- | If 'True' line numbers will be displayed beside the text.+--+sourceViewSetShowLineNumbers :: SourceViewClass sv => sv +                             -> Bool  -- ^ @show@ whether line numbers should be displayed. +                             -> IO ()+sourceViewSetShowLineNumbers sv newVal =+  {#call source_view_set_show_line_numbers#} (toSourceView sv) (fromBool newVal)+  +-- | Returns whether line numbers are displayed beside the text.+--+sourceViewGetShowLineNumbers :: SourceViewClass sv => sv +                             -> IO Bool  -- ^ returns 'True' if the line numbers are displayed. +sourceViewGetShowLineNumbers sv = liftM toBool $+  {#call unsafe source_view_get_show_line_numbers#} (toSourceView sv)++-- | If 'True' a right margin is displayed+--+sourceViewSetShowRightMargin :: SourceViewClass sv => sv +                             -> Bool  -- ^ @show@ whether to show a right margin. +                             -> IO ()+sourceViewSetShowRightMargin sv newVal =+  {#call source_view_set_show_right_margin#} (toSourceView sv) (fromBool newVal)+  +-- | Returns whether a right margin is displayed.+--+sourceViewGetShowRightMargin :: SourceViewClass sv => sv +                             -> IO Bool -- ^ returns 'True' if the right margin is shown. +sourceViewGetShowRightMargin sv = liftM toBool $+  {#call source_view_get_show_right_margin#} (toSourceView sv)+  +-- | Sets the position of the right margin in the given view.+--+sourceViewSetRightMarginPosition :: SourceViewClass sv => sv +                                 -> Word -- ^ @pos@  the width in characters where to position the right margin.  +                                 -> IO ()+sourceViewSetRightMarginPosition sv margin =+  {#call source_view_set_right_margin_position#} (toSourceView sv) (fromIntegral margin)+  +-- | Gets the position of the right margin in the given view.+--+sourceViewGetRightMarginPosition :: SourceViewClass sv => sv +                                 -> IO Int  -- ^ returns the position of the right margin. +sourceViewGetRightMarginPosition sv = liftM fromIntegral $+  {#call unsafe source_view_get_right_margin_position#} (toSourceView sv)++-- | Sets the width of tabulation in characters.+--+sourceViewSetTabWidth :: SourceViewClass sv => sv +                      -> Int  -- ^ @width@ width of tab in characters. +                      -> IO ()+sourceViewSetTabWidth sv width =+  {#call source_view_set_tab_width#} (toSourceView sv) (fromIntegral width)+  +-- | Returns the width of tabulation in characters.+--+sourceViewGetTabWidth :: SourceViewClass sv => sv +                      -> IO Int -- ^ returns width of tab.     +sourceViewGetTabWidth sv = liftM fromIntegral $+  {#call unsafe source_view_get_tab_width#} (toSourceView sv)++-- | Set if and how the spaces should be visualized. Specifying flags as 0 will disable display of+-- spaces.+sourceViewSetDrawSpaces :: SourceViewClass sv => sv+                        -> SourceDrawSpacesFlags -- ^ @flags@ 'SourceDrawSpacesFlags' specifing how white spaces should be displayed+                        -> IO ()+sourceViewSetDrawSpaces view flags =+  {#call gtk_source_view_set_draw_spaces #}  +    (toSourceView view)+    (fromIntegral $ fromEnum flags)++-- | Returns the 'SourceDrawSpacesFlags' specifying if and how spaces should be displayed for this view.+sourceViewGetDrawSpaces :: SourceViewClass sv => sv+                        -> IO SourceDrawSpacesFlags -- ^ returns the 'SourceDrawSpacesFlags', 0 if no spaces should be drawn. +sourceViewGetDrawSpaces view =                        +  liftM (toEnum . fromIntegral) $+  {#call gtk_source_view_get_draw_spaces #}+     (toSourceView view)++-- | Returns the 'SourceGutter' object associated with @windowType@ for view. Only 'TextWindowLeft'+-- and 'TextWindowRight' are supported, respectively corresponding to the left and right+-- gutter. The line numbers and mark category icons are rendered in the gutter corresponding to+-- 'TextWindowLeft'.+sourceViewGetGutter :: SourceViewClass sv => sv +                    -> TextWindowType  -- ^ @windowType@ the gutter window type +                    -> IO SourceGutter+sourceViewGetGutter sv windowType =+  makeNewGObject mkSourceGutter $+  {#call gtk_source_view_get_gutter #}+    (toSourceView sv)+    (fromIntegral $ fromEnum windowType)++#if GTK_MAJOR_VERSION < 3+-- | Set the priority for the given mark category. When there are multiple marks on the same line, marks+-- of categories with higher priorities will be drawn on top.+--+sourceViewSetMarkCategoryPriority :: SourceViewClass sv => sv +                                  -> String  -- ^ @category@ a mark category.              +                                  -> Int  -- ^ @priority@ the priority for the category +                                  -> IO ()+sourceViewSetMarkCategoryPriority sv markerType priority = withCString markerType $ \strPtr ->+  {#call source_view_set_mark_category_priority#} (toSourceView sv) strPtr (fromIntegral priority)++-- | Gets the priority which is associated with the given category.+--+sourceViewGetMarkCategoryPriority :: SourceViewClass sv => sv +                                  -> String  -- ^ @category@ a mark category.   +                                  -> IO Int -- ^ returns  the priority or if category exists but no priority was set, it defaults to 0.+sourceViewGetMarkCategoryPriority sv markerType = withCString markerType $ \strPtr ->+  liftM fromIntegral $+  {#call unsafe source_view_get_mark_category_priority#} (toSourceView sv) strPtr++-- | Sets the icon to be used for category to pixbuf. If pixbuf is 'Nothing', the icon is unset.+sourceViewSetMarkCategoryIconFromPixbuf :: SourceViewClass sv => sv+                                        -> String -- ^ @category@ a mark category.     +                                        -> Maybe Pixbuf -- ^ @pixbuf@   a 'Pixbuf' or 'Nothing'. +                                        -> IO ()+sourceViewSetMarkCategoryIconFromPixbuf sv category pixbuf =+  withCString category $ \categoryPtr ->+  {#call gtk_source_view_set_mark_category_icon_from_pixbuf #}+     (toSourceView sv)+     categoryPtr+     (fromMaybe (Pixbuf nullForeignPtr) pixbuf)++-- | Sets the icon to be used for category to the stock item @stockId@. If @stockId@ is 'Nothing', the icon is+-- unset.+sourceViewSetMarkCategoryIconFromStock :: SourceViewClass sv => sv+                                       -> String -- ^ @category@ a mark category.      +                                       -> Maybe String -- ^ @stockId@ the stock id or 'Nothing'. +                                       -> IO ()+sourceViewSetMarkCategoryIconFromStock sv category stockId =+  withCString category $ \categoryPtr ->+  maybeWith withCString stockId $ \stockIdPtr ->+  {#call gtk_source_view_set_mark_category_icon_from_stock #}+    (toSourceView sv)+    categoryPtr+    stockIdPtr++-- | Sets the icon to be used for category to the named theme item name. If name is 'Nothing', the icon is+-- unset.+sourceViewSetMarkCategoryIconFromIconName :: SourceViewClass sv => sv+                                       -> String -- ^ @category@ a mark category.      +                                       -> Maybe String -- ^ @name@     the themed icon name or 'Nothing'. +                                       -> IO ()+sourceViewSetMarkCategoryIconFromIconName sv category name =+  withCString category $ \categoryPtr ->+  maybeWith withCString name $ \namePtr ->+  {#call gtk_source_view_set_mark_category_icon_from_icon_name #}+    (toSourceView sv)+    categoryPtr+    namePtr++-- | Sets given background color for mark category. If color is 'Nothing', the background color is unset.+sourceViewSetMarkCategoryBackground :: SourceViewClass sv => sv+                                    -> String -- ^ @category@ a mark category.                      +                                    -> Maybe Color  -- ^ @color@    background color or 'Nothing' to unset it. +                                    -> IO ()+sourceViewSetMarkCategoryBackground sv category color =+  let withMB :: Storable a => Maybe a -> (Ptr a -> IO b) -> IO b+      withMB Nothing f = f nullPtr+      withMB (Just x) f = with x f+  in withCString category $ \categoryPtr ->+     withMB color $ \colorPtr ->+     {#call gtk_source_view_set_mark_category_background #}+       (toSourceView sv)+       categoryPtr+       (castPtr colorPtr)++-- | Gets the background color associated with given category.+sourceViewGetMarkCategoryBackground :: SourceViewClass sv => sv+                                    -> String -- ^ @category@ a mark category.+                                    -> Color -- ^ @dest@     destination 'Color' structure to fill in.+                                    -> IO Bool -- ^ returns  'True' if background color for category was set and dest is set to a valid color, or 'False' otherwise.+sourceViewGetMarkCategoryBackground sv category color = +    liftM toBool $+    withCString category $ \ categoryPtr ->+    with color $ \ colorPtr ->+    {#call gtk_source_view_get_mark_category_background #}+      (toSourceView sv)+      categoryPtr+      (castPtr colorPtr)+#endif++-- | Whether to enable auto indentation.+-- +-- Default value: 'False'+--+sourceViewAutoIndent :: SourceViewClass sv => Attr sv Bool+sourceViewAutoIndent = newAttrFromBoolProperty "auto-indent"++-- | The completion object associated with the view.+--+sourceViewCompletion :: SourceViewClass sv => ReadAttr sv SourceCompletion+sourceViewCompletion = readAttrFromObjectProperty "completion"+                       {#call pure unsafe gtk_source_completion_get_type #}++-- | Set if and how the spaces should be visualized.+--+sourceViewDrawSpaces :: SourceViewClass sv => Attr sv SourceDrawSpacesFlags+sourceViewDrawSpaces = newAttrFromEnumProperty "draw-spaces" {#call fun gtk_source_draw_spaces_flags_get_type#}++-- | Whether to highlight the current line.+-- +-- Default value: 'False'+--+sourceViewHighlightCurrentLine :: SourceViewClass sv => Attr sv Bool+sourceViewHighlightCurrentLine = newAttrFromBoolProperty "highlight-current-line"++-- | Whether to indent the selected text when the tab key is pressed.+-- +-- Default value: 'True'+--+sourceViewIndentOnTab :: SourceViewClass sv => Attr sv Bool+sourceViewIndentOnTab = newAttrFromBoolProperty "indent-on-tab"++-- | Width of an indentation step expressed in number of spaces.+-- +-- Allowed values: [GMaxulong,32]+-- +-- Default value: -1+--+sourceViewIndentWidth :: SourceViewClass sv => Attr sv Int+sourceViewIndentWidth = newAttrFromIntProperty "indent-width"++-- | Whether to insert spaces instead of tabs.+-- +-- Default value: 'False'+--+sourceViewInsertSpacesInsteadOfTabs :: SourceViewClass sv => Attr sv Bool+sourceViewInsertSpacesInsteadOfTabs = newAttrFromBoolProperty "insert-spaces-instead-of-tabs"++-- | Position of the right margin.+-- +-- Allowed values: [1,200]+-- +-- Default value: 80+--+sourceViewRightMarginPosition :: SourceViewClass sv => Attr sv Int+sourceViewRightMarginPosition = newAttrFromUIntProperty "right-margin-position"++-- | Whether to display line numbers+-- +-- Default value: 'False'+--+sourceViewShowLineNumbers :: SourceViewClass sv => Attr sv Bool+sourceViewShowLineNumbers = newAttrFromBoolProperty "show-line-numbers"++-- | Whether to display line mark pixbufs+-- +-- Default value: 'False'+--+sourceViewShowRightMargin :: SourceViewClass sv => Attr sv Bool+sourceViewShowRightMargin = newAttrFromBoolProperty "show-right-margin"++-- | Set the behavior of the HOME and END keys.+-- +-- Default value: 'SourceSmartHomeEndDisabled'+-- +-- Since 2.0+--+sourceViewSmartHomeEnd :: SourceViewClass sv => Attr sv SourceSmartHomeEndType+sourceViewSmartHomeEnd = newAttrFromEnumProperty "smart-home-end" {#call fun gtk_source_smart_home_end_type_get_type#}++-- | Width of an tab character expressed in number of spaces.+-- +-- Allowed values: [1,32]+-- +-- Default value: 8+--+sourceViewTabWidth :: SourceViewClass sv => Attr sv Int+sourceViewTabWidth = newAttrFromUIntProperty "tab-width"++-- |+--+sourceViewUndo :: SourceViewClass sv => Signal sv (IO ())+sourceViewUndo = Signal $ connect_NONE__NONE "undo"++-- |+--+sourceViewRedo :: SourceViewClass sv => Signal sv (IO ())+sourceViewRedo = Signal $ connect_NONE__NONE "redo"++-- | The 'moveLines' signal is a keybinding which gets emitted when the user initiates moving a+-- line. The default binding key is Alt+Up/Down arrow. And moves the currently selected lines, or the+-- current line by count. For the moment, only count of -1 or 1 is valid.+sourceViewMoveLines :: SourceViewClass sv => Signal sv (Bool -> Int -> IO ())+sourceViewMoveLines = Signal $ connect_BOOL_INT__NONE "move-lines"++-- | The 'showCompletion' signal is a keybinding signal which gets emitted when the user initiates a+-- completion in default mode.+-- +-- Applications should not connect to it, but may emit it with @gSignalEmitByName@ if they need to+-- control the default mode completion activation.+sourceViewShowCompletion :: SourceViewClass sv => Signal sv (IO ())+sourceViewShowCompletion = Signal $ connect_NONE__NONE "show-completion"++-- | Emitted when a line mark has been activated (for instance when there was a button press in the line+-- marks gutter). You can use iter to determine on which line the activation took place.+sourceViewLineMarkActivated :: SourceViewClass sv => Signal sv (TextIter -> EventM EAny ())+sourceViewLineMarkActivated = +  Signal (\after obj fun -> +           connect_BOXED_PTR__NONE "line-mark-activated" mkTextIterCopy after obj+                                   (\iter eventPtr -> runReaderT (fun iter) eventPtr)+         )++#if GTK_MAJOR_VERSION < 3+-- * Deprecated+#ifndef DISABLE_DEPRECATED+-- | 'sourceViewSetMarkCategoryPixbuf' is deprecated and should not be used in newly-written+-- code. Use 'sourceViewSetMarkCategoryIconFromPixbuf' instead+--+sourceViewSetMarkCategoryPixbuf :: SourceViewClass sv => sv -> String -> Pixbuf -> IO ()+sourceViewSetMarkCategoryPixbuf sv markerType marker = withCString markerType $ \strPtr ->+  {#call source_view_set_mark_category_pixbuf#} (toSourceView sv) strPtr marker++-- | 'sourceViewGetMarkCategoryPixbuf' is deprecated and should not be used in newly-written code.+--+sourceViewGetMarkCategoryPixbuf :: SourceViewClass sv => sv -> String -> IO Pixbuf+sourceViewGetMarkCategoryPixbuf sv markerType = withCString markerType $ \strPtr ->+  wrapNewGObject mkPixbuf $+  {#call unsafe source_view_get_mark_category_pixbuf#} (toSourceView sv) strPtr+#endif+#endif+
+ Graphics/UI/Gtk/SourceView/Types.chs view
@@ -0,0 +1,534 @@+{-# OPTIONS_HADDOCK hide #-}+-- -*-haskell-*-+-- -------------------- automatically generated file - do not edit ----------+--  Object hierarchy for the GIMP Toolkit (GTK) Binding for Haskell+--+--  Author : Axel Simon+--+--  Copyright (C) 2001-2005 Axel Simon+--+--  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.+--+-- #hide++-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+-- This file reflects the Gtk+ object hierarchy in terms of Haskell classes.+--+-- Note: the mk... functions were originally meant to simply be an alias+-- for the constructor. However, in order to communicate the destructor+-- of an object to objectNew, the mk... functions are now a tuple containing+-- Haskell constructor and the destructor function pointer. This hack avoids+-- changing all modules that simply pass mk... to objectNew.+--+module Graphics.UI.Gtk.SourceView.Types (++  module Graphics.UI.GtkInternals,+  SourceGutter(SourceGutter), SourceGutterClass,+  toSourceGutter, +  mkSourceGutter, unSourceGutter,+  castToSourceGutter, gTypeSourceGutter,+  SourceUndoManager(SourceUndoManager), SourceUndoManagerClass,+  toSourceUndoManager, +  mkSourceUndoManager, unSourceUndoManager,+  castToSourceUndoManager, gTypeSourceUndoManager,+  SourceCompletionProvider(SourceCompletionProvider), SourceCompletionProviderClass,+  toSourceCompletionProvider, +  mkSourceCompletionProvider, unSourceCompletionProvider,+  castToSourceCompletionProvider, gTypeSourceCompletionProvider,+  SourceCompletionProposal(SourceCompletionProposal), SourceCompletionProposalClass,+  toSourceCompletionProposal, +  mkSourceCompletionProposal, unSourceCompletionProposal,+  castToSourceCompletionProposal, gTypeSourceCompletionProposal,+  SourceCompletionContext(SourceCompletionContext), SourceCompletionContextClass,+  toSourceCompletionContext, +  mkSourceCompletionContext, unSourceCompletionContext,+  castToSourceCompletionContext, gTypeSourceCompletionContext,+  SourceCompletionItem(SourceCompletionItem), SourceCompletionItemClass,+  toSourceCompletionItem, +  mkSourceCompletionItem, unSourceCompletionItem,+  castToSourceCompletionItem, gTypeSourceCompletionItem,+  SourceCompletion(SourceCompletion), SourceCompletionClass,+  toSourceCompletion, +  mkSourceCompletion, unSourceCompletion,+  castToSourceCompletion, gTypeSourceCompletion,+  SourceGutterRenderer(SourceGutterRenderer), SourceGutterRendererClass,+  toSourceGutterRenderer, +  mkSourceGutterRenderer, unSourceGutterRenderer,+  castToSourceGutterRenderer, gTypeSourceGutterRenderer,+  SourceBuffer(SourceBuffer), SourceBufferClass,+  toSourceBuffer, +  mkSourceBuffer, unSourceBuffer,+  castToSourceBuffer, gTypeSourceBuffer,+  SourceMark(SourceMark), SourceMarkClass,+  toSourceMark, +  mkSourceMark, unSourceMark,+  castToSourceMark, gTypeSourceMark,+  SourceCompletionInfo(SourceCompletionInfo), SourceCompletionInfoClass,+  toSourceCompletionInfo, +  mkSourceCompletionInfo, unSourceCompletionInfo,+  castToSourceCompletionInfo, gTypeSourceCompletionInfo,+  SourceView(SourceView), SourceViewClass,+  toSourceView, +  mkSourceView, unSourceView,+  castToSourceView, gTypeSourceView,+  SourceLanguage(SourceLanguage), SourceLanguageClass,+  toSourceLanguage, +  mkSourceLanguage, unSourceLanguage,+  castToSourceLanguage, gTypeSourceLanguage,+  SourceLanguageManager(SourceLanguageManager), SourceLanguageManagerClass,+  toSourceLanguageManager, +  mkSourceLanguageManager, unSourceLanguageManager,+  castToSourceLanguageManager, gTypeSourceLanguageManager,+  SourceStyleObject(SourceStyleObject), SourceStyleObjectClass,+  toSourceStyleObject, +  mkSourceStyleObject, unSourceStyleObject,+  castToSourceStyleObject, gTypeSourceStyleObject,+  SourceStyleScheme(SourceStyleScheme), SourceStyleSchemeClass,+  toSourceStyleScheme, +  mkSourceStyleScheme, unSourceStyleScheme,+  castToSourceStyleScheme, gTypeSourceStyleScheme,+  SourceStyleSchemeManager(SourceStyleSchemeManager), SourceStyleSchemeManagerClass,+  toSourceStyleSchemeManager, +  mkSourceStyleSchemeManager, unSourceStyleSchemeManager,+  castToSourceStyleSchemeManager, gTypeSourceStyleSchemeManager+  ) where++import Foreign.ForeignPtr (ForeignPtr, castForeignPtr)+#if __GLASGOW_HASKELL__ >= 707+import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)+#else+import Foreign.ForeignPtr (unsafeForeignPtrToPtr)+#endif+import Foreign.C.Types    (CULong(..), CUInt(..))+import System.Glib.GType  (GType, typeInstanceIsA)+{#import Graphics.UI.GtkInternals#}++{# context lib="gtk" prefix="gtk" #}++-- The usage of foreignPtrToPtr should be safe as the evaluation will only be+-- forced if the object is used afterwards+--+castTo :: (GObjectClass obj, GObjectClass obj') => GType -> String+                                                -> (obj -> obj')+castTo gtype objTypeName obj =+  case toGObject obj of+    gobj@(GObject objFPtr)+      | typeInstanceIsA ((unsafeForeignPtrToPtr.castForeignPtr) objFPtr) gtype+                  -> unsafeCastGObject gobj+      | otherwise -> error $ "Cannot cast object to " ++ objTypeName+++-- *************************************************************** SourceGutter++{#pointer *GtkSourceGutter as SourceGutter foreign newtype #} deriving (Eq,Ord)++mkSourceGutter = (SourceGutter, objectUnrefFromMainloop)+unSourceGutter (SourceGutter o) = o++class GObjectClass o => SourceGutterClass o+toSourceGutter :: SourceGutterClass o => o -> SourceGutter+toSourceGutter = unsafeCastGObject . toGObject++instance SourceGutterClass SourceGutter+instance GObjectClass SourceGutter where+  toGObject = GObject . castForeignPtr . unSourceGutter+  unsafeCastGObject = SourceGutter . castForeignPtr . unGObject++castToSourceGutter :: GObjectClass obj => obj -> SourceGutter+castToSourceGutter = castTo gTypeSourceGutter "SourceGutter"++gTypeSourceGutter :: GType+gTypeSourceGutter =+  {# call fun unsafe gtk_source_gutter_get_type #}++-- ********************************************************** SourceUndoManager++{#pointer *GtkSourceUndoManager as SourceUndoManager foreign newtype #} deriving (Eq,Ord)++mkSourceUndoManager = (SourceUndoManager, objectUnrefFromMainloop)+unSourceUndoManager (SourceUndoManager o) = o++class GObjectClass o => SourceUndoManagerClass o+toSourceUndoManager :: SourceUndoManagerClass o => o -> SourceUndoManager+toSourceUndoManager = unsafeCastGObject . toGObject++instance SourceUndoManagerClass SourceUndoManager+instance GObjectClass SourceUndoManager where+  toGObject = GObject . castForeignPtr . unSourceUndoManager+  unsafeCastGObject = SourceUndoManager . castForeignPtr . unGObject++castToSourceUndoManager :: GObjectClass obj => obj -> SourceUndoManager+castToSourceUndoManager = castTo gTypeSourceUndoManager "SourceUndoManager"++gTypeSourceUndoManager :: GType+gTypeSourceUndoManager =+  {# call fun unsafe gtk_source_undo_manager_get_type #}++-- *************************************************** SourceCompletionProvider++{#pointer *GtkSourceCompletionProvider as SourceCompletionProvider foreign newtype #} deriving (Eq,Ord)++mkSourceCompletionProvider = (SourceCompletionProvider, objectUnrefFromMainloop)+unSourceCompletionProvider (SourceCompletionProvider o) = o++class GObjectClass o => SourceCompletionProviderClass o+toSourceCompletionProvider :: SourceCompletionProviderClass o => o -> SourceCompletionProvider+toSourceCompletionProvider = unsafeCastGObject . toGObject++instance SourceCompletionProviderClass SourceCompletionProvider+instance GObjectClass SourceCompletionProvider where+  toGObject = GObject . castForeignPtr . unSourceCompletionProvider+  unsafeCastGObject = SourceCompletionProvider . castForeignPtr . unGObject++castToSourceCompletionProvider :: GObjectClass obj => obj -> SourceCompletionProvider+castToSourceCompletionProvider = castTo gTypeSourceCompletionProvider "SourceCompletionProvider"++gTypeSourceCompletionProvider :: GType+gTypeSourceCompletionProvider =+  {# call fun unsafe gtk_source_completion_provider_get_type #}++-- *************************************************** SourceCompletionProposal++{#pointer *GtkSourceCompletionProposal as SourceCompletionProposal foreign newtype #} deriving (Eq,Ord)++mkSourceCompletionProposal = (SourceCompletionProposal, objectUnrefFromMainloop)+unSourceCompletionProposal (SourceCompletionProposal o) = o++class GObjectClass o => SourceCompletionProposalClass o+toSourceCompletionProposal :: SourceCompletionProposalClass o => o -> SourceCompletionProposal+toSourceCompletionProposal = unsafeCastGObject . toGObject++instance SourceCompletionProposalClass SourceCompletionProposal+instance GObjectClass SourceCompletionProposal where+  toGObject = GObject . castForeignPtr . unSourceCompletionProposal+  unsafeCastGObject = SourceCompletionProposal . castForeignPtr . unGObject++castToSourceCompletionProposal :: GObjectClass obj => obj -> SourceCompletionProposal+castToSourceCompletionProposal = castTo gTypeSourceCompletionProposal "SourceCompletionProposal"++gTypeSourceCompletionProposal :: GType+gTypeSourceCompletionProposal =+  {# call fun unsafe gtk_source_completion_proposal_get_type #}++-- **************************************************** SourceCompletionContext++{#pointer *GtkSourceCompletionContext as SourceCompletionContext foreign newtype #} deriving (Eq,Ord)++mkSourceCompletionContext = (SourceCompletionContext, objectUnrefFromMainloop)+unSourceCompletionContext (SourceCompletionContext o) = o++class GObjectClass o => SourceCompletionContextClass o+toSourceCompletionContext :: SourceCompletionContextClass o => o -> SourceCompletionContext+toSourceCompletionContext = unsafeCastGObject . toGObject++instance SourceCompletionContextClass SourceCompletionContext+instance GObjectClass SourceCompletionContext where+  toGObject = GObject . castForeignPtr . unSourceCompletionContext+  unsafeCastGObject = SourceCompletionContext . castForeignPtr . unGObject++castToSourceCompletionContext :: GObjectClass obj => obj -> SourceCompletionContext+castToSourceCompletionContext = castTo gTypeSourceCompletionContext "SourceCompletionContext"++gTypeSourceCompletionContext :: GType+gTypeSourceCompletionContext =+  {# call fun unsafe gtk_source_completion_context_get_type #}++-- ******************************************************* SourceCompletionItem++{#pointer *GtkSourceCompletionItem as SourceCompletionItem foreign newtype #} deriving (Eq,Ord)++mkSourceCompletionItem = (SourceCompletionItem, objectUnrefFromMainloop)+unSourceCompletionItem (SourceCompletionItem o) = o++class GObjectClass o => SourceCompletionItemClass o+toSourceCompletionItem :: SourceCompletionItemClass o => o -> SourceCompletionItem+toSourceCompletionItem = unsafeCastGObject . toGObject++instance SourceCompletionItemClass SourceCompletionItem+instance GObjectClass SourceCompletionItem where+  toGObject = GObject . castForeignPtr . unSourceCompletionItem+  unsafeCastGObject = SourceCompletionItem . castForeignPtr . unGObject++castToSourceCompletionItem :: GObjectClass obj => obj -> SourceCompletionItem+castToSourceCompletionItem = castTo gTypeSourceCompletionItem "SourceCompletionItem"++gTypeSourceCompletionItem :: GType+gTypeSourceCompletionItem =+  {# call fun unsafe gtk_source_completion_item_get_type #}++-- *********************************************************** SourceCompletion++{#pointer *GtkSourceCompletion as SourceCompletion foreign newtype #} deriving (Eq,Ord)++mkSourceCompletion = (SourceCompletion, objectUnrefFromMainloop)+unSourceCompletion (SourceCompletion o) = o++class GObjectClass o => SourceCompletionClass o+toSourceCompletion :: SourceCompletionClass o => o -> SourceCompletion+toSourceCompletion = unsafeCastGObject . toGObject++instance SourceCompletionClass SourceCompletion+instance GObjectClass SourceCompletion where+  toGObject = GObject . castForeignPtr . unSourceCompletion+  unsafeCastGObject = SourceCompletion . castForeignPtr . unGObject++castToSourceCompletion :: GObjectClass obj => obj -> SourceCompletion+castToSourceCompletion = castTo gTypeSourceCompletion "SourceCompletion"++gTypeSourceCompletion :: GType+gTypeSourceCompletion =+  {# call fun unsafe gtk_source_completion_get_type #}++-- ******************************************************* SourceGutterRenderer++{#pointer *GtkSourceGutterRenderer as SourceGutterRenderer foreign newtype #} deriving (Eq,Ord)++mkSourceGutterRenderer = (SourceGutterRenderer, objectUnrefFromMainloop)+unSourceGutterRenderer (SourceGutterRenderer o) = o++class GObjectClass o => SourceGutterRendererClass o+toSourceGutterRenderer :: SourceGutterRendererClass o => o -> SourceGutterRenderer+toSourceGutterRenderer = unsafeCastGObject . toGObject++instance SourceGutterRendererClass SourceGutterRenderer+instance GObjectClass SourceGutterRenderer where+  toGObject = GObject . castForeignPtr . unSourceGutterRenderer+  unsafeCastGObject = SourceGutterRenderer . castForeignPtr . unGObject++castToSourceGutterRenderer :: GObjectClass obj => obj -> SourceGutterRenderer+castToSourceGutterRenderer = castTo gTypeSourceGutterRenderer "SourceGutterRenderer"++gTypeSourceGutterRenderer :: GType+gTypeSourceGutterRenderer =+  {# call fun unsafe gtk_source_gutter_renderer_get_type #}++-- *************************************************************** SourceBuffer++{#pointer *GtkSourceBuffer as SourceBuffer foreign newtype #} deriving (Eq,Ord)++mkSourceBuffer = (SourceBuffer, objectUnrefFromMainloop)+unSourceBuffer (SourceBuffer o) = o++class TextBufferClass o => SourceBufferClass o+toSourceBuffer :: SourceBufferClass o => o -> SourceBuffer+toSourceBuffer = unsafeCastGObject . toGObject++instance SourceBufferClass SourceBuffer+instance TextBufferClass SourceBuffer+instance GObjectClass SourceBuffer where+  toGObject = GObject . castForeignPtr . unSourceBuffer+  unsafeCastGObject = SourceBuffer . castForeignPtr . unGObject++castToSourceBuffer :: GObjectClass obj => obj -> SourceBuffer+castToSourceBuffer = castTo gTypeSourceBuffer "SourceBuffer"++gTypeSourceBuffer :: GType+gTypeSourceBuffer =+  {# call fun unsafe gtk_source_buffer_get_type #}++-- ***************************************************************** SourceMark++{#pointer *GtkSourceMark as SourceMark foreign newtype #} deriving (Eq,Ord)++mkSourceMark = (SourceMark, objectUnrefFromMainloop)+unSourceMark (SourceMark o) = o++class TextMarkClass o => SourceMarkClass o+toSourceMark :: SourceMarkClass o => o -> SourceMark+toSourceMark = unsafeCastGObject . toGObject++instance SourceMarkClass SourceMark+instance TextMarkClass SourceMark+instance GObjectClass SourceMark where+  toGObject = GObject . castForeignPtr . unSourceMark+  unsafeCastGObject = SourceMark . castForeignPtr . unGObject++castToSourceMark :: GObjectClass obj => obj -> SourceMark+castToSourceMark = castTo gTypeSourceMark "SourceMark"++gTypeSourceMark :: GType+gTypeSourceMark =+  {# call fun unsafe gtk_source_mark_get_type #}++-- ******************************************************* SourceCompletionInfo++{#pointer *GtkSourceCompletionInfo as SourceCompletionInfo foreign newtype #} deriving (Eq,Ord)++mkSourceCompletionInfo = (SourceCompletionInfo, objectUnrefFromMainloop)+unSourceCompletionInfo (SourceCompletionInfo o) = o++class WindowClass o => SourceCompletionInfoClass o+toSourceCompletionInfo :: SourceCompletionInfoClass o => o -> SourceCompletionInfo+toSourceCompletionInfo = unsafeCastGObject . toGObject++instance SourceCompletionInfoClass SourceCompletionInfo+instance WindowClass SourceCompletionInfo+instance BinClass SourceCompletionInfo+instance ContainerClass SourceCompletionInfo+instance WidgetClass SourceCompletionInfo+instance TextMarkClass SourceCompletionInfo+instance GObjectClass SourceCompletionInfo where+  toGObject = GObject . castForeignPtr . unSourceCompletionInfo+  unsafeCastGObject = SourceCompletionInfo . castForeignPtr . unGObject++castToSourceCompletionInfo :: GObjectClass obj => obj -> SourceCompletionInfo+castToSourceCompletionInfo = castTo gTypeSourceCompletionInfo "SourceCompletionInfo"++gTypeSourceCompletionInfo :: GType+gTypeSourceCompletionInfo =+  {# call fun unsafe gtk_source_completion_info_get_type #}++-- ***************************************************************** SourceView++{#pointer *GtkSourceView as SourceView foreign newtype #} deriving (Eq,Ord)++mkSourceView = (SourceView, objectUnrefFromMainloop)+unSourceView (SourceView o) = o++class TextViewClass o => SourceViewClass o+toSourceView :: SourceViewClass o => o -> SourceView+toSourceView = unsafeCastGObject . toGObject++instance SourceViewClass SourceView+instance TextViewClass SourceView+instance ContainerClass SourceView+instance WidgetClass SourceView+instance TextMarkClass SourceView+instance GObjectClass SourceView where+  toGObject = GObject . castForeignPtr . unSourceView+  unsafeCastGObject = SourceView . castForeignPtr . unGObject++castToSourceView :: GObjectClass obj => obj -> SourceView+castToSourceView = castTo gTypeSourceView "SourceView"++gTypeSourceView :: GType+gTypeSourceView =+  {# call fun unsafe gtk_source_view_get_type #}++-- ************************************************************* SourceLanguage++{#pointer *GtkSourceLanguage as SourceLanguage foreign newtype #} deriving (Eq,Ord)++mkSourceLanguage = (SourceLanguage, objectUnrefFromMainloop)+unSourceLanguage (SourceLanguage o) = o++class GObjectClass o => SourceLanguageClass o+toSourceLanguage :: SourceLanguageClass o => o -> SourceLanguage+toSourceLanguage = unsafeCastGObject . toGObject++instance SourceLanguageClass SourceLanguage+instance GObjectClass SourceLanguage where+  toGObject = GObject . castForeignPtr . unSourceLanguage+  unsafeCastGObject = SourceLanguage . castForeignPtr . unGObject++castToSourceLanguage :: GObjectClass obj => obj -> SourceLanguage+castToSourceLanguage = castTo gTypeSourceLanguage "SourceLanguage"++gTypeSourceLanguage :: GType+gTypeSourceLanguage =+  {# call fun unsafe gtk_source_language_get_type #}++-- ****************************************************** SourceLanguageManager++{#pointer *GtkSourceLanguageManager as SourceLanguageManager foreign newtype #} deriving (Eq,Ord)++mkSourceLanguageManager = (SourceLanguageManager, objectUnrefFromMainloop)+unSourceLanguageManager (SourceLanguageManager o) = o++class GObjectClass o => SourceLanguageManagerClass o+toSourceLanguageManager :: SourceLanguageManagerClass o => o -> SourceLanguageManager+toSourceLanguageManager = unsafeCastGObject . toGObject++instance SourceLanguageManagerClass SourceLanguageManager+instance GObjectClass SourceLanguageManager where+  toGObject = GObject . castForeignPtr . unSourceLanguageManager+  unsafeCastGObject = SourceLanguageManager . castForeignPtr . unGObject++castToSourceLanguageManager :: GObjectClass obj => obj -> SourceLanguageManager+castToSourceLanguageManager = castTo gTypeSourceLanguageManager "SourceLanguageManager"++gTypeSourceLanguageManager :: GType+gTypeSourceLanguageManager =+  {# call fun unsafe gtk_source_language_manager_get_type #}++-- ********************************************************** SourceStyleObject++{#pointer *GtkSourceStyle as SourceStyleObject foreign newtype #} deriving (Eq,Ord)++mkSourceStyleObject = (SourceStyleObject, objectUnrefFromMainloop)+unSourceStyleObject (SourceStyleObject o) = o++class GObjectClass o => SourceStyleObjectClass o+toSourceStyleObject :: SourceStyleObjectClass o => o -> SourceStyleObject+toSourceStyleObject = unsafeCastGObject . toGObject++instance SourceStyleObjectClass SourceStyleObject+instance GObjectClass SourceStyleObject where+  toGObject = GObject . castForeignPtr . unSourceStyleObject+  unsafeCastGObject = SourceStyleObject . castForeignPtr . unGObject++castToSourceStyleObject :: GObjectClass obj => obj -> SourceStyleObject+castToSourceStyleObject = castTo gTypeSourceStyleObject "SourceStyleObject"++gTypeSourceStyleObject :: GType+gTypeSourceStyleObject =+  {# call fun unsafe gtk_source_style_get_type #}++-- ********************************************************** SourceStyleScheme++{#pointer *GtkSourceStyleScheme as SourceStyleScheme foreign newtype #} deriving (Eq,Ord)++mkSourceStyleScheme = (SourceStyleScheme, objectUnrefFromMainloop)+unSourceStyleScheme (SourceStyleScheme o) = o++class GObjectClass o => SourceStyleSchemeClass o+toSourceStyleScheme :: SourceStyleSchemeClass o => o -> SourceStyleScheme+toSourceStyleScheme = unsafeCastGObject . toGObject++instance SourceStyleSchemeClass SourceStyleScheme+instance GObjectClass SourceStyleScheme where+  toGObject = GObject . castForeignPtr . unSourceStyleScheme+  unsafeCastGObject = SourceStyleScheme . castForeignPtr . unGObject++castToSourceStyleScheme :: GObjectClass obj => obj -> SourceStyleScheme+castToSourceStyleScheme = castTo gTypeSourceStyleScheme "SourceStyleScheme"++gTypeSourceStyleScheme :: GType+gTypeSourceStyleScheme =+  {# call fun unsafe gtk_source_style_scheme_get_type #}++-- *************************************************** SourceStyleSchemeManager++{#pointer *GtkSourceStyleSchemeManager as SourceStyleSchemeManager foreign newtype #} deriving (Eq,Ord)++mkSourceStyleSchemeManager = (SourceStyleSchemeManager, objectUnrefFromMainloop)+unSourceStyleSchemeManager (SourceStyleSchemeManager o) = o++class GObjectClass o => SourceStyleSchemeManagerClass o+toSourceStyleSchemeManager :: SourceStyleSchemeManagerClass o => o -> SourceStyleSchemeManager+toSourceStyleSchemeManager = unsafeCastGObject . toGObject++instance SourceStyleSchemeManagerClass SourceStyleSchemeManager+instance GObjectClass SourceStyleSchemeManager where+  toGObject = GObject . castForeignPtr . unSourceStyleSchemeManager+  unsafeCastGObject = SourceStyleSchemeManager . castForeignPtr . unGObject++castToSourceStyleSchemeManager :: GObjectClass obj => obj -> SourceStyleSchemeManager+castToSourceStyleSchemeManager = castTo gTypeSourceStyleSchemeManager "SourceStyleSchemeManager"++gTypeSourceStyleSchemeManager :: GType+gTypeSourceStyleSchemeManager =+  {# call fun unsafe gtk_source_style_scheme_manager_get_type #}+
+ Gtk2HsSetup.hs view
@@ -0,0 +1,474 @@+{-# LANGUAGE CPP, ViewPatterns #-}++#ifndef CABAL_VERSION_CHECK+#error This module has to be compiled via the Setup.hs program which generates the gtk2hs-macros.h file+#endif++-- | Build a Gtk2hs package.+--+module Gtk2HsSetup ( +  gtk2hsUserHooks, +  getPkgConfigPackages, +  checkGtk2hsBuildtools,+  typeGenProgram,+  signalGenProgram,+  c2hsLocal+  ) where++import Distribution.Simple+import Distribution.Simple.PreProcess+import Distribution.InstalledPackageInfo ( importDirs,+                                           showInstalledPackageInfo,+                                           libraryDirs,+                                           extraLibraries,+                                           extraGHCiLibraries )+import Distribution.Simple.PackageIndex ( lookupInstalledPackageId )+import Distribution.PackageDescription as PD ( PackageDescription(..),+                                               updatePackageDescription,+                                               BuildInfo(..),+                                               emptyBuildInfo, allBuildInfo,+                                               Library(..),+                                               libModules, hasLibs)+import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(withPackageDB, buildDir, localPkgDescr, installedPkgs, withPrograms),+                                           InstallDirs(..),+                                           componentPackageDeps,+                                           absoluteInstallDirs)+import Distribution.Simple.Compiler  ( Compiler(..) )+import Distribution.Simple.Program (+  Program(..), ConfiguredProgram(..),+  rawSystemProgramConf, rawSystemProgramStdoutConf, programName, programPath,+  c2hsProgram, pkgConfigProgram, gccProgram, requireProgram, ghcPkgProgram,+  simpleProgram, lookupProgram, rawSystemProgramStdout, ProgArg)+import Distribution.ModuleName ( ModuleName, components, toFilePath )+import Distribution.Simple.Utils+import Distribution.Simple.Setup (CopyFlags(..), InstallFlags(..), CopyDest(..),+                                  defaultCopyFlags, ConfigFlags(configVerbosity),+                                  fromFlag, toFlag, RegisterFlags(..), flagToMaybe,+                                  fromFlagOrDefault, defaultRegisterFlags)+import Distribution.Simple.BuildPaths ( autogenModulesDir )+import Distribution.Simple.Install ( install )+import Distribution.Simple.Register ( generateRegistrationInfo, registerPackage )+import Distribution.Text ( simpleParse, display )+import System.FilePath+import System.Exit (exitFailure)+import System.Directory ( doesFileExist, getDirectoryContents, doesDirectoryExist )+import Distribution.Version (Version(..))+import Distribution.Verbosity+import Control.Monad (when, unless, filterM, liftM, forM, forM_)+import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList )+import Data.List (isPrefixOf, isSuffixOf, stripPrefix, nub)+import Data.Char (isAlpha, isNumber)+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Distribution.Simple.LocalBuildInfo as LBI+import Distribution.Simple.Compiler (compilerVersion)++import Control.Applicative ((<$>))++#if CABAL_VERSION_CHECK(1,17,0)+import Distribution.Simple.Program.Find ( defaultProgramSearchPath )+onDefaultSearchPath f a b = f a b defaultProgramSearchPath+libraryConfig lbi = case [clbi | (LBI.CLibName, clbi, _) <- LBI.componentsConfigs lbi] of+  [clbi] -> Just clbi+  _ -> Nothing+#else+onDefaultSearchPath = id+libraryConfig = LBI.libraryConfig+#endif++-- the name of the c2hs pre-compiled header file+precompFile = "precompchs.bin"++gtk2hsUserHooks = simpleUserHooks {+    hookedPrograms = [typeGenProgram, signalGenProgram, c2hsLocal],+    hookedPreProcessors = [("chs", ourC2hs)],+    confHook = \pd cf ->+      (fmap adjustLocalBuildInfo (confHook simpleUserHooks pd cf)),+    postConf = \args cf pd lbi -> do+      genSynthezisedFiles (fromFlag (configVerbosity cf)) pd lbi+      postConf simpleUserHooks args cf pd lbi,+    buildHook = \pd lbi uh bf -> fixDeps pd >>= \pd ->+                                 buildHook simpleUserHooks pd lbi uh bf,+    copyHook = \pd lbi uh flags -> copyHook simpleUserHooks pd lbi uh flags >>+      installCHI pd lbi (fromFlag (copyVerbosity flags)) (fromFlag (copyDest flags)),+    instHook = \pd lbi uh flags ->+#if defined(mingw32_HOST_OS) || defined(__MINGW32__)+      installHook pd lbi uh flags >>+      installCHI pd lbi (fromFlag (installVerbosity flags)) NoCopyDest,+    regHook = registerHook+#else+      instHook simpleUserHooks pd lbi uh flags >>+      installCHI pd lbi (fromFlag (installVerbosity flags)) NoCopyDest+#endif+  }++------------------------------------------------------------------------------+-- Lots of stuff for windows ghci support+------------------------------------------------------------------------------++getDlls :: [FilePath] -> IO [FilePath]+getDlls dirs = filter ((== ".dll") . takeExtension) . concat <$>+    mapM getDirectoryContents dirs++fixLibs :: [FilePath] -> [String] -> [String]+fixLibs dlls = concatMap $ \ lib ->+    case filter (isLib lib) dlls of+                dll:_ -> [dropExtension dll]+                _     -> if lib == "z" then [] else [lib]+  where+    isLib lib dll =+        case stripPrefix ("lib"++lib) dll of+            Just ('.':_)                -> True+            Just ('-':n:_) | isNumber n -> True+            _                           -> False+        +-- The following code is a big copy-and-paste job from the sources of+-- Cabal 1.8 just to be able to fix a field in the package file. Yuck.++installHook :: PackageDescription -> LocalBuildInfo+                   -> UserHooks -> InstallFlags -> IO ()+installHook pkg_descr localbuildinfo _ flags = do+  let copyFlags = defaultCopyFlags {+                      copyDistPref   = installDistPref flags,+                      copyDest       = toFlag NoCopyDest,+                      copyVerbosity  = installVerbosity flags+                  }+  install pkg_descr localbuildinfo copyFlags+  let registerFlags = defaultRegisterFlags {+                          regDistPref  = installDistPref flags,+                          regInPlace   = installInPlace flags,+                          regPackageDB = installPackageDB flags,+                          regVerbosity = installVerbosity flags+                      }+  when (hasLibs pkg_descr) $ register pkg_descr localbuildinfo registerFlags++registerHook :: PackageDescription -> LocalBuildInfo+        -> UserHooks -> RegisterFlags -> IO ()+registerHook pkg_descr localbuildinfo _ flags =+    if hasLibs pkg_descr+    then register pkg_descr localbuildinfo flags+    else setupMessage verbosity+           "Package contains no library to register:" (packageId pkg_descr)+  where verbosity = fromFlag (regVerbosity flags)++register :: PackageDescription -> LocalBuildInfo+         -> RegisterFlags -- ^Install in the user's database?; verbose+         -> IO ()+register pkg@(library       -> Just lib )+         lbi@(libraryConfig -> Just clbi) regFlags+  = do++    installedPkgInfoRaw <- generateRegistrationInfo+                           verbosity pkg lib lbi clbi inplace distPref++    dllsInScope <- getSearchPath >>= (filterM doesDirectoryExist) >>= getDlls+    let libs = fixLibs dllsInScope (extraLibraries installedPkgInfoRaw)+        installedPkgInfo = installedPkgInfoRaw {+                                extraGHCiLibraries = libs }++     -- Three different modes:+    case () of+     _ | modeGenerateRegFile   -> die "Generate Reg File not supported"+       | modeGenerateRegScript -> die "Generate Reg Script not supported"+       | otherwise             -> registerPackage verbosity+                                    installedPkgInfo pkg lbi inplace+#if CABAL_VERSION_CHECK(1,10,0)+                                    packageDbs+#else+                                    packageDb+#endif++  where+    modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))+    modeGenerateRegScript = fromFlag (regGenScript regFlags)+    inplace   = fromFlag (regInPlace regFlags)+    packageDbs = nub $ withPackageDB lbi+                    ++ maybeToList (flagToMaybe  (regPackageDB regFlags))+    packageDb = registrationPackageDB packageDbs+    distPref  = fromFlag (regDistPref regFlags)+    verbosity = fromFlag (regVerbosity regFlags)++register _ _ regFlags = notice verbosity "No package to register"+  where+    verbosity = fromFlag (regVerbosity regFlags)+++------------------------------------------------------------------------------+-- This is a hack for Cabal-1.8, It is not needed in Cabal-1.9.1 or later+------------------------------------------------------------------------------++adjustLocalBuildInfo :: LocalBuildInfo -> LocalBuildInfo+adjustLocalBuildInfo lbi =+  let extra = (Just libBi, [])+      libBi = emptyBuildInfo { includeDirs = [ autogenModulesDir lbi+                                             , buildDir lbi ] }+   in lbi { localPkgDescr = updatePackageDescription extra (localPkgDescr lbi) }++------------------------------------------------------------------------------+-- Processing .chs files with our local c2hs.+------------------------------------------------------------------------------++ourC2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor+ourC2hs bi lbi = PreProcessor {+  platformIndependent = False,+  runPreProcessor = runC2HS bi lbi+}++runC2HS :: BuildInfo -> LocalBuildInfo ->+           (FilePath, FilePath) -> (FilePath, FilePath) -> Verbosity -> IO ()+runC2HS bi lbi (inDir, inFile)  (outDir, outFile) verbosity = do+  -- have the header file name if we don't have the precompiled header yet+  header <- case lookup "x-c2hs-header" (customFieldsBI bi) of+    Just h -> return h+    Nothing -> die ("Need x-c2hs-Header definition in the .cabal Library section "+++                    "that sets the C header file to process .chs.pp files.")++  -- c2hs will output files in out dir, removing any leading path of the input file.+  -- Thus, append the dir of the input file to the output dir.+  let (outFileDir, newOutFile) = splitFileName outFile+  let newOutDir = outDir </> outFileDir+  -- additional .chi files might be needed that other packages have installed;+  -- we assume that these are installed in the same place as .hi files+  let chiDirs = [ dir |+                  ipi <- maybe [] (map fst . componentPackageDeps) (libraryConfig lbi),+                  dir <- maybe [] importDirs (lookupInstalledPackageId (installedPkgs lbi) ipi) ]+  (gccProg, _) <- requireProgram verbosity gccProgram (withPrograms lbi)+  rawSystemProgramConf verbosity c2hsLocal (withPrograms lbi) $+       map ("--include=" ++) (outDir:chiDirs)+    ++ [ "--cpp=" ++ programPath gccProg, "--cppopts=-E" ]+    ++ ["--cppopts=" ++ opt | opt <- getCppOptions bi lbi]+    ++ ["--output-dir=" ++ newOutDir,+        "--output=" ++ newOutFile,+        "--precomp=" ++ buildDir lbi </> precompFile,+        header, inDir </> inFile]++getCppOptions :: BuildInfo -> LocalBuildInfo -> [String]+getCppOptions bi lbi+    = nub $+      ["-I" ++ dir | dir <- PD.includeDirs bi]+   ++ [opt | opt@('-':c:_) <- PD.cppOptions bi ++ PD.ccOptions bi, c `elem` "DIU"]+   ++ ["-D__GLASGOW_HASKELL__="++show (ghcDefine . versionBranch . compilerVersion $ LBI.compiler lbi)]+ where+  ghcDefine (v1:v2:_) = v1 * 100 + v2+  ghcDefine _ = __GLASGOW_HASKELL__++installCHI :: PackageDescription -- ^information from the .cabal file+        -> LocalBuildInfo -- ^information from the configure step+        -> Verbosity -> CopyDest -- ^flags sent to copy or install+        -> IO ()+installCHI pkg@PD.PackageDescription { library = Just lib } lbi verbosity copydest = do+  let InstallDirs { libdir = libPref } = absoluteInstallDirs pkg lbi copydest+  -- cannot use the recommended 'findModuleFiles' since it fails if there exists+  -- a modules that does not have a .chi file+  mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi] . toFilePath)+                   (PD.libModules lib)+                 +  let files = [ f | Just f <- mFiles ]+  installOrdinaryFiles verbosity libPref files++  +installCHI _ _ _ _ = return ()++------------------------------------------------------------------------------+-- Generating the type hierarchy and signal callback .hs files.+------------------------------------------------------------------------------++typeGenProgram :: Program+typeGenProgram = simpleProgram "gtk2hsTypeGen"++signalGenProgram :: Program+signalGenProgram = simpleProgram "gtk2hsHookGenerator"++c2hsLocal :: Program+c2hsLocal = (simpleProgram "gtk2hsC2hs") {+    programFindVersion = findProgramVersion "--version" $ \str ->+      -- Invoking "gtk2hsC2hs --version" gives a string like:+      -- C->Haskell Compiler, version 0.13.4 (gtk2hs branch) "Bin IO", 13 Nov 2004+      case words str of+        (_:_:_:ver:_) -> ver+        _             -> ""+  }+++genSynthezisedFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()+genSynthezisedFiles verb pd lbi = do++  cPkgs <- getPkgConfigPackages verb lbi pd++  let xList = maybe [] (customFieldsBI . libBuildInfo) (library pd)+              ++customFieldsPD pd+      typeOpts :: String -> [ProgArg]+      typeOpts tag = concat [ map (\val -> '-':'-':drop (length tag) field++'=':val) (words content)+                            | (field,content) <- xList,+                              tag `isPrefixOf` field,+                              field /= (tag++"file")]+              ++ [ "--tag=" ++ tag+                 | PackageIdentifier name (Version (major:minor:_) _) <- cPkgs+                 , let name' = filter isAlpha (display name)+                 , tag <- name'+                        : [ name' ++ "-" ++ show major ++ "." ++ show digit+                          | digit <- [0,2..minor] ]+                 ]++      signalsOpts :: [ProgArg]+      signalsOpts = concat [ map (\val -> '-':'-':drop 10 field++'=':val) (words content)+                        | (field,content) <- xList,+                          "x-signals-" `isPrefixOf` field,+                          field /= "x-signals-file"]++      genFile :: Program -> [ProgArg] -> FilePath -> IO ()+      genFile prog args outFile = do+         res <- rawSystemProgramStdoutConf verb prog (withPrograms lbi) args+         rewriteFile outFile res++  forM_ (filter (\(tag,_) -> "x-types-" `isPrefixOf` tag && "file" `isSuffixOf` tag) xList) $+    \(fileTag, f) -> do+      let tag = reverse (drop 4 (reverse fileTag))+      info verb ("Ensuring that class hierarchy in "++f++" is up-to-date.")+      genFile typeGenProgram (typeOpts tag) f++  case lookup "x-signals-file" xList of+    Nothing -> return ()+    Just f -> do+      info verb ("Ensuring that callback hooks in "++f++" are up-to-date.")+      genFile signalGenProgram signalsOpts f++  writeFile "gtk2hs_macros.h" $ generateMacros cPkgs++-- Based on Cabal/Distribution/Simple/Build/Macros.hs+generateMacros :: [PackageId] -> String+generateMacros cPkgs = concat $+  "/* DO NOT EDIT: This file is automatically generated by Gtk2HsSetup.hs */\n\n" :+  [ concat+    ["/* package ",display pkgid," */\n"+    ,"#define VERSION_",pkgname," ",show (display version),"\n"+    ,"#define MIN_VERSION_",pkgname,"(major1,major2,minor) (\\\n"+    ,"  (major1) <  ",major1," || \\\n"+    ,"  (major1) == ",major1," && (major2) <  ",major2," || \\\n"+    ,"  (major1) == ",major1," && (major2) == ",major2," && (minor) <= ",minor,")"+    ,"\n\n"+    ]+  | pkgid@(PackageIdentifier name version) <- cPkgs+  , let (major1:major2:minor:_) = map show (versionBranch version ++ repeat 0)+        pkgname = map fixchar (display name)+  ]+  where fixchar '-' = '_'+        fixchar '.' = '_'+        fixchar c   = c++--FIXME: Cabal should tell us the selected pkg-config package versions in the+--       LocalBuildInfo or equivalent.+--       In the mean time, ask pkg-config again.++getPkgConfigPackages :: Verbosity -> LocalBuildInfo -> PackageDescription -> IO [PackageId]+getPkgConfigPackages verbosity lbi pkg =+  sequence+    [ do version <- pkgconfig ["--modversion", display pkgname]+         case simpleParse version of+           Nothing -> die "parsing output of pkg-config --modversion failed"+           Just v  -> return (PackageIdentifier pkgname v)+    | Dependency pkgname _ <- concatMap pkgconfigDepends (allBuildInfo pkg) ]+  where+    pkgconfig = rawSystemProgramStdoutConf verbosity+                  pkgConfigProgram (withPrograms lbi)++------------------------------------------------------------------------------+-- Dependency calculation amongst .chs files.+------------------------------------------------------------------------------++-- Given all files of the package, find those that end in .chs and extract the+-- .chs files they depend upon. Then return the PackageDescription with these+-- files rearranged so that they are built in a sequence that files that are+-- needed by other files are built first.+fixDeps :: PackageDescription -> IO PackageDescription+fixDeps pd@PD.PackageDescription {+          PD.library = Just lib@PD.Library {+            PD.exposedModules = expMods,+            PD.libBuildInfo = bi@PD.BuildInfo {+              PD.hsSourceDirs = srcDirs,+              PD.otherModules = othMods+            }}} = do+  let findModule m = findFileWithExtension [".chs.pp",".chs"] srcDirs+                       (joinPath (components m))+  mExpFiles <- mapM findModule expMods+  mOthFiles <- mapM findModule othMods++  -- tag all exposed files with True so we throw an error if we need to build+  -- an exposed module before an internal modules (we cannot express this)+  let modDeps = zipWith (ModDep True []) expMods mExpFiles+++                zipWith (ModDep False []) othMods mOthFiles+  modDeps <- mapM extractDeps modDeps+  let (expMods, othMods) = span mdExposed $ sortTopological modDeps+      badOther = map (fromMaybe "<no file>" . mdLocation) $+                 filter (not . mdExposed) expMods+  unless (null badOther) $+    die ("internal chs modules "++intercalate "," badOther+++         " depend on exposed chs modules; cabal needs to build internal modules first")+  return pd { PD.library = Just lib {+    PD.exposedModules = map mdOriginal expMods,+    PD.libBuildInfo = bi { PD.otherModules = map mdOriginal othMods }+  }}++data ModDep = ModDep {+  mdExposed :: Bool,+  mdRequires :: [ModuleName],+  mdOriginal :: ModuleName,+  mdLocation :: Maybe FilePath+}++instance Show ModDep where+  show x = show (mdLocation x)++instance Eq ModDep where+  ModDep { mdOriginal = m1 } == ModDep { mdOriginal = m2 } = m1==m2+instance Ord ModDep where+  compare ModDep { mdOriginal = m1 } ModDep { mdOriginal = m2 } = compare m1 m2++-- Extract the dependencies of this file. This is intentionally rather naive as it+-- ignores CPP conditionals. We just require everything which means that the+-- existance of a .chs module may not depend on some CPP condition.  +extractDeps :: ModDep -> IO ModDep+extractDeps md@ModDep { mdLocation = Nothing } = return md+extractDeps md@ModDep { mdLocation = Just f } = withUTF8FileContents f $ \con -> do+  let findImports acc (('{':'#':xs):xxs) = case (dropWhile (' ' ==) xs) of+        ('i':'m':'p':'o':'r':'t':' ':ys) ->+          case simpleParse (takeWhile ('#' /=) ys) of+            Just m -> findImports (m:acc) xxs +            Nothing -> die ("cannot parse chs import in "++f++":\n"+++                            "offending line is {#"++xs)+         -- no more imports after the first non-import hook+        _ -> return acc+      findImports acc (_:xxs) = findImports acc xxs+      findImports acc [] = return acc+  mods <- findImports [] (lines con)+  return md { mdRequires = mods }++-- Find a total order of the set of modules that are partially sorted by their+-- dependencies on each other. The function returns the sorted list of modules+-- together with a list of modules that are required but not supplied by this+-- in the input set of modules.+sortTopological :: [ModDep] -> [ModDep]+sortTopological ms = reverse $ fst $ foldl visit ([], S.empty) (map mdOriginal ms)+  where+  set = M.fromList (map (\m -> (mdOriginal m, m)) ms)+  visit (out,visited) m+    | m `S.member` visited = (out,visited)+    | otherwise = case m `M.lookup` set of+        Nothing -> (out, m `S.insert` visited)+        Just md -> (md:out', visited')+          where+            (out',visited') = foldl visit (out, m `S.insert` visited) (mdRequires md)++-- Check user whether install gtk2hs-buildtools correctly.+checkGtk2hsBuildtools :: [Program] -> IO ()+checkGtk2hsBuildtools programs = do+  programInfos <- mapM (\ prog -> do+                         location <- onDefaultSearchPath programFindLocation prog normal+                         return (programName prog, location)+                      ) programs+  let printError name = do+        putStrLn $ "Cannot find " ++ name ++ "\n" +                 ++ "Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin)."+        exitFailure+  forM_ programInfos $ \ (name, location) ->+    when (isNothing location) (printError name) 
+ Setup.hs view
@@ -0,0 +1,10 @@+-- Standard setup file for a Gtk2Hs module.+--+-- See also:+--  * SetupMain.hs    : the real Setup script for this package+--  * Gtk2HsSetup.hs  : Gtk2Hs-specific boilerplate+--  * SetupWrapper.hs : wrapper for compat with various ghc/cabal versions++import SetupWrapper ( setupWrapper )++main = setupWrapper "SetupMain.hs"
+ SetupMain.hs view
@@ -0,0 +1,13 @@+-- The real Setup file for a Gtk2Hs package (invoked via the SetupWrapper).+-- It contains only adjustments specific to this package,+-- all Gtk2Hs-specific boilerplate is kept in Gtk2HsSetup.hs+-- which should be kept identical across all packages.+--+import Gtk2HsSetup ( gtk2hsUserHooks, checkGtk2hsBuildtools,+                     typeGenProgram, signalGenProgram, c2hsLocal)+import Distribution.Simple ( defaultMainWithHooks )++main = do+  checkGtk2hsBuildtools [typeGenProgram, signalGenProgram, c2hsLocal]+  defaultMainWithHooks gtk2hsUserHooks+  
+ SetupWrapper.hs view
@@ -0,0 +1,164 @@+-- A wrapper script for Cabal Setup.hs scripts. Allows compiling the real Setup+-- conditionally depending on the Cabal version.++module SetupWrapper (setupWrapper) where++import Distribution.Package+import Distribution.Compiler+import Distribution.Simple.Utils+import Distribution.Simple.Program+import Distribution.Simple.Compiler+import Distribution.Simple.BuildPaths (exeExtension)+import Distribution.Simple.Configure (configCompiler)+import Distribution.Simple.GHC (getInstalledPackages)+import qualified Distribution.Simple.PackageIndex as PackageIndex+import Distribution.Version+import Distribution.Verbosity+import Distribution.Text++import System.Environment+import System.Process+import System.Exit+import System.FilePath+import System.Directory+import qualified Control.Exception as Exception+import System.IO.Error (isDoesNotExistError)++import Data.List+import Data.Char+import Control.Monad+++-- moreRecentFile is implemented in Distribution.Simple.Utils, but only in+-- Cabal >= 1.18. For backwards-compatibility, we implement a copy with a new+-- name here. Some desirable alternate strategies don't work:+-- * We can't use CPP to check which version of Cabal we're up against because+--   this is the file that's generating the macros for doing that.+-- * We can't use the name moreRecentFiles and use+--   import D.S.U hiding (moreRecentFiles)+--   because on old GHC's (and according to the Report) hiding a name that+--   doesn't exist is an error.+moreRecentFile' :: FilePath -> FilePath -> IO Bool+moreRecentFile' a b = do+  exists <- doesFileExist b+  if not exists+    then return True+    else do tb <- getModificationTime b+            ta <- getModificationTime a+            return (ta > tb)++setupWrapper :: FilePath -> IO ()+setupWrapper setupHsFile = do+  args <- getArgs+  createDirectoryIfMissingVerbose verbosity True setupDir+  compileSetupExecutable+  invokeSetupScript args++  where+    setupDir         = "dist/setup-wrapper"+    setupVersionFile = setupDir </> "setup" <.> "version"+    setupProgFile    = setupDir </> "setup" <.> exeExtension+    setupMacroFile   = setupDir </> "wrapper-macros.h"++    useCabalVersion  = Version [1,8] []+    usePackageDB     = [GlobalPackageDB, UserPackageDB]+    verbosity        = normal++    cabalLibVersionToUse comp conf = do+      savedVersion <- savedCabalVersion+      case savedVersion of+        Just version+          -> return version+        _ -> do version <- installedCabalVersion comp conf+                writeFile setupVersionFile (show version ++ "\n")+                return version++    savedCabalVersion = do+      versionString <- readFile setupVersionFile+                         `Exception.catch` \e -> if isDoesNotExistError e+                                                   then return ""+                                                   else Exception.throwIO e+      case reads versionString of+        [(version,s)] | all isSpace s -> return (Just version)+        _                             -> return Nothing++    installedCabalVersion comp conf = do+      index <- getInstalledPackages verbosity usePackageDB conf++      let cabalDep = Dependency (PackageName "Cabal")+                                (orLaterVersion useCabalVersion)+      case PackageIndex.lookupDependency index cabalDep of+        []   -> die $ "The package requires Cabal library version "+                   ++ display useCabalVersion+                   ++ " but no suitable version is installed."+        pkgs -> return $ bestVersion (map fst pkgs)+      where+        bestVersion          = maximumBy (comparing preference)+        preference version   = (sameVersion, sameMajorVersion+                               ,stableVersion, latestVersion)+          where+            sameVersion      = version == cabalVersion+            sameMajorVersion = majorVersion version == majorVersion cabalVersion+            majorVersion     = take 2 . versionBranch+            stableVersion    = case versionBranch version of+                                 (_:x:_) -> even x+                                 _       -> False+            latestVersion    = version++    -- | If the Setup.hs is out of date wrt the executable then recompile it.+    -- Currently this is GHC only. It should really be generalised.+    --+    compileSetupExecutable = do+      setupHsNewer      <- setupHsFile      `moreRecentFile'` setupProgFile+      cabalVersionNewer <- setupVersionFile `moreRecentFile'` setupProgFile+      let outOfDate = setupHsNewer || cabalVersionNewer+      when outOfDate $ do+        debug verbosity "Setup script is out of date, compiling..."++        (comp, conf)    <- configCompiler (Just GHC) Nothing Nothing+                             defaultProgramConfiguration verbosity+        cabalLibVersion <- cabalLibVersionToUse comp conf+        let cabalPkgid = PackageIdentifier (PackageName "Cabal") cabalLibVersion+        debug verbosity $ "Using Cabal library version " ++ display cabalLibVersion++        writeFile setupMacroFile (generateVersionMacro cabalLibVersion)++        rawSystemProgramConf verbosity ghcProgram conf $+            ["--make", setupHsFile, "-o", setupProgFile]+         ++ ghcPackageDbOptions usePackageDB+         ++ ["-package", display cabalPkgid+            ,"-cpp", "-optP-include", "-optP" ++ setupMacroFile+            ,"-odir", setupDir, "-hidir", setupDir]+      where++        ghcPackageDbOptions dbstack = case dbstack of+          (GlobalPackageDB:UserPackageDB:dbs) -> concatMap specific dbs+          (GlobalPackageDB:dbs)               -> "-no-user-package-conf"+                                               : concatMap specific dbs+          _                                   -> ierror+          where+            specific (SpecificPackageDB db) = [ "-package-conf", db ]+            specific _ = ierror+            ierror     = error "internal error: unexpected package db stack"++        generateVersionMacro :: Version -> String+        generateVersionMacro version =+          concat+            ["/* DO NOT EDIT: This file is automatically generated by Cabal */\n\n"+            ,"#define CABAL_VERSION_CHECK(major1,major2,minor) (\\\n"+            ,"  (major1) <  ",major1," || \\\n"+            ,"  (major1) == ",major1," && (major2) <  ",major2," || \\\n"+            ,"  (major1) == ",major1," && (major2) == ",major2," && (minor) <= ",minor,")"+            ,"\n\n"+            ]+          where+            (major1:major2:minor:_) = map show (versionBranch version ++ repeat 0)++    invokeSetupScript :: [String] -> IO ()+    invokeSetupScript args = do+      info verbosity $ unwords (setupProgFile : args)+      process <- runProcess (currentDir </> setupProgFile) args+                   Nothing Nothing+                   Nothing Nothing Nothing+      exitCode <- waitForProcess process+      unless (exitCode == ExitSuccess) $ exitWith exitCode
+ demo/LineNumber.hs view
@@ -0,0 +1,53 @@+-- | Line number demo.+--  Author      :  Andy Stewart+--  Copyright   :  (c) 2010 Andy Stewart <lazycat.manatee@gmail.com>+--+-- This demo show how to build your own line number gutter.+--+module Main where++import Graphics.UI.Gtk+import Graphics.UI.Gtk.SourceView++main = do+  -- Init.+  initGUI+  +  -- Create window.+  window <- windowNew+  windowSetDefaultSize window 900 600+  windowSetPosition window WinPosCenter++  -- Create source view widget.+  sourceView <- sourceViewNew++  -- Create scroll window.+  scrolledWindow <- scrolledWindowNew Nothing Nothing++  -- Insert CellRendererText in source view's gutter.+  gutter <- sourceViewGetGutter sourceView TextWindowLeft+  cell   <- cellRendererTextNew+  sourceGutterInsert gutter cell 0++  -- Set gutter data.+  sourceGutterSetCellDataFunc gutter cell $ \ c l currentLine -> do+         -- Display line number.+         set (castToCellRendererText c) [cellText := show (l + 1)]+         -- Highlight current line.+         let color = if currentLine +                        then Color 65535 0 0 +                        else Color 0 65535 0+         set (castToCellRendererText c) [cellTextForegroundColor := color]++  -- Set gutter size.+  sourceGutterSetCellSizeFunc gutter cell $ \ c -> +      -- -1 mean cell renderer will adjust width with chars dynamically.+      set (castToCellRendererText c) [cellTextWidthChars := (-1)]++  -- Connect and show.+  scrolledWindow `containerAdd` sourceView+  window `containerAdd` scrolledWindow+  window `onDestroy` mainQuit+  widgetShowAll window++  mainGUI
+ demo/Makefile view
@@ -0,0 +1,18 @@++PROGS  = sourceview linenumber +SOURCES = SourceView.hs LineNumber.hs++all : $(PROGS)++sourceview : SourceView.hs+	$(HC_RULE)++linenumber : LineNumber.hs+	$(HC_RULE)++HC_RULE = $(HC) --make $< -o $@ $(HCFLAGS)++clean:+	rm -f $(SOURCES:.hs=.hi) $(SOURCES:.hs=.o) $(PROGS)++HC=ghc
+ demo/SourceView.hs view
@@ -0,0 +1,46 @@+-- Test file for the SourceView widget.+module Main where++import Graphics.UI.Gtk+import Graphics.UI.Gtk.SourceView++main = do+  initGUI+  win <- windowNew+  windowSetPosition win WinPosCenter+  win `onDestroy` mainQuit++  -- create the appropriate language+  lm <- sourceLanguageManagerNew+  langM <- sourceLanguageManagerGetLanguage lm "haskell"+  lang <- case langM of+    (Just lang) -> return lang+    Nothing -> do+      langDirs <- sourceLanguageManagerGetSearchPath lm+      error ("please copy haskell.lang to one of the following directories:\n"+        ++unlines langDirs)++  -- create a new SourceBuffer object+  buffer <- sourceBufferNewWithLanguage lang++  -- load up and display a file+  fileContents <- readFile "SourceView.hs"+  textBufferSetText buffer fileContents+  textBufferSetModified buffer False++  sourceBufferSetHighlightSyntax buffer True++  -- create a new SourceView Widget+  sv <- sourceViewNewWithBuffer buffer++  -- put it in a scrolled window+  sw <- scrolledWindowNew Nothing Nothing+  sw `containerAdd` sv+  scrolledWindowSetPolicy sw PolicyAutomatic PolicyAutomatic+  sw `scrolledWindowSetShadowType` ShadowIn+  win `containerAdd` sw++  -- show the widget and run the main loop+  windowSetDefaultSize win 400 500+  widgetShowAll win+  mainGUI
+ demo/haskell.lang view
@@ -0,0 +1,114 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE language SYSTEM "language.dtd">+<language _name="Haskell" version="1.0" _section="Sources" mimetypes="text/x-haskell">++	<escape-char>\</escape-char>++	<line-comment _name = "Line Comment" style= "Comment">+		<start-regex>--</start-regex>+	</line-comment>++	<block-comment _name = "Block Comment" style = "Comment">+		<start-regex>\{-</start-regex>+        	<end-regex>-\}</end-regex>+	</block-comment>++	<syntax-item _name = "Pragma" style = "Preprocessor">+		<start-regex>\{-#</start-regex>+	        <end-regex>#-\}</end-regex>+	</syntax-item>++	<pattern-item _name = "Data Type or Constructor" style = "Data Type">+		<regex>\b[A-Z][0-9a-zA-Z._]*(&apos;|#)*</regex>+	</pattern-item>++	<pattern-item _name = "Keysymbols" style = "Keyword">+		<regex>::|-&gt;|&lt;-|=&gt;|=|\||\\|@|~|\.\.</regex>+	</pattern-item>+<!--+	<pattern-item _name = "Operators" style = "Operators">+                <regex>[:!#$%&amp;*+./&gt;=&lt;?@\\^|~\-]+</regex>+	</pattern-item>++	<keyword-list _name="Keysymbols" style = "Keyword">+		<keyword>::</keyword>+		<keyword>-&gt;</keyword>+		<keyword>&lt;-</keyword>+		<keyword>=&gt;</keyword>+		<keyword>=</keyword>+		<keyword>|</keyword>`+		<keyword>\</keyword>+		<keyword>@</keyword>+		<keyword>~</keyword>+		<keyword>..</keyword>+	</keyword-list>+-->+	<string _name = "String" style = "String" end-at-line-end = "true">+		<start-regex>&quot;</start-regex>+		<end-regex>&quot;</end-regex>+	</string>++	<string _name = "Character Constant" style = "String" end-at-line-end = "true">+		<start-regex>[^A-Za-z0-9]&apos;</start-regex>+		<end-regex>&apos;</end-regex>+	</string>++	<pattern-item _name = "Decimal" style = "Decimal">+		<regex>\b[0-9]\b</regex>+	</pattern-item>++	<pattern-item _name = "Floating Point Number" style = "Floating point">+		<regex>\b([0-9]+.[0-9]+([eE][+-]?[0-9])?|[0-9][eE][+-]?[0-9])</regex>+	</pattern-item>++	<pattern-item _name = "Octal Number" style = "Base-N Integer">+                <regex>\b[oO][0-7]+\b</regex>+        </pattern-item>++	<pattern-item _name = "Hex Number" style = "Base-N Integer">+		<regex>\b0[xX][0-9a-fA-F]+\b</regex>+	</pattern-item>++	<keyword-list _name = "Keywords" style = "Keyword" case-sensitive="true">+                <keyword>as</keyword>+                <keyword>case</keyword>+	        <keyword>class</keyword>+                <keyword>data</keyword>+                <keyword>deriving</keyword>+                <keyword>do</keyword>+                <keyword>else</keyword>+                <keyword>forall</keyword> <!-- GHC extension -->+                <keyword>hiding</keyword>+                <keyword>if</keyword>+                <keyword>import</keyword>+                <keyword>in</keyword>+                <keyword>infix</keyword>+                <keyword>infixl</keyword>+                <keyword>infixr</keyword>+                <keyword>instance</keyword>+                <keyword>let</keyword>+                <keyword>module</keyword>+                <keyword>newtype</keyword>+                <keyword>of</keyword>+                <keyword>qualified</keyword>+                <keyword>then</keyword>+                <keyword>where</keyword>+                <keyword>with</keyword> <!-- GHC extension -->+	</keyword-list>++	<keyword-list _name = "Preprocessor Definitions" style = "Preprocessor" case-sensitive="true"+		match-empty-string-at-beginning = "false"+		match-empty-string-at-end = "true"+		beginning-regex = "^[ \t]*#[ \t]*">+		<keyword>if</keyword>+		<keyword>ifdef</keyword>+		<keyword>ifndef</keyword>+		<keyword>else</keyword>+		<keyword>elif</keyword>+		<keyword>define</keyword>+		<keyword>endif</keyword>+		<keyword>undef</keyword>+		<keyword>error</keyword>+	</keyword-list>++</language>
+ gtksourceview2.h view
@@ -0,0 +1,19 @@+#include "gtk2hs_macros.h"+#include <gtksourceview/gtksourcebuffer.h>+#if GTK_MAJOR_VERSION < 3+#include <gtksourceview/gtksourceiter.h>+#endif+#include <gtksourceview/gtksourcelanguage.h>+#include <gtksourceview/gtksourcelanguagemanager.h>+#include <gtksourceview/gtksourcestyle.h>+#include <gtksourceview/gtksourcestylescheme.h>+#include <gtksourceview/gtksourcestyleschememanager.h>+#include <gtksourceview/gtksourceview.h>+#include <gtksourceview/gtksourceview-typebuiltins.h>+#include <gtksourceview/gtksourceundomanager.h>+#include <gtksourceview/gtksourcecompletionitem.h>+#include <gtksourceview/gtksourcegutter.h>+#include <gtksourceview/gtksourcecompletionprovider.h>+#include <gtksourceview/gtksourcecompletionproposal.h>+#include <gtksourceview/gtksourcemark.h>+#include <gtksourceview/gtksourcecompletioninfo.h>
+ gtksourceview3.cabal view
@@ -0,0 +1,84 @@+Name:           gtksourceview3+Version:        0.12.5.0+License:        LGPL-2.1+License-file:   COPYING+Copyright:      (c) 2001-2010 The Gtk2Hs Team+Author:         Duncan Coutts, Peter Gavin, Axel Simon+Maintainer:     gtk2hs-users@lists.sourceforge.net+Build-Type:     Custom+Cabal-Version:  >= 1.8+Stability:      provisional+homepage:       http://projects.haskell.org/gtk2hs/+bug-reports:    http://hackage.haskell.org/trac/gtk2hs/+Synopsis:       Binding to the GtkSourceView library.+Description:    GtkSourceView is a text widget that extends the standard GTK+ 2.x text widget+                GtkTextView. It improves GtkTextView by implementing syntax highlighting and+                other features typical of a source editor.++Category:       Graphics+Tested-With:    GHC == 6.10.4, GHC == 6.12.3, GHC == 7.0.4, GHC == 7.2.1+Extra-Source-Files: gtksourceview2.h+                    SetupWrapper.hs SetupMain.hs Gtk2HsSetup.hs+                    marshal.list+                    hierarchy3.list++Data-Dir:       demo+Data-Files:     haskell.lang+                SourceView.hs+                Makefile+                LineNumber.hs++x-Types-File:       Graphics/UI/Gtk/SourceView/Types.chs+x-Types-Tag:        gtksourceview2+x-Types-ModName:    Graphics.UI.Gtk.SourceView.Types+x-Types-Forward:    *Graphics.UI.GtkInternals+x-Types-Destructor: objectUnrefFromMainloop+x-Types-Hierarchy:  hierarchy3.list++Source-Repository head+  type:         git+  location:     https://github.com/gtk2hs/gtksourceview++Library+        build-depends:  base >= 4 && < 5, array, containers, mtl,+                        glib  >= 0.12 && < 0.13++        build-tools:    gtk2hsC2hs >= 0.13.8,+                        gtk2hsHookGenerator, gtk2hsTypeGen++        exposed-modules:+          Graphics.UI.Gtk.SourceView+          Graphics.UI.Gtk.SourceView.Enums+          Graphics.UI.Gtk.SourceView.SourceBuffer+          Graphics.UI.Gtk.SourceView.SourceCompletion+          Graphics.UI.Gtk.SourceView.SourceCompletionContext+          Graphics.UI.Gtk.SourceView.SourceCompletionInfo+          Graphics.UI.Gtk.SourceView.SourceCompletionItem+          Graphics.UI.Gtk.SourceView.SourceCompletionProposal+          Graphics.UI.Gtk.SourceView.SourceCompletionProvider+          Graphics.UI.Gtk.SourceView.SourceGutter+          Graphics.UI.Gtk.SourceView.SourceIter+          Graphics.UI.Gtk.SourceView.SourceLanguage+          Graphics.UI.Gtk.SourceView.SourceLanguageManager+          Graphics.UI.Gtk.SourceView.SourceMark+          Graphics.UI.Gtk.SourceView.SourceStyle+          Graphics.UI.Gtk.SourceView.SourceStyleScheme+          Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager+          Graphics.UI.Gtk.SourceView.SourceUndoManager+          Graphics.UI.Gtk.SourceView.SourceView+        other-modules:+          Graphics.UI.Gtk.SourceView.SourceStyle.Internal+          Graphics.UI.Gtk.SourceView.Types+          Graphics.UI.Gtk.SourceView.Signals++        extensions:     ForeignFunctionInterface++        x-Signals-File:  Graphics/UI/Gtk/SourceView/Signals.chs+        x-Signals-Modname: Graphics.UI.Gtk.SourceView.Signals+        x-Signals-Types: marshal.list++        include-dirs:      .+        x-c2hs-Header:     gtksourceview2.h+        pkgconfig-depends: gtksourceview-3.0 >= 3.0.0+        x-Types-Hierarchy: hierarchy3.list+        build-depends:     gtk3 >=0.12.5.0 && <0.13
+ hierarchy3.list view
@@ -0,0 +1,349 @@+# This list is the result of a copy-and-paste from the GtkObject hierarchy+# html documentation. Deprecated widgets are uncommented. Some additional+# object have been defined at the end of the copied list.++# The Gtk prefix of every object is removed, the other prefixes are+# kept.  The indentation implies the object hierarchy. In case the+# type query function cannot be derived from the name or the type name+# is different, an alternative name and type query function can be+# specified by appending 'as typename, <query_func>'.  In case this+# function is not specified, the <name> is converted to+# gtk_<name'>_get_type where <name'> is <name> where each upperscore+# letter is converted to an underscore and lowerletter. The underscore+# is omitted if an upperscore letter preceeded: GtkHButtonBox ->+# gtk_hbutton_box_get_type. The generation of a type can be+# conditional by appending 'if <tag>'. Such types are only produces if+# --tag=<tag> is given on the command line of TypeGenerator.+++    GObject +		GtkSourceGutter if gtksourceview2+		GtkSourceUndoManager if gtksourceview2+		GtkSourceCompletionProvider if gtksourceview2+		GtkSourceCompletionProposal if gtksourceview2+		GtkSourceCompletionContext if gtksourceview2+		GtkSourceCompletionItem if gtksourceview2+        GtkSourceCompletion if gtksourceview2+        GtkSourceGutterRenderer if gtksourceview2+        GdkDrawable +            GdkWindow		as DrawWindow, gdk_window_object_get_type+#            GdkDrawableImplX11+#                GdkWindowImplX11+            GdkPixmap+            GdkGLPixmap		if gtkglext+            GdkGLWindow		if gtkglext+        GdkColormap+	GdkScreen		if gtk-2.2+	GdkDisplay		if gtk-2.2+	GdkVisual+	GdkDevice+        GtkSettings+        GtkTextBuffer+            GtkSourceBuffer	if sourceview+            GtkSourceBuffer	if gtksourceview2+        GtkTextTag+            GtkSourceTag	if sourceview+        GtkTextTagTable+            GtkSourceTagTable	if sourceview+        GtkStyle+	GtkRcStyle+        GdkDragContext+        GdkPixbuf+	GdkPixbufAnimation+	    GdkPixbufSimpleAnim+	GdkPixbufAnimationIter+        GtkTextChildAnchor+        GtkTextMark+	    GtkSourceMarker	if sourceview+            GtkSourceMark       if gtksourceview2+            GtkWidget+                GtkMisc+                    GtkLabel+                        GtkAccelLabel+                        GtkTipsQuery	if deprecated+                    GtkArrow+                    GtkImage+                GtkContainer+                    WebKitWebView as WebView, webkit_web_view_get_type            if webkit +                    GtkBin+                        GtkAlignment+                        GtkFrame+                            GtkAspectFrame+                        GtkButton+                            GtkToggleButton+                                GtkCheckButton+                                    GtkRadioButton+                            GtkColorButton		if gtk-2.4+                            GtkFontButton		if gtk-2.4+                            GtkOptionMenu		if deprecated+                        GtkItem+                            GtkMenuItem+                                GtkCheckMenuItem+                                    GtkRadioMenuItem+                                GtkTearoffMenuItem+                                GtkImageMenuItem+                                GtkSeparatorMenuItem+                            GtkListItem			if deprecated+#			    GtkTreeItem+                        GtkWindow+							GtkSourceCompletionInfo if gtksourceview2+                            GtkDialog+			    	GtkAboutDialog		if gtk-2.6+                                GtkColorSelectionDialog+                                GtkFileSelection+				GtkFileChooserDialog	if gtk-2.4+                                GtkFontSelectionDialog+                                GtkInputDialog+                                GtkMessageDialog+                            GtkPlug	if plugNsocket+                        GtkEventBox+                        GtkHandleBox+                        GtkScrolledWindow+                        GtkViewport+			GtkExpander			if gtk-2.4+			GtkComboBox			if gtk-2.4+			    GtkComboBoxEntry		if gtk-2.4+			GtkToolItem			if gtk-2.4+			    GtkToolButton		if gtk-2.4+				GtkMenuToolButton	if gtk-2.6+				GtkToggleToolButton	if gtk-2.4+				    GtkRadioToolButton	if gtk-2.4+			    GtkSeparatorToolItem	if gtk-2.4+			GtkMozEmbed		if mozembed+			VteTerminal as Terminal if vte+                    GtkBox+                        GtkButtonBox+                            GtkHButtonBox+                            GtkVButtonBox+                        GtkVBox+                            GtkColorSelection+                            GtkFontSelection+			    GtkFileChooserWidget	if gtk-2.4+                        GtkHBox+                            GtkCombo	if deprecated+                            GtkFileChooserButton	if gtk-2.6+                            GtkStatusbar+                    GtkCList		if deprecated+                        GtkCTree	if deprecated+                    GtkFixed+                    GtkPaned+                        GtkHPaned+                        GtkVPaned+                    GtkIconView		if gtk-2.6+                    GtkLayout+                    GtkList		if deprecated+                    GtkMenuShell+                        GtkMenu+                        GtkMenuBar+                    GtkNotebook+#                    GtkPacker+                    GtkSocket		if plugNsocket+                    GtkTable+                    GtkTextView+                        GtkSourceView	if sourceview+                        GtkSourceView	if gtksourceview2+                    GtkToolbar+                    GtkTreeView+                GtkCalendar+                GtkCellView		if gtk-2.6+		GtkDrawingArea+                GtkEntry+                    GtkSpinButton+                GtkRuler+                    GtkHRuler+                    GtkVRuler+                GtkRange+                    GtkScale+                        GtkHScale+                        GtkVScale+                    GtkScrollbar+                        GtkHScrollbar+                        GtkVScrollbar+                GtkSeparator+                    GtkHSeparator+                    GtkVSeparator+                GtkInvisible+#                GtkOldEditable+#                    GtkText+                GtkPreview		if deprecated+# Progress is deprecated, ProgressBar contains everything necessary+#                GtkProgress+                GtkProgressBar+            GtkAdjustment+            GtkIMContext+                GtkIMMulticontext+            GtkItemFactory		if deprecated+            GtkTooltips+			+# These object were added by hand because they do not show up in the hierarchy+# chart.+# These are derived from GtkObject:+	    GtkTreeViewColumn+	    GtkCellRenderer+		GtkCellRendererPixbuf+		GtkCellRendererText+		    GtkCellRendererCombo	if gtk-2.6+		GtkCellRendererToggle+		GtkCellRendererProgress	if gtk-2.6+	    GtkFileFilter		if gtk-2.4+            GtkBuilder if gtk-2.12+# These are actually interfaces, but all objects that implement it are at+# least GObjects.+	GtkCellLayout			if gtk-2.4+	GtkTreeSortable			if gtk-2.4+	GtkTooltip				if gtk-2.12+# These are derived from GObject:+  	GtkStatusIcon                   if gtk-2.10+        GtkTreeSelection+        GtkTreeModel+            GtkTreeStore+            GtkListStore+	GtkTreeModelSort+	GtkTreeModelFilter		if gtk-2.4+	GtkIconFactory+	GtkIconTheme+	GtkSizeGroup+	GtkClipboard			if gtk-2.2+	GtkAccelGroup+	GtkAccelMap			if gtk-2.4+	GtkEntryCompletion		if gtk-2.4+	GtkAction			if gtk-2.4+	    GtkToggleAction		if gtk-2.4+		GtkRadioAction		if gtk-2.4+	GtkActionGroup			if gtk-2.4+	GtkUIManager			if gtk-2.4+	GtkWindowGroup+        GtkSourceLanguage		if sourceview+        GtkSourceLanguage		if gtksourceview2+        GtkSourceLanguagesManager	if sourceview+        GtkSourceLanguageManager	if gtksourceview2+	GladeXML			as GladeXML, glade_xml_get_type if libglade+	GConfClient			as GConf if gconf+# These ones are actualy interfaces, but interface implementations are GObjects+	GtkEditable+	GtkSourceStyle			as SourceStyleObject if gtksourceview2+	GtkSourceStyleScheme		if sourceview+	GtkSourceStyleScheme		if gtksourceview2+	GtkSourceStyleSchemeManager	if gtksourceview2+	GtkFileChooser			if gtk-2.4+## This now became a GObject in version 2:+	GdkGC				as GC, gdk_gc_get_type+## These are Pango structures+	PangoContext		as PangoContext, pango_context_get_type if pango+	PangoLayout		as PangoLayoutRaw, pango_layout_get_type if pango+	PangoFont		as Font, pango_font_get_type if pango+	PangoFontFamily		as FontFamily, pango_font_family_get_type if pango+	PangoFontFace		as FontFace, pango_font_face_get_type if pango+	PangoFontMap		as FontMap, pango_font_face_get_type if pango+	PangoFontset		as FontSet, pango_fontset_get_type if pango+## This type is only available for PANGO_ENABLE_BACKEND compiled source+##	    PangoFontsetSimple	as FontSetSimple, pango_fontset_simple_get_type++## GtkGlExt classes+	GdkGLContext		if gtkglext+	GdkGLConfig		if gtkglext+	GdkGLDrawable		if gtkglext++## GnomeVFS classes+	GnomeVFSVolume		as Volume, gnome_vfs_volume_get_type if gnomevfs+	GnomeVFSDrive		as Drive, gnome_vfs_drive_get_type if gnomevfs+	GnomeVFSVolumeMonitor	as VolumeMonitor, gnome_vfs_volume_monitor_get_type if gnomevfs++## GIO classes+# Note on all the "as" clauses: the prefix G is unfortunate since it leads+# to two consecutive upper case letters which are not translated with an+# underscore each (e.g. GConf -> gconf, GtkHButtonBox -> gtk_hbutton_box).+#        GUnixMountMonitor		as UnixMountMonitor, g_unix_mount_monitor_get_type if gio+        GOutputStream			as OutputStream, g_output_stream_get_type if gio+            GFilterOutputStream		as FilterOutputStream, g_filter_output_stream_get_type if gio+                GDataOutputStream	as DataOutputStream, g_data_output_stream_get_type if gio+                GBufferedOutputStream   as BufferedOutputStream, g_buffered_output_stream_get_type if gio+#            GUnixOutputStream		as UnixOutputStream, g_unix_output_stream_get_type if gio+            GFileOutputStream           as FileOutputStream, g_file_output_stream_get_type if gio+            GMemoryOutputStream		as MemoryOutputStream, g_memory_output_stream_get_type if gio+        GInputStream			as InputStream, g_input_stream_get_type if gio+#            GUnixInputStream		as UnixInputStream, g_unix_input_stream_get_type if gio+            GMemoryInputStream		as MemoryInputStream, g_memory_input_stream_get_type if gio+            GFilterInputStream		as FilterInputStream, g_filter_input_stream_get_type if gio+                GBufferedInputStream	as BufferedInputStream, g_buffered_input_stream_get_type if gio+                    GDataInputStream	as DataInputStream, g_data_input_stream_get_type if gio+            GFileInputStream		as FileInputStream, g_file_input_stream_get_type if gio+#        GDesktopAppInfo			as DesktopAppInfo, g_desktop_app_info_get_type if gio+        GFileMonitor			as FileMonitor, g_file_monitor_get_type if gio+        GVfs				as Vfs, g_vfs_get_type if gio+        GMountOperation			as MountOperation, g_mount_operation_get_type if gio+        GThemedIcon			as ThemedIcon, g_themed_icon_get_type if gio+        GEmblem			as Emblem, g_emblem_get_type if gio+        GEmblemedIcon			as EmblemedIcon, g_emblemed_icon_get_type if gio+        GFileEnumerator			as FileEnumerator, g_file_enumerator_get_type if gio+        GFilenameCompleter		as FilenameCompleter, g_filename_completer_get_type if gio+        GFileIcon			as FileIcon, g_file_icon_get_type if gio+        GVolumeMonitor			as VolumeMonitor, g_volume_monitor_get_type if gio+        GCancellable			as Cancellable, g_cancellable_get_type if gio+        GSimpleAsyncResult		as SimpleAsyncResult, g_async_result_get_type if gio+        GFileInfo			as FileInfo, g_file_info_get_type if gio+		GAppLaunchContext   as AppLaunchContext, g_app_launch_context_get_type if gio+## these are actually GInterfaces+        GIcon				as Icon, g_icon_get_type if gio+        GSeekable			as Seekable, g_seekable_get_type if gio+        GAppInfo			as AppInfo, g_app_info_get_type if gio+        GVolume				as Volume, g_volume_get_type if gio+        GAsyncResult			as AsyncResult, g_async_result_get_type if gio+        GLoadableIcon			as LoadableIcon, g_loadable_icon_get_type if gio+        GDrive				as Drive, g_drive_get_type if gio+        GFile				noEq as File, g_file_get_type if gio+        GMount				as Mount, g_mount_get_type if gio++## GStreamer classes+	GstObject			as Object,		gst_object_get_type			if gstreamer+	    GstPad			as Pad,			gst_pad_get_type			if gstreamer+	        GstGhostPad		as GhostPad,		gst_ghost_pad_get_type			if gstreamer+	    GstPluginFeature		as PluginFeature,	gst_plugin_feature_get_type		if gstreamer+	        GstElementFactory	as ElementFactory,	gst_element_factory_get_type		if gstreamer+	        GstTypeFindFactory	as TypeFindFactory,	gst_type_find_factory_get_type		if gstreamer+	        GstIndexFactory		as IndexFactory,	gst_index_factory_get_type		if gstreamer+	    GstElement			as Element,		gst_element_get_type			if gstreamer+	        GstBin			as Bin,			gst_bin_get_type			if gstreamer+	            GstPipeline		as Pipeline,		gst_pipeline_get_type			if gstreamer+	        GstImplementsInterface  as ImplementsInterface, gst_implements_interface_get_type	if gstreamer+	        GstTagSetter            as TagSetter,           gst_tag_setter_get_type			if gstreamer+                GstBaseSrc              as BaseSrc,             gst_base_src_get_type			if gstreamer+                    GstPushSrc          as PushSrc,             gst_push_src_get_type                   if gstreamer+                GstBaseSink             as BaseSink,            gst_base_sink_get_type                  if gstreamer+                GstBaseTransform        as BaseTransform,       gst_base_transform_get_type             if gstreamer+	    GstPlugin			as Plugin,		gst_plugin_get_type			if gstreamer+	    GstRegistry			as Registry,		gst_registry_get_type			if gstreamer+	    GstBus			as Bus,			gst_bus_get_type			if gstreamer+	    GstClock			as Clock,		gst_clock_get_type			if gstreamer+	        GstAudioClock		as AudioClock,		gst_audio_clock_get_type		if gstreamer+	        GstSystemClock		as SystemClock,		gst_system_clock_get_type		if gstreamer+                GstNetClientClock       as NetClientClock,      gst_net_client_clock_get_type           if gstreamer+	    GstIndex			as Index,		gst_index_get_type			if gstreamer+	    GstPadTemplate		as PadTemplate,		gst_pad_template_get_type		if gstreamer+	    GstTask			as Task,		gst_task_get_type			if gstreamer+	    GstXML			as XML,			gst_xml_get_type			if gstreamer+	    GstChildProxy               as ChildProxy,          gst_child_proxy_get_type		if gstreamer+            GstCollectPads              as CollectPads,         gst_collect_pads_get_type               if gstreamer+## these are actually GInterfaces+	GstURIHandler                   as URIHandler,          gst_uri_handler_get_type		if gstreamer+        GstAdapter                      as Adapter,             gst_adapter_get_type                    if gstreamer+        GstController                   as Controller,          gst_controller_get_type                 if gstreamer++        WebKitWebFrame as WebFrame, webkit_web_frame_get_type          if webkit +        WebKitWebSettings as WebSettings, webkit_web_settings_get_type    if webkit+        WebKitNetworkRequest as NetworkRequest, webkit_network_request_get_type  if webkit+        WebKitNetworkResponse as NetworkResponse, webkit_network_response_get_type    if webkit+        WebKitDownload as Download, webkit_download_get_type  if webkit+        WebKitWebBackForwardList as WebBackForwardList, webkit_web_back_forward_list_get_type if webkit+        WebKitWebHistoryItem as WebHistoryItem, webkit_web_history_item_get_type if webkit+        WebKitWebInspector as WebInspector, webkit_web_inspector_get_type if webkit+        WebKitHitTestResult as HitTestResult, webkit_hit_test_result_get_type if webkit+        WebKitSecurityOrigin as SecurityOrigin, webkit_security_origin_get_type if webkit+        WebKitSoupAuthDialog as SoupAuthDialog, webkit_soup_auth_dialog_get_type if webkit+        WebKitWebDatabase as WebDatabase, webkit_web_database_get_type if webkit+        WebKitWebDataSource as WebDataSource, webkit_web_data_source_get_type if webkit+        WebKitWebNavigationAction as WebNavigationAction, webkit_web_navigation_action_get_type if webkit+        WebKitWebPolicyDecision as WebPolicyDecision, webkit_web_policy_decision_get_type if webkit+        WebKitWebResource as WebResource, webkit_web_resource_get_type if webkit+        WebKitWebWindowFeatures as WebWindowFeatures, webkit_web_window_features_get_type if webkit+
+ marshal.list view
@@ -0,0 +1,52 @@+# see glib-genmarshal(1) for a detailed description of the file format,+# possible parameter types are:+#   VOID        indicates   no   return   type,  or  no  extra+#               parameters. if VOID is used as  the  parameter+#               list, no additional parameters may be present.+#   BOOLEAN     for boolean types (gboolean)+#   CHAR        for signed char types (gchar)+#   UCHAR       for unsigned char types (guchar)+#   INT         for signed integer types (gint)+#   UINT        for unsigned integer types (guint)+#   LONG        for signed long integer types (glong)+#   ULONG       for unsigned long integer types (gulong)+#   ENUM        for enumeration types (gint)+#   FLAGS       for flag enumeration types (guint)+#   FLOAT       for single-precision float types (gfloat)+#   DOUBLE      for double-precision float types (gdouble)+#   STRING      for string types (gchar*)+#   BOXED       for boxed (anonymous but reference counted) types (GBoxed*)+#   POINTER     for anonymous pointer types (gpointer)+#   NONE        deprecated alias for VOID+#   BOOL        deprecated alias for BOOLEAN++#+# One discrepancy from Gtk+ is that for signals that may pass NULL for an object+# reference, the Haskell signal should be passed a 'Maybe GObject'.+# We therefore have two variants that are marshalled as a maybe type:+#+#   OBJECT      for GObject or derived types (GObject*)+#   MOBJECT      for GObject or derived types (GObject*) that may be NULL++# Furthermore, some objects needs to be destroyed synchronously from the main loop of+# Gtk rather than during GC. These objects need to be marshalled using TOBJECT (for thread-safe+# object). It doesn't hurt to use TOBJECT for an object that doesn't need it, except for the+# some performance. As a rule of thumb, use TOBJECT for all libraries that build on package+# 'gtk' and use OBJECT for all packages that only need packages 'glib', 'pango', 'cairo',+# 'gio'. Again both variants exist. Note that the same names will be generated for OBJECT and+# TOBJECT, so you have to remove the OBJECT handler if you need both.+#+#   TOBJECT      for GObject or derived types (GObject*)+#   MTOBJECT      for GObject or derived types (GObject*) that may be NULL++# If you add a new signal type, please check that it actually works!+# If it is a Boxed type check that the reference counting is right.++NONE:NONE+NONE:OBJECT+NONE:BOXED,BOXED+NONE:BOOL,INT+NONE:BOXED,POINTER+NONE:OBJECT,BOXED,POINTER+BOOL:OBJECT,BOXED,OBJECT+NONE:ENUM,INT