gtk2hs-rpn-0.2: Adds a module to gtk2hs allowing layouts to be defined using reverse polish notation.




data RPN Source

RPN is the type of all operators, and encapsulates the underline machinery. It instantiates Monoid, therefore we can sequence operators in a list, and also create new operators by mconcating others.


widgetsFromRpn :: [RPN] -> IO [Widget]Source

After we describe our widgets using a list of RPNs, we use widgetsFromRpn to get them.

rWID :: Widget -> RPNSource

Inserts your widget in the stack. Your widget needs to pass through Gtk.toWidget before applying rWID.

rCENTER :: RPNSource

Insert the last widget inside a container. When that container grows, the widget keeps its natural size, aligned in the center of the container.

rLEFT :: RPNSource

Same as rCENTER, but aligns to the left.

rRIGHT :: RPNSource

Same as rCENTER, but aligns to the right.

rARROW :: ArrowType -> RPNSource

Inserts an Graphics.UI.Gtk.Misc.Arrow.Arrow in the stack.

rASPECT :: RPNSource

Sets the last widget to always keep the aspect ratio of its original size requisition.

rBUTTON :: StockId -> IO () -> RPNSource

Inserts a button into the stack, after a Graphics.UI.Gtk.General.StockItems.StockId and an IO () to be called when it is clicked.

rEXPANDER :: String -> RPNSource

Packs the last widget in an Graphics.UI.Gtk.Layout.Expander.Expander, allowing the user to hide or show that widget under a label.

rCOLOR :: Color -> (Color -> IO ()) -> RPNSource

Inserts a color chooser button, after an initial Graphics.UI.Gtk.Gdk.GC.Color and a Color -> IO () to be called when a new color is choosen.

rFILE :: FileChooserAction -> RPNSource

Inserts a Graphics.UI.Gtk.Selectors.FileChooserButton.FileChooserButton after a System.IO.FilePath -> IO () to be called when a file is choosen by the user. (This is not working since gtk2hs do not yet support the file-set signal for this widget.)

rFONT :: String -> (String -> IO ()) -> RPNSource

Inserts a font chooser button after a String -> IO () to be called when a new font is choosen.

rFRAME :: String -> RPNSource

Frames the last widget, adding a label.

rVBOX :: [Packing] -> RPNSource

After a list of Graphics.UI.Gtk.Abstract.Box.Packing styles, rHBOX and rVBOX pack the last widgets respectively in an horizontal or vertical box, as many as there are styles in that list. Do not use them to pack buttons, instead use rHBBOX and rVBBOX.

rVBBOX :: Integral n => n -> RPNSource

After a number n, rHBBOX and rVBBOX pack the last n widgets respectively in an horizontal or vertical box. Widgets are supposed to be buttons.

rVPANE :: (Bool, Bool) -> RPNSource

rHPANE and rVPANE create, respectively, horizontal and vertical Graphics.UI.Gtk.Abstract.Paned.Paneds. Bool parameters says whether left and right panes are allowed to expand when the containing Paned widget grows.

rVSCALE :: (Double, Double) -> (Double -> IO ()) -> RPNSource

rHSCALE and rVSCALE create, respectively, horizontal and vertical Graphics.UI.Gtk.Abstract.Scale.Scales, after a (Double,Double) interval and a Double -> IO () to be called when the value in the Scale changes.


rHSEPARATOR and rVSEPARATOR insert, respectively, horizontal and vertical Graphics.UI.Gtk.Abstract.Separators in the stack.

rIMAGE :: FilePath -> RPNSource

rIMAGE takes a System.IO.FilePath to an image and inserts a widget showing that image in the stack.

rLABEL :: String -> RPNSource

rLABEL inserts a Graphics.UI.Gtk.Display.Label.Label in the stack, after a String. This String is supposed to be Pango Graphics.UI.Gtk.Pango.Markup.

rNOTEBOOK :: [String] -> RPNSource

rNOTEBOOK takes a list of String labels and add widgets from the stack to a Graphics.UI.Gtk.Layout.Notebook.Notebook, as many as the labels provided.

rSCROLL :: RPNSource

rSCROLL packs the last widget in a container with horizontal and vertical scroll bars.

rSOCKET :: NativeWindowId -> RPNSource

rSOCKET allows inserting a foreign (from other program) widget inside the stack, given its Graphics.UI.Gtk.Embedding.Socket.NativeWindowId.

rSPIN :: (Double, Double) -> (Double -> IO ()) -> RPNSource

rSPIN creates a Graphics.UI.Gtk.Entry.SpinButton.SpinButton after a (Double,Double) interval and a Double -> IO () to be called when the value in the SpinButton changes.

rTEXT :: TextBufferClass b => b -> RPNSource

rTEXT creates a text view after a given buffer, which shall be an instance of Graphics.UI.Gtk.Multiline.TextBuffer.TextBufferClass.

rMAIN :: String -> RPNSource

rMAIN packs the last widget in a main window, given its title.