gtk2hs-rpn 0.0.1 → 0.0.2
raw patch · 14 files changed
+741/−735 lines, 14 files
Files
- .hg_archival.txt +1/−1
- .hgtags +1/−0
- LICENSE +143/−0
- examples/Setup.hs +5/−0
- examples/example1.hs +60/−0
- examples/examples.cabal +12/−0
- gtk2hs-rpn.cabal +10/−12
- src/CanBeCasted.hs +0/−508
- src/Graphics/UI/Gtk/Layout/Rpn.hs +1/−1
- src/Graphics/UI/Gtk/Layout/Rpn/CanBeCasted.hs +508/−0
- src/example.hs +0/−60
- src/rpnCompilar.hs +0/−8
- src/rpnTeste.hs +0/−37
- src/rpnTeste2.hs +0/−108
.hg_archival.txt view
@@ -1,2 +1,2 @@ repo: 73f9f23123106e581edbcf74b725d9a23e2eb1f4-node: 7eab16509ef9e1c66dac522e1cfb48701d3ee1e8+node: d6720590f1abaf37f58578d9aa71302681440f8c
+ .hgtags view
@@ -0,0 +1,1 @@+9e2bed8ab08ad6f310093bec0c339ae8f6ddb142 0.0.2
+ LICENSE view
@@ -0,0 +1,143 @@++GNU LESSER GENERAL PUBLIC LICENSE++Version 3, 29 June 2007++Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>++Everyone is permitted to copy and distribute verbatim copies of this license+document, but changing it is not allowed.++This version of the GNU Lesser General Public License incorporates the terms and+conditions of version 3 of the GNU General Public License, supplemented by the+additional permissions listed below.++0. Additional Definitions.++As used herein, “this License” refers to version 3 of the GNU Lesser General Public+License, and the “GNU GPL” refers to version 3 of the GNU General Public License.++“The Library” refers to a covered work governed by this License, other than an+Application or a Combined Work as defined below.++An “Application” is any work that makes use of an interface provided by the Library,+but which is not otherwise based on the Library. Defining a subclass of a class+defined by the Library is deemed a mode of using an interface provided by the+Library.++A “Combined Work” is a work produced by combining or linking an Application with the+Library. The particular version of the Library with which the Combined Work was made+is also called the “Linked Version”.++The “Minimal Corresponding Source” for a Combined Work means the Corresponding+Source for the Combined Work, excluding any source code for portions of the Combined+Work that, considered in isolation, are based on the Application, and not on the+Linked Version.++The “Corresponding Application Code” for a Combined Work means the object code and/+or source code for the Application, including any data and utility programs needed+for reproducing the Combined Work from the Application, but excluding the System+Libraries of the Combined Work.++1. Exception to Section 3 of the GNU GPL.++You may convey a covered work under sections 3 and 4 of this License without being+bound by section 3 of the GNU GPL.++2. Conveying Modified Versions.++If you modify a copy of the Library, and, in your modifications, a facility refers+to a function or data to be supplied by an Application that uses the facility (other+than as an argument passed when the facility is invoked), then you may convey a copy+of the modified version:++ • a) under this License, provided that you make a good faith effort to ensure+ that, in the event an Application does not supply the function or data, the+ facility still operates, and performs whatever part of its purpose remains+ meaningful, or+ • b) under the GNU GPL, with none of the additional permissions of this License+ applicable to that copy.++3. Object Code Incorporating Material from Library Header Files.++The object code form of an Application may incorporate material from a header file+that is part of the Library. You may convey such object code under terms of your+choice, provided that, if the incorporated material is not limited to numerical+parameters, data structure layouts and accessors, or small macros, inline functions+and templates (ten or fewer lines in length), you do both of the following:++ • a) Give prominent notice with each copy of the object code that the Library is+ used in it and that the Library and its use are covered by this License.+ • b) Accompany the object code with a copy of the GNU GPL and this license+ document.++4. Combined Works.++You may convey a Combined Work under terms of your choice that, taken together,+effectively do not restrict modification of the portions of the Library contained in+the Combined Work and reverse engineering for debugging such modifications, if you+also do each of the following:++ • a) Give prominent notice with each copy of the Combined Work that the Library is+ used in it and that the Library and its use are covered by this License.+ • b) Accompany the Combined Work with a copy of the GNU GPL and this license+ document.+ • c) For a Combined Work that displays copyright notices during execution, include+ the copyright notice for the Library among these notices, as well as a reference+ directing the user to the copies of the GNU GPL and this license document.+ • d) Do one of the following:+ □ 0) Convey the Minimal Corresponding Source under the terms of this License,+ and the Corresponding Application Code in a form suitable for, and under+ terms that permit, the user to recombine or relink the Application with a+ modified version of the Linked Version to produce a modified Combined Work,+ in the manner specified by section 6 of the GNU GPL for conveying+ Corresponding Source.+ □ 1) Use a suitable shared library mechanism for linking with the Library. A+ suitable mechanism is one that (a) uses at run time a copy of the Library+ already present on the user's computer system, and (b) will operate properly+ with a modified version of the Library that is interface-compatible with the+ Linked Version.+ • e) Provide Installation Information, but only if you would otherwise be required+ to provide such information under section 6 of the GNU GPL, and only to the+ extent that such information is necessary to install and execute a modified+ version of the Combined Work produced by recombining or relinking the+ Application with a modified version of the Linked Version. (If you use option+ 4d0, the Installation Information must accompany the Minimal Corresponding+ Source and Corresponding Application Code. If you use option 4d1, you must+ provide the Installation Information in the manner specified by section 6 of the+ GNU GPL for conveying Corresponding Source.)++5. Combined Libraries.++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 that are not Applications+and are not covered by this License, and convey such a combined library under terms+of your choice, if you do both of the following:++ • a) Accompany the combined library with a copy of the same work based on the+ Library, uncombined with any other library facilities, conveyed under the terms+ of this License.+ • b) Give prominent notice with the combined library that part of it is a work+ based on the Library, and explaining where to find the accompanying uncombined+ form of the same work.++6. Revised Versions of the GNU Lesser General Public License.++The Free Software Foundation may publish revised and/or new versions of the GNU+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 as you+received it specifies that a certain numbered version of the GNU Lesser General+Public License “or any later version” applies to it, you have the option of+following the terms and conditions either of that published version or of any later+version published by the Free Software Foundation. If the Library as you received it+does not specify a version number of the GNU Lesser General Public License, you may+choose any version of the GNU Lesser General Public License ever published by the+Free Software Foundation.++If the Library as you received it specifies that a proxy can decide whether future+versions of the GNU Lesser General Public License shall apply, that proxy's public+statement of acceptance of any version is permanent authorization for you to choose+that version for the Library.
+ examples/Setup.hs view
@@ -0,0 +1,5 @@+#!/usr/bin/env runhaskell++import Distribution.Simple++main = defaultMain
+ examples/example1.hs view
@@ -0,0 +1,60 @@+module Main where+import Graphics.UI.Gtk+import Graphics.UI.Gtk.Gdk.EventM+import Graphics.Rendering.Cairo+import Graphics.UI.Gtk.Layout.Rpn+import Data.Monoid++title :: String -> [AttrOp Window]+title s = [windowTitle := s]+pressed :: Signal Widget (EventM EButton Bool)+pressed = buttonPressEvent++main = do+ initGUI++ -- Create a new operator ('line') that takes a label+ -- ('cLBL') and a button ('cBTNL') and pack then ('pBPED')+ -- in a horizontal box ('cHBX').++ let line s = mconcat [+ cLBL (Just $ s ++ ":"),+ cBTNL s,+ cHBX True 0,+ pBPED,+ pBPED]++ -- Create a new operator ('column') that packs many 'line'+ -- in a vertical box ('cVBX').++ let column = mconcat $ [+ line "One Button",+ line "Another Button",+ line "Yet Another Button",+ line "Last Button",+ cVBX True 0] ++ replicate 4 pBPED++ -- Take two copies of 'column' and add ('pNAP') then+ -- to a notebook ('cNBK'). Then create a stock button+ -- ('cBTNSTK') and attach a action to an event ('tON'). Then+ -- join the notebook and that button in a vertical box.+ -- Insert everything in a main window ('cWND, pCA'), and+ -- finally make everything into widgets ('widgetsFromRpn').++ [mainWindow] <- widgetsFromRpn $ mconcat $ [+ column,+ column,+ cNBK,+ pNAP "First Page",+ pNAP "Second Page",+ cBTNSTK stockQuit,+ tON pressed (liftIO mainQuit >> return True),+ cVBX False 0,+ pBPE PackNatural 0,+ pBPED,+ cWND,+ pCA,+ tSET (title "Layout.RPN Example")]++ widgetShowAll mainWindow+ mainGUI
+ examples/examples.cabal view
@@ -0,0 +1,12 @@+cabal-Version: >= 1.2+name: gtk2hs-rpn-examples+version: 1+build-type: Simple+license: PublicDomain+maintainer: Maurício CA <mauricio.antunes@gmail.com>+Executable example1+ main-is: example1.hs+ build-depends: base, gtk, gtk2hs-rpn, mtl, cairo+ hs-source-dirs: .+ extensions:+ NoMonomorphismRestriction
gtk2hs-rpn.cabal view
@@ -1,17 +1,20 @@ cabal-Version: >= 1.2 name: gtk2hs-rpn-version: 0.0.1+version: 0.0.2 synopsis: Adds a module to gtk2hs allowing layouts to be defined using reverse polish notation. description:- Adds a module 'Graphics.UI.Gtk.Layout.Rpn' to- gtk2hs. This module defines a type 'RPN' for- operators, and is an instance of Monoid class.- You can combine those operators to define a- layout, as well as buttons and other widgets.+ Adds a module 'Graphics.UI.Gtk.Layout.Rpn' to gtk2hs. This+ module defines a type 'RPN' for operators, and is an instance+ of Monoid class. You can combine those operators using reverse+ polish notation, as made popular by, say, HP calculators. There+ are operators for layout elements, like expanders, panes,+ boxes and notebooks, and for a few other widgets, like buttons+ and labels. You can include any gtk2hs widget in the stack. build-type: Simple license: LGPL+license-file: LICENSE maintainer: Maurício CA <mauricio.antunes@gmail.com> category: GUI Library@@ -21,9 +24,4 @@ NoMonomorphismRestriction exposed-modules: Graphics.UI.Gtk.Layout.Rpn-Executable example- main-is: example.hs- build-depends: base, gtk >= 0.10, cairo- hs-source-dirs: src- extensions:- NoMonomorphismRestriction+ Graphics.UI.Gtk.Layout.Rpn.CanBeCasted
− src/CanBeCasted.hs
@@ -1,508 +0,0 @@-module CanBeCasted where {-import Graphics.UI.Gtk ;-import Graphics.UI.Gtk.Types ;-- class ( GObjectClass g ) => CanBeCasted g where {- glibCast :: ( GObjectClass o ) => o -> Maybe g ;- glibCast a = if isA a t then Just ( c a ) else Nothing- where { ( t , c ) = castData } ;- castData :: ( GObjectClass g1 ) => ( GType , g1 -> g )- } ;-- instance CanBeCasted AboutDialog where {- castData = ( gTypeAboutDialog , castToAboutDialog )- } ;- instance CanBeCasted AccelLabel where {- castData = ( gTypeAccelLabel , castToAccelLabel )- } ;- instance CanBeCasted Action where {- castData = ( gTypeAction , castToAction )- } ;- instance CanBeCasted ActionGroup where {- castData = ( gTypeActionGroup , castToActionGroup )- } ;--- instance CanBeCasted Adapter where {--- castData = ( gTypeAdapter , castToAdapter )--- } ;- instance CanBeCasted Adjustment where {- castData = ( gTypeAdjustment , castToAdjustment )- } ;- instance CanBeCasted Alignment where {- castData = ( gTypeAlignment , castToAlignment )- } ;- instance CanBeCasted Arrow where {- castData = ( gTypeArrow , castToArrow )- } ;- instance CanBeCasted AspectFrame where {- castData = ( gTypeAspectFrame , castToAspectFrame )- } ;--- instance CanBeCasted BaseSink where {--- castData = ( gTypeBaseSink , castToBaseSink )--- } ;--- instance CanBeCasted BaseSrc where {--- castData = ( gTypeBaseSrc , castToBaseSrc )--- } ;--- instance CanBeCasted BaseTransform where {--- castData = ( gTypeBaseTransform , castToBaseTransform )--- } ;- instance CanBeCasted Bin where {- castData = ( gTypeBin , castToBin )- } ;- instance CanBeCasted Box where {- castData = ( gTypeBox , castToBox )- } ;--- instance CanBeCasted Buffer where {--- castData = ( gTypeBuffer , castToBuffer )--- } ;--- instance CanBeCasted Bus where {--- castData = ( gTypeBus , castToBus )--- } ;- instance CanBeCasted Button where {- castData = ( gTypeButton , castToButton )- } ;- instance CanBeCasted ButtonBox where {- castData = ( gTypeButtonBox , castToButtonBox )- } ;- instance CanBeCasted Calendar where {- castData = ( gTypeCalendar , castToCalendar )- } ;- instance CanBeCasted CellRenderer where {- castData = ( gTypeCellRenderer , castToCellRenderer )- } ;- instance CanBeCasted CellRendererCombo where {- castData = ( gTypeCellRendererCombo , castToCellRendererCombo )- } ;- instance CanBeCasted CellRendererPixbuf where {- castData = ( gTypeCellRendererPixbuf , castToCellRendererPixbuf )- } ;- instance CanBeCasted CellRendererProgress where {- castData = ( gTypeCellRendererProgress , castToCellRendererProgress )- } ;- instance CanBeCasted CellRendererText where {- castData = ( gTypeCellRendererText , castToCellRendererText )- } ;- instance CanBeCasted CellRendererToggle where {- castData = ( gTypeCellRendererToggle , castToCellRendererToggle )- } ;- instance CanBeCasted CellView where {- castData = ( gTypeCellView , castToCellView )- } ;- instance CanBeCasted CheckButton where {- castData = ( gTypeCheckButton , castToCheckButton )- } ;- instance CanBeCasted CheckMenuItem where {- castData = ( gTypeCheckMenuItem , castToCheckMenuItem )- } ;- instance CanBeCasted Clipboard where {- castData = ( gTypeClipboard , castToClipboard )- } ;--- instance CanBeCasted Clock where {--- castData = ( gTypeClock , castToClock )--- } ;- instance CanBeCasted ColorButton where {- castData = ( gTypeColorButton , castToColorButton )- } ;- instance CanBeCasted ColorSelection where {- castData = ( gTypeColorSelection , castToColorSelection )- } ;- instance CanBeCasted ColorSelectionDialog where {- castData = ( gTypeColorSelectionDialog , castToColorSelectionDialog )- } ;- instance CanBeCasted Combo where {- castData = ( gTypeCombo , castToCombo )- } ;- instance CanBeCasted ComboBox where {- castData = ( gTypeComboBox , castToComboBox )- } ;- instance CanBeCasted ComboBoxEntry where {- castData = ( gTypeComboBoxEntry , castToComboBoxEntry )- } ;- instance CanBeCasted Container where {- castData = ( gTypeContainer , castToContainer )- } ;- instance CanBeCasted Dialog where {- castData = ( gTypeDialog , castToDialog )- } ;- instance CanBeCasted DragContext where {- castData = ( gTypeDragContext , castToDragContext )- } ;- instance CanBeCasted DrawWindow where {- castData = ( gTypeDrawWindow , castToDrawWindow )- } ;- instance CanBeCasted Drawable where {- castData = ( gTypeDrawable , castToDrawable )- } ;- instance CanBeCasted DrawingArea where {- castData = ( gTypeDrawingArea , castToDrawingArea )- } ;--- instance CanBeCasted Drive where {--- castData = ( gTypeDrive , castToDrive )--- } ;- instance CanBeCasted Editable where {- castData = ( gTypeEditable , castToEditable )- } ;--- instance CanBeCasted Element where {--- castData = ( gTypeElement , castToElement )--- } ;--- instance CanBeCasted ElementFactory where {--- castData = ( gTypeElementFactory , castToElementFactory )--- } ;- instance CanBeCasted Entry where {- castData = ( gTypeEntry , castToEntry )- } ;- instance CanBeCasted EntryCompletion where {- castData = ( gTypeEntryCompletion , castToEntryCompletion )- } ;- instance CanBeCasted EventBox where {- castData = ( gTypeEventBox , castToEventBox )- } ;- instance CanBeCasted Expander where {- castData = ( gTypeExpander , castToExpander )- } ;- instance CanBeCasted FileChooser where {- castData = ( gTypeFileChooser , castToFileChooser )- } ;- instance CanBeCasted FileChooserButton where {- castData = ( gTypeFileChooserButton , castToFileChooserButton )- } ;- instance CanBeCasted FileChooserDialog where {- castData = ( gTypeFileChooserDialog , castToFileChooserDialog )- } ;- instance CanBeCasted FileChooserWidget where {- castData = ( gTypeFileChooserWidget , castToFileChooserWidget )- } ;- instance CanBeCasted FileFilter where {- castData = ( gTypeFileFilter , castToFileFilter )- } ;- instance CanBeCasted FileSelection where {- castData = ( gTypeFileSelection , castToFileSelection )- } ;- instance CanBeCasted Fixed where {- castData = ( gTypeFixed , castToFixed )- } ;- instance CanBeCasted FontButton where {- castData = ( gTypeFontButton , castToFontButton )- } ;- instance CanBeCasted FontSelection where {- castData = ( gTypeFontSelection , castToFontSelection )- } ;- instance CanBeCasted FontSelectionDialog where {- castData = ( gTypeFontSelectionDialog , castToFontSelectionDialog )- } ;- instance CanBeCasted Frame where {- castData = ( gTypeFrame , castToFrame )- } ;- instance CanBeCasted GC where {- castData = ( gTypeGC , castToGC )- } ;--- instance CanBeCasted GLConfig where {--- castData = ( gTypeGLConfig , castToGLConfig )--- } ;--- instance CanBeCasted GLContext where {--- castData = ( gTypeGLContext , castToGLContext )--- } ;--- instance CanBeCasted GLDrawable where {--- castData = ( gTypeGLDrawable , castToGLDrawable )--- } ;--- instance CanBeCasted GLPixmap where {--- castData = ( gTypeGLPixmap , castToGLPixmap )--- } ;--- instance CanBeCasted GLWindow where {--- castData = ( gTypeGLWindow , castToGLWindow )--- } ;--- instance CanBeCasted GhostPad where {--- castData = ( gTypeGhostPad , castToGhostPad )--- } ;- instance CanBeCasted HBox where {- castData = ( gTypeHBox , castToHBox )- } ;- instance CanBeCasted HButtonBox where {- castData = ( gTypeHButtonBox , castToHButtonBox )- } ;- instance CanBeCasted HPaned where {- castData = ( gTypeHPaned , castToHPaned )- } ;- instance CanBeCasted HScale where {- castData = ( gTypeHScale , castToHScale )- } ;- instance CanBeCasted HScrollbar where {- castData = ( gTypeHScrollbar , castToHScrollbar )- } ;- instance CanBeCasted HSeparator where {- castData = ( gTypeHSeparator , castToHSeparator )- } ;- instance CanBeCasted HandleBox where {- castData = ( gTypeHandleBox , castToHandleBox )- } ;- instance CanBeCasted IconFactory where {- castData = ( gTypeIconFactory , castToIconFactory )- } ;- instance CanBeCasted IconView where {- castData = ( gTypeIconView , castToIconView )- } ;- instance CanBeCasted Image where {- castData = ( gTypeImage , castToImage )- } ;- instance CanBeCasted ImageMenuItem where {- castData = ( gTypeImageMenuItem , castToImageMenuItem )- } ;--- instance CanBeCasted ImplementsInterface where {--- castData = ( gTypeImplementsInterface , castToImplementsInterface )--- } ;--- instance CanBeCasted Index where {--- castData = ( gTypeIndex , castToIndex )--- } ;--- instance CanBeCasted IndexFactory where {--- castData = ( gTypeIndexFactory , castToIndexFactory )--- } ;- instance CanBeCasted Label where {- castData = ( gTypeLabel , castToLabel )- } ;- instance CanBeCasted Layout where {- castData = ( gTypeLayout , castToLayout )- } ;- instance CanBeCasted Menu where {- castData = ( gTypeMenu , castToMenu )- } ;- instance CanBeCasted MenuBar where {- castData = ( gTypeMenuBar , castToMenuBar )- } ;- instance CanBeCasted MenuItem where {- castData = ( gTypeMenuItem , castToMenuItem )- } ;- instance CanBeCasted MenuShell where {- castData = ( gTypeMenuShell , castToMenuShell )- } ;- instance CanBeCasted MenuToolButton where {- castData = ( gTypeMenuToolButton , castToMenuToolButton )- } ;--- instance CanBeCasted Message where {--- castData = ( gTypeMessage , castToMessage )--- } ;- instance CanBeCasted MessageDialog where {- castData = ( gTypeMessageDialog , castToMessageDialog )- } ;--- instance CanBeCasted MiniObject where {--- castData = ( gTypeMiniObject , castToMiniObject )--- } ;- instance CanBeCasted Misc where {- castData = ( gTypeMisc , castToMisc )- } ;- instance CanBeCasted Notebook where {- castData = ( gTypeNotebook , castToNotebook )- } ;- instance CanBeCasted Object where {- castData = ( gTypeObject , castToObject )- } ;- instance CanBeCasted OptionMenu where {- castData = ( gTypeOptionMenu , castToOptionMenu )- } ;--- instance CanBeCasted Pad where {--- castData = ( gTypePad , castToPad )--- } ;--- instance CanBeCasted PadTemplate where {--- castData = ( gTypePadTemplate , castToPadTemplate )--- } ;- instance CanBeCasted Paned where {- castData = ( gTypePaned , castToPaned )- } ;--- instance CanBeCasted Pipeline where {--- castData = ( gTypePipeline , castToPipeline )--- } ;- instance CanBeCasted Pixbuf where {- castData = ( gTypePixbuf , castToPixbuf )- } ;- instance CanBeCasted Plug where {- castData = ( gTypePlug , castToPlug )- } ;--- instance CanBeCasted Plugin where {--- castData = ( gTypePlugin , castToPlugin )--- } ;--- instance CanBeCasted PluginFeature where {--- castData = ( gTypePluginFeature , castToPluginFeature )--- } ;- instance CanBeCasted ProgressBar where {- castData = ( gTypeProgressBar , castToProgressBar )- } ;--- instance CanBeCasted PushSrc where {--- castData = ( gTypePushSrc , castToPushSrc )--- } ;--- instance CanBeCasted Query where {--- castData = ( gTypeQuery , castToQuery )--- } ;- instance CanBeCasted RadioAction where {- castData = ( gTypeRadioAction , castToRadioAction )- } ;- instance CanBeCasted RadioButton where {- castData = ( gTypeRadioButton , castToRadioButton )- } ;- instance CanBeCasted RadioMenuItem where {- castData = ( gTypeRadioMenuItem , castToRadioMenuItem )- } ;- instance CanBeCasted RadioToolButton where {- castData = ( gTypeRadioToolButton , castToRadioToolButton )- } ;- instance CanBeCasted Range where {- castData = ( gTypeRange , castToRange )- } ;--- instance CanBeCasted Registry where {--- castData = ( gTypeRegistry , castToRegistry )--- } ;- instance CanBeCasted Scale where {- castData = ( gTypeScale , castToScale )- } ;- instance CanBeCasted Screen where {- castData = ( gTypeScreen , castToScreen )- } ;- instance CanBeCasted Scrollbar where {- castData = ( gTypeScrollbar , castToScrollbar )- } ;- instance CanBeCasted ScrolledWindow where {- castData = ( gTypeScrolledWindow , castToScrolledWindow )- } ;- instance CanBeCasted Separator where {- castData = ( gTypeSeparator , castToSeparator )- } ;- instance CanBeCasted SeparatorMenuItem where {- castData = ( gTypeSeparatorMenuItem , castToSeparatorMenuItem )- } ;- instance CanBeCasted SeparatorToolItem where {- castData = ( gTypeSeparatorToolItem , castToSeparatorToolItem )- } ;- instance CanBeCasted SizeGroup where {- castData = ( gTypeSizeGroup , castToSizeGroup )- } ;- instance CanBeCasted Socket where {- castData = ( gTypeSocket , castToSocket )- } ;--- instance CanBeCasted SourceBuffer where {--- castData = ( gTypeSourceBuffer , castToSourceBuffer )--- } ;--- instance CanBeCasted SourceLanguage where {--- castData = ( gTypeSourceLanguage , castToSourceLanguage )--- } ;--- instance CanBeCasted SourceLanguageManager where {--- castData = ( gTypeSourceLanguageManager , castToSourceLanguageManager )--- } ;--- instance CanBeCasted SourceMark where {--- castData = ( gTypeSourceMark , castToSourceMark )--- } ;--- instance CanBeCasted SourceStyleScheme where {--- castData = ( gTypeSourceStyleScheme , castToSourceStyleScheme )--- } ;--- instance CanBeCasted SourceView where {--- castData = ( gTypeSourceView , castToSourceView )--- } ;- instance CanBeCasted SpinButton where {- castData = ( gTypeSpinButton , castToSpinButton )- } ;- instance CanBeCasted StatusIcon where {- castData = ( gTypeStatusIcon , castToStatusIcon )- } ;- instance CanBeCasted Statusbar where {- castData = ( gTypeStatusbar , castToStatusbar )- } ;- instance CanBeCasted Style where {- castData = ( gTypeStyle , castToStyle )- } ;--- instance CanBeCasted SystemClock where {--- castData = ( gTypeSystemClock , castToSystemClock )--- } ;- instance CanBeCasted Table where {- castData = ( gTypeTable , castToTable )- } ;- instance CanBeCasted TearoffMenuItem where {- castData = ( gTypeTearoffMenuItem , castToTearoffMenuItem )- } ;- instance CanBeCasted TextBuffer where {- castData = ( gTypeTextBuffer , castToTextBuffer )- } ;- instance CanBeCasted TextMark where {- castData = ( gTypeTextMark , castToTextMark )- } ;- instance CanBeCasted TextTag where {- castData = ( gTypeTextTag , castToTextTag )- } ;- instance CanBeCasted TextTagTable where {- castData = ( gTypeTextTagTable , castToTextTagTable )- } ;- instance CanBeCasted TextView where {- castData = ( gTypeTextView , castToTextView )- } ;- instance CanBeCasted ToggleAction where {- castData = ( gTypeToggleAction , castToToggleAction )- } ;- instance CanBeCasted ToggleButton where {- castData = ( gTypeToggleButton , castToToggleButton )- } ;- instance CanBeCasted ToggleToolButton where {- castData = ( gTypeToggleToolButton , castToToggleToolButton )- } ;- instance CanBeCasted ToolButton where {- castData = ( gTypeToolButton , castToToolButton )- } ;- instance CanBeCasted ToolItem where {- castData = ( gTypeToolItem , castToToolItem )- } ;- instance CanBeCasted Toolbar where {- castData = ( gTypeToolbar , castToToolbar )- } ;- instance CanBeCasted Tooltips where {- castData = ( gTypeTooltips , castToTooltips )- } ;- instance CanBeCasted TreeModel where {- castData = ( gTypeTreeModel , castToTreeModel )- } ;- instance CanBeCasted TreeModelSort where {- castData = ( gTypeTreeModelSort , castToTreeModelSort )- } ;- instance CanBeCasted TreeSelection where {- castData = ( gTypeTreeSelection , castToTreeSelection )- } ;- instance CanBeCasted TreeSortable where {- castData = ( gTypeTreeSortable , castToTreeSortable )- } ;- instance CanBeCasted TreeView where {- castData = ( gTypeTreeView , castToTreeView )- } ;- instance CanBeCasted TreeViewColumn where {- castData = ( gTypeTreeViewColumn , castToTreeViewColumn )- } ;- instance CanBeCasted UIManager where {- castData = ( gTypeUIManager , castToUIManager )- } ;- instance CanBeCasted VBox where {- castData = ( gTypeVBox , castToVBox )- } ;- instance CanBeCasted VButtonBox where {- castData = ( gTypeVButtonBox , castToVButtonBox )- } ;- instance CanBeCasted VPaned where {- castData = ( gTypeVPaned , castToVPaned )- } ;- instance CanBeCasted VScale where {- castData = ( gTypeVScale , castToVScale )- } ;- instance CanBeCasted VScrollbar where {- castData = ( gTypeVScrollbar , castToVScrollbar )- } ;- instance CanBeCasted VSeparator where {- castData = ( gTypeVSeparator , castToVSeparator )- } ;- instance CanBeCasted Viewport where {- castData = ( gTypeViewport , castToViewport )- } ;--- instance CanBeCasted Volume where {--- castData = ( gTypeVolume , castToVolume )--- } ;- instance CanBeCasted Widget where {- castData = ( gTypeWidget , castToWidget )- } ;- instance CanBeCasted Window where {- castData = ( gTypeWindow , castToWindow )- } ;- instance CanBeCasted WindowGroup where {- castData = ( gTypeWindowGroup , castToWindowGroup )- }--}
src/Graphics/UI/Gtk/Layout/Rpn.hs view
@@ -7,7 +7,7 @@ import Data.IORef ; import Data.Maybe ; import Data.List ;-import CanBeCasted ;+import Graphics.UI.Gtk.Layout.Rpn.CanBeCasted ; doNothing :: (Monad m) => m () ; doNothing = return () ;
+ src/Graphics/UI/Gtk/Layout/Rpn/CanBeCasted.hs view
@@ -0,0 +1,508 @@+module Graphics.UI.Gtk.Layout.Rpn.CanBeCasted where {+import Graphics.UI.Gtk ;+import Graphics.UI.Gtk.Types ;++ class ( GObjectClass g ) => CanBeCasted g where {+ glibCast :: ( GObjectClass o ) => o -> Maybe g ;+ glibCast a = if isA a t then Just ( c a ) else Nothing+ where { ( t , c ) = castData } ;+ castData :: ( GObjectClass g1 ) => ( GType , g1 -> g )+ } ;++ instance CanBeCasted AboutDialog where {+ castData = ( gTypeAboutDialog , castToAboutDialog )+ } ;+ instance CanBeCasted AccelLabel where {+ castData = ( gTypeAccelLabel , castToAccelLabel )+ } ;+ instance CanBeCasted Action where {+ castData = ( gTypeAction , castToAction )+ } ;+ instance CanBeCasted ActionGroup where {+ castData = ( gTypeActionGroup , castToActionGroup )+ } ;+-- instance CanBeCasted Adapter where {+-- castData = ( gTypeAdapter , castToAdapter )+-- } ;+ instance CanBeCasted Adjustment where {+ castData = ( gTypeAdjustment , castToAdjustment )+ } ;+ instance CanBeCasted Alignment where {+ castData = ( gTypeAlignment , castToAlignment )+ } ;+ instance CanBeCasted Arrow where {+ castData = ( gTypeArrow , castToArrow )+ } ;+ instance CanBeCasted AspectFrame where {+ castData = ( gTypeAspectFrame , castToAspectFrame )+ } ;+-- instance CanBeCasted BaseSink where {+-- castData = ( gTypeBaseSink , castToBaseSink )+-- } ;+-- instance CanBeCasted BaseSrc where {+-- castData = ( gTypeBaseSrc , castToBaseSrc )+-- } ;+-- instance CanBeCasted BaseTransform where {+-- castData = ( gTypeBaseTransform , castToBaseTransform )+-- } ;+ instance CanBeCasted Bin where {+ castData = ( gTypeBin , castToBin )+ } ;+ instance CanBeCasted Box where {+ castData = ( gTypeBox , castToBox )+ } ;+-- instance CanBeCasted Buffer where {+-- castData = ( gTypeBuffer , castToBuffer )+-- } ;+-- instance CanBeCasted Bus where {+-- castData = ( gTypeBus , castToBus )+-- } ;+ instance CanBeCasted Button where {+ castData = ( gTypeButton , castToButton )+ } ;+ instance CanBeCasted ButtonBox where {+ castData = ( gTypeButtonBox , castToButtonBox )+ } ;+ instance CanBeCasted Calendar where {+ castData = ( gTypeCalendar , castToCalendar )+ } ;+ instance CanBeCasted CellRenderer where {+ castData = ( gTypeCellRenderer , castToCellRenderer )+ } ;+ instance CanBeCasted CellRendererCombo where {+ castData = ( gTypeCellRendererCombo , castToCellRendererCombo )+ } ;+ instance CanBeCasted CellRendererPixbuf where {+ castData = ( gTypeCellRendererPixbuf , castToCellRendererPixbuf )+ } ;+ instance CanBeCasted CellRendererProgress where {+ castData = ( gTypeCellRendererProgress , castToCellRendererProgress )+ } ;+ instance CanBeCasted CellRendererText where {+ castData = ( gTypeCellRendererText , castToCellRendererText )+ } ;+ instance CanBeCasted CellRendererToggle where {+ castData = ( gTypeCellRendererToggle , castToCellRendererToggle )+ } ;+ instance CanBeCasted CellView where {+ castData = ( gTypeCellView , castToCellView )+ } ;+ instance CanBeCasted CheckButton where {+ castData = ( gTypeCheckButton , castToCheckButton )+ } ;+ instance CanBeCasted CheckMenuItem where {+ castData = ( gTypeCheckMenuItem , castToCheckMenuItem )+ } ;+ instance CanBeCasted Clipboard where {+ castData = ( gTypeClipboard , castToClipboard )+ } ;+-- instance CanBeCasted Clock where {+-- castData = ( gTypeClock , castToClock )+-- } ;+ instance CanBeCasted ColorButton where {+ castData = ( gTypeColorButton , castToColorButton )+ } ;+ instance CanBeCasted ColorSelection where {+ castData = ( gTypeColorSelection , castToColorSelection )+ } ;+ instance CanBeCasted ColorSelectionDialog where {+ castData = ( gTypeColorSelectionDialog , castToColorSelectionDialog )+ } ;+ instance CanBeCasted Combo where {+ castData = ( gTypeCombo , castToCombo )+ } ;+ instance CanBeCasted ComboBox where {+ castData = ( gTypeComboBox , castToComboBox )+ } ;+ instance CanBeCasted ComboBoxEntry where {+ castData = ( gTypeComboBoxEntry , castToComboBoxEntry )+ } ;+ instance CanBeCasted Container where {+ castData = ( gTypeContainer , castToContainer )+ } ;+ instance CanBeCasted Dialog where {+ castData = ( gTypeDialog , castToDialog )+ } ;+ instance CanBeCasted DragContext where {+ castData = ( gTypeDragContext , castToDragContext )+ } ;+ instance CanBeCasted DrawWindow where {+ castData = ( gTypeDrawWindow , castToDrawWindow )+ } ;+ instance CanBeCasted Drawable where {+ castData = ( gTypeDrawable , castToDrawable )+ } ;+ instance CanBeCasted DrawingArea where {+ castData = ( gTypeDrawingArea , castToDrawingArea )+ } ;+-- instance CanBeCasted Drive where {+-- castData = ( gTypeDrive , castToDrive )+-- } ;+ instance CanBeCasted Editable where {+ castData = ( gTypeEditable , castToEditable )+ } ;+-- instance CanBeCasted Element where {+-- castData = ( gTypeElement , castToElement )+-- } ;+-- instance CanBeCasted ElementFactory where {+-- castData = ( gTypeElementFactory , castToElementFactory )+-- } ;+ instance CanBeCasted Entry where {+ castData = ( gTypeEntry , castToEntry )+ } ;+ instance CanBeCasted EntryCompletion where {+ castData = ( gTypeEntryCompletion , castToEntryCompletion )+ } ;+ instance CanBeCasted EventBox where {+ castData = ( gTypeEventBox , castToEventBox )+ } ;+ instance CanBeCasted Expander where {+ castData = ( gTypeExpander , castToExpander )+ } ;+ instance CanBeCasted FileChooser where {+ castData = ( gTypeFileChooser , castToFileChooser )+ } ;+ instance CanBeCasted FileChooserButton where {+ castData = ( gTypeFileChooserButton , castToFileChooserButton )+ } ;+ instance CanBeCasted FileChooserDialog where {+ castData = ( gTypeFileChooserDialog , castToFileChooserDialog )+ } ;+ instance CanBeCasted FileChooserWidget where {+ castData = ( gTypeFileChooserWidget , castToFileChooserWidget )+ } ;+ instance CanBeCasted FileFilter where {+ castData = ( gTypeFileFilter , castToFileFilter )+ } ;+ instance CanBeCasted FileSelection where {+ castData = ( gTypeFileSelection , castToFileSelection )+ } ;+ instance CanBeCasted Fixed where {+ castData = ( gTypeFixed , castToFixed )+ } ;+ instance CanBeCasted FontButton where {+ castData = ( gTypeFontButton , castToFontButton )+ } ;+ instance CanBeCasted FontSelection where {+ castData = ( gTypeFontSelection , castToFontSelection )+ } ;+ instance CanBeCasted FontSelectionDialog where {+ castData = ( gTypeFontSelectionDialog , castToFontSelectionDialog )+ } ;+ instance CanBeCasted Frame where {+ castData = ( gTypeFrame , castToFrame )+ } ;+ instance CanBeCasted GC where {+ castData = ( gTypeGC , castToGC )+ } ;+-- instance CanBeCasted GLConfig where {+-- castData = ( gTypeGLConfig , castToGLConfig )+-- } ;+-- instance CanBeCasted GLContext where {+-- castData = ( gTypeGLContext , castToGLContext )+-- } ;+-- instance CanBeCasted GLDrawable where {+-- castData = ( gTypeGLDrawable , castToGLDrawable )+-- } ;+-- instance CanBeCasted GLPixmap where {+-- castData = ( gTypeGLPixmap , castToGLPixmap )+-- } ;+-- instance CanBeCasted GLWindow where {+-- castData = ( gTypeGLWindow , castToGLWindow )+-- } ;+-- instance CanBeCasted GhostPad where {+-- castData = ( gTypeGhostPad , castToGhostPad )+-- } ;+ instance CanBeCasted HBox where {+ castData = ( gTypeHBox , castToHBox )+ } ;+ instance CanBeCasted HButtonBox where {+ castData = ( gTypeHButtonBox , castToHButtonBox )+ } ;+ instance CanBeCasted HPaned where {+ castData = ( gTypeHPaned , castToHPaned )+ } ;+ instance CanBeCasted HScale where {+ castData = ( gTypeHScale , castToHScale )+ } ;+ instance CanBeCasted HScrollbar where {+ castData = ( gTypeHScrollbar , castToHScrollbar )+ } ;+ instance CanBeCasted HSeparator where {+ castData = ( gTypeHSeparator , castToHSeparator )+ } ;+ instance CanBeCasted HandleBox where {+ castData = ( gTypeHandleBox , castToHandleBox )+ } ;+ instance CanBeCasted IconFactory where {+ castData = ( gTypeIconFactory , castToIconFactory )+ } ;+ instance CanBeCasted IconView where {+ castData = ( gTypeIconView , castToIconView )+ } ;+ instance CanBeCasted Image where {+ castData = ( gTypeImage , castToImage )+ } ;+ instance CanBeCasted ImageMenuItem where {+ castData = ( gTypeImageMenuItem , castToImageMenuItem )+ } ;+-- instance CanBeCasted ImplementsInterface where {+-- castData = ( gTypeImplementsInterface , castToImplementsInterface )+-- } ;+-- instance CanBeCasted Index where {+-- castData = ( gTypeIndex , castToIndex )+-- } ;+-- instance CanBeCasted IndexFactory where {+-- castData = ( gTypeIndexFactory , castToIndexFactory )+-- } ;+ instance CanBeCasted Label where {+ castData = ( gTypeLabel , castToLabel )+ } ;+ instance CanBeCasted Layout where {+ castData = ( gTypeLayout , castToLayout )+ } ;+ instance CanBeCasted Menu where {+ castData = ( gTypeMenu , castToMenu )+ } ;+ instance CanBeCasted MenuBar where {+ castData = ( gTypeMenuBar , castToMenuBar )+ } ;+ instance CanBeCasted MenuItem where {+ castData = ( gTypeMenuItem , castToMenuItem )+ } ;+ instance CanBeCasted MenuShell where {+ castData = ( gTypeMenuShell , castToMenuShell )+ } ;+ instance CanBeCasted MenuToolButton where {+ castData = ( gTypeMenuToolButton , castToMenuToolButton )+ } ;+-- instance CanBeCasted Message where {+-- castData = ( gTypeMessage , castToMessage )+-- } ;+ instance CanBeCasted MessageDialog where {+ castData = ( gTypeMessageDialog , castToMessageDialog )+ } ;+-- instance CanBeCasted MiniObject where {+-- castData = ( gTypeMiniObject , castToMiniObject )+-- } ;+ instance CanBeCasted Misc where {+ castData = ( gTypeMisc , castToMisc )+ } ;+ instance CanBeCasted Notebook where {+ castData = ( gTypeNotebook , castToNotebook )+ } ;+ instance CanBeCasted Object where {+ castData = ( gTypeObject , castToObject )+ } ;+ instance CanBeCasted OptionMenu where {+ castData = ( gTypeOptionMenu , castToOptionMenu )+ } ;+-- instance CanBeCasted Pad where {+-- castData = ( gTypePad , castToPad )+-- } ;+-- instance CanBeCasted PadTemplate where {+-- castData = ( gTypePadTemplate , castToPadTemplate )+-- } ;+ instance CanBeCasted Paned where {+ castData = ( gTypePaned , castToPaned )+ } ;+-- instance CanBeCasted Pipeline where {+-- castData = ( gTypePipeline , castToPipeline )+-- } ;+ instance CanBeCasted Pixbuf where {+ castData = ( gTypePixbuf , castToPixbuf )+ } ;+ instance CanBeCasted Plug where {+ castData = ( gTypePlug , castToPlug )+ } ;+-- instance CanBeCasted Plugin where {+-- castData = ( gTypePlugin , castToPlugin )+-- } ;+-- instance CanBeCasted PluginFeature where {+-- castData = ( gTypePluginFeature , castToPluginFeature )+-- } ;+ instance CanBeCasted ProgressBar where {+ castData = ( gTypeProgressBar , castToProgressBar )+ } ;+-- instance CanBeCasted PushSrc where {+-- castData = ( gTypePushSrc , castToPushSrc )+-- } ;+-- instance CanBeCasted Query where {+-- castData = ( gTypeQuery , castToQuery )+-- } ;+ instance CanBeCasted RadioAction where {+ castData = ( gTypeRadioAction , castToRadioAction )+ } ;+ instance CanBeCasted RadioButton where {+ castData = ( gTypeRadioButton , castToRadioButton )+ } ;+ instance CanBeCasted RadioMenuItem where {+ castData = ( gTypeRadioMenuItem , castToRadioMenuItem )+ } ;+ instance CanBeCasted RadioToolButton where {+ castData = ( gTypeRadioToolButton , castToRadioToolButton )+ } ;+ instance CanBeCasted Range where {+ castData = ( gTypeRange , castToRange )+ } ;+-- instance CanBeCasted Registry where {+-- castData = ( gTypeRegistry , castToRegistry )+-- } ;+ instance CanBeCasted Scale where {+ castData = ( gTypeScale , castToScale )+ } ;+ instance CanBeCasted Screen where {+ castData = ( gTypeScreen , castToScreen )+ } ;+ instance CanBeCasted Scrollbar where {+ castData = ( gTypeScrollbar , castToScrollbar )+ } ;+ instance CanBeCasted ScrolledWindow where {+ castData = ( gTypeScrolledWindow , castToScrolledWindow )+ } ;+ instance CanBeCasted Separator where {+ castData = ( gTypeSeparator , castToSeparator )+ } ;+ instance CanBeCasted SeparatorMenuItem where {+ castData = ( gTypeSeparatorMenuItem , castToSeparatorMenuItem )+ } ;+ instance CanBeCasted SeparatorToolItem where {+ castData = ( gTypeSeparatorToolItem , castToSeparatorToolItem )+ } ;+ instance CanBeCasted SizeGroup where {+ castData = ( gTypeSizeGroup , castToSizeGroup )+ } ;+ instance CanBeCasted Socket where {+ castData = ( gTypeSocket , castToSocket )+ } ;+-- instance CanBeCasted SourceBuffer where {+-- castData = ( gTypeSourceBuffer , castToSourceBuffer )+-- } ;+-- instance CanBeCasted SourceLanguage where {+-- castData = ( gTypeSourceLanguage , castToSourceLanguage )+-- } ;+-- instance CanBeCasted SourceLanguageManager where {+-- castData = ( gTypeSourceLanguageManager , castToSourceLanguageManager )+-- } ;+-- instance CanBeCasted SourceMark where {+-- castData = ( gTypeSourceMark , castToSourceMark )+-- } ;+-- instance CanBeCasted SourceStyleScheme where {+-- castData = ( gTypeSourceStyleScheme , castToSourceStyleScheme )+-- } ;+-- instance CanBeCasted SourceView where {+-- castData = ( gTypeSourceView , castToSourceView )+-- } ;+ instance CanBeCasted SpinButton where {+ castData = ( gTypeSpinButton , castToSpinButton )+ } ;+ instance CanBeCasted StatusIcon where {+ castData = ( gTypeStatusIcon , castToStatusIcon )+ } ;+ instance CanBeCasted Statusbar where {+ castData = ( gTypeStatusbar , castToStatusbar )+ } ;+ instance CanBeCasted Style where {+ castData = ( gTypeStyle , castToStyle )+ } ;+-- instance CanBeCasted SystemClock where {+-- castData = ( gTypeSystemClock , castToSystemClock )+-- } ;+ instance CanBeCasted Table where {+ castData = ( gTypeTable , castToTable )+ } ;+ instance CanBeCasted TearoffMenuItem where {+ castData = ( gTypeTearoffMenuItem , castToTearoffMenuItem )+ } ;+ instance CanBeCasted TextBuffer where {+ castData = ( gTypeTextBuffer , castToTextBuffer )+ } ;+ instance CanBeCasted TextMark where {+ castData = ( gTypeTextMark , castToTextMark )+ } ;+ instance CanBeCasted TextTag where {+ castData = ( gTypeTextTag , castToTextTag )+ } ;+ instance CanBeCasted TextTagTable where {+ castData = ( gTypeTextTagTable , castToTextTagTable )+ } ;+ instance CanBeCasted TextView where {+ castData = ( gTypeTextView , castToTextView )+ } ;+ instance CanBeCasted ToggleAction where {+ castData = ( gTypeToggleAction , castToToggleAction )+ } ;+ instance CanBeCasted ToggleButton where {+ castData = ( gTypeToggleButton , castToToggleButton )+ } ;+ instance CanBeCasted ToggleToolButton where {+ castData = ( gTypeToggleToolButton , castToToggleToolButton )+ } ;+ instance CanBeCasted ToolButton where {+ castData = ( gTypeToolButton , castToToolButton )+ } ;+ instance CanBeCasted ToolItem where {+ castData = ( gTypeToolItem , castToToolItem )+ } ;+ instance CanBeCasted Toolbar where {+ castData = ( gTypeToolbar , castToToolbar )+ } ;+ instance CanBeCasted Tooltips where {+ castData = ( gTypeTooltips , castToTooltips )+ } ;+ instance CanBeCasted TreeModel where {+ castData = ( gTypeTreeModel , castToTreeModel )+ } ;+ instance CanBeCasted TreeModelSort where {+ castData = ( gTypeTreeModelSort , castToTreeModelSort )+ } ;+ instance CanBeCasted TreeSelection where {+ castData = ( gTypeTreeSelection , castToTreeSelection )+ } ;+ instance CanBeCasted TreeSortable where {+ castData = ( gTypeTreeSortable , castToTreeSortable )+ } ;+ instance CanBeCasted TreeView where {+ castData = ( gTypeTreeView , castToTreeView )+ } ;+ instance CanBeCasted TreeViewColumn where {+ castData = ( gTypeTreeViewColumn , castToTreeViewColumn )+ } ;+ instance CanBeCasted UIManager where {+ castData = ( gTypeUIManager , castToUIManager )+ } ;+ instance CanBeCasted VBox where {+ castData = ( gTypeVBox , castToVBox )+ } ;+ instance CanBeCasted VButtonBox where {+ castData = ( gTypeVButtonBox , castToVButtonBox )+ } ;+ instance CanBeCasted VPaned where {+ castData = ( gTypeVPaned , castToVPaned )+ } ;+ instance CanBeCasted VScale where {+ castData = ( gTypeVScale , castToVScale )+ } ;+ instance CanBeCasted VScrollbar where {+ castData = ( gTypeVScrollbar , castToVScrollbar )+ } ;+ instance CanBeCasted VSeparator where {+ castData = ( gTypeVSeparator , castToVSeparator )+ } ;+ instance CanBeCasted Viewport where {+ castData = ( gTypeViewport , castToViewport )+ } ;+-- instance CanBeCasted Volume where {+-- castData = ( gTypeVolume , castToVolume )+-- } ;+ instance CanBeCasted Widget where {+ castData = ( gTypeWidget , castToWidget )+ } ;+ instance CanBeCasted Window where {+ castData = ( gTypeWindow , castToWindow )+ } ;+ instance CanBeCasted WindowGroup where {+ castData = ( gTypeWindowGroup , castToWindowGroup )+ }++}
− src/example.hs
@@ -1,60 +0,0 @@-module Main where-import Graphics.UI.Gtk-import Graphics.UI.Gtk.Gdk.EventM-import Graphics.Rendering.Cairo-import Graphics.UI.Gtk.Layout.Rpn-import Data.Monoid--title :: String -> [AttrOp Window]-title s = [windowTitle := s]-pressed :: Signal Widget (EventM EButton Bool)-pressed = buttonPressEvent--main = do- initGUI-- -- Create a new operator ('line') that takes a label- -- ('cLBL') and a button ('cBTNL') and pack then ('pBPED')- -- in a horizontal box ('cHBX').-- let line s = mconcat [- cLBL (Just $ s ++ ":"),- cBTNL s,- cHBX True 0,- pBPED,- pBPED]-- -- Create a new operator ('column') that packs many 'line'- -- in a vertical box ('cVBX').-- let column = mconcat $ [- line "One Button",- line "Another Button",- line "Yet Another Button",- line "Last Button",- cVBX True 0] ++ replicate 4 pBPED-- -- Take two copies of 'column' and add ('pNAP') then- -- to a notebook ('cNBK'). Then create a stock button- -- ('cBTNSTK') and attach a action to an event ('tON'). Then- -- join the notebook and that button in a vertical box.- -- Insert everything in a main window ('cWND, pCA'), and- -- finally make everything into widgets ('widgetsFromRpn').-- [mainWindow] <- widgetsFromRpn $ mconcat $ [- column,- column,- cNBK,- pNAP "First Page",- pNAP "Second Page",- cBTNSTK stockQuit,- tON pressed (liftIO mainQuit >> return True),- cVBX False 0,- pBPE PackNatural 0,- pBPED,- cWND,- pCA,- tSET (title "Layout.RPN Example")]-- widgetShowAll mainWindow- mainGUI
− src/rpnCompilar.hs
@@ -1,8 +0,0 @@-module Main where {-import Graphics.UI.Gtk ;-import Graphics.Rendering.Cairo ;-import Graphics.UI.Gtk.Layout.Rpn ;-- main = return ()--}
− src/rpnTeste.hs
@@ -1,37 +0,0 @@-module Main where {-import Data.Monoid ;-import Graphics.UI.Gtk ; import Graphics.UI.Gtk.Layout.Rpn ;-import Graphics.Rendering.Cairo ;-- main = do {-- initGUI ;-- janelaPrincipal <- windowNew ; onDestroy janelaPrincipal mainQuit ;-- [ w ] <- widgetsFromRpn $ mconcat [-- cBTNSTK stockAbout ,- cBTNSTK stockQuit ,- cHBXBTN ,- pCA ,- pCA ,- cLBL $ Just "<b> Oi! </b>" ,- tSET $ ([labelUseMarkup := True] :: [AttrOp Label]) ,- cDRW ,- cVPD ,- pPA2 ,- pPA1 ,- cVBX False 0 ,- pBPE PackGrow 0 ,- pBPE PackNatural 0-- ] ;-- containerAdd janelaPrincipal w ;-- widgetShowAll janelaPrincipal ; mainGUI-- }--}
− src/rpnTeste2.hs
@@ -1,108 +0,0 @@-module Main where {-import Graphics.UI.Gtk ;-import Graphics.UI.Gtk.Layout.Rpn ;-import Graphics.Rendering.Cairo ;-import Data.Monoid ;-import Data.IORef ;--desenharQuadrados = do {- dw <- eventWindow ;- (w,h) <- drawableGetSize ;--dQ :: IORef (Double,Double) -> Int -> RPN ;-dQ ior n = mconcat [- cDRW ,- tON widgetExposeEvent desenharQuadrados ,- cFRM ,- tSET label ,- pCA- ] where {- widgetExposeEvent :: Signal Widget (EventM ECrossing Bool) ;- widgetExposeEvent = exposeEvent ;- label :: [AttrOp Frame] ;- label = [frameLabel := ( show n ++ " cm" )] ;- desenharQuadrados = do {- dw <- eventWindow ;- (w,h) <- drawableGetSize ;- let (w',h') = (fromIntegral w, fromIntegral h) ;- (eX,eY) <- readIORef ior ;- xs <- [0,n'*eX..w'] ;- ys <- [0,n'*eY..h'] ;- renderWithDrawable dw $ do {---main = do {-- initGUI ;-- janelaPrincipal <- windowNew ;-- proporções <- newIORef ( 10 , 10 ) ;-- let {- atualizarX = \v -> modifyIORef proporções $ \( _ , y ) -> ( 200 / v , y ) ;- atualizarY = \v -> modifyIORef proporções $ \( x , _ ) -> ( x , 200 / v ) ;- desenharQuadrados n = do {- ( px , py ) <- readIORef proporções ;- return $ Just $ \( w , h ) -> do {- let { dx = n * px ; dy = n * py } ;- sequence $ ( flip map ) [ 0 , dx .. w ] $- \v -> moveTo v 0 >> lineTo v h ;- sequence $ ( flip map ) [ 0 , dy .. h ] $- \v -> moveTo 0 v >> lineTo w v ;- stroke- } ;- } ;- janelinha n = mconcat [- rpnCairoLiveShape ( desenharQuadrados n ) 2000 ,- rpnFrame $ Just $ "<b> Quadrados de " ++ show n ++ " <i> cm </i></b>"- ] ;- } ;-- [conteúdo] <- widgetFromRpn $ mconcat [-- rpnCairoShape $ const $ rectangle 10 10 200 200 >> stroke ,- rpnMinimumSize 220 220 ,-- rpnSetOrientation OrientationVertical ,- rpnScale 2 10 20 1 ( Just PosRight ) atualizarY ,-- rpnSetOrientation OrientationHorizontal ,- rpnBox [ PackGrow , PackNatural ] ,-- rpnSetOrientation OrientationHorizontal ,- rpnScale 2 10 20 1 ( Just PosBottom ) atualizarX ,-- rpnSetOrientation OrientationVertical ,- rpnBox [ PackNatural , PackNatural ] ,-- rpnSetAlign ( 0.5 , 0.5 ) ,- rpnAlign 0 0 ,-- rpnSetOrientation OrientationHorizontal ,- rpnStockButton stockQuit mainQuit ,- rpnButtonBox ButtonboxCenter [False] ,-- rpnSetOrientation OrientationVertical ,- rpnBox [ PackGrow , PackNatural ] ,-- janelinha 1 ,- janelinha 2 ,- janelinha 3 ,- rpnBox $ take 3 $ replicate 3 PackGrow ,-- rpnSetOrientation OrientationHorizontal ,- rpnBox [ PackNatural , PackGrow ]-- ] ;-- containerAdd janelaPrincipal conteúdo ;-- widgetShowAll janelaPrincipal ;-- mainGUI-- }---}