From: Andy S. <And...@co...> - 2010-03-25 07:38:15
|
Thu Mar 25 03:36:01 EDT 2010 Andy Stewart <laz...@gm...> * Update all `Selectors` modules to Gtk+2.18.3 Ignore-this: 9ed53d2178cbcd44c5a43d462a7f1551 hunk ./ApiUpdateTodoList.txt 63 -*** TODO HSV.chs +*** DONE HSV.chs hunk ./ApiUpdateTodoList.txt 74 -*** TODO InputDialog.chs +*** DONE InputDialog.chs hunk ./ApiUpdateTodoList.txt 308 -*** TODO ColorButton.chs.pp -*** TODO ColorSelection.chs -*** TODO ColorSelectionDialog.chs -*** TODO FileChooserButton.chs.pp +*** DONE ColorButton.chs.pp +*** DONE ColorSelection.chs +*** DONE ColorSelectionDialog.chs +*** DONE FileChooserButton.chs.pp hunk ./ApiUpdateTodoList.txt 313 -*** TODO FileChooserDialog.chs.pp -*** TODO FileChooserWidget.chs.pp -*** TODO FileFilter.chs.pp -*** TODO FileSelection.chs.pp -*** TODO FontButton.chs.pp -*** TODO FontSelection.chs -*** TODO FontSelectionDialog.chs +*** DONE FileChooserDialog.chs.pp +*** DONE FileChooserWidget.chs.pp +*** DONE FileFilter.chs.pp +*** DEPRECATED FileSelection.chs.pp +*** DONE FontButton.chs.pp +*** DONE FontSelection.chs +*** DONE FontSelectionDialog.chs hunk ./Makefile.am 729 + gtk/Graphics/UI/Gtk/Selectors/InputDialog.chs.pp \ + gtk/Graphics/UI/Gtk/Selectors/HSV.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 167 + module Graphics.UI.Gtk.Selectors.InputDialog, + module Graphics.UI.Gtk.Selectors.HSV, hunk ./gtk/Graphics/UI/Gtk.hs.pp 384 +import Graphics.UI.Gtk.Selectors.InputDialog +import Graphics.UI.Gtk.Selectors.HSV hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 38 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 73 + colorButtonColor, hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 78 + colorSet, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 85 +#endif hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 93 +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 237 +-- | The selected color. +-- [_$_] +-- Since 2.4 +colorButtonColor :: ColorButtonClass self => Attr self Color +colorButtonColor = newAttrFromBoxedStorableProperty "color" + {# call pure unsafe gdk_color_get_type #} + hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 258 +-- | The 'colorSet' signal is emitted when the user selects a color. When handling this signal, use +-- 'colorButtonGetColor' to find out which color was just +-- selected. +-- [_$_] +-- Note that this signal is only emitted when the user changes the color. If you need to react to +-- programmatic color changes as well, use the 'color' signal. +colorSet :: ColorButtonClass self => Signal self (IO ()) +colorSet = Signal (connect_NONE__NONE "color-set") + [_$_] + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorButton.chs.pp 279 - +#endif [_$_] hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 30 --- [_$_] +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 37 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 72 + colorSelectionPaletteFromString, + colorSelectionPaletteToString, + -- colorSelectionSetChangePaletteWithScreenHook, hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 81 + +-- * Signals + colorChanged, hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 90 +import System.Glib.Properties +import System.Glib.UTFString hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 94 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 249 +-- | Parses a color palette string; the string is a colon-separated list of +-- color names readable by 'colorParse'. +-- +colorSelectionPaletteFromString :: + String -- ^ @str@ - a string encoding a color palette. + -- -> [Color] -- ^ @colors@ - return location for allocated array of + -- 'Color'. + -> IO ([Color], Int, Bool) -- ^ @(_, nColors)@ {FIXME: merge return value docs} + -- returns @True@ if a palette was successfully parsed. + -- @nColors@ - return location for length of array. +colorSelectionPaletteFromString str = [_$_] + alloca $ \colorPtr -> + alloca $ \lenPtr -> + withUTFString str $ \ strPtr -> do + resPtr <- {# call color_selection_palette_from_string#} [_$_] + strPtr [_$_] + (castPtr colorPtr) + lenPtr + color <- peekArray 0 colorPtr + colorLen <- peek lenPtr + let result = toBool resPtr + return (color, (fromIntegral colorLen), result) + +-- | Encodes a palette as a string, useful for persistent storage. +-- +colorSelectionPaletteToString :: + Color -- ^ @colors@ - an array of colors. + -> Int -- ^ @nColors@ - length of the array. + -> IO String -- ^ returns allocated string encoding the palette. +colorSelectionPaletteToString colors nColors = + with colors $ \colorsPtr -> + {# call gtk_color_selection_palette_to_string #} + (castPtr colorsPtr) + (fromIntegral nColors) + >>= readUTFString + +-- #if GTK_CHECK_VERSION(2,2,0) +-- | Installs a global function to be called whenever the user tries to modify +-- the palette in a color selection. This function should save the new palette +-- contents, and update the 'Settings' property \"gtk-color-palette\" so all +-- 'ColorSelection' widgets will be modified. +-- +-- * Available since Gtk+ version 2.2 +-- +-- colorSelectionSetChangePaletteWithScreenHook :: +-- {-GtkColorSelectionChangePaletteWithScreenFunc-} -- ^ @func@ - a +-- -- function to call +-- -- when the custom +-- -- palette needs +-- -- saving. +-- -> IO {-GtkColorSelectionChangePaletteWithScreenFunc-} -- ^ returns the +-- -- previous change +-- -- palette hook (that +-- -- was replaced). +-- colorSelectionSetChangePaletteWithScreenHook func = +-- {# call gtk_color_selection_set_change_palette_with_screen_hook #} +-- {-func-} +-- #endif + hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 347 + +----------------- +-- Signals +-- | This signal is emitted when the color changes in the 'ColorSelection' according to its update +-- policy. +colorChanged :: ColorSelectionClass self => Signal self (IO ()) +colorChanged = Signal (connect_NONE__NONE "color-changed") + [_$_] hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelectionDialog.chs 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelectionDialog.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelectionDialog.chs 36 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelectionDialog.chs 57 + colorSelectionDialogGetColorSelection, hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelectionDialog.chs 94 + +-- | Retrieves the 'ColorSelection' widget embedded in the dialog. +-- +-- * Available since Gtk+ version 2.14 +-- +colorSelectionDialogGetColorSelection :: ColorSelectionDialogClass self => self + -> IO Widget -- ^ returns the embedded 'ColorSelection' +colorSelectionDialogGetColorSelection self = + makeNewObject mkWidget $ + {# call gtk_color_selection_dialog_get_color_selection #} + (toColorSelectionDialog self) hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 30 +-- The following functions don't bind, use corresponding attributes instead: +-- gtk_file_chooser_set_create_folders +-- gtk_file_chooser_get_create_folders +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 35 + hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 124 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 188 +-- #if GTK_CHECK_VERSION(2,14,0) +-- fileChooserGetCurrentFolderFile, +-- #endif hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 216 +#if GTK_CHECK_VERSION(2,18,0) + fileChooserCreateFolders, +#endif + fileChooserFileSystemBackend, hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 222 + currentFolderChanged, + fileActivated, + updatePreview, + confirmOverwrite, + fileChooserSelectionChanged, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 238 -#if GTK_CHECK_VERSION(2,8,0) hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 249 +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 926 +-- #if GTK_CHECK_VERSION(2,14,0) +-- -- | Gets the current folder of @chooser@ as {GFile, FIXME: unknown +-- -- type\/value}. See 'fileChooserGetCurrentFolderURI'. +-- -- +-- -- * Available since Gtk+ version 2.14 +-- -- +-- fileChooserGetCurrentFolderFile :: FileChooserClass self => self +-- -> IO GFile -- ^ returns the {GFile, FIXME: unknown type\/value} for the +-- -- current folder. +-- fileChooserGetCurrentFolderFile self = +-- {# call gtk_file_chooser_get_current_folder_file #} +-- (toFileChooser self) +-- #endif + hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 1094 --------------------- --- Signals +#if GTK_CHECK_VERSION(2,18,0) +fileChooserCreateFolders :: FileChooserClass self => Attr self Bool +fileChooserCreateFolders = newAttrFromBoolProperty "create-folders" +#endif + +-- | Name of file system backend to use. +-- [_$_] +-- Default value: 'Nothing' +fileChooserFileSystemBackend :: FileChooserClass self => WriteAttr self String +fileChooserFileSystemBackend = writeAttrFromStringProperty "file-system-backend" hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 1105 +---------------- +-- Signal hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 1119 +currentFolderChanged :: FileChooserClass self => Signal self (IO ()) +currentFolderChanged = Signal (connect_NONE__NONE "current-folder-changed") + +-- | This signal is emitted when there is a change in the set of selected +-- files in a 'FileChooser'. This can happen when the user modifies the +-- selection with the mouse or the keyboard, or when explicitly calling +-- functions to change the selection. +-- +-- Normally you do not need to connect to this signal, as it is easier to +-- wait for the file chooser to finish running, and then to get the list of +-- selected files using the functions mentioned below. +-- +-- See also: 'fileChooserSelectFilename', 'fileChooserUnselectFilename', +-- 'fileChooserGetFilename', 'fileChooserGetFilenames', 'fileChooserSelectURI', +-- 'fileChooserUnselectURI', 'fileChooserGetURI', 'fileChooserGetURIs'. +-- +fileChooserSelectionChanged :: FileChooserClass self => Signal self (IO ()) +fileChooserSelectionChanged = Signal (connect_NONE__NONE "selection-changed") + +-- | This signal is emitted when the preview in a file chooser should be +-- regenerated. For example, this can happen when the currently selected file +-- changes. You should use this signal if you want your file chooser to have a +-- preview widget. +-- +-- Once you have installed a preview widget with +-- 'fileChooserSetPreviewWidget', you should update it when this signal is +-- emitted. You can use the functions 'fileChooserGetPreviewFilename' or +-- 'fileChooserGetPreviewURI' to get the name of the file to preview. Your +-- widget may not be able to preview all kinds of files; your callback must +-- call 'fileChooserSetPreviewWidgetActive' to inform the file chooser about +-- whether the preview was generated successfully or not. +-- +-- Please see the example code in '{FIXME: gtk-doc cross reference +-- to:gtkfilechooser-preview}'. +-- +-- See also: 'fileChooserSetPreviewWidget', +-- 'fileChooserSetPreviewWidgetActive', 'fileChooserSetUsePreviewLabel', +-- 'fileChooserGetPreviewFilename', 'fileChooserGetPreviewURI'. +-- +updatePreview :: FileChooserClass self => Signal self (IO ()) +updatePreview = Signal (connect_NONE__NONE "update-preview") + +-- | This signal is emitted when the user \"activates\" a file in the file +-- chooser. This can happen by double-clicking on a file in the file list, or +-- by pressing Enter. +-- +-- Normally you do not need to connect to this signal. It is used internally +-- by 'FileChooserDialog' to know when to activate the default button in the +-- dialog. +-- +-- See also: 'fileChooserGetFilename', 'fileChooserGetFilenames', +-- 'fileChooserGetURI', 'fileChooserGetURIs'. +-- +fileActivated :: FileChooserClass self => Signal self (IO ()) +fileActivated = Signal (connect_NONE__NONE "file-activated") + +-- | This signal gets emitted whenever it is appropriate to present a +-- confirmation dialog when the user has selected a file name that already +-- exists. The signal only gets emitted when the file chooser is in +-- 'FileChooserActionSave' mode. +-- +-- Most applications just need to turn on the do-overwrite-confirmation +-- property (or call the 'fileChooserSetDoOverwriteConfirmation' function), and +-- they will automatically get a stock confirmation dialog. Applications which +-- need to customize this behavior should do that, and also connect to the +-- confirm-overwrite signal. +-- +-- A signal handler for this signal must return a 'FileChooserConfirmation' +-- value, which indicates the action to take. If the handler determines that +-- the user wants to select a different filename, it should return +-- 'FileChooserConfirmationSelectAgain'. If it determines that the user is +-- satisfied with his choice of file name, it should return +-- 'FileChooserConfirmationAcceptFilename'. On the other hand, if it determines +-- that the stock confirmation dialog should be used, it should return +-- 'FileChooserConfirmationConfirm'. The following example illustrates this. +-- +confirmOverwrite :: FileChooserClass self => Signal self (IO FileChooserConfirmation) +confirmOverwrite = Signal (connect_NONE__ENUM "confirm-overwrite") + +#ifndef DISABLE_DEPRECATED +-- | This signal is emitted when the current folder in a 'FileChooser' changes. This can happen due to +-- the user performing some action that changes folders, such as selecting a bookmark or visiting a +-- folder on the file list. It can also happen as a result of calling a function to explicitly change +-- the current folder in a file chooser. +-- [_$_] +-- Normally you do not need to connect to this signal, unless you need to keep track of which folder a +-- file chooser is showing. +-- [_$_] +-- See also: 'fileChooserSetCurrentFolder', +-- 'fileChooserSetCurrentFolderUri'. hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 1303 +#endif hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserButton.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserButton.chs.pp 29 +-- The following functions don't bind, use corresponding attributes instead: +-- gtk_file_chooser_button_get_focus_on_click +-- gtk_file_chooser_button_set_focus_on_click +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserButton.chs.pp 34 + hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserButton.chs.pp 47 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserButton.chs.pp 81 +#if GTK_CHECK_VERSION(2,10,0) + fileChooserButtonFocusOnClick, +#endif hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserButton.chs.pp 222 + +#if GTK_CHECK_VERSION(2,10,0) +-- | Whether the 'FileChooserButton' button grabs focus when it is clicked with the mouse. +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.10 +fileChooserButtonFocusOnClick :: FileChooserButtonClass self => Attr self Bool +fileChooserButtonFocusOnClick = newAttrFromBoolProperty "focus-on-click" +#endif hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserDialog.chs.pp 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserDialog.chs.pp 30 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserDialog.chs.pp 32 + hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserDialog.chs.pp 52 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserWidget.chs.pp 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserWidget.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooserWidget.chs.pp 42 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FileFilter.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/FileFilter.chs.pp 29 +-- The following functions just for internal use, don't bind it: +-- gtk_file_filter_get_needed +-- gtk_file_filter_filter +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FileFilter.chs.pp 34 + hunk ./gtk/Graphics/UI/Gtk/Selectors/FileFilter.chs.pp 52 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FontButton.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/FontButton.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/Selectors/FontButton.chs.pp 38 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FontButton.chs.pp 84 + fontSet, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Selectors/FontButton.chs.pp 91 +#endif hunk ./gtk/Graphics/UI/Gtk/Selectors/FontButton.chs.pp 324 +fontSet :: FontButtonClass self => Signal self (IO ()) +fontSet = Signal (connect_NONE__NONE "font-set") hunk ./gtk/Graphics/UI/Gtk/Selectors/FontButton.chs.pp 327 +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Selectors/FontButton.chs.pp 338 - +#endif hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelection.chs 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelection.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelection.chs 44 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelection.chs 70 + fontSelectionGetFace, + fontSelectionGetFaceList, + fontSelectionGetFamily, + fontSelectionGetSize, + fontSelectionGetFamilyList, + fontSelectionGetPreviewEntry, + fontSelectionGetSizeEntry, + fontSelectionGetSizeList, hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelection.chs 148 +-- | Gets the 'FontFace' representing the selected font group details (i.e. +-- family, slant, weight, width, etc). +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionGetFace :: FontSelectionClass self => self + -> IO FontFace -- ^ returns A 'FontFace' representing the selected font group + -- details. The returned object is owned by @fontsel@ and must + -- not be modified or freed. +fontSelectionGetFace self = + makeNewGObject mkFontFace $ + {# call gtk_font_selection_get_face #} + (toFontSelection self) + +-- | This returns the 'TreeView' which lists all styles available for the +-- selected font. For example, \'Regular\', \'Bold\', etc. +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionGetFaceList :: FontSelectionClass self => self + -> IO Widget -- ^ returns A 'Widget' that is part of @fontsel@ +fontSelectionGetFaceList self = + makeNewObject mkWidget $ + {# call gtk_font_selection_get_face_list #} + (toFontSelection self) + +-- | Gets the 'FontFamily' representing the selected font family. +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionGetFamily :: FontSelectionClass self => self + -> IO FontFamily -- ^ returns A 'FontFamily' representing the selected font + -- family. Font families are a collection of font faces. The + -- returned object is owned by @fontsel@ and must not be + -- modified or freed. +fontSelectionGetFamily self = + makeNewGObject mkFontFamily $ + {# call gtk_font_selection_get_family #} + (toFontSelection self) + +-- | The selected font size. +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionGetSize :: FontSelectionClass self => self + -> IO Int -- ^ returns A n integer representing the selected font size, or -1 + -- if no font size is selected. +fontSelectionGetSize self = + liftM fromIntegral $ + {# call gtk_font_selection_get_size #} + (toFontSelection self) + +-- | This returns the 'TreeView' that lists font families, for example, +-- \'Sans\', \'Serif\', etc. +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionGetFamilyList :: FontSelectionClass self => self + -> IO Widget -- ^ returns A 'Widget' that is part of @fontsel@ +fontSelectionGetFamilyList self = + makeNewObject mkWidget $ + {# call gtk_font_selection_get_family_list #} + (toFontSelection self) + +-- | This returns the 'Entry' used to display the font as a preview. +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionGetPreviewEntry :: FontSelectionClass self => self + -> IO Widget -- ^ returns A 'Widget' that is part of @fontsel@ +fontSelectionGetPreviewEntry self = + makeNewObject mkWidget $ + {# call gtk_font_selection_get_preview_entry #} + (toFontSelection self) + +-- | This returns the 'Entry' used to allow the user to edit the font number +-- manually instead of selecting it from the list of font sizes. +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionGetSizeEntry :: FontSelectionClass self => self + -> IO Widget -- ^ returns A 'Widget' that is part of @fontsel@ +fontSelectionGetSizeEntry self = + makeNewObject mkWidget $ + {# call gtk_font_selection_get_size_entry #} + (toFontSelection self) + +-- | This returns the {GtkTreeeView, FIXME: unknown type\/value} used to list +-- font sizes. +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionGetSizeList :: FontSelectionClass self => self + -> IO Widget -- ^ returns A 'Widget' that is part of @fontsel@ +fontSelectionGetSizeList self = + makeNewObject mkWidget $ + {# call gtk_font_selection_get_size_list #} + (toFontSelection self) + hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelectionDialog.chs 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelectionDialog.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelectionDialog.chs 42 +-- hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelectionDialog.chs 69 + fontSelectionDialogGetCancelButton, + fontSelectionDialogGetOkButton, hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelectionDialog.chs 143 +-- | Gets the \'Cancel\' button. +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionDialogGetCancelButton :: FontSelectionDialogClass self => self + -> IO Widget -- ^ returns the 'Widget' used in the dialog for the \'Cancel\' + -- button. +fontSelectionDialogGetCancelButton self = + makeNewObject mkWidget $ + {# call gtk_font_selection_dialog_get_cancel_button #} + (toFontSelectionDialog self) + +-- | Gets the \'OK\' button. +-- +-- * Available since Gtk+ version 2.14 +-- +fontSelectionDialogGetOkButton :: FontSelectionDialogClass self => self + -> IO Widget -- ^ returns the 'Widget' used in the dialog for the \'OK\' + -- button. +fontSelectionDialogGetOkButton self = + makeNewObject mkWidget $ + {# call gtk_font_selection_dialog_get_ok_button #} + (toFontSelectionDialog self) + addfile ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs.pp hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget HSV +-- +-- Author : Andy Stewart +-- +-- Created: 25 Mar 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- A \'color wheel\' widget +-- +-- * Module available since Gtk+ version 2.14 +-- +module Graphics.UI.Gtk.Selectors.HSV ( hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs.pp 31 +-- * Detail +-- +-- | 'HSV' is the \'color wheel\' part of a complete color selector widget. It +-- allows to select a color by determining its HSV components in an intuitive +-- way. Moving the selection around the outer ring changes the hue, and moving +-- the selection point inside the inner triangle changes value and saturation. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----HSV +-- @ + +#if GTK_CHECK_VERSION(2,14,0) +-- * Types + HSV, + HSVClass, + castToHSV, + toHSV, + +-- * Constructors + hsvNew, + +-- * Methods + hsvSetColor, + hsvGetColor, + hsvSetMetrics, + hsvGetMetrics, + hsvIsAdjusting, + hsvToRgb, + rgbToHsv, + +-- * Signals + hsvChanged, + hsvMove, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.General.Enums (DirectionType (..)) +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Signals#} +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,14,0) +-------------------- +-- Constructors + +-- | Creates a new HSV color selector. +-- +hsvNew :: IO HSV +hsvNew = + makeNewObject mkHSV $ + liftM (castPtr :: Ptr Widget -> Ptr HSV) $ + {# call gtk_hsv_new #} + +-------------------- +-- Methods + +-- | Sets the current color in an HSV color selector. Color component values +-- must be in the [0.0, 1.0] range. +-- +hsvSetColor :: HSVClass self => self + -> Double -- ^ @h@ - Hue + -> Double -- ^ @s@ - Saturation + -> Double -- ^ @v@ - Value + -> IO () +hsvSetColor self h s v = + {# call gtk_hsv_set_color #} + (toHSV self) + (realToFrac h) + (realToFrac s) + (realToFrac v) + +-- | Queries the current color in an HSV color selector. Returned values will +-- be in the [0.0, 1.0] range. +-- +hsvGetColor :: HSVClass self => self + -> IO (Double, Double, Double) -- ^ @(h, s, v)@ {FIXME: merge return value + -- docs} @h@ - Return value for the hue @s@ - + -- Return value for the saturation @v@ - Return + -- value for the value +hsvGetColor self = + alloca $ \hPtr -> + alloca $ \sPtr -> + alloca $ \vPtr -> do + {# call gtk_hsv_get_color #} + (toHSV self) + hPtr + sPtr + vPtr + h <- peek hPtr + s <- peek sPtr + v <- peek vPtr + return (realToFrac h, realToFrac s, realToFrac v) + +-- | Sets the size and ring width of an HSV color selector. +-- +hsvSetMetrics :: HSVClass self => self + -> Int -- ^ @size@ - Diameter for the hue ring + -> Int -- ^ @ringWidth@ - Width of the hue ring + -> IO () +hsvSetMetrics self size ringWidth = + {# call gtk_hsv_set_metrics #} + (toHSV self) + (fromIntegral size) + (fromIntegral ringWidth) + +-- | Queries the size and ring width of an HSV color selector. +-- +hsvGetMetrics :: HSVClass self => self + -> IO (Int, Int) -- ^ @(size, ringWidth)@ {FIXME: merge return value docs} + -- @size@ - Return value for the diameter of the hue ring + -- @ringWidth@ - Return value for the width of the hue ring +hsvGetMetrics self = + alloca $ \sizePtr -> + alloca $ \ringWidthPtr -> do + {# call gtk_hsv_get_metrics #} + (toHSV self) + sizePtr + ringWidthPtr + size <- peek sizePtr + ringWidth <- peek ringWidthPtr + return (fromIntegral size, fromIntegral ringWidth) + +-- | An HSV color selector can be said to be adjusting if multiple rapid +-- changes are being made to its value, for example, when the user is adjusting +-- the value with the mouse. This function queries whether the HSV color +-- selector is being adjusted or not. +-- +hsvIsAdjusting :: HSVClass self => self + -> IO Bool -- ^ returns @True@ if clients can ignore changes to the color + -- value, since they may be transitory, or @False@ if they should + -- consider the color value status to be final. +hsvIsAdjusting self = + liftM toBool $ + {# call gtk_hsv_is_adjusting #} + (toHSV self) + +-- | Converts a color from HSV space to RGB. Input values must be in the [0.0, +-- 1.0] range; output values will be in the same range. +-- +hsvToRgb :: + Double -- ^ @h@ - Hue + -> Double -- ^ @s@ - Saturation + -> Double -- ^ @v@ - Value + -> IO (Double, Double, Double) -- ^ @(r, g, b)@ {FIXME: merge return value + -- docs} @r@ - Return value for the red + -- component @g@ - Return value for the green + -- component @b@ - Return value for the blue + -- component +hsvToRgb h s v = + alloca $ \rPtr -> + alloca $ \gPtr -> + alloca $ \bPtr -> do + {# call gtk_hsv_to_rgb #} + (realToFrac h) + (realToFrac s) + (realToFrac v) + rPtr + gPtr + bPtr + r <- peek rPtr + g <- peek gPtr + b <- peek bPtr + return (realToFrac r, realToFrac g, realToFrac b) + +-- | Converts a color from RGB space to HSV. Input values must be in the [0.0, 1.0] range; output values +-- will be in the same range. +rgbToHsv :: Double -> Double -> Double -> IO (Double, Double, Double) +rgbToHsv r g b = + alloca $ \hPtr -> + alloca $ \sPtr -> + alloca $ \vPtr -> do + {# call rgb_to_hsv #} + (realToFrac r) + (realToFrac g) + (realToFrac b) + hPtr + sPtr + vPtr + h <- peek hPtr + s <- peek sPtr + v <- peek vPtr + return (realToFrac h, realToFrac s, realToFrac v) + +-------------------- +-- Signals + +-- | +-- +hsvChanged :: HSVClass self => Signal self (IO ()) +hsvChanged = Signal (connect_NONE__NONE "changed") + +-- | +-- +hsvMove :: HSVClass self => Signal self (DirectionType -> IO ()) +hsvMove = Signal (connect_ENUM__NONE "move") + [_$_] +#endif addfile ./gtk/Graphics/UI/Gtk/Selectors/InputDialog.chs.pp hunk ./gtk/Graphics/UI/Gtk/Selectors/InputDialog.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget InputDialog +-- +-- Author : Andy Stewart +-- +-- Created: 25 Mar 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Configure devices for the XInput extension +-- +module Graphics.UI.Gtk.Selectors.InputDialog ( + +-- * Detail +-- +-- | NOTE this widget is considered too specialized\/little-used for Gtk+, and +-- will in the future be moved to some other package. If your application needs +-- this widget, feel free to use it, as the widget does work and is useful in +-- some applications; it's just not of general interest. However, we are not +-- accepting new features for the widget, and it will eventually move out of +-- the Gtk+ distribution. +-- +-- 'InputDialog' displays a dialog which allows the user to configure XInput +-- extension devices. For each device, they can control the mode of the device +-- (disabled, screen-relative, or window-relative), the mapping of axes to +-- coordinates, and the mapping of the devices macro keys to key press events. +-- +-- 'InputDialog' contains two buttons to which the application can connect; +-- one for closing the dialog, and one for saving the changes. No actions are +-- bound to these by default. The changes that the user makes take effect +-- immediately. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Container' +-- | +----'Bin' +-- | +----'Window' +-- | +----'Dialog' +-- | +----InputDialog +-- @ + +-- * Types + InputDialog, + InputDialogClass, + castToInputDialog, + toInputDialog, + +-- * Constructors + inputDialogNew, + +-- * Signals + enableDevice, + disableDevice, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Signals#} +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Constructors + +-- | Creates a new 'InputDialog'. +-- +inputDialogNew :: IO InputDialog +inputDialogNew = + makeNewObject mkInputDialog $ + liftM (castPtr :: Ptr Widget -> Ptr InputDialog) $ + {# call gtk_input_dialog_new #} + +-------------------- +-- Signals + +-- | This signal is emitted when the user changes the mode of a device from +-- 'ModeDisabled' to a 'ModeScreen' or 'ModeWindow'. +-- +enableDevice :: InputDialogClass self => Signal self (Device -> IO ()) +enableDevice = Signal (connect_OBJECT__NONE "enable-device") + +-- | This signal is emitted when the user changes the mode of a device from a +-- 'ModeScreen' or 'ModeWindow' to {GDK_MODE_ENABLED, FIXME: unknown +-- type\/value}. +-- +disableDevice :: InputDialogClass self => Signal self (Device -> IO ()) +disableDevice = Signal (connect_OBJECT__NONE "disable-device") hunk ./tools/hierarchyGen/hierarchy.list 53 + GtkHSV as HSV, gtk_hsv_get_type hunk ./tools/hierarchyGen/hierarchy.list 90 + GtkInputDialog hunk ./tools/hierarchyGen/hierarchy.list 94 - GtkInputDialog |