You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(68) |
Aug
(4) |
Sep
|
Oct
(23) |
Nov
(95) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
(51) |
May
(81) |
Jun
(2) |
Jul
(86) |
Aug
(143) |
Sep
(3) |
Oct
(31) |
Nov
(63) |
Dec
(90) |
2005 |
Jan
(277) |
Feb
(157) |
Mar
(99) |
Apr
(195) |
May
(151) |
Jun
(148) |
Jul
(98) |
Aug
(123) |
Sep
(20) |
Oct
(174) |
Nov
(155) |
Dec
(26) |
2006 |
Jan
(51) |
Feb
(19) |
Mar
(16) |
Apr
(12) |
May
(5) |
Jun
|
Jul
(11) |
Aug
(7) |
Sep
(10) |
Oct
(31) |
Nov
(174) |
Dec
(56) |
2007 |
Jan
(45) |
Feb
(52) |
Mar
(10) |
Apr
(5) |
May
(47) |
Jun
(16) |
Jul
(80) |
Aug
(29) |
Sep
(14) |
Oct
(59) |
Nov
(46) |
Dec
(16) |
2008 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
(49) |
Jun
(26) |
Jul
(8) |
Aug
(4) |
Sep
(25) |
Oct
(53) |
Nov
(9) |
Dec
(1) |
2009 |
Jan
(66) |
Feb
(11) |
Mar
(1) |
Apr
(14) |
May
(8) |
Jun
(1) |
Jul
(2) |
Aug
(2) |
Sep
(9) |
Oct
(23) |
Nov
(35) |
Dec
|
2010 |
Jan
(7) |
Feb
(2) |
Mar
(39) |
Apr
(19) |
May
(161) |
Jun
(19) |
Jul
(32) |
Aug
(65) |
Sep
(113) |
Oct
(120) |
Nov
(2) |
Dec
|
2012 |
Jan
|
Feb
(5) |
Mar
(4) |
Apr
(7) |
May
(9) |
Jun
(14) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(12) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
(17) |
Mar
(4) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(8) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Andy S. <And...@co...> - 2010-04-04 08:56:19
|
Sun Apr 4 04:54:03 EDT 2010 Andy Stewart <laz...@gm...> * Fix pango compile problem, add #ifdef keyword if pango version higher 1.24 Ignore-this: e22469fde03c3d42369d2ee0f90f1813 hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 54 +#if PANGO_CHECK_VERSION(1,26,0) hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 56 +#endif hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 304 +#if PANGO_CHECK_VERSION(1,26,0) hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 328 +#endif hunk ./gtk/Graphics/UI/Gtk/Pango/Vertical.chs.pp 30 +#if PANGO_CHECK_VERSION(1,26,0) hunk ./gtk/Graphics/UI/Gtk/Pango/Vertical.chs.pp 32 +#endif hunk ./gtk/Graphics/UI/Gtk/Pango/Vertical.chs.pp 71 +#if PANGO_CHECK_VERSION(1,26,0) hunk ./gtk/Graphics/UI/Gtk/Pango/Vertical.chs.pp 89 +#endif hunk ./gtk/Graphics/UI/Gtk/Pango/Vertical.chs.pp 100 + |
From: Andy S. <And...@co...> - 2010-04-03 10:31:24
|
Sat Apr 3 06:30:13 EDT 2010 Andy Stewart <laz...@gm...> * Update miscellaneous functions that need handle GdkEvent. Ignore-this: 4e1c5d19c0211caac25b34fdefe81638 hunk ./Makefile.am 905 + gtk/Graphics/UI/Gtk/Gdk/Display_stub.o \ hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 183 + containerPropagateExpose, hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 215 +import Control.Monad.Reader.Class (ask) +import Control.Monad.Trans (liftIO) hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 229 +import Graphics.UI.Gtk.Gdk.EventM (EventM, EKey, EExpose) +import Graphics.UI.Gtk.Gdk.Events (Event, EventKey, marshalEvent) hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 540 +-- | When a container receives an expose event, it must send synthetic expose events to all children that +-- don't have their own 'Windows'. This function provides a convenient way of doing this. A container, +-- when it receives an expose event, calls 'containerPropagateExpose' once for each child, +-- passing in the event the container received. +-- [_$_] +-- 'containerPropagateExpose' takes care of deciding whether an expose event needs to be sent to +-- the child, intersecting the event's area with the child area, and sending the event. +-- [_$_] +-- In most cases, a container can simply either simply inherit the "expose" implementation from +-- 'Container', or, do some drawing and then chain to the 'expose' implementation from 'Container'. +containerPropagateExpose :: (ContainerClass container, WidgetClass child) => container -> child -> EventM EExpose () +containerPropagateExpose container child = do + eventPtr <- ask + liftIO $ {#call container_propagate_expose#} + (toContainer container) + (toWidget child) + (castPtr eventPtr) + hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 29 +-- The following functions not useful, don't bind: +-- gdk_display_set_pointer_hooks +-- hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 76 + displayAddClientMessageFilter, hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 82 - -- displayGetEvent, - -- displayPeekEvent, - -- displayPutEvent, + displayGetEvent, + displayPeekEvent, + displayPutEvent, hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 122 +import Control.Monad.Reader.Class (ask) +import Control.Monad.Trans (liftIO) hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 133 -import Graphics.UI.Gtk.Gdk.Enums (Modifier(..)) +import Graphics.UI.Gtk.Gdk.Enums (Modifier(..), FilterReturn(..)) hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 135 +import Graphics.UI.Gtk.Gdk.EventM (EventM, EKey, EAny) +import Graphics.UI.Gtk.Gdk.Events (Event, EventKey, marshalEvent) hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 256 +-- | Adds a filter to be called when X ClientMessage events are received. See 'windowAddFilter' if +-- you are interested in filtering other types of events. +displayAddClientMessageFilter :: Display -> Atom -> (Event -> IO FilterReturn) -> IO () +displayAddClientMessageFilter display (Atom messageType) func = do + funcPtr <- mkFilterFunc $ \_ eventPtr _ -> do + event <- marshalEvent eventPtr + liftM (fromIntegral . fromEnum) (func event) [_$_] + {#call display_add_client_message_filter#} + display + (castPtr messageType) + funcPtr + (castFunPtrToPtr funcPtr) + +{#pointer FilterFunc#} +{#pointer *XEvent newtype#} + +foreign import ccall "wrapper" mkFilterFunc :: [_$_] + (Ptr XEvent -> Ptr Event -> Ptr () -> IO {#type gint#}) + -> IO FilterFunc [_$_] + hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 313 +-- | Gets the next 'Event' to be processed for display, fetching events from the windowing system if +-- necessary. +displayGetEvent :: Display -> IO (Maybe Event) +displayGetEvent self = do + eventPtr <- {#call display_get_event#} self + if eventPtr == nullPtr + then return Nothing + else liftM Just (marshalEvent (castPtr eventPtr)) [_$_] + +-- | Gets a copy of the first 'Event' in the display's event queue, without removing the event from the +-- queue. (Note that this function will not get more events from the windowing system. It only checks +-- the events that have already been moved to the GDK event queue.) +displayPeekEvent :: Display -> IO (Maybe Event) +displayPeekEvent self = do + eventPtr <- {#call display_peek_event#} self + if eventPtr == nullPtr + then return Nothing + else liftM Just (marshalEvent (castPtr eventPtr)) [_$_] + +-- | Appends a copy of the given event onto the front of the event queue for display. +displayPutEvent :: Display -> EventM EAny () +displayPutEvent self = do + eventPtr <- ask + liftIO $ {#call display_put_event#} self (castPtr eventPtr) + hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 663 + hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs.pp 60 + FilterReturn(..), hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs.pp 303 + +-- | Specifies the result of applying a 'FilterFunc' to a native event. +{#enum FilterReturn {underscoreToCase} deriving (Bounded,Eq,Show)#} hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 96 - -- screenBroadcastClientMessage, + screenBroadcastClientMessage, hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 126 +import Control.Monad.Reader.Class (ask) +import Control.Monad.Trans (liftIO) hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 142 +import Graphics.UI.Gtk.Gdk.EventM (EventM, EKey, EAny) +import Graphics.UI.Gtk.Gdk.Events (Event, EventKey, marshalEvent) hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 496 --- screenBroadcastClientMessage :: Screen --- -> {-GdkEvent*-} -- ^ @event@ - the 'Event' --- -> IO () --- screenBroadcastClientMessage self event = --- {# call gdk_screen_broadcast_client_message #} --- self --- {-event-} - +screenBroadcastClientMessage :: Screen -> EventM EAny () +screenBroadcastClientMessage self = do + eventPtr <- ask + liftIO $ {# call gdk_screen_broadcast_client_message #} + self + (castPtr eventPtr) hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 138 + +-- * Signals [_$_] + ownerChange, hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 144 +import Control.Monad.Reader.Class (ask) +import Control.Monad.Trans (liftIO) hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 150 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 162 +import Graphics.UI.Gtk.Gdk.EventM (EventM, EKey, EAny) +import Graphics.UI.Gtk.Gdk.Events (Event, EventKey, marshalEvent) hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 883 + +------------- +-- Signals +-- | The 'ownerChange' signal is emitted when GTK+ receives an event that indicates that the ownership +-- of the selection associated with clipboard has changed. +ownerChange :: ClipboardClass self => Signal self (Event -> IO Bool) +ownerChange = Signal (connect_BOXED__BOOL "owner-change" marshalEvent) + hunk ./gtk/Graphics/UI/Gtk/General/General.chs 77 + getEventWidget, + propagateEvent, + getCurrentEvent, + + -- * Snooper + keySnooperInstall, + keySnooperRemove, hunk ./gtk/Graphics/UI/Gtk/General/General.chs 103 +import Control.Monad.Reader.Class (ask) +import Control.Monad.Trans (liftIO) + hunk ./gtk/Graphics/UI/Gtk/General/General.chs 120 +import Graphics.UI.Gtk.Gdk.EventM (EventM, EKey, EAny) +import Graphics.UI.Gtk.Gdk.Events (Event, EventKey, marshalEvent) hunk ./gtk/Graphics/UI/Gtk/General/General.chs 336 +-- | If event is 'Nothing' or the event was not associated with any widget, returns 'Nothing', otherwise returns +-- the widget that received the event originally. +getEventWidget :: EventM EAny (Maybe Widget) +getEventWidget = do + eventPtr <- ask + liftIO $ do + widgetPtr <- {#call get_event_widget#} (castPtr eventPtr) + if widgetPtr == nullPtr + then return Nothing + else liftM Just (makeNewObject mkWidget (return widgetPtr)) + +-- | Sends an event to a widget, propagating the event to parent widgets if the event remains +-- unhandled. Events received by GTK+ from GDK normally begin in 'mainDoEvent'. Depending on the +-- type of event, existence of modal dialogs, grabs, etc., the event may be propagated; if so, this +-- function is used. 'propagateEvent' on each widget it decides to send +-- the event to. So 'widgetEvent' is the lowest-level function; it simply emits the "event" and +-- possibly an event-specific signal on a widget. 'propagateEvent' is a bit higher-level, and +-- 'mainDoEvent' is the highest level. +-- [_$_] +-- All that said, you most likely don't want to use any of these functions; synthesizing events is +-- rarely needed. Consider asking on the mailing list for better ways to achieve your goals. For +-- example, use 'windowInvalidateRect' instead of making up expose +-- events. +propagateEvent :: WidgetClass widget => widget -> EventM EAny () +propagateEvent widget = do + eventPtr <- ask + liftIO $ {#call propagate_event#} + (toWidget widget) + (castPtr eventPtr) + +-- | Obtains a copy of the event currently being processed by GTK+. For example, if you get a "clicked" +-- signal from 'Button', the current event will be the 'EventButton' that triggered the "clicked" +-- signal. The returned event must be freed with 'eventFree'. If there is no current event, the +-- function returns 'Nothing'. +getCurrentEvent :: IO (Maybe Event) +getCurrentEvent = do + eventPtr <- {#call get_current_event#} [_$_] + if eventPtr == nullPtr + then return Nothing + else liftM Just (marshalEvent (castPtr eventPtr)) [_$_] + +-- | Installs a key snooper function, which will get called on all key events before delivering them +-- normally. +keySnooperInstall :: (EventKey -> IO Int) -> IO Int +keySnooperInstall func = do + funcPtr <- mkKeySnoopFunc $ \_ eventPtr _ -> do + event <- marshalEvent eventPtr + liftM fromIntegral (func event) + liftM fromIntegral $ + {#call key_snooper_install#} + funcPtr + (castFunPtrToPtr funcPtr) + +{#pointer KeySnoopFunc#} + +foreign import ccall "wrapper" mkKeySnoopFunc :: [_$_] + (Ptr Widget -> Ptr EventKey -> Ptr () -> IO {#type gint#}) + -> IO KeySnoopFunc [_$_] hunk ./gtk/Graphics/UI/Gtk/General/General.chs 395 +-- | Removes the key snooper function with the given id. +keySnooperRemove :: Int -> IO () +keySnooperRemove handlerId = + {#call key_snooper_remove#} (fromIntegral handlerId) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp 49 - -- cellEditableStartEditing, + cellEditableStartEditing, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp 59 +import Control.Monad.Reader.Class (ask) +import Control.Monad.Trans (liftIO) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp 67 +import Graphics.UI.Gtk.Gdk.EventM (EventM, EKey, EAny) +import Graphics.UI.Gtk.Gdk.Events (Event, EventKey, marshalEvent) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp 80 --- cellEditableStartEditing :: CellEditableClass self => self --- -> {-GdkEvent*-} -- ^ @event@ - A {GdkEvent, FIXME: unknown type\/value}, or --- -- {@NULL@, FIXME: this should probably be converted to a --- -- Maybe data type} --- -> IO () --- cellEditableStartEditing self event = --- {# call gtk_cell_editable_start_editing #} --- (toCellEditable self) --- {-event-} +cellEditableStartEditing :: CellEditableClass self => self -> EventM EAny () +cellEditableStartEditing self = do + eventPtr <- ask + liftIO $ {# call gtk_cell_editable_start_editing #} + (toCellEditable self) + (castPtr eventPtr) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 86 - -- cellRendererActivate, - -- cellRendererStartEditing, + cellRendererActivate, + cellRendererStartEditing, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 135 +import Control.Monad.Reader.Class (ask) +import Control.Monad.Trans (liftIO) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 147 +import Graphics.UI.Gtk.Gdk.EventM (EventM, EKey, EAny) +import Graphics.UI.Gtk.Gdk.Events (Event, EventKey, marshalEvent) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 258 --- cellRendererActivate :: (CellRendererClass self, WidgetClass widget) => [_$_] --- cell --- -> Event --- -> widget --- -> String --- -> Rectangle --- -> Rectangle --- -> CellRendererState --- -> IO Bool --- cellRendererActivate self event widget path background cell flags = --- liftM toBool $ --- withUTFString path $ \ pathPtr -> [_$_] --- with background $ \ backgroundPtr -> [_$_] --- with cell $ \ cellPtr -> [_$_] --- {#call cell_renderer_activate#} --- (toCellRenderer self) --- event --- (toWidget widget) --- pathPtr --- backgroundPtr --- cellPtr --- ((fromIntegral . fromEnum) flags) +cellRendererActivate :: (CellRendererClass self, WidgetClass widget) => [_$_] + self + -> widget + -> String + -> Rectangle + -> Rectangle + -> CellRendererState + -> EventM EAny Bool +cellRendererActivate self widget path background cell flags = do + eventPtr <- ask + liftIO $ liftM toBool $ do + withUTFString path $ \ pathPtr -> [_$_] + with background $ \ backgroundPtr -> [_$_] + with cell $ \ cellPtr -> [_$_] + {#call cell_renderer_activate#} + (toCellRenderer self) + (castPtr eventPtr) + (toWidget widget) + pathPtr + (castPtr backgroundPtr) + (castPtr cellPtr) + ((fromIntegral . fromEnum) flags) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 282 --- cellRendererStartEditing +cellRendererStartEditing :: (CellRendererClass self, WidgetClass widget) => self -> widget + -> String [_$_] + -> Rectangle + -> Rectangle + -> CellRendererState + -> EventM EAny CellEditable +cellRendererStartEditing cell widget path backArea cellArea flags = do + eventPtr <- ask + liftIO $ makeNewGObject mkCellEditable $ [_$_] + withUTFString path $ \ pathPtr -> [_$_] + with backArea $ \ backAreaPtr -> [_$_] + with cellArea $ \ cellAreaPtr -> [_$_] + {#call cell_renderer_start_editing#} + (toCellRenderer cell) + (castPtr eventPtr) + (toWidget widget) + pathPtr + (castPtr backAreaPtr) + (castPtr cellAreaPtr) + ((fromIntegral . fromEnum) flags) |
From: Andy S. <And...@co...> - 2010-04-03 09:47:44
|
Sat Apr 3 05:46:26 EDT 2010 Andy Stewart <laz...@gm...> * Fix gio module load problem. Ignore-this: c5802e701cf1395319f39f2cb72f5827 hunk ./configure.ac 254 + GIO_SPLITBASE_DEPENDS="${PKG_BYTESTRING_ID} ${PKG_ARRAY_ID}" hunk ./configure.ac 279 +AC_SUBST(GIO_SPLITBASE_DEPENDS) hunk ./gio/gio.package.conf.in 17 -depends: @PKG_BASE_ID@ glib-@PACKAGE_VERSION@ +depends: @PKG_BASE_ID@ glib-@PACKAGE_VERSION@ @GIO_SPLITBASE_DEPENDS@ |
From: Andy S. <And...@co...> - 2010-04-03 07:01:17
|
Sat Apr 3 03:00:22 EDT 2010 Andy Stewart <laz...@gm...> * Fix a bug of Editable signal "insertText". Ignore-this: e75192d1521bee73faf2dec69ab03794 hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 293 -insertText :: EditableClass self => Signal self (String -> Int -> Int -> IO ()) -insertText = Signal (connect_STRING_INT_INT__NONE "insert-text") +insertText :: EditableClass self => Signal self (String -> Int -> IO Int) +insertText = Signal (connect_STRINGPTR_INT__INTPTR "insert-text") + +-- | Singal helper functions. +connect_STRINGPTR_INT__INTPTR :: + EditableClass self => SignalName -> + ConnectAfter -> self -> + (String -> Int -> IO Int) -> + IO (ConnectId self) +connect_STRINGPTR_INT__INTPTR signal after obj user = + connectGeneric signal after obj + (\strPtr strLen posPtr -> do + str <- if strLen<0 then peekUTFString strPtr + else peekUTFStringLen (strPtr, strLen) + pos <- peek (posPtr :: Ptr {#type gint#}) + pos' <- user str (fromIntegral pos) + poke (posPtr :: Ptr {#type gint#}) (fromIntegral pos') + ) |
From: Andy S. <And...@co...> - 2010-04-03 06:20:49
|
Sat Apr 3 02:19:49 EDT 2010 Andy Stewart <laz...@gm...> * Add miscellaneous Gdk moudles, and fix some functions. Ignore-this: 18d0b99b5af657eaf226ab00ace57ff3 hunk ./ApiUpdateTodoList.txt 28 -*** TODO Border.chs +*** DONE Border.chs hunk ./ApiUpdateTodoList.txt 30 -*** TODO Builder.chs +*** DONE Builder.chs hunk ./ApiUpdateTodoList.txt 36 -*** TODO Color.chs -*** TODO Colormap.chs +*** DONE Color.chs +*** DONE Colormap.chs hunk ./ApiUpdateTodoList.txt 43 -*** TODO Device.chs +*** DONE Device.chs hunk ./ApiUpdateTodoList.txt 46 -*** TODO DragContext.chs +*** DONE DragContext.chs hunk ./ApiUpdateTodoList.txt 49 -*** TODO Drop.chs +*** DONE Drop.chs hunk ./ApiUpdateTodoList.txt 51 -*** TODO Error.chs -*** TODO Event.chs +*** DONE Error.chs +*** DONE Event.chs hunk ./ApiUpdateTodoList.txt 59 -*** TODO Global.chs +*** DONE Global.chs hunk ./ApiUpdateTodoList.txt 77 -*** TODO Keyboard.chs +*** DONE Keyboard.chs hunk ./ApiUpdateTodoList.txt 79 -*** TODO Keymap.chs +*** DONE Keymap.chs hunk ./ApiUpdateTodoList.txt 86 -*** TODO Notify.chs -*** TODO Offscreen.chs +*** DONE Notify.chs +*** DONE Offscreen.chs hunk ./ApiUpdateTodoList.txt 107 -*** TODO Pointer.chs +*** DONE Pointer.chs hunk ./ApiUpdateTodoList.txt 122 -*** TODO Property.chs -*** TODO Query.chs +*** DONE Property.chs +*** DONE Query.chs hunk ./ApiUpdateTodoList.txt 138 -*** TODO Rgb.chs +*** DONE Rgb.chs hunk ./ApiUpdateTodoList.txt 150 -*** TODO Spawn.chs +*** DONE Spawn.chs hunk ./ApiUpdateTodoList.txt 158 -*** TODO Threads.chs +*** DONE Threads.chs hunk ./Makefile.am 813 + gtk/Graphics/UI/Gtk/Gdk/Rgb.chs.pp \ + gtk/Graphics/UI/Gtk/Gdk/Colormap.chs.pp \ + gtk/Graphics/UI/Gtk/Gdk/Color.chs.pp \ + gtk/Graphics/UI/Gtk/Gdk/Device.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 52 - module Graphics.UI.Gtk.Gdk.Keys, hunk ./gtk/Graphics/UI/Gtk.hs.pp 59 + module Graphics.UI.Gtk.Gdk.Keys, hunk ./gtk/Graphics/UI/Gtk.hs.pp 77 + module Graphics.UI.Gtk.Gdk.Rgb, + module Graphics.UI.Gtk.Gdk.Colormap, + module Graphics.UI.Gtk.Gdk.Color, + module Graphics.UI.Gtk.Gdk.Device, hunk ./gtk/Graphics/UI/Gtk.hs.pp 308 -import Graphics.UI.Gtk.Gdk.Keys hunk ./gtk/Graphics/UI/Gtk.hs.pp 316 +import Graphics.UI.Gtk.Gdk.Keys hunk ./gtk/Graphics/UI/Gtk.hs.pp 329 +import Graphics.UI.Gtk.Gdk.Rgb +import Graphics.UI.Gtk.Gdk.Colormap +import Graphics.UI.Gtk.Gdk.Color +import Graphics.UI.Gtk.Gdk.Device addfile ./gtk/Graphics/UI/Gtk/Gdk/Color.chs.pp hunk ./gtk/Graphics/UI/Gtk/Gdk/Color.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Color +-- +-- Author : Andy Stewart +-- +-- Created: 2 Apr 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) +-- +module Graphics.UI.Gtk.Gdk.Color ( +-- * Methods [_$_] + colorEqual, + colorHash, + colorToString, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.GObject (constructNewGObject, makeNewGObject) +{#import Graphics.UI.Gtk.Types#} +import Graphics.UI.Gtk.General.Structs (Color) + +{# context lib="gdk" prefix="gdk" #} + +-- | Compares two colors. +colorEqual :: Color -> Color -> IO Bool +colorEqual color1 color2 = + liftM toBool $ + with color1 $ \ color1Ptr -> [_$_] + with color2 $ \ color2Ptr -> [_$_] + {#call color_equal#} + (castPtr color1Ptr) + (castPtr color2Ptr) + +-- | A hash function suitable for using for a hash table that stores 'Color''s. +colorHash :: Color -> IO Int +colorHash color = + liftM fromIntegral $ [_$_] + with color $ \ colorPtr -> {#call color_hash#} (castPtr colorPtr) + +-- | Returns a textual specification of color in the hexadecimal form #rrrrggggbbbb, where r, g and b are +-- hex digits representing the red, green and blue components respectively. +colorToString :: Color -> IO String +colorToString color = + with color $ \ colorPtr -> [_$_] + {#call color_to_string#} (castPtr colorPtr) + >>= peekUTFString addfile ./gtk/Graphics/UI/Gtk/Gdk/Colormap.chs.pp hunk ./gtk/Graphics/UI/Gtk/Gdk/Colormap.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Colormap +-- +-- Author : Andy Stewart +-- +-- Created: 2 Apr 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) +-- +-- The following funtion not useful or just internal, don't bind: +-- gdk_colormap_ref [_$_] +-- gdk_colormap_unref +-- gdk_colormap_alloc_colors +-- gdk_colormap_alloc_color +-- gdk_colormap_free_colors +-- gdk_colormap_query_color +-- +module Graphics.UI.Gtk.Gdk.Colormap ( + +-- * Types + Colormap, + ColormapClass, + castToColormap, + toColormap, + +-- * Constructors + colormapNew, + +-- * Methods + colormapGetScreen, + colormapGetSystem, + colormapGetVisual, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.GObject (constructNewGObject, makeNewGObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gdk" prefix="gdk" #} + +-------------------- +-- Constructors + +-- | Creates a new colormap for the given visual. +colormapNew :: VisualClass visual => visual -> Bool -> IO Colormap +colormapNew visual allocate = + constructNewGObject mkColormap $ + {# call gdk_colormap_new #} + (toVisual visual) + (fromBool allocate) + +-------------------- +-- Methods +-- | Gets the screen for which this colormap was created. +colormapGetScreen :: Colormap -> IO Screen +colormapGetScreen self = + makeNewGObject mkScreen $ + {# call gdk_colormap_get_screen #} + self + +-- | Gets the system's default colormap for the default screen. (See +-- 'colormapGetSystemForScreen' +colormapGetSystem :: IO Colormap +colormapGetSystem = + makeNewGObject mkColormap $ + {# call gdk_colormap_get_system #} + +-- | Returns the visual for which a given colormap was created. +colormapGetVisual :: Colormap -> IO Visual +colormapGetVisual self = + makeNewGObject mkVisual $ + {# call gdk_colormap_get_visual #} + self addfile ./gtk/Graphics/UI/Gtk/Gdk/Device.chs.pp hunk ./gtk/Graphics/UI/Gtk/Gdk/Device.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Device +-- +-- Author : Andy Stewart +-- +-- Created: 2 Apr 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) +-- +-- +module Graphics.UI.Gtk.Gdk.Device ( + +-- * Details +-- | In addition to the normal keyboard and mouse input devices, GTK+ also contains support for extended +-- input devices. In particular, this support is targeted at graphics tablets. Graphics tablets +-- typically return sub-pixel positioning information and possibly information about the pressure and +-- tilt of the stylus. Under X, the support for extended devices is done through the XInput extension. +-- [_$_] +-- Because handling extended input devices may involve considerable overhead, they need to be turned on +-- for each 'Window' individually using 'inputSetExtensionEvents'. (Or, more typically, for +-- 'Widgets', using 'widgetSetExtensionEvents'. As an additional complication, depending on +-- the support from the windowing system, its possible that a normal mouse cursor will not be displayed +-- for a particular extension device. If an application does not want to deal with displaying a cursor +-- itself, it can ask only to get extension events from devices that will display a cursor, by passing +-- the 'ExtensionEventsCursor' value to 'inputSetExtensionEvents'. Otherwise, the +-- application must retrieve the device information using 'devicesList', check the @hasCursor@ +-- field, and, if it is 'False', draw a cursor itself when it receives motion events. +-- [_$_] +-- Each pointing device is assigned a unique integer ID; events from a particular device can be +-- identified by the deviceid field in the event structure. The events generated by pointer devices +-- have also been extended to contain pressure, xtilt and ytilt fields which contain the extended +-- information reported as additional valuators from the device. The pressure field is a a double value +-- ranging from 0.0 to 1.0, while the tilt fields are double values ranging from -1.0 to 1.0. (With +-- -1.0 representing the maximum tilt to the left or up, and 1.0 representing the maximum tilt to the +-- right or down.) +-- [_$_] +-- One additional field in each event is the source field, which contains an enumeration value +-- describing the type of device; this currently can be one of 'SourceMouse', 'SourcePen', +-- 'SourceEraser', or 'SourceCursor'. This field is present to allow simple applications to (for +-- instance) delete when they detect eraser devices without having to keep track of complicated +-- per-device settings. +-- [_$_] +-- Various aspects of each device may be configured. The configuration of devices is queried using +-- 'devicesList', which also controls +-- whether the device's range is mapped to the entire screen or to a single window. The mapping of the +-- valuators of the device onto the predefined valuator types is set using +-- 'deviceSetAxisUse'. And the source type for each device can be set with +-- 'deviceSetSource'. +-- [_$_] +-- Devices may also have associated keys or macro buttons. Such keys can be globally set to map into +-- normal X keyboard events. The mapping is set using 'deviceSetKey'. +-- [_$_] +-- The interfaces in this section will most likely be considerably modified in the future to accomodate +-- devices that may have different sets of additional valuators than the pressure xtilt and ytilt. + +-- * Types + Device, + DeviceClass, + castToDevice, + toDevice, + TimeCoord, + +-- * Methods + devicesList, + deviceFreeHistory, + deviceGetAxis, + deviceGetCorePointer, + deviceGetHistory, + deviceGetState, + deviceSetAxisUse, + deviceSetKey, + deviceSetMode, + deviceSetSource, + inputSetExtensionEvents, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.GList +import System.Glib.Flags +import System.Glib.UTFString +import System.Glib.GObject (constructNewGObject, makeNewGObject) +import Graphics.UI.Gtk.Gdk.Enums (InputSource(..), InputMode(..), ExtensionMode(..), AxisUse(..), Modifier(..)) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gdk" prefix="gdk" #} + +-------------------- +-- types +-- | The 'TimeCoord' structure stores a single event in a motion history. It contains the following +-- fields: +{#pointer *TimeCoord newtype#} + +-------------------- +-- Methods + +-- | Returns the list of available input devices for the default display. The list is statically +-- allocated and should not be freed. +devicesList :: IO [Device] +devicesList = do + glist <- {#call devices_list#} + mapM (makeNewGObject mkDevice . return) =<< fromGList glist + +-- | Frees an array of 'TimeCoord' that was returned by 'deviceGetHistory'. +-- [_$_] +-- Frees an array of 'TimeCoord' that was returned by 'deviceGetHistory'. +deviceFreeHistory :: [TimeCoord] -> Int -> IO () +deviceFreeHistory events nEvents = + withArray (map (\(TimeCoord x) -> x) events) $ \eventsPtr -> + {# call gdk_device_free_history #} + (castPtr eventsPtr) + (fromIntegral nEvents) + +-- | Interprets an array of double as axis values for a given device, and locates the value in the array +-- for a given axis use. +deviceGetAxis :: DeviceClass self => self -> AxisUse -> IO (Maybe (Double, Double)) +deviceGetAxis self use = + alloca $ \axesPtr -> + alloca $ \valuePtr -> do + success <- liftM toBool $ + {# call gdk_device_get_axis #} + (toDevice self) + axesPtr + ((fromIntegral . fromEnum) use) + valuePtr + if success [_$_] + then do + axes <- peek axesPtr + value <- peek valuePtr + return (Just (realToFrac axes, realToFrac value)) + else return Nothing + +-- | Returns the core pointer device for the default display. +deviceGetCorePointer :: IO Device +deviceGetCorePointer = + makeNewGObject mkDevice $ + {# call gdk_device_get_core_pointer #} + +-- | Obtains the motion history for a device; given a starting and ending timestamp, return all events in +-- the motion history for the device in the given range of time. Some windowing systems do not support +-- motion history, in which case, 'False' will be returned. (This is not distinguishable from the case +-- where motion history is supported and no events were found.) +deviceGetHistory :: DeviceClass self => self -> DrawWindow -> Word32 -> Word32 -> IO (Maybe ([TimeCoord], Int)) +deviceGetHistory self window start stop = + allocaArray 0 $ \ eventsPtr -> [_$_] + alloca $ \nEventsPtr -> do + success <- liftM toBool $ + {# call gdk_device_get_history #} + (toDevice self) + window + (fromIntegral start) + (fromIntegral stop) + eventsPtr + nEventsPtr + if success [_$_] + then do + events_ <- peekArray 0 eventsPtr + let events = map TimeCoord events_ + nEvents <- peek nEventsPtr + return (Just (events, fromIntegral nEvents)) + else return Nothing + +-- | Gets the current state of a device. +deviceGetState :: DeviceClass self => self -> DrawWindow -> IO ([Double], Modifier) +deviceGetState self window = + allocaArray 0 $ \axesPtr -> + alloca $ \modifierPtr -> do + {# call gdk_device_get_state #} + (toDevice self) + window + axesPtr + modifierPtr + axes <- peekArray 0 axesPtr + modifier <- peek modifierPtr + return ((map realToFrac axes), (toEnum (fromIntegral modifier))) + +-- | Specifies how an axis of a device is used. +deviceSetAxisUse :: DeviceClass self => self -> Int -> AxisUse -> IO () +deviceSetAxisUse self index use = + {# call gdk_device_set_axis_use #} + (toDevice self) + (fromIntegral index) + ((fromIntegral . fromEnum) use) + +-- | Specifies the X key event to generate when a macro button of a device is pressed. +deviceSetKey :: DeviceClass self => self -> Int -> Int -> [Modifier] -> IO () +deviceSetKey self index keyval modifiers = + {# call gdk_device_set_key #} + (toDevice self) + (fromIntegral index) + (fromIntegral keyval) + ((fromIntegral . fromFlags) modifiers) + +-- | Sets a the mode of an input device. The mode controls if the device is active and whether the +-- device's range is mapped to the entire screen or to a single window. +deviceSetMode :: DeviceClass self => self -> InputMode -> IO Bool +deviceSetMode self mode = + liftM toBool $ + {# call gdk_device_set_mode #} + (toDevice self) + ((fromIntegral . fromEnum) mode) + +-- | Sets the source type for an input device. +deviceSetSource :: DeviceClass self => self -> InputSource -> IO () +deviceSetSource self source = + {# call gdk_device_set_source #} + (toDevice self) + ((fromIntegral . fromEnum) source) + +-- | Turns extension events on or off for a particular window, and specifies the event mask for extension +-- events. +inputSetExtensionEvents :: DrawWindow -> Int -> ExtensionMode -> IO () +inputSetExtensionEvents window mask mode = + {#call input_set_extension_events#} + window + (fromIntegral mask) + ((fromIntegral . fromEnum) mode) + hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs.pp 57 + InputSource(..), + InputMode(..), + AxisUse(..), hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs.pp 292 + +-- | An enumeration describing the type of an input device in general terms. +{#enum InputSource {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | An enumeration that describes the mode of an input device. +{#enum InputMode {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | An enumeration describing the way in which a device axis (valuator) maps onto the predefined +-- valuator types that GTK+ understands. +{#enum AxisUse {underscoreToCase} deriving (Bounded,Eq,Show)#} addfile ./gtk/Graphics/UI/Gtk/Gdk/Rgb.chs.pp hunk ./gtk/Graphics/UI/Gtk/Gdk/Rgb.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Rgb +-- +-- Author : Andy Stewart +-- +-- Created: 2 Apr 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) +-- +-- +module Graphics.UI.Gtk.Gdk.Rgb ( +-- * Types + RgbCmap, + +-- * Methods + rgbCmapNew, + drawRgbImage, + drawRgbImageDithalign, + drawIndexedImage, + drawGrayImage, + drawRgb32Image, + drawRgb32ImageDithalign, + rgbColormapDitherable, + rgbDitherable, + rgbFindColor, + rgbGetColormap, + rgbGetVisual, + rgbSetInstall, + rgbSetMinColors, + rgbSetVerbose, + ) where + +import Control.Monad (when, liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.GObject (constructNewGObject) +{#import Graphics.UI.Gtk.Types#} +import Graphics.UI.Gtk.General.Structs +import Graphics.UI.Gtk.General.Enums + +{# context lib="gdk" prefix="gdk" #} + +-------------------- +-- Types +{#pointer *RgbCmap newtype#} + +-------------------- +-- Methods + +-- | Draws an RGB image in the drawable. This is the core 'RGB' function, and likely the only one you +-- will need to use. +-- [_$_] +-- The rowstride parameter allows for lines to be aligned more flexibly. For example, lines may be +-- allocated to begin on 32-bit boundaries, even if the width of the rectangle is odd. Rowstride is +-- also useful when drawing a subrectangle of a larger image in memory. Finally, to replicate the same +-- line a number of times, the trick of setting rowstride to 0 is allowed. +-- [_$_] +-- In general, for 0 <= i < width and 0 <= j < height, the pixel (x + i, y + j) is colored with red +-- value @rgbBuf@[j * rowstride + i * 3], green value @rgbBuf@[j * rowstride + i * 3 + 1], and blue value +-- @rgbBuf@[j * rowstride + i * 3 + 2]. +drawRgbImage :: DrawableClass drawable => drawable -> GC -> Int -> Int -> Int -> Int -> Dither -> String -> Int -> IO () +drawRgbImage drawable gc x y width height dith buf rowstride = + withUTFString buf $ \ bufPtr -> [_$_] + {#call draw_rgb_image#} + (toDrawable drawable) + gc + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + ((fromIntegral . fromEnum) dith) + (castPtr bufPtr) + (fromIntegral rowstride) + +-- | Draws an RGB image in the drawable, with an adjustment for dither alignment. +-- [_$_] +-- This function is useful when drawing dithered images into a window that may be scrolled. Pixel (x, +-- y) will be drawn dithered as if its actual location is (x + xdith, y + ydith). Thus, if you draw an +-- image into a window using zero dither alignment, then scroll up one pixel, subsequent draws to the +-- window should have ydith = 1. +-- [_$_] +-- Setting the dither alignment correctly allows updating of small parts of the screen while avoiding +-- visible "seams" between the different dither textures. +drawRgbImageDithalign :: DrawableClass drawable => drawable -> GC -> Int -> Int -> Int -> Int -> Dither -> String -> Int -> Int -> Int -> IO () +drawRgbImageDithalign drawable gc x y width height dith buf rowstride xdith ydith = + withUTFString buf $ \ bufPtr -> [_$_] + {#call draw_rgb_image_dithalign#} + (toDrawable drawable) + gc + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + ((fromIntegral . fromEnum) dith) + (castPtr bufPtr) + (fromIntegral rowstride) + (fromIntegral xdith) + (fromIntegral ydith) + +-- | Draws an indexed image in the drawable, using a 'RgbCmap' to assign actual colors to the color +-- indices. +drawIndexedImage :: DrawableClass drawable => drawable -> GC -> Int -> Int -> Int -> Int -> Dither -> String -> Int -> RgbCmap -> IO () +drawIndexedImage drawable gc x y width height dith buf rowstride cmap = + withUTFString buf $ \ bufPtr -> [_$_] + {#call draw_indexed_image#} + (toDrawable drawable) + gc + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + ((fromIntegral . fromEnum) dith) + (castPtr bufPtr) + (fromIntegral rowstride) + cmap + +-- | Draws a grayscale image in the drawable. +drawGrayImage :: DrawableClass drawable => drawable -> GC -> Int -> Int -> Int -> Int -> Dither -> String -> Int -> IO () +drawGrayImage drawable gc x y width height dith buf rowstride = + withUTFString buf $ \ bufPtr -> [_$_] + {#call draw_gray_image#} + (toDrawable drawable) + gc + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + ((fromIntegral . fromEnum) dith) + (castPtr bufPtr) + (fromIntegral rowstride) + +-- | Draws a padded RGB image in the drawable. The image is stored as one pixel per 32-bit word. It is +-- laid out as a red byte, a green byte, a blue byte, and a padding byte. +-- [_$_] +-- It's unlikely that this function will give significant performance gains in practice. In my +-- experience, the performance gain from having pixels aligned to 32-bit boundaries is cancelled out by +-- the increased memory bandwidth. +drawRgb32Image :: DrawableClass drawable => drawable -> GC -> Int -> Int -> Int -> Int -> Dither -> String -> Int -> IO () +drawRgb32Image drawable gc x y width height dith buf rowstride = + withUTFString buf $ \ bufPtr -> [_$_] + {#call draw_rgb_32_image#} + (toDrawable drawable) + gc + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + ((fromIntegral . fromEnum) dith) + (castPtr bufPtr) + (fromIntegral rowstride) + +-- | Like @gdkDrawRgb@_32_image(), but allows you to specify the dither offsets. See +-- 'drawRgbImageDithalign' for more details. +drawRgb32ImageDithalign :: DrawableClass drawable => drawable -> GC -> Int -> Int -> Int -> Int -> Dither -> String -> Int -> Int -> Int -> IO () +drawRgb32ImageDithalign drawable gc x y width height dith buf rowstride xdith ydith = + withUTFString buf $ \ bufPtr -> [_$_] + {#call draw_rgb_32_image_dithalign#} + (toDrawable drawable) + gc + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + ((fromIntegral . fromEnum) dith) + (castPtr bufPtr) + (fromIntegral rowstride) + (fromIntegral xdith) + (fromIntegral ydith) + +-- | Creates a new 'RgbCmap' structure. The cmap maps color indexes to RGB colors. If @nColors@ is less +-- than 256, then images containing color values greater than or equal to @nColors@ will produce +-- undefined results, including possibly segfaults. +rgbCmapNew :: [Word32] -> Int -> IO RgbCmap +rgbCmapNew colors nColors = + liftM RgbCmap $ + withArray colors $ \ colorsPtr -> [_$_] + {#call rgb_cmap_new#} [_$_] + (castPtr colorsPtr) + (fromIntegral nColors) + +-- | Determines whether the visual associated with cmap is ditherable. This function may be useful for +-- presenting a user interface choice to the user about which dither mode is desired; if the display is +-- not ditherable, it may make sense to gray out or hide the corresponding UI widget. +rgbColormapDitherable :: Colormap -> IO Bool +rgbColormapDitherable cmap = + liftM toBool $ + {# call rgb_colormap_ditherable #} + cmap + +-- | Determines whether the preferred visual is ditherable. This function may be useful for presenting a +-- user interface choice to the user about which dither mode is desired; if the display is not +-- ditherable, it may make sense to gray out or hide the corresponding UI widget. +rgbDitherable :: IO Bool +rgbDitherable = + liftM toBool $ + {# call rgb_ditherable #} + +-- | colormap should be the colormap for the graphics context and drawable you're using to draw. If +-- you're drawing to a 'Widget', call 'widgetGetColormap'. +-- [_$_] +-- color should have its red, green, and blue fields initialized; 'rgbFindColor' will fill in the +-- pixel field with the best matching pixel from a color cube. The color is then ready to be used for +-- drawing, e.g. you can call 'gcSetForeground' which expects pixel to be initialized. +-- [_$_] +-- In many cases, you can avoid this whole issue by calling 'gcSetRgbFgColor' or +-- 'gcSetRgbBgColor', which do not expect pixel to be initialized in advance. If you use those +-- functions, there's no need for 'rgbFindColor'. +rgbFindColor :: Colormap -> IO Color +rgbFindColor colormap = + alloca $ \colorPtr -> do + {# call rgb_find_color #} + colormap + (castPtr colorPtr) + >> peek colorPtr >>= \color -> + return color + +-- | Get the preferred colormap for rendering image data. Not a very useful function; historically, GDK +-- could only render RGB image data to one colormap and visual, but in the current version it can +-- render to any colormap and visual. So there's no need to call this function. +rgbGetColormap :: IO Colormap +rgbGetColormap = + makeNewGObject mkColormap $ + {# call rgb_get_colormap #} + +-- | Gets a "preferred visual" chosen by 'RGB' for rendering image data on the default screen. In +-- previous versions of GDK, this was the only visual 'RGB' could use for rendering. In current +-- versions, it's simply the visual 'RGB' would have chosen as the optimal one in those previous +-- versions. 'RGB' can now render to drawables with any visual. +rgbGetVisual :: IO Visual +rgbGetVisual = + makeNewGObject mkVisual $ + {# call rgb_get_visual #} + +-- | If install is 'True', directs 'RGB' to always install a new "private" colormap rather than trying to +-- find a best fit with the colors already allocated. Ordinarily, 'RGB' will install a colormap only +-- if a sufficient cube cannot be allocated. +-- [_$_] +-- A private colormap has more colors, leading to better quality display, but also leads to the dreaded +-- "colormap flashing" effect. +rgbSetInstall :: Bool -> IO () +rgbSetInstall install = + {# call rgb_set_install #} + (fromBool install) + +-- | Sets the minimum number of colors for the color cube. Generally, 'RGB' tries to allocate the +-- largest color cube it can. If it can't allocate a color cube at least as large as @minColors@, it +-- installs a private colormap. +rgbSetMinColors :: Int -> IO () +rgbSetMinColors minColors = + {# call rgb_set_min_colors #} + (fromIntegral minColors) + +-- | Sets the "verbose" flag. This is generally only useful for debugging. +rgbSetVerbose :: Bool -> IO () +rgbSetVerbose verbose = + {# call rgb_set_verbose #} + (fromBool verbose) |
From: Andy S. <And...@co...> - 2010-04-02 18:27:26
|
Fri Apr 2 14:26:25 EDT 2010 Andy Stewart <laz...@gm...> * Add miscellaneous Gtk+ modules, and fix some functions. Ignore-this: cf8f39a7c6c9e8e77f8e3ec8970b122b hunk ./ApiUpdateTodoList.txt 4 --- Before that, we will convert tag `TODO` to tag `FINISH` +-- Before that, we will convert tag `TODO` to tag `DONE` hunk ./ApiUpdateTodoList.txt 8 --- So please make sure convert `FINISH` tag here to avoid duplicate work. +-- So please make sure convert `DONE` tag here to avoid duplicate work. hunk ./ApiUpdateTodoList.txt 18 -*** TODO Accel.chs -*** TODO Accelerator.chs -*** TODO AccelGroup.chs -*** TODO AccelMap.chs -*** TODO Accessible.chs +*** DONE Accel.chs +*** DONE Accelerator.chs +*** DONE AccelGroup.chs +*** DONE AccelMap.chs +*** DONE Accessible.chs hunk ./ApiUpdateTodoList.txt 26 -*** TODO Bindings.chs -*** TODO Bitmap.chs +*** DONE Bindings.chs +*** DONE Bitmap.chs hunk ./ApiUpdateTodoList.txt 29 -*** TODO Buildable.chs +*** DONE Buildable.chs hunk ./ApiUpdateTodoList.txt 34 -*** TODO Char.chs +*** DONE Char.chs hunk ./ApiUpdateTodoList.txt 38 -*** TODO Colors.chs +*** DONE Colors.chs hunk ./ApiUpdateTodoList.txt 42 -*** TODO CustomPaperUnixDialog.chs +*** DONE CustomPaperUnixDialog.chs hunk ./ApiUpdateTodoList.txt 53 -*** TODO FileChooserEmbed.chs +*** DONE FileChooserEmbed.chs hunk ./ApiUpdateTodoList.txt 60 -*** TODO Grab.chs +*** DONE Grab.chs hunk ./ApiUpdateTodoList.txt 63 -*** TODO Icon.chs +*** DONE Icon.chs hunk ./ApiUpdateTodoList.txt 65 -*** TODO IconSet.chs -*** TODO IconSource.chs +*** DONE IconSet.chs +*** DONE IconSource.chs hunk ./ApiUpdateTodoList.txt 68 -*** TODO Idle.chs +*** DONE Idle.chs hunk ./ApiUpdateTodoList.txt 71 -*** TODO Init.chs -*** TODO Input.chs +*** DONE Init.chs +*** DONE Input.chs hunk ./ApiUpdateTodoList.txt 74 -*** TODO Invisible.chs -*** TODO Item.chs +*** DONE Invisible.chs +*** DONE Item.chs hunk ./ApiUpdateTodoList.txt 84 -*** TODO Main.chs -*** TODO MountOperation.chs +*** DONE Main.chs +*** DONE MountOperation.chs hunk ./ApiUpdateTodoList.txt 124 -*** TODO Quit.chs -*** TODO Rc.chs -*** TODO RcStyle.chs +*** DONE Quit.chs +*** DONE Rc.chs +*** DONE RcStyle.chs hunk ./ApiUpdateTodoList.txt 137 -*** TODO Requisition.chs +*** DONE Requisition.chs hunk ./ApiUpdateTodoList.txt 141 -*** TODO Screen.chs -*** TODO SearchEngineBeagle.chs -*** TODO SearchEngine.chs -*** TODO SearchEngineQuartz.chs -*** TODO SearchEngineSimple.chs -*** TODO SearchEngineTracker.chs -*** TODO SelectionData.chs +*** DONE Screen.chs +*** DONE SearchEngineBeagle.chs +*** DONE SearchEngine.chs +*** DONE SearchEngineQuartz.chs +*** DONE SearchEngineSimple.chs +*** DONE SearchEngineTracker.chs +*** DONE SelectionData.chs hunk ./ApiUpdateTodoList.txt 149 -*** TODO Signal.chs +*** DONE Signal.chs hunk ./ApiUpdateTodoList.txt 151 -*** TODO Stock.chs -*** TODO Target.chs -*** TODO TargetList.chs -*** TODO Targets.chs -*** TODO TextAttributes.chs -*** TODO TextChildAnchor.chs +*** DONE Stock.chs +*** DONE Target.chs +*** DONE TargetList.chs +*** DONE Targets.chs +*** DONE TextAttributes.chs +*** DONE TextChildAnchor.chs hunk ./ApiUpdateTodoList.txt 159 -*** TODO Timeout.chs +*** DONE Timeout.chs hunk ./ApiUpdateTodoList.txt 163 -*** TODO TrayIcon.chs +*** DONE TrayIcon.chs hunk ./ApiUpdateTodoList.txt 165 -*** TODO TreeDragDest.chs -*** TODO TreeDragSource.chs -*** TODO TreeModelFilter.chs -*** TODO Type.chs +*** DONE TreeDragDest.chs +*** DONE TreeDragSource.chs +*** DONE TreeModelFilter.chs +*** DONE Type.chs hunk ./ApiUpdateTodoList.txt 175 -** TODO Directory: gtk-modules/Graphics/UI/Gtk -*** TODO Cairo.chs.pp +** DONE Directory: gtk-modules/Graphics/UI/Gtk +*** DONE Cairo.chs.pp hunk ./Makefile.am 657 + gtk/Graphics/UI/Gtk/General/AccelGroup.chs.pp \ + gtk/Graphics/UI/Gtk/General/AccelMap.chs.pp \ + gtk/Graphics/UI/Gtk/General/Paint.chs.pp \ + gtk/Graphics/UI/Gtk/General/Binding.chs.pp \ hunk ./Makefile.am 681 + gtk/Graphics/UI/Gtk/MenuComboToolbar/Item.chs.pp \ hunk ./Makefile.am 848 - gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp \ + gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp \ hunk ./Makefile.am 901 + gtk/Graphics/UI/Gtk/General/General_stub.o \ hunk ./Makefile.am 920 - gtk/Graphics/UI/Gtk/Pango/Fontset_stub.o [_$_] + gtk/Graphics/UI/Gtk/Pango/Fontset_stub.o \ + gtk/Graphics/UI/Gtk/General/AccelMap_stub.o hunk ./glib/System/Glib/Properties.chs 75 + readAttrFromFlagsProperty, hunk ./glib/System/Glib/Properties.chs 291 +readAttrFromFlagsProperty :: (GObjectClass gobj, Flags flag) => String -> GType -> ReadAttr gobj [flag] +readAttrFromFlagsProperty propName gtype = + readNamedAttr propName (objectGetPropertyFlags gtype propName) [_$_] + hunk ./gtk/Graphics/UI/Gtk.hs.pp 43 + module Graphics.UI.Gtk.General.AccelGroup, + module Graphics.UI.Gtk.General.AccelMap, hunk ./gtk/Graphics/UI/Gtk.hs.pp 56 + module Graphics.UI.Gtk.General.Paint, + module Graphics.UI.Gtk.General.Binding, hunk ./gtk/Graphics/UI/Gtk.hs.pp 152 + module Graphics.UI.Gtk.MenuComboToolbar.Item, hunk ./gtk/Graphics/UI/Gtk.hs.pp 253 + + -- * Builder modules hunk ./gtk/Graphics/UI/Gtk.hs.pp 291 +import Graphics.UI.Gtk.General.AccelGroup +import Graphics.UI.Gtk.General.AccelMap hunk ./gtk/Graphics/UI/Gtk.hs.pp 301 +import Graphics.UI.Gtk.General.Paint +import Graphics.UI.Gtk.General.Binding hunk ./gtk/Graphics/UI/Gtk.hs.pp 410 +import Graphics.UI.Gtk.MenuComboToolbar.Item hunk ./gtk/Graphics/UI/Gtk/Builder.chs.pp 4 --- Author: John Millikin +-- Author: John Millikin, Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Builder.chs.pp 9 +-- Copyright (C) 2010 Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Builder.chs.pp 35 +-- The following functions not useful, don't bind: +-- gtk_builder_connect_signals +-- gtk_builder_connect_signals_full +-- hunk ./gtk/Graphics/UI/Gtk/Builder.chs.pp 97 + , builderGetTypeFromName + , builderValueFromStringType hunk ./gtk/Graphics/UI/Gtk/Builder.chs.pp 101 +import Control.Monad (liftM) hunk ./gtk/Graphics/UI/Gtk/Builder.chs.pp 109 +import System.Glib.GType ( GType ) +import System.Glib.GError (GErrorDomain, GErrorClass(..), propagateGError) +import System.Glib.GValue (GValue(GValue)) hunk ./gtk/Graphics/UI/Gtk/Builder.chs.pp 256 +-- | Looks up a type by name, using the virtual function that 'Builder' has +-- for that purpose. This is mainly used when implementing the 'Buildable' +-- interface on a type. +-- +builderGetTypeFromName :: BuilderClass self => self + -> String -- ^ @typeName@ - type name to lookup + -> IO (Maybe GType) +builderGetTypeFromName self typeName = + withUTFString typeName $ \typeNamePtr -> do + gtype <- {# call gtk_builder_get_type_from_name #} + (toBuilder self) + typeNamePtr + return $ if gtype == 0 + then Just $ fromIntegral gtype + else Nothing + +-- | Like 'builderValueFromString', this function demarshals a value from a string, but takes a +-- GType instead of GParamSpec. This function calls 'valueInit' on the value argument, so it need +-- not be initialised beforehand. +builderValueFromStringType :: BuilderClass self => self -> GType -> String -> GValue -> IO Bool +builderValueFromStringType self typ str (GValue value) = + liftM toBool $ + withUTFString str $ \ strPtr -> [_$_] + propagateGError $ \gerrorPtr -> + {#call gtk_builder_value_from_string_type#} [_$_] + (toBuilder self) + typ + strPtr + (castPtr value) + gerrorPtr hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 151 - -- entryInnerBorder, + entryInnerBorder, hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 239 +import Graphics.UI.Gtk.General.Structs (Border) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 1082 --- entryInnerBorder :: EntryClass self => Attr self {-GtkBorder-} --- entryInnerBorder = newAttrFrom{-GtkBorder-}Property "inner-border" +-- | Sets the text area's border between the text and the frame. +-- [_$_] +-- Since 2.10 +entryInnerBorder :: EntryClass self => Attr self Border +entryInnerBorder = newAttrFromBoxedStorableProperty "inner-border" + {#call pure unsafe gtk_border_get_type#} addfile ./gtk/Graphics/UI/Gtk/General/AccelGroup.chs.pp hunk ./gtk/Graphics/UI/Gtk/General/AccelGroup.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget AccelGroup +-- +-- Author : Andy Stewart +-- +-- Created: 2 Apr 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) +-- +-- Groups of global keyboard accelerators for an entire 'Window' +-- +module Graphics.UI.Gtk.General.AccelGroup ( + +-- * Detail +-- +-- | A 'AccelGroup' represents a group of keyboard accelerators, typically +-- attached to a toplevel 'Window' (with 'windowAddAccelGroup'). Usually you +-- won't need to create a 'AccelGroup' directly; instead, when using +-- 'ItemFactory', Gtk+ automatically sets up the accelerators for your menus in +-- the item factory's 'AccelGroup'. +-- +-- Note that accelerators are different from mnemonics. Accelerators are +-- shortcuts for activating a menu item; they appear alongside the menu item +-- they\'re a shortcut for. For example \"Ctrl+Q\" might appear alongside the +-- \"Quit\" menu item. Mnemonics are shortcuts for GUI elements such as text +-- entries or buttons; they appear as underlined characters. See +-- 'labelNewWithMnemonic'. Menu items can have both accelerators and mnemonics, +-- of course. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----AccelGroup +-- @ + +-- * Types + AccelGroup, + AccelGroupClass, + castToAccelGroup, + toAccelGroup, + AccelGroupEntry, + AccelKey(AccelKey), + +-- * Constructors + accelGroupNew, + +-- * Methods + -- accelGroupConnect, + -- accelGroupConnectByPath, + -- accelGroupDisconnect, + accelGroupDisconnectKey, + -- accelGroupQuery, + accelGroupActivate, + accelGroupLock, + accelGroupUnlock, +#if GTK_CHECK_VERSION(2,14,0) + accelGroupGetIsLocked, +#endif + -- accelGroupFromAccelClosure, +#if GTK_CHECK_VERSION(2,14,0) + accelGroupGetModifierMask, +#endif + -- accelGroupFind, + + acceleratorValid, + acceleratorParse, + acceleratorName, + acceleratorGetLabel, + acceleratorSetDefaultModMask, + acceleratorGetDefaultModMask, + +-- * Attributes + accelGroupIsLocked, + accelGroupModifierMask, + +-- * Signals + accelGroupAccelActivate, + -- accelGroupAccelChanged, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Flags +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.Gdk.Enums (Modifier(..)) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Types +{#pointer *AccelGroupEntry newtype#} +{#pointer *AccelKey newtype#} + +-------------------- +-- Constructors + +-- | Creates a new 'AccelGroup'. +-- +accelGroupNew :: IO AccelGroup +accelGroupNew = + constructNewGObject mkAccelGroup $ + {# call gtk_accel_group_new #} + +-------------------- +-- Methods + +-- | Installs an accelerator in this group. When @accelGroup@ is being +-- activated in response to a call to 'accelGroupsActivate', @closure@ will be +-- invoked if the @accelKey@ and @accelMods@ from 'accelGroupsActivate' match +-- those of this connection. +-- +-- The signature used for the @closure@ is that of 'accelGroupActivate' +-- +-- Note that, due to implementation details, a single closure can only be +-- connected to one accelerator group. +-- +-- accelGroupConnect :: AccelGroup +-- -> Int -- ^ @accelKey@ - key value of the accelerator +-- -> [Modifier] -- ^ @accelMods@ - modifier combination of the accelerator +-- -> [AccelFlags] -- ^ @accelFlags@ - a flag mask to configure this +-- -- accelerator +-- -> {-GClosure*-} -- ^ @closure@ - closure to be executed upon accelerator +-- -- activation +-- -> IO () +-- accelGroupConnect self accelKey accelMods accelFlags closure = +-- {# call gtk_accel_group_connect #} +-- self +-- (fromIntegral accelKey) +-- ((fromIntegral . fromFlags) accelMods) +-- ((fromIntegral . fromFlags) accelFlags) +-- {-closure-} + +-- | Installs an accelerator in this group, using an accelerator path to look +-- up the appropriate key and modifiers (see 'accelMapAddEntry'). When +-- @accelGroup@ is being activated in response to a call to +-- 'accelGroupsActivate', @closure@ will be invoked if the @accelKey@ and +-- @accelMods@ from 'accelGroupsActivate' match the key and modifiers for the +-- path. +-- +-- The signature used for the @closure@ is that of 'accelGroupActivate' +-- +-- Note that @accelPath@ string will be stored in a 'Quark' +-- . Therefore, if you pass a static string, you can save some memory by +-- interning it first with 'gInternStaticString'. +-- +-- accelGroupConnectByPath :: AccelGroup +-- -> String -- ^ @accelPath@ - path used for determining key and +-- -- modifiers. +-- -> {-GClosure*-} -- ^ @closure@ - closure to be executed upon accelerator +-- -- activation +-- -> IO () +-- accelGroupConnectByPath self accelPath closure = +-- withUTFString accelPath $ \accelPathPtr -> +-- {# call gtk_accel_group_connect_by_path #} +-- self +-- accelPathPtr +-- {-closure-} +-- [_$_] +-- -- | Removes an accelerator previously installed through 'accelGroupConnect'. +-- -- +-- accelGroupDisconnect :: AccelGroup +-- -> {-GClosure*-} -- ^ @closure@ - the closure to remove from this accelerator +-- -- group +-- -> IO Bool -- ^ returns @True@ if the closure was found and got +-- -- disconnected +-- accelGroupDisconnect self closure = +-- liftM toBool $ +-- {# call gtk_accel_group_disconnect #} +-- self +-- {-closure-} + +-- | Removes an accelerator previously installed through 'accelGroupConnect'. +-- +accelGroupDisconnectKey :: AccelGroup + -> Int -- ^ @accelKey@ - key value of the accelerator + -> [Modifier] -- ^ @accelMods@ - modifier combination of the accelerator + -> IO Bool -- ^ returns @True@ if there was an accelerator which could + -- be removed, @False@ otherwise +accelGroupDisconnectKey self accelKey accelMods = + liftM toBool $ + {# call gtk_accel_group_disconnect_key #} + self + (fromIntegral accelKey) + ((fromIntegral . fromFlags) accelMods) + +-- | Queries an accelerator group for all entries matching @accelKey@ and +-- @accelMods@. +-- +-- accelGroupQuery :: AccelGroup +-- -> Int -- ^ @accelKey@ - key value of the +-- -- accelerator +-- -> [Modifier] -- ^ @accelMods@ - modifier combination +-- -- of the accelerator +-- -> IO ([AccelGroupEntry], Int) +-- accelGroupQuery self accelKey accelMods = +-- alloca $ \nEntriesPtr -> do +-- entryPtr <- {# call gtk_accel_group_query #} +-- self +-- (fromIntegral accelKey) +-- ((fromIntegral . fromFlags) accelMods) +-- nEntriesPtr +-- entry <- peekArray 0 entryPtr +-- nEntries <- peek nEntriesPtr +-- return (entry, fromIntegral nEntries) + +-- | Finds the first accelerator in @accelGroup@ that matches @accelKey@ and +-- @accelMods@, and activates it. +-- +accelGroupActivate :: GObjectClass acceleratable => AccelGroup + -> Quark -- ^ @accelQuark@ - the quark for the accelerator name + -> acceleratable -- ^ @acceleratable@ - the 'GObject', usually a 'Window', + -- on which to activate the accelerator. + -> Int -- ^ @accelKey@ - accelerator keyval from a key event + -> [Modifier] -- ^ @accelMods@ - keyboard state mask from a key event + -> IO Bool -- ^ returns @True@ if an accelerator was activated and + -- handled this keypress +accelGroupActivate self accelQuark acceleratable accelKey accelMods = + liftM toBool $ + {# call gtk_accel_group_activate #} + self + accelQuark + (toGObject acceleratable) + (fromIntegral accelKey) + ((fromIntegral . fromFlags) accelMods) + +-- | Locks the given accelerator group. +-- +-- Locking an acelerator group prevents the accelerators contained within it +-- to be changed during runtime. Refer to 'accelMapChangeEntry' about runtime +-- accelerator changes. +-- +-- If called more than once, @accelGroup@ remains locked until +-- 'accelGroupUnlock' has been called an equivalent number of times. +-- +accelGroupLock :: AccelGroup -> IO () +accelGroupLock self = + {# call gtk_accel_group_lock #} + self + +-- | Undoes the last call to 'accelGroupLock' on this @accelGroup@. +-- +accelGroupUnlock :: AccelGroup -> IO () +accelGroupUnlock self = + {# call gtk_accel_group_unlock #} + self + +#if GTK_CHECK_VERSION(2,14,0) +-- | Locks are added and removed using 'accelGroupLock' and +-- 'accelGroupUnlock'. +-- +-- * Available since Gtk+ version 2.14 +-- +accelGroupGetIsLocked :: AccelGroup + -> IO Bool -- ^ returns @True@ if there are 1 or more locks on the + -- @accelGroup@, @False@ otherwise. +accelGroupGetIsLocked self = + liftM toBool $ + {# call gtk_accel_group_get_is_locked #} + self +#endif + +-- | Finds the 'AccelGroup' to which @closure@ is connected; see +-- 'accelGroupConnect'. +-- +-- accelGroupFromAccelClosure :: +-- {-GClosure*-} -- ^ @closure@ - a 'GClosure' +-- -> IO AccelGroup -- ^ returns the 'AccelGroup' to which @closure@ is +-- -- connected +-- accelGroupFromAccelClosure closure = +-- makeNewGObject mkAccelGroup $ +-- {# call gtk_accel_group_from_accel_closure #} +-- {-closure-} + +#if GTK_CHECK_VERSION(2,14,0) +-- | Gets a 'Modifier' representing the mask for this @accelGroup@. For +-- example, 'ControlMask', 'ShiftMask', etc. +-- +-- * Available since Gtk+ version 2.14 +-- +accelGroupGetModifierMask :: AccelGroup + -> IO [Modifier] -- ^ returns the modifier mask for this accel group. +accelGroupGetModifierMask self = + liftM (toFlags . fromIntegral) $ + {# call gtk_accel_group_get_modifier_mask #} + self +#endif + +-- | Finds the first entry in an accelerator group for which @findFunc@ +-- returns @True@ and returns its 'AccelKey'. +-- +-- accelGroupFind :: AccelGroup +-- -> {-GtkAccelGroupFindFunc-} -- ^ @findFunc@ - a function to filter the +-- -- entries of @accelGroup@ with +-- -> {-gpointer-} -- ^ @data@ - data to pass to @findFunc@ +-- -> IO {-GtkAccelKey*-} -- ^ returns the key of the first entry passing +-- -- @findFunc@. The key is owned by Gtk+ and must +-- -- not be freed. +-- accelGroupFind self findFunc data_ = +-- {# call gtk_accel_group_find #} +-- self +-- {-findFunc-} +-- {-data_-} + +-------------------- +-- Attributes + +-- | Is the accel group locked. +-- [_$_] +-- Default value: 'False' +accelGroupIsLocked :: ReadAttr AccelGroup Bool +accelGroupIsLocked = readAttrFromBoolProperty "is-locked" + +-- | Modifier Mask. +-- [_$_] +-- Default value: +-- 'ShiftMask'|'ControlMask'|'Mod'1_MASK|'SuperMask'|'HyperMask'|'MetaMask' +accelGroupModifierMask :: ReadAttr AccelGroup [Modifier] +accelGroupModifierMask = readAttrFromFlagsProperty "modifier-mask" + {# call pure unsafe gdk_modifier_type_get_type #} + +-- | Gets the value set by 'acceleratorSetDefaultModMask'. +-- [_$_] +-- Returns[_\c2_][_\a0_]: the default accelerator modifier mask +acceleratorGetDefaultModMask :: IO Int +acceleratorGetDefaultModMask = + liftM fromIntegral $ + {# call gtk_accelerator_get_default_mod_mask #} + +-- | Converts an accelerator keyval and modifier mask into a string which can be used to represent the +-- accelerator to the user. +acceleratorGetLabel :: Int -> [Modifier] -> IO String +acceleratorGetLabel acceleratorKey acceleratorMods = + {# call gtk_accelerator_get_label #} + (fromIntegral acceleratorKey) + ((fromIntegral . fromFlags) acceleratorMods) + >>= readUTFString + +-- | Converts an accelerator keyval and modifier mask into a string parseable by +-- 'acceleratorParse'. For example, if you pass in GDK_q and 'ControlMask', this function +-- returns "<Control>q". +-- [_$_] +-- If you need to display accelerators in the user interface, see 'acceleratorGetLabel'. +acceleratorName :: Int -> [Modifier] -> IO String +acceleratorName acceleratorKey acceleratorMods = + {# call gtk_accelerator_name #} + (fromIntegral acceleratorKey) + ((fromIntegral . fromFlags) acceleratorMods) + >>= readUTFString + +-- | Parses a string representing an accelerator. The format looks like "<Control>a" or "<Shift><Alt>F1" +-- or "<Release>z" (the last one is for key release). The parser is fairly liberal and allows lower or +-- upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". +acceleratorParse :: String -> IO (Int, Modifier) +acceleratorParse accelerator = + alloca $ \acceleratorKeyPtr -> + alloca $ \ modsPtr -> [_$_] + withUTFString accelerator $ \acceleratorPtr -> do + {# call gtk_accelerator_parse #} + acceleratorPtr + acceleratorKeyPtr + modsPtr [_$_] + mods <- peek modsPtr + acceleratorKey <- peek acceleratorKeyPtr + return (fromIntegral acceleratorKey, (toEnum (fromIntegral mods))) + +-- | Sets the modifiers that will be considered significant for keyboard accelerators. The default mod +-- mask is 'ControlMask' | 'ShiftMask' | 'Mod'1_MASK | 'SuperMask' | 'HyperMask' | +-- 'MetaMask', that is, Control, Shift, Alt, Super, Hyper and Meta. Other modifiers will by default +-- be ignored by 'AccelGroup'. You must include at least the three modifiers Control, Shift and Alt in +-- any value you pass to this function. +-- [_$_] +-- The default mod mask should be changed on application startup, before using any accelerator groups. +acceleratorSetDefaultModMask :: [Modifier] -> IO () +acceleratorSetDefaultModMask defaultModMask = + {# call gtk_accelerator_set_default_mod_mask #} + ((fromIntegral . fromFlags) defaultModMask) + +-- | Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator. For +-- example, the GDK_a keyval plus 'ControlMask' is valid - this is a "Ctrl+a" accelerator. But, you +-- can't, for instance, use the 'Control'_L keyval as an accelerator. +acceleratorValid :: Int -> [Modifier] -> IO Bool +acceleratorValid keyval modifiers = + liftM toBool $ + {# call gtk_accelerator_valid #} + (fromIntegral keyval) + ((fromIntegral . fromFlags) modifiers) + +-------------------- +-- Signals + +-- | The accel-activate signal is an implementation detail of 'AccelGroup' and +-- not meant to be used by applications. +-- +accelGroupAccelActivate :: AccelGroupClass self => Signal self (GObject -> Int -> Modifier -> IO Bool) +accelGroupAccelActivate = Signal (connect_OBJECT_INT_ENUM__BOOL "accel-activate") + +-- | The accel-changed signal is emitted when a 'AccelGroupEntry' is added to or removed from the accel group. +-- +-- Widgets like 'AccelLabel' which display an associated accelerator should +-- connect to this signal, and rebuild their visual representation if the +-- @accelClosure@ is theirs. +-- +-- accelGroupAccelChanged :: AccelGroupClass self => Signal self (Int -> Modifier -> GClosure -> IO ()) +-- accelGroupAccelChanged = Signal (connect_INT_ENUM_BOXED__NONE "accel-changed") + addfile ./gtk/Graphics/UI/Gtk/General/AccelMap.chs.pp hunk ./gtk/Graphics/UI/Gtk/General/AccelMap.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget AccelMap +-- +-- Author : Andy Stewart +-- +-- Created: 2 Apr 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) +-- +-- Loadable keyboard accelerator specifications +-- +module Graphics.UI.Gtk.General.AccelMap ( + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----AccelMap +-- @ + +-- * Types + AccelMap, + AccelMapClass, + castToAccelMap, + toAccelMap, + +-- * Methods + accelMapAddEntry, + accelMapLookupEntry, + accelMapChangeEntry, + accelMapLoad, + accelMapSave, + accelMapForeach, + accelMapLoadFd, + accelMapSaveFd, + -- accelMapLoadScanner, + accelMapAddFilter, + accelMapForeachUnfiltered, +#if GTK_CHECK_VERSION(2,4,0) + accelMapGet, + accelMapLockPath, + accelMapUnlockPath, +#endif + +-- * Signals +#if GTK_CHECK_VERSION(2,4,0) + accelMapChanged, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Flags +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.Gdk.Enums (Modifier(..)) +import Graphics.UI.Gtk.General.AccelGroup (AccelKey(AccelKey)) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Methods + +-- | Registers a new accelerator with the global accelerator map. This +-- function should only be called once per @accelPath@ with the canonical +-- @accelKey@ and @accelMods@ for this path. To change the accelerator during +-- runtime programatically, use 'accelMapChangeEntry'. The accelerator path +-- must consist of \"\<WINDOWTYPE>\/Category1\/Category2\/...\/Action\", where +-- \<WINDOWTYPE> should be a unique application-specific identifier, that +-- corresponds to the kind of window the accelerator is being used in, e.g. +-- \"Gimp-Image\", \"Abiword-Document\" or \"Gnumeric-Settings\". The +-- Category1\/...\/Action portion is most appropriately chosen by the action +-- the accelerator triggers, i.e. for accelerators on menu items, choose the +-- item's menu path, e.g. \"File\/Save As\", \"Image\/View\/Zoom\" or +-- \"Edit\/Select All\". So a full valid accelerator path may look like: +-- \"\<Gimp-Toolbox>\/File\/Dialogs\/Tool Options...\". +-- +-- Note that @accelPath@ string will be stored in a 'Quark'. Therefore, if you pass a static string, you can save some memory by +-- interning it first with 'gInternStaticString'. +-- +accelMapAddEntry :: + String -- ^ @accelPath@ - valid accelerator path + -> Int -- ^ @accelKey@ - the accelerator key + -> [Modifier] -- ^ @accelMods@ - the accelerator modifiers + -> IO () +accelMapAddEntry accelPath accelKey accelMods = + withUTFString accelPath $ \accelPathPtr -> + {# call gtk_accel_map_add_entry #} + accelPathPtr + (fromIntegral accelKey) + ((fromIntegral . fromFlags) accelMods) + +-- | Looks up the accelerator entry for @accelPath@ and fills in @key@. +-- +accelMapLookupEntry :: + String -- ^ @accelPath@ - a valid accelerator path + -> AccelKey -- ^ @key@ - the accelerator key to be filled in + -- (optional) + -> IO Bool -- ^ returns @True@ if @accelPath@ is known, @False@ + -- otherwise +accelMapLookupEntry accelPath (AccelKey keyPtr) = + liftM toBool $ + withUTFString accelPath $ \accelPathPtr -> + {# call gtk_accel_map_lookup_entry #} + accelPathPtr + (castPtr keyPtr) + +-- | Changes the @accelKey@ and @accelMods@ currently associated with +-- @accelPath@. Due to conflicts with other accelerators, a change may not +-- always be possible, @replace@ indicates whether other accelerators may be +-- deleted to resolve such conflicts. A change will only occur if all conflicts +-- could be resolved (which might not be the case if conflicting accelerators +-- are locked). Successful changes are indicated by a @True@ return value. +-- +-- Note that @accelPath@ string will be stored in a 'Quark'. Therefore, if you pass a static string, you can save some memory by +-- interning it first with 'gInternStaticString'. +-- +accelMapChangeEntry :: + String -- ^ @accelPath@ - a valid accelerator path + -> Int -- ^ @accelKey@ - the new accelerator key + -> [Modifier] -- ^ @accelMods@ - the new accelerator modifiers + -> Bool -- ^ @replace@ - @True@ if other accelerators may be + -- deleted upon conflicts + -> IO Bool -- ^ returns @True@ if the accelerator could be changed, + -- @False@ otherwise +accelMapChangeEntry accelPath accelKey accelMods replace = + liftM toBool $ + withUTFString accelPath $ \accelPathPtr -> + {# call gtk_accel_map_change_entry #} + accelPathPtr + (fromIntegral accelKey) + ((fromIntegral . fromFlags) accelMods) + (fromBool replace) + +-- | Parses a file previously saved with 'accelMapSave' for accelerator +-- specifications, and propagates them accordingly. +-- +accelMapLoad :: + String -- ^ @fileName@ - a file containing accelerator specifications, in + -- the GLib file name encoding + -> IO () +accelMapLoad fileName = + withUTFString fileName $ \fileNamePtr -> + {# call gtk_accel_map_load #} + fileNamePtr + +-- | Saves current accelerator specifications (accelerator path, key and +-- modifiers) to @fileName@. The file is written in a format suitable to be +-- read back in by 'accelMapLoad'. +-- +accelMapSave :: + String -- ^ @fileName@ - the name of the file to contain accelerator + -- specifications, in the GLib file name encoding + -> IO () +accelMapSave fileName = + withUTFString fileName $ \fileNamePtr -> + {# call gtk_accel_map_save #} + fileNamePtr + +-- | Loops over the entries in the accelerator map whose accel path doesn't +-- match any of the filters added with 'accelMapAddFilter', and execute +-- @foreachFunc@ on each. The signature of @foreachFunc@ is that of +-- 'AccelMapForeach', the @changed@ parameter +-- indicates whether this accelerator was changed during runtime (thus, would +-- need saving during an accelerator map dump). +-- +accelMapForeach :: (String -> Int -> Modifier -> IO Bool) -> IO () +accelMapForeach func = do + funcPtr <- mkAccelMapForeach $ \_ pathPtr key mods -> do + path <- peekCString pathPtr + liftM fromBool $ func path (fromIntegral key) ((toEnum . fromIntegral) mods) + {# call gtk_accel_map_foreach #} + (castFunPtrToPtr funcPtr) + funcPtr + +{#pointer AccelMapForeach#} + +foreign import ccall "wrapper" mkAccelMapForeach :: [_$_] + (Ptr () -> CString -> {#type guint#} -> CInt -> IO {#type gboolean#}) + -> IO AccelMapForeach + +-- | Filedescriptor variant of 'accelMapLoad'. +-- +-- Note that the file descriptor will not be closed by this function. +-- +accelMapLoadFd :: + Int -- ^ @fd@ - a valid readable file descriptor + -> IO () +accelMapLoadFd fd = + {# call gtk_accel_map_load_fd #} + (fromIntegral fd) + +-- | Filedescriptor variant of 'accelMapSave'. +-- +-- Note that the file descriptor will not be closed by this function. +-- +accelMapSaveFd :: + Int -- ^ @fd@ - a valid writable file descriptor + -> IO () +accelMapSaveFd fd = + {# call gtk_accel_map_save_fd #} + (fromIntegral fd) + +-- | +-- +-- accelMapLoadScanner :: +-- {-GScanner*-} -- ^ @scanner@ - a 'GScanner' +-- -- which has already been provided with an input file +-- -> IO () +-- accelMapLoadScanner scanner = +-- {# call gtk_accel_map_load_scanner #} +-- {-scanner-} + +-- | Adds a filter to the global list of accel path filters. +-- +-- Accel map entries whose accel path matches one of the filters are skipped +-- by 'accelMapForeach'. +-- +-- This function is intended for Gtk+ modules that create their own menus, +-- but don't want them to be saved into the applications accelerator map dump. +-- +accelMapAddFilter :: + String -- ^ @filterPattern@ - a pattern + -> IO () +accelMapAddFilter filterPattern = + withUTFString filterPattern $ \filterPatternPtr -> + {# call gtk_accel_map_add_filter #} + filterPatternPtr + +-- | Loops over all entries in the accelerator map, and execute @foreachFunc@ +-- on each. The signature of @foreachFunc@ is that of 'AccelMapForeach', +-- , the @changed@ parameter indicates whether this +-- accelerator was changed during runtime (thus, would need saving during an +-- accelerator map dump). +-- +accelMapForeachUnfiltered :: (String -> Int -> Modifier -> IO Bool) -> IO () +accelMapForeachUnfiltered func = do + funcPtr <- mkAccelMapForeach $ \_ pathPtr key mods -> do + path <- peekCString pathPtr + liftM fromBool $ func path (fromIntegral key) ((toEnum . fromIntegral) mods) + {# call gtk_accel_map_foreach_unfiltered #} + (castFunPtrToPtr funcPtr) + funcPtr + +#if GTK_CHECK_VERSION(2,4,0) +-- | Gets the singleton global 'AccelMap' object. This object is useful only +-- for notification of changes to the accelerator map via the ::changed signal; +-- it isn't a parameter to the other accelerator map functions. +-- +-- * Available since Gtk+ version 2.4 +-- +accelMapGet :: + IO AccelMap -- ^ returns the global 'AccelMap' object +accelMapGet = + makeNewGObject mkAccelMap $ + {# call gtk_accel_map_get #} + +-- | Locks the given accelerator path. If the accelerator map doesn't yet +-- contain an entry for @accelPath@, a new one is created. +-- +-- Locking an accelerator path prevents its accelerator from being changed +-- during runtime. A locked accelerator path can be unlocked by +-- 'accelMapUnlockPath'. Refer to 'accelMapChangeEntry' for information about +-- runtime accelerator changes. +-- +-- If called more than once, @accelPath@ remains locked until +-- 'accelMapUnlockPath' has been called an equivalent number of times. +-- +-- Note that locking of individual accelerator paths is independent from +-- locking the 'AccelGroup' containing them. For runtime accelerator changes to +-- be possible both the accelerator path and its 'AccelGroup' have to be +-- unlocked. +-- +-- * Available since Gtk+ version 2.4 +-- +accelMapLockPath :: + String -- ^ @accelPath@ - a valid accelerator path + -> IO () +accelMapLockPath accelPath = + withUTFString accelPath $ \accelPathPtr -> + {# call gtk_accel_map_lock_path #} + accelPathPtr + +-- | Undoes the last call to 'accelMapLockPath' on this @accelPath@. Refer to +-- 'accelMapLockPath' for information about accelerator path locking. +-- +-- * Available since Gtk+ version 2.4 +-- +accelMapUnlockPath :: + String -- ^ @accelPath@ - a valid accelerator path + -> IO () +accelMapUnlockPath accelPath = + withUTFString accelPath $ \accelPathPtr -> + {# call gtk_accel_map_unlock_path #} + accelPathPtr +#endif + +-------------------- +-- Signals + +#if GTK_CHECK_VERSION(2,4,0) +-- | Notifies of a change in the global accelerator map. The path is also used +-- as the detail for the signal, so it is possible to connect to +-- changed::accel_path. +-- +-- * Available since Gtk+ version 2.4 +-- +accelMapChanged :: AccelMapClass self => Signal self (String -> Int -> Modifier -> IO ()) +accelMapChanged = Signal (connect_STRING_INT_ENUM__NONE "changed") +#endif addfile ./gtk/Graphics/UI/Gtk/General/Binding.chs.pp hunk ./gtk/Graphics/UI/Gtk/General/Binding.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Bindings +-- +-- Author : Andy Stewart +-- +-- Created: 2 Apr 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) +-- +-- Current FFI don't support varargs functions: +-- gtk_binding_entry_add_signal +-- +-- The following functions not useful, don't bind: +-- gtk_binding_set_by_class +-- +module Graphics.UI.Gtk.General.Binding ( +-- * Types + BindingSet, + BindingArg, + +-- * Methods [_$_] + bindingEntryAddSignal, + bindingSetNew, + bindingSetFind, + bindingsActivate, + bindingsActivateEvent, + bindingSetActivate, + bindingEntrySkip, + bindingEntryRemove, + bindingSetAddPath, + ) where + +import Control.Monad (liftM) +import Control.Monad.Trans (liftIO) +import Control.Monad.Reader.Class (ask) + +import System.Glib.GObject (makeNewGObject) +import System.Glib.FFI +import System.Glib.GList +import System.Glib.GType +import System.Glib.GValue +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.General.Enums (PathPriorityType(..), PathType(..)) +import Graphics.UI.Gtk.Gdk.Enums (Modifier(..)) +{#import Graphics.UI.Gtk.Types#} +import Graphics.UI.Gtk.Gdk.EventM + +{# context lib="gtk" prefix="gtk" #} + +---------------- +-- Types +-- | A binding set maintains a list of activatable key bindings. A single binding set can match multiple +-- types of widgets. Similar to styles, widgets can be mapped by widget name paths, widget class paths +-- or widget class types. When a binding within a set is matched upon activation, an action signal is +-- emitted on the target widget to carry out the actual activation. +{#pointer *BindingSet newtype#} + +-- | A 'BindingArg' holds the data associated with an argument for a key binding signal emission as +-- stored in 'BindingSignal'. +{#pointer *BindingArg newtype#} + +---------------- +-- Methods + +-- | Override or install a new key binding for keyval with modifiers on @bindingSet@. +bindingEntryAddSignal :: BindingSet -> Int -> Modifier -> String -> [BindingArg] -> IO () +bindingEntryAddSignal set keyval modifiers signalName args = + withUTFString signalName $ \ signalNamePtr -> [_$_] + withGSList (map (\(BindingArg ptr) -> ptr) args) $ \argsList -> + {#call gtk_binding_entry_add_signall#} [_$_] + set [_$_] + (fromIntegral keyval) + ((fromIntegral . fromEnum) modifiers) + signalNamePtr + argsList + [_$_] +-- | GTK+ maintains a global list of binding sets. Each binding set has a unique name which needs to be +-- specified upon creation. +bindingSetNew :: String -> IO BindingSet +bindingSetNew name = + liftM BindingSet $ + withUTFString name $ \ namePtr -> [_$_] + {#call gtk_binding_set_new#} namePtr + +-- | Find a binding set by its globally unique name. The @setName@ can either be a name used for +-- 'bindingSetNew'. +bindingSetFind :: String -> IO BindingSet +bindingSetFind name = + liftM BindingSet $ + withUTFString name $ \ namePtr -> [_$_] + {#call gtk_binding_set_find#} namePtr + +-- | Find a key binding matching keyval and modifiers and activate the binding on object. +bindingsActivate :: ObjectClass obj => obj -> Int -> Modifier -> IO Bool +bindingsActivate obj keyval modifiers = + liftM toBool $ + {#call gtk_bindings_activate#} [_$_] + (toObject obj) + (fromIntegral keyval) + ((fromIntegral . fromEnum) modifiers) + +-- | Looks up key bindings for object to find one matching event, and if one was found, activate it. +bindingsActivateEvent :: ObjectClass obj => obj -> EventM EKey Bool +bindingsActivateEvent obj = do + ptr <- ask + liftIO $ liftM toBool $ {#call gtk_bindings_activate_event#} + (toObject obj) + (castPtr ptr) + + +-- | Find a key binding matching keyval and modifiers within @bindingSet@ and activate the binding on +-- object. +bindingSetActivate :: ObjectClass obj => BindingSet -> Int -> Modifier -> obj -> IO Bool +bindingSetActivate set keyval modifiers obj = + liftM toBool $ + {#call gtk_binding_set_activate#} [_$_] + set + (fromIntegral keyval) + ((fromIntegral . fromEnum) modifiers) + (toObject obj) + +-- | Install a binding on @bindingSet@ which causes key lookups to be aborted, to prevent bindings from +-- lower priority sets to be activated. +bindingEntrySkip :: BindingSet -> Int -> Modifier -> IO () +bindingEntrySkip set keyval modifiers = + {#call gtk_binding_entry_skip#} [_$_] + set + (fromIntegral keyval) + ((fromIntegral . fromEnum) modifiers) + +-- | Remove a binding previously installed via 'bindingEntryAddSignal' on @bindingSet@. +bindingEntryRemove :: BindingSet -> Int -> Modifier -> IO () +bindingEntryRemove set keyval modifiers = + {#call gtk_binding_entry_remove#} [_$_] + set + (fromIntegral keyval) + ((fromIntegral . fromEnum) modifiers) + +-- | This function is used internally by the 'RC' parsing mechanism to assign match patterns to +-- 'BindingSet' structures. +bindingSetAddPath :: BindingSet -> PathType -> String -> PathPriorityType -> IO () +bindingSetAddPath set path pattern priority = + withUTFString pattern $ \ patternPtr -> [_$_] + {#call gtk_binding_set_add_path#} + set + ((fromIntegral . fromEnum) path) + patternPtr + ((fromIntegral . fromEnum) priority) + hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 42 + ExpanderStyle(..), hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 422 +-- | Used to specify the style of the expanders drawn by a 'TreeView'. +{#enum ExpanderStyle {underscoreToCase} deriving (Bounded,Eq,Show)#} hunk ./gtk/Graphics/UI/Gtk/General/General.chs 4 --- Author : Axel Simon, Manuel M. T. Chakravarty +-- Author : Axel Simon, Manuel M. T. Chakravarty, Andy Stewart hunk ./gtk/Graphics/UI/Gtk/General/General.chs 9 +-- Copyright (C) 2010 Andy Stewart hunk ./gtk/Graphics/UI/Gtk/General/General.chs 21 --- TODO --- --- quitAddDestroy, quitAdd, quitRemove +-- The following function not useful, don't bind: +-- gtk_main_do_event +-- gtk_set_locale +-- gtk_parse_args +-- gtk_init_with_args +-- gtk_true +-- gtk_false +-- gtk_quit_add_full +-- gtk_quit_remove_by_data hunk ./gtk/Graphics/UI/Gtk/General/General.chs 39 --- getDefaultLanguage, + -- * Locale + disableSetlocale, + + -- * Language + getDefaultLanguage, + hunk ./gtk/Graphics/UI/Gtk/General/General.chs 47 + initAdd, + + -- * Quit + quitAddDestroy, + quitAdd, + quitRemove, hunk ./gtk/Graphics/UI/Gtk/General/General.chs 73 + + -- * Event + getCurrentEventTime, + getCurrentEventState, hunk ./gtk/Graphics/UI/Gtk/General/General.chs 106 +import Graphics.UI.Gtk.Gdk.Enums (Modifier(..)) +import System.Glib.Flags (Flags, toFlags, fromFlags) hunk ./gtk/Graphics/UI/Gtk/General/General.chs 109 +{#import Graphics.UI.Gtk.Pango.Types#} hunk ./gtk/Graphics/UI/Gtk/General/General.chs 113 -{- hunk ./gtk/Graphics/UI/Gtk/General/General.chs 117 ---getDefaultLanguage :: IO String ---getDefaultLanguage = do --- strPtr <- {#call unsafe get_default_language#} --- str <- peekUTFString strPtr --- destruct strPtr --- return str --} +getDefaultLanguage :: IO Language +getDefaultLanguage = liftM Language $ {#call unsafe get_default_language#} hunk ./gtk/Graphics/UI/Gtk/General/General.chs 126 + +-- | Prevents 'init' from automatically +-- calling setlocale (LcAll, ""). You would want to use this function if you wanted to set the locale +-- for your program to something other than the user's locale, or if you wanted to set different values +-- for different locale categories. +-- [_$_] +-- Most programs should not need to call this function. +disableSetlocale :: IO () +disableSetlocale = {#call disable_setlocale#} + hunk ./gtk/Graphics/UI/Gtk/General/General.chs 195 +-- | Registers a function to be called when the mainloop is started. +initAdd :: (IO Bool) -> IO () +initAdd func = do + funcPtr <- mkGtkFunction $ \_ -> liftM fromBool func + {#call unsafe init_add#} funcPtr (castFunPtrToPtr funcPtr) + +{#pointer GtkFunction#} + +foreign import ccall "wrapper" mkGtkFunction :: [_$_] + (Ptr () -> IO {#type gboolean#}) + -> IO GtkFunction [_$_] + +-- | Trigger destruction of object in case the mainloop at level @mainLevel@ is quit. +quitAddDestroy :: ObjectClass obj => Int -> obj -> IO () +quitAddDestroy level obj = + {#call unsafe quit_add_destroy#} (fromIntegral level) (toObject obj) + +-- | Registers a function to be called when an instance of the mainloop is left. +quitAdd :: Int -> (IO Bool) -> IO Int +quitAdd level func = [_$_] + liftM fromIntegral $ do + funcPtr <- mkGtkFunction $ \_ -> liftM fromBool func + {#call unsafe quit_add#} (fromIntegral level) funcPtr (castFunPtrToPtr funcPtr) + +-- | Removes a quit handler by its identifier. +quitRemove :: Int -> IO () +quitRemove handlerId = + {#call unsafe quit_remove#} (fromIntegral handlerId) + hunk ./gtk/Graphics/UI/Gtk/General/General.chs 305 + +-- | If there is a current event and it has a timestamp, return that timestamp, otherwise return +-- 'CurrentTime'. +getCurrentEventTime :: IO Int +getCurrentEventTime = [_$_] + liftM fromIntegral $ {#call get_current_event_time#} + +-- | If there is a current event and it has a state field, place that state field in state and return +-- 'True', otherwise return 'False'. +getCurrentEventState :: IO (Maybe [Modifier]) +getCurrentEventState = + alloca $ \ mPtr -> do + success <- liftM toBool $ {#call get_current_event_state#} mPtr + if success [_$_] + then do [_$_] + m <- peek mPtr + return (Just (toFlags (fromIntegral m))) + else return Nothing + hunk ./gtk/Graphics/UI/Gtk/General/IconFactory.chs.pp 83 + mkIconSet, hunk ./gtk/Graphics/UI/Gtk/General/IconFactory.chs.pp 89 - IconSource, + IconSource(IconSource), hunk ./gtk/Graphics/UI/Gtk/General/IconFactory.chs.pp 185 - if iconSetPtr == nullPtr then return Nothing else liftM (Just . IconSet) $ - newForeignPtr iconSetPtr icon_set_unref + if iconSetPtr == nullPtr [_$_] + then return Nothing [_$_] + else liftM Just (mkIconSet iconSetPtr) hunk ./gtk/Graphics/UI/Gtk/General/IconFactory.chs.pp 201 - if iconSetPtr == nullPtr then return Nothing else liftM (Just . IconSet) $ - newForeignPtr iconSetPtr icon_set_unref + if iconSetPtr == nullPtr [_$_] + then return Nothing [_$_] + else liftM Just (mkIconSet iconSetPtr) hunk ./gtk/Graphics/UI/Gtk/General/IconFactory.chs.pp 241 - liftM IconSet $ newForeignPtr isPtr icon_set_unref + mkIconSet isPtr hunk ./gtk/Graphics/UI/Gtk/General/IconFactory.chs.pp 252 - liftM IconSet $ newForeignPtr isPtr icon_set_unref + mkIconSet isPtr hunk ./gtk/Graphics/UI/Gtk/General/IconFactory.chs.pp 269 +mkIconSet :: Ptr IconSet -> IO IconSet +mkIconSet isPtr = liftM IconSet $ newForeignPtr isPtr icon_set_unref + addfile ./gtk/Graphics/UI/Gtk/General/Paint.chs.pp hunk ./gtk/Graphics/UI/Gtk/General/Paint.chs.pp 1 +{-# LANGUAGE ScopedTypeVariables #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Paint +-- +-- Author : Andy Stewart +-- +-- Created: 2 Apr 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) +-- +-- Customization of widgets. +-- +-- +module Graphics.UI.Gtk.General.Paint ( + paintArrow, + paintBox, + paintBoxGap, + paintCheck, + paintDiamond, + paintExtension, + paintFlatBox, + paintFocus, + paintHandle, + paintHline, + paintOption, + paintPolygon, + paintShadow, + paintShadowGap, + paintSlider, + paintTab, + paintVline, + paintExpander, + paintLayout, + paintResizeGrip, + drawInsertionCursor, + ) where + +import Control.Monad (liftM) + +import System.Glib.GObject (makeNewGObject) +import System.Glib.FFI +import System.Glib.Flags +import System.Glib.GType +import System.Glib.GValue +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Types#} +import Graphics.UI.Gtk.General.Structs (Rectangle, Color(..), Point) +import Graphics.UI.Gtk.General.Enums (StateType(..),TextDirection(..), [_$_] + ShadowType(..), ArrowType(..), [_$_] + Orientation(..), PositionType(..), ExpanderStyle(..)) +import Graphics.UI.Gtk.General.IconFactory (IconSet, mkIconSet, IconSource(IconSource)) +{#import Graphics.UI.Gtk.Pango.Types#} (PangoLayout(PangoLayout)) +import Graphics.UI.Gtk.Gdk.Enums (DrawWindowEdge(..)) + +{# context lib="gtk" prefix="gtk" #} + +-- | Draws an arrow in the given rectangle on window using the given parameters. @arrowType@ determines +-- the direction of the arrow. +paintArrow :: (StyleClass style, WidgetClass widget) => [_$_] + style [_$_] + -> DrawWindow [_$_] + -> StateType [_$_] + -> ShadowType [_$_] + -> Rectangle [_$_] + -> widget [_$_] + -> String + -> ArrowType [_$_] + -> Bool + -> Int + -> Int + -> Int + -> Int + -> IO () +paintArrow style window stateType shadowType area widget detail arrowType fill x y width height = + with area $ \ areaPtr -> [_$_] + withUTFString detail $ \ detailPtr -> [_$_] + {#call gtk_paint_arrow#} + (toStyle style) + window + ((fromIntegral . fromEnum) stateType) + ((fromIntegral . fromEnum) shadowType) + (castPtr areaPtr) + (toWidget widget) + detailPtr + ((fromIntegral . fromEnum) arrowType) + (fromBool fill) + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + +-- | Draws a box on window with the given parameters. +paintBox :: (StyleClass style, WidgetClass widget) => [_$_] + style [_$_] + -> DrawWindow [_$_] + -> StateType [_$_] + -> ShadowType [_$_] + -> Rectangle [_$_] + -> widget [_$_] + -> String + -> Int + -> Int + -> Int + -> Int + -> IO () +paintBox style window stateType shadowType area widget detail x y width height = + with area $ \ areaPtr -> [_$_] + withUTFString detail $ \ detailPtr -> [_$_] + {#call gtk_paint_box#} + (toStyle style) + window + ((fromIntegral . fromEnum) stateType) + ((fromIntegral . fromEnum) shadowType) + (castPtr areaPtr) + (toWidget widget) + detailPtr + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + +-- | Draws a box in window using the given style and state and shadow type, leaving a gap in one side. +paintBoxGap :: (StyleClass style, WidgetClass widget) => [_$_] + style [_$_] + -> DrawWindow [_$_] + -> StateType [_$_] + -> ShadowType [_$_] + -> Rectangle [_$_] + -> widget [_$_] + -> String + -> Int + -> Int + -> Int + -> Int + -> PositionType + -> Int + -> Int + -> IO () +paintBoxGap style window stateType shadowType area widget detail x y width height grapSide gapX gapWidth = + with area $ \ areaPtr -> [_$_] + withUTFString detail $ \ detailPtr -> [_$_] + {#call gtk_paint_box_gap#} + (toStyle style) + window + ((fromIntegral . fromEnum) stateType) + ((fromIntegral . fromEnum) shadowType) + (castPtr areaPtr) + (toWidget widget) + detailPtr + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + ((fromIntegral . fromEnum) grapSide) + (fromIntegral gapX) + (fromIntegral gapWidth) + +-- | Draws a check button indicator in the given rectangle on window with the given parameters. +paintCheck :: (StyleClass style, WidgetClass widget) => [_$_] + style [_$_] + -> DrawWindow [_$_] + -> StateType [_$_] + -> ShadowType [_$_] + -> Rectangle [_$_] + -> widget [_$_] + -> String + -> Int + -> Int + -> Int + -> Int + -> IO () +paintCheck style window stateType shadowType area widget detail x y width height = + with area $ \ areaPtr -> [_$_] + withUTFString detail $ \ detailPtr -> [_$_] + {#call gtk_paint_check#} + (toStyle style) + window + ((fromIntegral . fromEnum) stateType) + ((fromIntegral . fromEnum) shadowType) + (castPtr areaPtr) + (toWidget widget) + detailPtr + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + +-- | Draws a diamond in the given rectangle on window using the given parameters. +paintDiamond :: (StyleClass style, WidgetClass widget) => [_$_] + style [_$_] + -> DrawWindow [_$_] + -> StateType [_$_] + -> ShadowType [_$_] + -> Rectangle [_$_] + -> widget [_$_] + -> String + -> Int + -> Int + -> Int + -> Int + -> IO () +paintDiamond style window stateType shadowType area widget detail x y width height = + with area $ \ areaPtr -> [_$_] + withUTFString detail $ \ detailPtr -> [_$_] + {#call gtk_paint_diamond#} + (toStyle style) + window + ((fromIntegral . fromEnum) stateType) + ((fromIntegral . fromEnum) shadowType) + (castPtr areaPtr) + (toWidget widget) + detailPtr + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + +-- | Draws an extension, i.e. a notebook tab. +paintExtension :: (StyleClass style, WidgetClass widget) => [_$_] + style [_$_] + -> DrawWindow [_$_] + -> StateType [_$_] + -> ShadowType [_$_] + -> Rectangle [_$_] + -> widget [_$_] + -> String + -> Int ... [truncated message content] |
From: Andy S. <And...@co...> - 2010-04-01 16:48:13
|
Thu Apr 1 12:46:19 EDT 2010 Andy Stewart <laz...@gm...> * Update `Pango` modules to newest, fix pango functions, fix demo. Ignore-this: 6eabab447d42091fd1273a7f518437ac hunk ./ApiUpdateTodoList.txt 44 -*** TODO Display.chs hunk ./ApiUpdateTodoList.txt 45 -*** TODO DisplayManager.chs +*** DONE DisplayManager.chs hunk ./ApiUpdateTodoList.txt 47 -*** TODO Drawable.chs -*** TODO Draw.chs +*** DONE Drawable.chs +*** DONE Draw.chs hunk ./ApiUpdateTodoList.txt 54 -*** TODO Font.chs -*** TODO Fontset.chs +*** DONE Font.chs +*** DONE Fontset.chs hunk ./ApiUpdateTodoList.txt 92 -*** TODO Pango.chs -*** TODO PangoRenderer.chs +*** DONE Pango.chs +*** DONE PangoRenderer.chs hunk ./ApiUpdateTodoList.txt 309 -** TODO Directory: gtk-modules/Graphics/UI/Gtk/Multiline +** DONE Directory: gtk-modules/Graphics/UI/Gtk/Multiline hunk ./ApiUpdateTodoList.txt 311 -*** TODO TextIter.chs.pp +*** DONE TextIter.chs.pp hunk ./ApiUpdateTodoList.txt 315 -*** TODO TextView.chs.pp +*** DONE TextView.chs.pp hunk ./Makefile.am 810 + gtk/Graphics/UI/Gtk/Pango/Metrics.chs \ + gtk/Graphics/UI/Gtk/Pango/Coverage.chs \ hunk ./Makefile.am 813 + gtk/Graphics/UI/Gtk/Pango/Fontset.chs.pp \ + gtk/Graphics/UI/Gtk/Pango/Script.chs.pp \ + gtk/Graphics/UI/Gtk/Pango/Vertical.chs.pp \ + gtk/Graphics/UI/Gtk/Pango/Bidirectional.chs.pp \ + gtk/Graphics/UI/Gtk/Pango/TabArray.chs.pp \ hunk ./Makefile.am 913 - gtk/Graphics/UI/Gtk/Printing/PrintSettings_stub.o + gtk/Graphics/UI/Gtk/Printing/PrintSettings_stub.o \ + gtk/Graphics/UI/Gtk/Pango/Fontset_stub.o [_$_] hunk ./demo/carsim/CarSim.hs 252 - on mainWindow objectDestroy mainQuit + on mainWindow destroy mainQuit hunk ./demo/inputmethod/Layout.hs 49 - on win objectDestroy mainQuit + on win destroy mainQuit hunk ./demo/inputmethod/Layout.hs 91 - on im imContextPreeditStart $ do + on im preeditStart $ do hunk ./demo/inputmethod/Layout.hs 94 - on im imContextPreeditEnd $ do + on im preeditEnd $ do hunk ./demo/inputmethod/Layout.hs 97 - on im imContextPreeditChanged $ do + on im preeditChanged $ do hunk ./demo/inputmethod/Layout.hs 100 - on im imContextCommit $ \str -> do + on im commit $ \str -> do hunk ./demo/inputmethod/Layout.hs 103 - on im imContextRetrieveSurrounding $ do + on im retrieveSurrounding $ do hunk ./demo/inputmethod/Layout.hs 107 - on im imContextDeleteSurrounding' $ \off nchars -> do + on im deleteSurrounding $ \off nchars -> do hunk ./demo/pango/Layout.hs 19 - on win objectDestroy mainQuit + on win destroy mainQuit hunk ./gtk/Graphics/UI/Gtk.hs.pp 256 + module Graphics.UI.Gtk.Pango.Fontset, + module Graphics.UI.Gtk.Pango.Metrics, + module Graphics.UI.Gtk.Pango.Coverage, + module Graphics.UI.Gtk.Pango.Script, + module Graphics.UI.Gtk.Pango.Vertical, + module Graphics.UI.Gtk.Pango.Bidirectional, + module Graphics.UI.Gtk.Pango.TabArray, hunk ./gtk/Graphics/UI/Gtk.hs.pp 530 -import Graphics.UI.Gtk.Pango.Layout +import Graphics.UI.Gtk.Pango.Layout hiding (layoutGetSize) hunk ./gtk/Graphics/UI/Gtk.hs.pp 533 +import Graphics.UI.Gtk.Pango.Fontset +import Graphics.UI.Gtk.Pango.Metrics +import Graphics.UI.Gtk.Pango.Coverage +import Graphics.UI.Gtk.Pango.Script +import Graphics.UI.Gtk.Pango.Vertical +import Graphics.UI.Gtk.Pango.Bidirectional +import Graphics.UI.Gtk.Pango.TabArray hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTag.chs.pp 20 --- TODO --- [_$_] --- Haven't bind `textTagTabs` properties, need bind PangoTab first (in `pango-tabs.c`) --- hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTag.chs.pp 93 - -- textTagTabs, + textTagTabs, hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTag.chs.pp 168 +{#import Graphics.UI.Gtk.Pango.Types#} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTag.chs.pp 415 --- textTagTabs :: TextTagClass self => Attr self TabArray +textTagTabs :: TextTagClass self => Attr self TabArray +textTagTabs = [_$_] + newAttrFromBoxedOpaqueProperty (return . TabArray) (\(TabArray array) act -> act array) "tabs" + {#call pure unsafe pango_tab_array_get_type#} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 20 --- TODO --- --- If PangoTabArray is bound: [_$_] --- Fucntions: textViewSetTabs and textViewGetTabs --- Properties: textViewTabs --- hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 121 + textViewSetTabs, + textViewGetTabs, hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 142 + textViewTabs, hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 226 +{#import Graphics.UI.Gtk.Pango.Types#} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 941 +-- | Sets the default tab stops for paragraphs in @textView@. Tags in the buffer may override the default. +textViewSetTabs :: TextViewClass self => self -> TabArray -> IO () +textViewSetTabs self array = + {#call unsafe text_view_set_tabs#} (toTextView self) array + +-- | Gets the default tabs for @textView@. Tags in the buffer may override the defaults. The returned +-- array will be 'Nothing' if "standard" (8-space) tabs are used. Free the return value with +-- 'tabArrayFree'. +textViewGetTabs :: TextViewClass self => self -> IO TabArray +textViewGetTabs self = + liftM TabArray $ + {#call unsafe text_view_get_tabs#} (toTextView self) + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 1118 +-- | Custom tabs for this text. +textViewTabs :: TextViewClass self => Attr self TabArray +textViewTabs = newAttr + textViewGetTabs + textViewSetTabs + hunk ./gtk/Graphics/UI/Gtk/Pango/Attributes.chs.pp 34 - readAttrList + readAttrList, hunk ./gtk/Graphics/UI/Gtk/Pango/Attributes.chs.pp 218 + addfile ./gtk/Graphics/UI/Gtk/Pango/Bidirectional.chs.pp hunk ./gtk/Graphics/UI/Gtk/Pango/Bidirectional.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) - Bidirectional Text [_\e2_][_\80_][_\94_] Types and functions to help with handling bidirectional text +-- +-- Author : Andy Stewart +-- +-- Created: 31 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. +-- +-- #hide + +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +module Graphics.UI.Gtk.Pango.Bidirectional ( + pangoUnicharDirection, + pangoFindBaseDir, + pangoBidiTypeForUnichar, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Flags (Flags, fromFlags) +import System.Glib.UTFString +{#import Graphics.UI.Gtk.Types#} () +{#import Graphics.UI.Gtk.Pango.Types#} +import Graphics.UI.Gtk.Pango.Enums +import Graphics.UI.Gtk.Pango.Structs ( puToInt, intToPu ) +#if GTK_CHECK_VERSION(2,8,0) && defined(ENABLE_CAIRO) +{#import Graphics.Rendering.Cairo.Matrix#} +#endif + +{# context lib="pango" prefix="pango" #} + +-- | Determines the inherent direction of a character; either PangoDirectionLtr, PangoDirectionRtl, +-- or PangoDirectionNeutral. +-- [_$_] +-- This function is useful to categorize characters into left-to-right letters, right-to-left letters, +-- and everything else. If full Unicode bidirectional type of a character is needed, +-- 'bidiTypeForGunichar' can be used instead. +pangoUnicharDirection :: Char -> IO PangoDirection +pangoUnicharDirection char = + liftM (toEnum . fromIntegral) $ [_$_] + {#call unsafe pango_unichar_direction#} ((fromIntegral . fromEnum) char) + +-- | Searches a string the first character that has a strong direction, according to the Unicode +-- bidirectional algorithm. +pangoFindBaseDir :: String -> Int -> IO PangoDirection +pangoFindBaseDir text length = + liftM (toEnum . fromIntegral) $ + withUTFString text $ \ textPtr -> [_$_] + {#call unsafe pango_find_base_dir#} textPtr (fromIntegral length) + +-- | Determines the normative bidirectional character type of a character, as specified in the Unicode +-- Character Database. +-- [_$_] +-- A simplified version of this function is available as 'unicharGetDirection'. +pangoBidiTypeForUnichar :: Char -> IO BidiType +pangoBidiTypeForUnichar char = + liftM (toEnum . fromIntegral) $ + {#call unsafe pango_bidi_type_for_unichar#} ((fromIntegral . fromEnum) char) hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 4 --- Author : Axel Simon +-- Author : Axel Simon, Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 9 +-- Copyright (C) 2010 Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 49 + contextNew, + contextSetFontMap, + contextGetFontMap, hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 53 --- contextLoadFont, --- contextLoadFontSet, hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 58 - languageFromString, hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 60 - contextSetTextDir, - contextGetTextDir, + contextGetBaseDir, + contextSetBaseDir, hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 63 - contextSetTextGravity, - contextGetTextGravity, - contextSetTextGravityHint, - contextGetTextGravityHint, + contextSetBaseGravity, + contextGetBaseGravity, + contextSetGravityHint, + contextGetGravityHint, + contextGetGravity, hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 73 + contextLoadFont, + contextLoadFontset, + +-- * Compatibility list + contextSetTextDir, + contextGetTextDir, + contextSetTextGravity, + contextGetTextGravity, + contextSetTextGravityHint, + contextGetTextGravityHint, hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 101 +-- | Creates a new PangoContext initialized to default values. +-- [_$_] +-- This function is not particularly useful as it should always be followed by a +-- 'contextSetFontMap' does these two +-- steps together and hence users are recommended to use that. +-- [_$_] +-- If you are using Pango as part of a higher-level system, that system may have it's own way of create +-- a PangoContext. For instance, the GTK+ toolkit has, among others, +-- 'pangoContextGetForScreen'. Use those instead. +contextNew :: IO PangoContext +contextNew = do + contextPtr <- {#call unsafe context_new#} + liftM PangoContext $ newForeignPtr_ contextPtr + +-- | Sets the font map to be searched when fonts are looked-up in this context. This is only for internal +-- use by Pango backends, a PangoContext obtained via one of the recommended methods should already +-- have a suitable font map. +contextSetFontMap :: FontMapClass map => PangoContext -> map -> IO () +contextSetFontMap context map = + {#call unsafe context_set_font_map#} context (toFontMap map) + +-- | Gets the PangoFontmap used to look up fonts for this context. +contextGetFontMap :: PangoContext -> IO FontMap +contextGetFontMap context = + makeNewGObject mkFontMap $ + {#call unsafe context_get_font_map#} context hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 146 -contextGetMetrics :: PangoContext -> FontDescription -> Language -> - IO FontMetrics -contextGetMetrics pc fd l = do - mPtr <- {#call unsafe context_get_metrics#} pc fd l - ascent <- {#call unsafe font_metrics_get_ascent#} mPtr - descent <- {#call unsafe font_metrics_get_descent#} mPtr - approximate_char_width <- - {#call unsafe font_metrics_get_approximate_char_width#} mPtr - approximate_digit_width <- - {#call unsafe font_metrics_get_approximate_digit_width#} mPtr -#if PANGO_CHECK_VERSION(1,6,0) - underline_position <- - {#call unsafe font_metrics_get_underline_position#} mPtr - underline_thickness <- - {#call unsafe font_metrics_get_underline_thickness#} mPtr - strikethrough_position <- - {#call unsafe font_metrics_get_strikethrough_position#} mPtr - strikethrough_thickness <- - {#call unsafe font_metrics_get_strikethrough_thickness#} mPtr -#endif - return (FontMetrics - (intToPu ascent) - (intToPu descent) - (intToPu approximate_char_width) - (intToPu approximate_digit_width) -#if PANGO_CHECK_VERSION(1,6,0) - (intToPu underline_thickness) - (intToPu underline_position) - (intToPu strikethrough_thickness) - (intToPu strikethrough_position) -#endif - ) +contextGetMetrics :: PangoContext -> FontDescription -> Language -> IO FontMetrics +contextGetMetrics pc fd l = + {#call unsafe context_get_metrics#} pc fd l + >>= makeNewFontMetrics . castPtr hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 180 --- | Set the default text direction of this context. --- -contextSetTextDir :: PangoContext -> PangoDirection -> IO () -contextSetTextDir pc dir = - {#call unsafe context_set_base_dir#} pc (fromIntegral (fromEnum dir)) +-- | Retrieves the base direction for the context. See 'contextSetBaseDir'. +contextGetBaseDir :: PangoContext -> IO PangoDirection +contextGetBaseDir context = + liftM (toEnum . fromIntegral) $ + {#call unsafe context_get_base_dir#} context hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 186 --- | Get the current text direction of this context. --- -contextGetTextDir :: PangoContext -> IO PangoDirection -contextGetTextDir pc = liftM (toEnum . fromIntegral) $ - {#call unsafe context_get_base_dir#} pc +-- | Sets the base direction for the context. +-- [_$_] +-- The base direction is used in applying the Unicode bidirectional algorithm; if the direction is +-- PangoDirectionLtr or PangoDirectionRtl , then the value will be used as the paragraph direction +-- in the Unicode bidirectional algorithm. A value of PangoDirectionWeakLtr or +-- PangoDirectionWeakRtl is used only for paragraphs that do not contain any strong characters +-- themselves. +contextSetBaseDir :: PangoContext -> PangoDirection -> IO () +contextSetBaseDir context direction = + {#call unsafe context_set_base_dir#} context ((fromIntegral . fromEnum) direction) hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 202 -contextSetTextGravity :: PangoContext -> PangoGravity -> IO () -contextSetTextGravity pc gravity = +contextSetBaseGravity :: PangoContext -> PangoGravity -> IO () +contextSetBaseGravity pc gravity = hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 208 -contextGetTextGravity :: PangoContext -> IO PangoGravity -contextGetTextGravity pc = liftM (toEnum . fromIntegral) $ +contextGetBaseGravity :: PangoContext -> IO PangoGravity +contextGetBaseGravity pc = liftM (toEnum . fromIntegral) $ hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 214 -contextSetTextGravityHint :: PangoContext -> PangoGravityHint -> IO () -contextSetTextGravityHint pc gravity = +contextSetGravityHint :: PangoContext -> PangoGravityHint -> IO () +contextSetGravityHint pc gravity = hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 220 -contextGetTextGravityHint :: PangoContext -> IO PangoGravityHint -contextGetTextGravityHint pc = liftM (toEnum . fromIntegral) $ +contextGetGravityHint :: PangoContext -> IO PangoGravityHint +contextGetGravityHint pc = liftM (toEnum . fromIntegral) $ hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 223 + +-- | Retrieves the gravity for the context. This is similar to 'contextGetBaseGravity', except +-- for when the base gravity is PangoGravityAuto for which 'gravityGetForMatrix' is used to +-- return the gravity from the current context matrix. +contextGetGravity :: PangoContext -> IO PangoGravity +contextGetGravity pc = liftM (toEnum . fromIntegral) $ + {#call unsafe context_get_gravity#} pc hunk ./gtk/Graphics/UI/Gtk/Pango/Context.chs.pp 257 +-- | Loads the font in one of the fontmaps in the context that is the closest match for desc. +contextLoadFont :: PangoContext -> FontDescription -> IO Font +contextLoadFont pc fd = + makeNewGObject mkFont $ + {#call unsafe context_load_font#} pc fd + +-- | Load a set of fonts in the context that can be used to render a font matching desc. +contextLoadFontset :: PangoContext -> FontDescription -> Language -> IO FontSet +contextLoadFontset pc fd language = + makeNewGObject mkFontSet $ + {#call unsafe context_load_fontset#} pc fd language + +---------------------- +-- Compatibility list +contextSetTextDir :: PangoContext -> PangoDirection -> IO () +contextSetTextDir = contextSetBaseDir + +contextGetTextDir :: PangoContext -> IO PangoDirection +contextGetTextDir = contextGetBaseDir + +contextSetTextGravity :: PangoContext -> PangoGravity -> IO () +contextSetTextGravity = contextSetBaseGravity + +contextGetTextGravity :: PangoContext -> IO PangoGravity +contextGetTextGravity = contextGetBaseGravity + +contextSetTextGravityHint :: PangoContext -> PangoGravityHint -> IO () +contextSetTextGravityHint = contextSetGravityHint + +contextGetTextGravityHint :: PangoContext -> IO PangoGravityHint +contextGetTextGravityHint = contextGetGravityHint addfile ./gtk/Graphics/UI/Gtk/Pango/Coverage.chs hunk ./gtk/Graphics/UI/Gtk/Pango/Coverage.chs 1 +{-# OPTIONS_HADDOCK hide #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) - text layout functions: Font coverage +-- +-- Author : Andy Stewart +-- +-- Created: 1 Apr 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. +-- +-- #hide + +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Functions to manage font coverage. +-- +-- * The PangoCoverage structure represents a map from Unicode characters to PangoCoverageLevel. It is an +-- opaque structure with no public fields. +-- +-- Note: +-- +-- The following functions not useful, don't bind them: +-- pango_coverage_ref +-- pango_coverage_unref +-- +module Graphics.UI.Gtk.Pango.Coverage ( + Coverage, + coverageNew, + coverageCopy, + coverageGet, + coverageSet, + coverageMax, + coverageToBytes, + coverageFromBytes, + CoverageLevel(..), + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Flags (Flags, fromFlags) +import System.Glib.UTFString +{#import Graphics.UI.Gtk.Types#} () +{#import Graphics.UI.Gtk.Pango.Types#} +import Graphics.UI.Gtk.Pango.Enums +import Graphics.UI.Gtk.Pango.Structs ( puToInt, intToPu ) + +{# context lib="pango" prefix="pango_coverage" #} + +-- | Create a new PangoCoverage +coverageNew :: IO Coverage +coverageNew = {#call unsafe new#} >>= makeNewCoverage . castPtr + +-- | Copy an existing PangoCoverage. (This function may now be unnecessary since we refcount the +-- structure. File a bug if you use it.) +coverageCopy :: Coverage -> IO Coverage +coverageCopy coverage = [_$_] + {#call unsafe copy#} coverage + >>= makeNewCoverage . castPtr + +-- | Determine whether a particular index is covered by coverage +coverageGet :: Coverage -> Int -> IO CoverageLevel +coverageGet coverage index = + liftM (toEnum . fromIntegral) $ + {#call unsafe pango_coverage_get#} coverage (fromIntegral index) + +-- | Modify a particular index within coverage +coverageSet :: Coverage -> Int -> CoverageLevel -> IO () +coverageSet coverage index level = + {#call unsafe pango_coverage_set#} coverage (fromIntegral index) ((fromIntegral . fromEnum) level) + +-- | Set the coverage for each index in coverage to be the max (better) value of the current coverage for +-- the index and the coverage for the corresponding index in other. +coverageMax :: Coverage -> Coverage -> IO () +coverageMax coverage other = + {#call unsafe max#} coverage other + +-- | Convert a PangoCoverage structure into a flat binary format +coverageToBytes :: Coverage -> IO ([String], Int) +coverageToBytes coverage = + allocaArray 0 $ \ bytesPtr -> [_$_] + alloca $ \ nBytesPtr -> do + {#call to_bytes#} [_$_] + coverage [_$_] + (castPtr bytesPtr) + nBytesPtr + bytes <- mapM peekCString =<< peekArray 0 bytesPtr + nBytes <- peek nBytesPtr + {#call unsafe g_free#} (castPtr bytesPtr) + return (bytes, fromIntegral nBytes) + +-- | Convert data generated from 'converageToBytes' back to a PangoCoverage +coverageFromBytes :: [String] -> Int -> IO (Maybe Coverage) +coverageFromBytes bytes nBytes = + withUTFStringArray bytes $ \ bytesPtr -> do + coveragePtr <- {#call unsafe from_bytes#} + (castPtr bytesPtr) + (fromIntegral nBytes) + if coveragePtr == nullPtr + then return Nothing + else liftM Just $ makeNewCoverage coveragePtr + +-- | Used to indicate how well a font can represent a particular Unicode character point for a particular +-- script. +{#enum PangoCoverageLevel as CoverageLevel {underscoreToCase} deriving (Bounded,Eq,Show)#} + +instance Flags CoverageLevel hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 35 +-- Note: +-- +-- The following functions not useful, don't bind them: +-- pango_font_description_free +-- pango_font_descriptions_free +-- hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 45 + fontDescriptionCopyStatic, + fontDescriptionHash, + fontDescriptionEqual, hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 49 + fontDescriptionSetFamilyStatic, hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 61 + fontDescriptionSetAbsoluteSize, + fontDescriptionGetSizeIsAbsolute, + fontDescriptionSetGravity, + fontDescriptionGetGravity, hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 66 + fontDescriptionGetSetFields, hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 69 + fontDescriptionMergeStatic, hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 72 - fontDescriptionToString + fontDescriptionToString, + fontDescriptionToFilename, hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 100 +-- | Like 'fontDescriptionCopy', but only a shallow copy is made of the family name and other +-- allocated fields. The result can only be used until desc is modified or freed. This is meant to be +-- used when the copy is only needed temporarily. +fontDescriptionCopyStatic :: FontDescription -> IO FontDescription +fontDescriptionCopyStatic fd = {#call unsafe copy_static#} fd >>= makeNewFontDescription + +-- | Computes a hash of a PangoFontDescription structure suitable to be used, for example, as an argument +-- to 'hashTableNew'. The hash value is independent of desc->mask. +fontDescriptionHash :: FontDescription -> IO Int +fontDescriptionHash fd = [_$_] + liftM fromIntegral $ {#call unsafe hash#} fd + +-- | Compares two font descriptions for equality. Two font descriptions are considered equal if the fonts +-- they describe are provably identical. This means that their masks do not have to match, as long as +-- other fields are all the same. (Two font descriptions may result in identical fonts being loaded, +-- but still compare 'False'.) +fontDescriptionEqual :: FontDescription -> FontDescription -> IO Bool +fontDescriptionEqual fd1 fd2 = [_$_] + liftM toBool $ {#call unsafe equal#} fd1 fd2 + hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 131 +-- | Like 'fontDescriptionSetFamily', except that no copy of family is made. The caller must +-- make sure that the string passed in stays around until desc has been freed or the name is set +-- again. This function can be used if family is a static string such as a C string literal, or if desc +-- is only needed temporarily. +fontDescriptionSetFamilyStatic :: FontDescription -> String -> IO () +fontDescriptionSetFamilyStatic fd family = withUTFString family $ \strPtr -> + {#call unsafe set_family_static#} fd strPtr + + hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 235 +-- | Sets the size field of a font description, in device units. This is mutually exclusive with +-- 'fontDescriptionSetSize' which sets the font size in points. +fontDescriptionSetAbsoluteSize :: FontDescription -> Double -> IO () +fontDescriptionSetAbsoluteSize fd p = + {#call unsafe set_absolute_size#} fd (realToFrac p) + +-- | Determines whether the size of the font is in points (not absolute) or device units (absolute). See +-- 'fontDescriptionSetSize'. +fontDescriptionGetSizeIsAbsolute :: FontDescription -> IO Bool +fontDescriptionGetSizeIsAbsolute fd = + liftM toBool $ {#call unsafe get_size_is_absolute#} fd + +-- | Sets the gravity field of a font description. The gravity field specifies how the glyphs should be +-- rotated. If gravity is PangoGravityAuto, this actually unsets the gravity mask on the font +-- description. +-- [_$_] +-- This function is seldom useful to the user. Gravity should normally be set on a PangoContext. +fontDescriptionSetGravity :: FontDescription -> PangoGravity -> IO () +fontDescriptionSetGravity fd pg = + {#call unsafe set_gravity#} fd ((fromIntegral . fromEnum) pg) + +-- | Gets the gravity field of a font description. See 'fontDescriptionSetGravity'. +fontDescriptionGetGravity :: FontDescription -> IO PangoGravity +fontDescriptionGetGravity fd = [_$_] + liftM (toEnum . fromIntegral) $ {#call unsafe get_gravity#} fd [_$_] + +-- | Determines which fields in a font description have been set. +fontDescriptionGetSetFields :: FontDescription -> IO FontMask [_$_] +fontDescriptionGetSetFields fd = + liftM (toEnum . fromIntegral) $ {#call unsafe get_set_fields#} fd + hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 282 +-- | Like 'fontDescriptionMerge', but only a shallow copy is made of the family name and other +-- allocated fields. desc can only be used until @descToMerge@ is modified or freed. This is meant to +-- be used when the merged font description is only needed temporarily. +fontDescriptionMergeStatic :: FontDescription -> FontDescription -> Bool -> IO () +fontDescriptionMergeStatic fd1 fd2 replace = + {#call unsafe merge_static#} fd1 fd2 (fromBool replace) + hunk ./gtk/Graphics/UI/Gtk/Pango/Description.chs 337 - - +-- | Creates a filename representation of a font description. The filename is identical to the result +-- from calling 'fontDescriptionToString', but with underscores instead of characters that are +-- untypical in filenames, and in lower case only. +fontDescriptionToFilename :: FontDescription -> IO String +fontDescriptionToFilename fd = do + strPtr <- {#call unsafe to_filename#} fd + str <- peekUTFString strPtr + {#call unsafe g_free#} (castPtr strPtr) + return str hunk ./gtk/Graphics/UI/Gtk/Pango/Enums.chs.pp 42 + Script(..), + BidiType(..), + TabAlign(..), hunk ./gtk/Graphics/UI/Gtk/Pango/Enums.chs.pp 88 +{#enum Script {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | The PangoBidiType type represents the bidirectional character type of a Unicode character as +-- specified by the Unicode bidirectional algorithm. +{#enum BidiType {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | A PangoTabAlign specifies where a tab stop appears relative to the text. +{#enum TabAlign {underscoreToCase} deriving (Bounded,Eq,Show)#} + hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 4 --- Author : Axel Simon +-- Author : Axel Simon, Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 9 +-- Copyright (C) 2010 Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 56 + -- Functions to manage font metrics [_$_] + module Graphics.UI.Gtk.Pango.Metrics, + -- Functions to manage font coverage + module Graphics.UI.Gtk.Pango.Coverage, hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 64 + pangoFontFamilyGetName, hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 74 - FontMetrics(..) + pangoFontDescribe, + pangoFontDescribeWithAbsoluteSize, + pangoFontGetCoverage, + pangoFontGetGlyphExtents, + pangoFontGetMetrics, + pangoFontGetFontMap, + pangoFontFaceGetFaceName, + pangoFontFaceIsSynthesized, + pangoFontMapCreateContext, + pangoFontMapLoadFont, + pangoFontMapLoadFontset, hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 95 +import Graphics.UI.Gtk.Pango.Metrics +import Graphics.UI.Gtk.Pango.Coverage hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 107 -pangoFontMapListFamilies :: FontMap -> IO [FontFamily] +pangoFontMapListFamilies :: FontMapClass fontMap => fontMap -> IO [FontFamily] hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 109 - {#call unsafe font_map_list_families#} fm arrPtrPtr sizePtr + {#call unsafe font_map_list_families#} (toFontMap fm) arrPtrPtr sizePtr hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 134 -pangoFontFamilyIsMonospace :: FontFamily -> Bool +pangoFontFamilyIsMonospace :: FontFamilyClass family => family -> Bool hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 136 - liftM toBool $ {#call unsafe font_family_is_monospace#} ff + liftM toBool $ {#call unsafe font_family_is_monospace#} (toFontFamily ff) hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 146 -pangoFontFamilyListFaces :: FontFamily -> IO [FontFace] +pangoFontFamilyListFaces :: FontFamilyClass family => family -> IO [FontFace] hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 148 - {#call unsafe font_family_list_faces#} ff arrPtrPtr sizePtr + {#call unsafe font_family_list_faces#} (toFontFamily ff) arrPtrPtr sizePtr hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 169 -pangoFontFaceListSizes :: FontFace -> IO (Maybe [Double]) +pangoFontFaceListSizes :: FontFaceClass face => face -> IO (Maybe [Double]) hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 171 - {#call unsafe font_face_list_sizes#} ff arrPtrPtr sizePtr + {#call unsafe font_face_list_sizes#} (toFontFace ff) arrPtrPtr sizePtr hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 185 -pangoFontFaceDescribe :: FontFace -> IO FontDescription +pangoFontFaceDescribe :: FontFaceClass face => face -> IO FontDescription hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 187 - fdPtr <- {#call unsafe font_face_describe#} ff + fdPtr <- {#call unsafe font_face_describe#} (toFontFace ff) hunk ./gtk/Graphics/UI/Gtk/Pango/Font.chs.pp 189 + +-- | Returns a description of the font, with font size set in points. Use +-- 'fontDescribeWithAbsoluteSize' if you want the font size in device units. +pangoFontDescribe :: FontClass font => font -> IO FontDescription +pangoFontDescribe font = + {#call unsafe font_describe#} (toFont font) + >>= makeNewFontDescription . castPtr + +-- | Returns a description of the font, with absolute font size set (in device units). Use +-- 'fontDescribe' if you want the font size in points. +pangoFontDescribeWithAbsoluteSize :: FontClass font => font -> IO FontDescription +pangoFontDescribeWithAbsoluteSize font = + {#call unsafe font_describe_with_absolute_size#} (toFont font) + >>= makeNewFontDescription . castPtr + +-- | Computes the coverage map for a given font and language tag. +pangoFontGetCoverage :: FontClass font => font -> Language -> IO Coverage +pangoFontGetCoverage font language = + {#call unsafe font_get_coverage#} (toFont font) language + >>= makeNewCoverage . castPtr + [_$_] +-- | Gets the logical and ink extents of a glyph within a font. The coordinate system for each rectangle +-- has its origin at the base line and horizontal origin of the character with increasing coordinates +-- extending to the right and down. The macros 'ASCENT', and +-- 'RBEARING' can be used to convert from the extents rectangle to more traditional font +-- metrics. The units of the rectangles are in 1/PangoScale of a device unit. +pangoFontGetGlyphExtents :: FontClass font => font -> Glyph -> IO (PangoRectangle, PangoRectangle) +pangoFontGetGlyphExtents font (Glyph glyph) = + alloca $ \logPtr -> alloca $ \inkPtr -> do + {#call unsafe font_get_glyph_extents#} (toFont font) (fromIntegral glyph) (castPtr logPtr) (castPtr inkPtr) + log <- peek logPtr + ink <- peek inkPtr + return (fromRect log, fromRect ink) + +-- | Gets overall metric information for a font. Since the metrics may be substantially different for +-- different scripts, a language tag can be provided to indicate that the metrics should be retrieved +-- that correspond to the script(s) used by that language. +pangoFontGetMetrics :: FontClass font => font -> Language -> IO FontMetrics +pangoFontGetMetrics font language = + {#call unsafe font_get_metrics#} (toFont font) language + >>= makeNewFontMetrics . castPtr + +-- | Gets the font map for which the font was created. +-- [_$_] +-- Note that the font maintains a weak reference to the font map, so if all references to font map are +-- dropped, the font map will be finalized even if there are fonts created with the font map that are +-- still alive. In that case this function will return 'Nothing'. It is the responsibility of the user to +-- ensure that the font map is kept alive. In most uses this is not an issue as a PangoContext holds a +-- reference to the font map. +-- [_$_] +pangoFontGetFontMap :: FontClass font => font -> IO FontMap +pangoFontGetFontMap font = + makeNewGObject mkFontMap $ + {#call unsafe font_get_font_map#} (toFont font) + +-- | Gets the name of the family. The name is unique among all fonts for the font backend and can be used +-- in a PangoFontDescription to specify that a face from this family is desired. +pangoFontFamilyGetName :: FontFamilyClass family => family -> IO String +pangoFontFamilyGetName family = + {#call unsafe font_family_get_name#} (toFontFamily family) + >>= peekUTFString + +-- | Gets a name representing the style of this face among the different faces in the PangoFontFamily for +-- the face. This name is unique among all faces in the family and is suitable for displaying to users. +pangoFontFaceGetFaceName :: FontFaceClass face => face -> IO String +pangoFontFaceGetFaceName face = + {#call unsafe font_face_get_face_name#} (toFontFace face) + >>= peekUTFString + +-- | Returns whether a PangoFontFace is synthesized by the underlying font rendering engine from another +-- face, perhaps by shearing, emboldening, or lightening it. +pangoFontFaceIsSynthesized :: FontFaceClass face => face -> IO Bool +pangoFontFaceIsSynthesized face = + liftM toBool $ + {#call unsafe font_face_is_synthesized#} (toFontFace face) + +-- | Creates a PangoContext connected to fontmap. This is equivalent to 'contextNew' followed by +-- 'contextSetFontMap'. +-- [_$_] +-- If you are using Pango as part of a higher-level system, that system may have it's own way of create +-- a PangoContext. For instance, the GTK+ toolkit has, among others, +-- 'pangoContextGetForScreen'. Use those instead. +pangoFontMapCreateContext :: FontMapClass map => map -> IO PangoContext +pangoFontMapCreateContext map = + makeNewGObject mkPangoContext $ + {#call unsafe font_map_create_context#} (toFontMap map) + +-- | Load the font in the fontmap that is the closest match for desc. +pangoFontMapLoadFont :: (FontMapClass map, PangoContextClass context) => map -> context -> FontDescription -> IO Font [_$_] +pangoFontMapLoadFont map context description = + makeNewGObject mkFont $ + {#call font_map_load_font#} (toFontMap map) (toPangoContext context) description + [_$_] +-- | Load a set of fonts in the fontmap that can be used to render a font matching desc. +pangoFontMapLoadFontset :: (FontMapClass map, PangoContextClass context) => map -> context -> FontDescription -> Language -> IO FontSet +pangoFontMapLoadFontset map context description language = + makeNewGObject mkFontSet $ + {#call font_map_load_fontset#} (toFontMap map) (toPangoContext context) description language addfile ./gtk/Graphics/UI/Gtk/Pango/Fontset.chs.pp hunk ./gtk/Graphics/UI/Gtk/Pango/Fontset.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) - text layout functions: Fontset +-- +-- Author : Andy Stewart +-- +-- Created: 1 Apr 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) +-- +-- Fonts. The selection of an appropriate font to render text becomes a +-- substantial task in the presence of Unicode where a single font does not +-- cover the whole range of possible characters. Pango provides several +-- concepts to find appropriate fonts and to query information about them: +-- +module Graphics.UI.Gtk.Pango.Fontset ( + pangoFontsetGetFont, + pangoFontsetGetMetrics, + pangoFontsetForeach, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +{#import Graphics.UI.Gtk.Types#} +import System.Glib.GObject (makeNewGObject) +{#import Graphics.UI.Gtk.Pango.Types#} +import Graphics.UI.Gtk.Pango.Description +import Graphics.UI.Gtk.Pango.Metrics +import Graphics.UI.Gtk.Pango.Coverage +import Graphics.UI.Gtk.Pango.Structs + +{# context lib="pango" prefix="pango" #} + +-- | Returns the font in the fontset that contains the best glyph for the Unicode character wc. +pangoFontsetGetFont :: FontSetClass fontset => fontset -> Char -> IO Font +pangoFontsetGetFont fontset wc = + makeNewGObject mkFont $ + {#call fontset_get_font#} (toFontSet fontset) ((fromIntegral . fromEnum) wc) + +-- | Get overall metric information for the fonts in the fontset. +pangoFontsetGetMetrics :: FontSetClass fontset => fontset -> IO FontMetrics +pangoFontsetGetMetrics fontset = + {#call fontset_get_metrics#} (toFontSet fontset) + >>= makeNewFontMetrics . castPtr + +-- | Iterates through all the fonts in a fontset, calling func for each one. If func returns 'True', that +-- stops the iteration. +pangoFontsetForeach :: FontSetClass fontset => fontset -> (Font -> IO Bool) -> IO () +pangoFontsetForeach fontset func = do + funcPtr <- mkFontsetForeachFunc $ \_ fontPtr _ -> do + font <- makeNewGObject mkFont (return fontPtr) [_$_] + liftM fromBool $ func font + {#call fontset_foreach#} + (toFontSet fontset) + funcPtr + (castFunPtrToPtr funcPtr) + +{#pointer FontsetForeachFunc#} + +foreign import ccall "wrapper" mkFontsetForeachFunc :: [_$_] + (Ptr FontSet -> Ptr Font -> Ptr () -> IO {#type gboolean#}) + -> IO FontsetForeachFunc hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 5 --- Author : Axel Simon +-- Author : Axel Simon, Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 10 +-- Copyright (C) 2010 Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 33 + matrixCopy, + matrixTranslate, + matrixScale, + matrixRotate, + matrixConcat, + matrixTransformPoint, + matrixTransformDistance, + -- matrixTransformRectangle, + -- matrixTransformPixelRectangle, + matrixGetFontScaleFactor, + + glyphStringNew, + glyphStringCopy, + glyphStringSetSize, + glyphStringGetWidth, + + glyphItemCopy, hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 56 - glyphItemSplit + glyphItemSplit, hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 75 +{#import Graphics.Rendering.Cairo.Matrix#} + hunk ./gtk/Graphics/UI/Gtk/Pango/GlyphStorage.chs.pp 82 +-- | Copies a PangoMatrix. +matrixCopy :: Matrix -> IO Matrix +matrixCopy mat = [_$_] + with mat $ \ matPtr -> do + resPtr <- {#call unsafe matrix_copy#} (castPtr matPtr) + if resPtr==nullPtr then return identity else peek (castPtr resPtr) + +-- | Changes the transformation represented by matrix to be the transformation given by first translating +-- by (tx, ty) then applying the original transformation. +matrixTranslate :: Matrix -> Double -> Double -> IO () +matrixTranslate mat tx ty = + with mat $ \ matPtr -> [_$_] + {#call unsafe matrix_translate#} (castPtr matPtr) (realToFrac tx) (realToFrac ty) + +-- | Changes the transformation represented by matrix to be the transformation given by first scaling by +-- sx in the X direction and sy in the Y direction then applying the original transformation. +matrixScale :: Matrix -> Double -> Double -> IO () +matrixScale mat tx ty = + with mat $ \ matPtr -> [_$_] + {#call unsafe matrix_scale#} (castPtr matPtr) (realToFrac tx) (realToFrac ty) + +-- | Changes the transformation represented by matrix to be the transformation given by first rotating by +-- degrees degrees counter-clockwise then applying the original transformation. +matrixRotate :: Matrix -> Double -> IO () +matrixRotate mat degrees = + with mat $ \ matPtr -> [_$_] + {#call unsafe matrix_rotate#} (castPtr matPtr) (realToFrac degrees) + +-- | Changes the transformation represented by matrix to be the transformation given by first applying +-- transformation given by @newMatrix@ then applying the original transformation. +matrixConcat :: Matrix -> Matrix -> IO () +matrixConcat mat newMat = + with mat $ \ matPtr -> [_$_] + with newMat $ \ newMatPtr -> [_$_] + {#call unsafe matrix_concat#} (castPtr matPtr) (castPtr newMatPtr) + +-- | Transforms the point (x, y) by matrix. +matrixTransformPoint :: Matrix -> (Double, Double) -> IO (Double, Double) +matrixTransformPoint mat (x, y) = + with mat $ \ matPtr -> [_$_] + with x $ \ xPtr -> [_$_] + with y $ \ yPtr -> do + {#call unsafe matrix_transform_point#} (castPtr matPtr) (castPtr xPtr) (castPtr yPtr) + nx <- peek xPtr + ny <- peek yPtr + return (realToFrac nx, realToFrac ny) + +-- | Transforms the distance vector (dx,dy) by matrix. This is similar to 'matrixTransformPoint' +-- except that the translation components of the transformation are ignored. The calculation of the +-- returned vector is as follows: +-- [_$_] +-- dx2 = dx1 * xx + dy1 * xy; dy2 = dx1 * yx + dy1 * yy; +-- [_$_] +-- Affine transformations are position invariant, so the same vector always transforms to the same +-- vector. If (x1,y1) transforms to (x2,y2) then (x1+dx1,y1+dy1) will transform to (x1+dx2,y1+dy2) for +-- all values of x1 and x2. +matrixTransformDistance :: Matrix -> (Double, Double) -> IO (Double, Double) +matrixTransformDistance mat (x, y) = + with mat $ \ matPtr -> [_$_] + with x $ \ xPtr -> [_$_] + with y $ \ yPtr -> do + {#call unsafe matrix_transform_distance#} (castPtr matPtr) (castPtr xPtr) (castPtr yPtr) + nx <- peek xPtr + ny <- peek yPtr + return (realToFrac nx, realToFrac ny) + +-- | First transforms rect using matrix, then calculates the bounding box of the transformed +-- rectangle. The rectangle should be in Pango units. +-- [_$_] +-- This function is useful for example when you want to draw a rotated PangoLayout to an image buffer, +-- and want to know how large the image should be and how much you should shift the layout when +-- rendering. +-- [_$_] +-- If you have a rectangle in device units (pixels), use 'matrixTransformPixelRectangle'. +-- If you have the rectangle in Pango units and want to convert to transformed pixel bounding box, it +-- [_$_] +-- is more accurate to transform it first (using this function) and pass the result to +-- 'extentsToPixels', first argument, for an inclusive rounded rectangle. However, there are +-- valid reasons that you may want to convert to pixels first and then transform, for example when the +-- transformed coordinates may overflow in Pango units (large matrix translation for example). +-- matrixTransformRectangle :: Matrix -> PangoRectangle -> IO PangoRectangle +-- matrixTransformRectangle mat rect = +-- with mat $ \ matPtr -> [_$_] +-- with rect $ \ rectPtr -> do +-- {#call matrix_transform_rectangle#} (castPtr matPtr) (castPtr rectPtr) +-- peek rectPtr + +-- | First transforms the rect using matrix, then calculates the bounding box of the transformed +-- rectangle. The rectangle should be in device units (pixels). +-- [_$_] +-- This function is useful for example when you want to draw a rotated PangoLayout to an image buffer, +-- and want to know how large the image should be and how much you should shift the layout when +-- rendering. +-- [_$_] +-- For better accuracy, you should use 'matrixTransformRectangle' on original rectangle in +-- Pango units and convert to pixels afterward using 'extentsToPixels''s first argument. +-- matrixTransformPixelRectangle :: Matrix -> PangoRectangle -> IO PangoRectangle +-- matrixTransformPixelRectangle mat rect = +-- with mat $ \ matPtr -> [_$_] +-- with rect $ \ rectPtr -> do +-- {#call matrix_transform_pixel_rectangle#} (castPtr matPtr) (castPtr rectPtr) +-- peek rectPtr + +-- | Returns the scale factor of a matrix on the height of the font. That is, the scale factor in the +-- direction perpendicular to the vector that the X coordinate is mapped to. +matrixGetFontScaleFactor :: Matrix -> IO Double +matrixGetFontScaleFactor mat = + liftM realToFrac $ + with mat $ \ matPtr -> [_$_] + {#call unsafe matrix_get_font_scale_factor#} (castPtr matPtr) + +-- | Create a new PangoGlyphString. +glyphStringNew :: IO GlyphStringRaw +glyphStringNew = [_$_] + {#call unsafe glyph_string_new#} + >>= makeNewGlyphStringRaw . castPtr + +glyphStringCopy :: GlyphStringRaw -> IO GlyphStringRaw +glyphStringCopy str = [_$_] + {#call unsafe glyph_string_copy#} str + >>= makeNewGlyphStringRaw . castPtr + +-- | Resize a glyph string to the given length. +glyphStringSetSize :: GlyphStringRaw -> Int -> IO () +glyphStringSetSize str len = [_$_] + {#call unsafe glyph_string_set_size#} str (fromIntegral len) + +-- | Computes the logical width of the glyph string as can also be computed using +-- 'glyphStringExtents'. However, since this only computes the width, it's much faster. This is +-- in fact only a convenience function that computes the sum of geometry.width for each glyph in the +-- glyphs. +glyphStringGetWidth :: GlyphStringRaw -> IO Int +glyphStringGetWidth str = + liftM fromIntegral $ + {#call unsafe glyph_string_get_width#} str + +-- | Make a deep copy of an existing PangoGlyphItem structure. +glyphItemCopy :: GlyphItem -> IO GlyphItem +glyphItemCopy (GlyphItem (PangoItem ps pir) gs) = do + pirPtr1 <- {#call unsafe pango_item_copy#} pir + gsrPtr1 <- {#call unsafe glyph_string_copy#} gs + pir1 <- makeNewPangoItemRaw pirPtr1 + gsr1 <- makeNewGlyphStringRaw gsrPtr1 + return (GlyphItem (PangoItem ps pir1) gsr1) + hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 4 --- Author : Axel Simon +-- Author : Axel Simon, Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 9 +-- Copyright (C) 2010 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 27 +-- The following functions not useful, don't bind: +-- pango_layout_iter_free +-- hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 62 + layoutSetHeight, + layoutGetHeight, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 67 + layoutIsWrapped, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 72 + layoutIsEllipsized, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 87 - TabAlign, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 93 + layoutGetUnknownGlyphsCount, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 96 + layoutIndexToLineX, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 102 + layoutGetSize, + layoutGetPixelSize, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 109 + layoutIterCopy, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 121 + layoutIterGetLayout, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 127 + layoutIterGetLayoutExtents, hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 148 -{#import Graphics.UI.Gtk.Pango.Enums#} (EllipsizeMode(..)) +{#import Graphics.UI.Gtk.Pango.Enums#} (EllipsizeMode(..), TabAlign(..)) hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 361 +-- | Sets the height to which the PangoLayout should be ellipsized at. There are two different behaviors, +-- based on whether height is positive or negative. +-- [_$_] +-- If height is positive, it will be the maximum height of the layout. Only lines would be shown that +-- would fit, and if there is any text omitted, an ellipsis added. At least one line is included in +-- each paragraph regardless of how small the height value is. A value of zero will render exactly one +-- line for the entire layout. +-- [_$_] +-- If height is negative, it will be the (negative of) maximum number of lines per paragraph. That is, +-- the total number of lines shown may well be more than this value if the layout contains multiple +-- paragraphs of text. The default value of -1 means that first line of each paragraph is +-- ellipsized. This behvaior may be changed in the future to act per layout instead of per +-- paragraph. File a bug against pango at http://bugzilla.gnome.org/ if your code relies on this +-- behavior. +-- [_$_] +-- Height setting only has effect if a positive width is set on layout and ellipsization mode of layout +-- is not PangoEllipsizeNone. The behavior is undefined if a height other than -1 is set and +-- ellipsization mode is set to PangoEllipsizeNone, and may change in the future. +layoutSetHeight :: PangoLayout -> Maybe Double -> IO () +layoutSetHeight (PangoLayout _ pl) Nothing = + {#call unsafe layout_set_height#} pl (-1) +layoutSetHeight (PangoLayout _ pl) (Just pu) = + {#call unsafe layout_set_height#} pl (puToInt pu) + +-- | Gets the width to which the lines of the PangoLayout should wrap. +layoutGetHeight :: PangoLayout -> IO (Maybe Double) +layoutGetHeight (PangoLayout _ pl) = do + w <- {#call unsafe layout_get_height#} pl + return (if w==(-1) then Nothing else Just (intToPu w)) + hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 431 +-- | Queries whether the layout had to wrap any paragraphs. +-- [_$_] +-- This returns 'True' if a positive width is set on layout, ellipsization mode of layout is set to +-- PangoEllipsizeNone, and there are paragraphs exceeding the layout width that have to be wrapped. +layoutIsWrapped :: PangoLayout -> IO Bool +layoutIsWrapped (PangoLayout _ pl) = + liftM toBool $ + {#call unsafe layout_is_wrapped#} pl + hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 452 + +-- | Queries whether the layout had to ellipsize any paragraphs. +-- [_$_] +-- This returns 'True' if the ellipsization mode for layout is not PangoEllipsizeNone, a positive width +-- is set on layout, and there are paragraphs exceeding that width that have to be ellipsized. +layoutIsEllipsized :: PangoLayout -> IO Bool +layoutIsEllipsized (PangoLayout _ pl) = + liftM toBool $ + {#call unsafe layout_is_ellipsized#} pl + hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 571 --- | Specify where the Tab stop appears relative to the text. --- --- * Only Tab stops that align text to the left are supported right now. --- -{#enum PangoTabAlign as TabAlign {underscoreToCase}#} - hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 582 - {#call unsafe tab_array_set_tab#} tabPtr idx + {#call unsafe tab_array_set_tab#} (TabArray tabPtr) idx hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 584 - {#call unsafe layout_set_tabs#} pl tabPtr - {#call unsafe tab_array_free#} tabPtr + {#call unsafe layout_set_tabs#} pl (TabArray tabPtr) + {#call unsafe tab_array_free#} (TabArray tabPtr) hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 592 -layoutResetTabs (PangoLayout _ pl) = {#call unsafe layout_set_tabs#} pl nullPtr +layoutResetTabs (PangoLayout _ pl) = {#call unsafe layout_set_tabs#} pl (TabArray nullPtr) hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 603 - len <- {#call unsafe tab_array_get_size#} tabPtr + len <- {#call unsafe tab_array_get_size#} (TabArray tabPtr) hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 605 - {#call unsafe tab_array_get_tab#} tabPtr idx alignPtr posPtr + {#call unsafe tab_array_get_tab#} (TabArray tabPtr) idx alignPtr posPtr hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 630 +-- | Counts the number unknown glyphs in layout. That is, zero if glyphs for all characters in the layout +-- text were found, or more than zero otherwise. +-- [_$_] +-- This function can be used to determine if there are any fonts available to render all characters in +-- a certain string, or when used in combination with PangoAttrFallback, to check if a certain font +-- supports all the characters in the string. +-- [_$_] +layoutGetUnknownGlyphsCount :: PangoLayout -> IO Int +layoutGetUnknownGlyphsCount (PangoLayout _ pl) = + liftM fromIntegral $ + {#call layout_get_unknown_glyphs_count#} pl + hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 691 +-- | Converts from byte index_ within the layout to line and X position. (X position is measured from the +-- left edge of the line) +layoutIndexToLineX :: PangoLayout -> Int -> Bool -> IO (Int, Int) +layoutIndexToLineX (PangoLayout _ pl) index trailing = + alloca $ \ linePtr -> [_$_] + alloca $ \ xPosPtr -> do + {#call layout_index_to_line_x#} + pl (fromIntegral index) (fromBool trailing) linePtr xPosPtr [_$_] + line <- peek linePtr + xPos <- peek xPosPtr + return (fromIntegral line, fromIntegral xPos) + hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 815 +-- | Determines the logical width and height of a PangoLayout in Pango units (device units scaled by +-- PangoScale). This is simply a convenience function around 'layoutGetExtents'. +layoutGetSize :: PangoLayout -> IO (Int, Int) +layoutGetSize (PangoLayout _ pl) = + alloca $ \ widthPtr -> [_$_] + alloca $ \ heightPtr -> do + {#call layout_get_size#} + pl widthPtr heightPtr + width <- peek widthPtr + height <- peek heightPtr + return (fromIntegral width, fromIntegral height) + +-- | Determines the logical width and height of a PangoLayout in device units. ('layoutGetSize' +-- returns the width and height scaled by PangoScale.) This is simply a convenience function around +-- 'layoutGetPixelExtents'. +layoutGetPixelSize :: PangoLayout -> IO (Int, Int) +layoutGetPixelSize (PangoLayout _ pl) = + alloca $ \ widthPtr -> [_$_] + alloca $ \ heightPtr -> do + {#call layout_get_pixel_size#} + pl widthPtr heightPtr + width <- peek widthPtr + height <- peek heightPtr + return (fromIntegral width, fromIntegral height) + hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 901 +-- | Copies a PangLayoutIter. +layoutIterCopy :: LayoutIter -> IO LayoutIter +layoutIterCopy li@(LayoutIter str raw) = do + iterPtr <- {#call unsafe layout_iter_copy#} raw + liftM (LayoutIter str) $ makeNewLayoutIterRaw iterPtr + hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 1004 +-- | Gets the layout associated with a PangoLayoutIter. +layoutIterGetLayout :: LayoutIter -> IO PangoLayout +layoutIterGetLayout (LayoutIter psRef li) = do + pl <- constructNewGObject mkPangoLayoutRaw $ + {#call unsafe layout_iter_get_layout#} li + return (PangoLayout psRef pl) + hunk ./gtk/Graphics/UI/Gtk/Pango/Layout.chs.pp 1093 +-- | Obtains the extents of the PangoLayout being iterated over. @inkRect@ or @logicalRect@ can be 'Nothing' if +-- you aren't interested in them. +layoutIterGetLayoutExtents :: LayoutIter -> IO (PangoRectangle, PangoRectangle) +layoutIterGetLayoutExtents (LayoutIter _ li) = + alloca $ \logPtr -> alloca $ \inkPtr -> do + {#call unsafe layout_iter_get_layout_extents#} li (castPtr logPtr) + (castPtr inkPtr) + log <- peek logPtr + ink <- peek inkPtr + return (fromRect log, fromRect ink) addfile ./gtk/Graphics/UI/Gtk/Pango/Metrics.chs hunk ./gtk/Graphics/UI/Gtk/Pango/Metrics.chs 1 +{-# OPTIONS_HADDOCK hide #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) - text layout functions: Font Metrics ... [truncated message content] |
From: Andy S. <And...@co...> - 2010-03-31 12:06:26
|
Wed Mar 31 08:05:29 EDT 2010 Andy Stewart <laz...@gm...> * Add new `Printing` modules in Gtk+ 2.18.3 Ignore-this: 2330b4d21bceb5025f66121ad0f103ca hunk ./ApiUpdateTodoList.txt 110 -*** TODO PrintBackend.chs -*** TODO Print.chs +*** NON-PORTABLE PrintBackend.chs +*** NON-PORTABLE Print.chs hunk ./ApiUpdateTodoList.txt 113 -*** TODO Printer.chs -*** TODO PrinterOption.chs -*** TODO PrinterOptionSet.chs -*** TODO PrinterOptionWidget.chs -*** TODO PrintJob.chs -*** TODO PrintOperation.chs -*** TODO PrintOperationPreview.chs +*** NON-PORTABLE Printer.chs +*** DONE PrinterOption.chs +*** DONE PrinterOptionSet.chs +*** DONE PrinterOptionWidget.chs +*** NON-PORTABLE PrintJob.chs +*** DONE PrintOperation.chs +*** DONE PrintOperationPreview.chs hunk ./ApiUpdateTodoList.txt 121 -*** TODO PrintUnixDialog.chs +*** NON-PORTABLE PrintUnixDialog.chs hunk ./Makefile.am 816 + gtk/Graphics/UI/Gtk/Printing/PageSetup.chs.pp \ + gtk/Graphics/UI/Gtk/Printing/PaperSize.chs.pp \ + gtk/Graphics/UI/Gtk/Printing/PrintContext.chs.pp \ + gtk/Graphics/UI/Gtk/Printing/PrintOperation.chs.pp \ + gtk/Graphics/UI/Gtk/Printing/PrintOperationPreview.chs.pp \ + gtk/Graphics/UI/Gtk/Printing/PrintSettings.chs.pp \ hunk ./Makefile.am 905 - gtk/Graphics/UI/Gtk/Recent/RecentFilter_stub.o + gtk/Graphics/UI/Gtk/Recent/RecentFilter_stub.o \ + gtk/Graphics/UI/Gtk/Printing/PrintSettings_stub.o hunk ./gtk/Graphics/UI/Gtk.hs.pp 258 + -- * Printing modules + module Graphics.UI.Gtk.Printing.PageSetup, + module Graphics.UI.Gtk.Printing.PaperSize, + module Graphics.UI.Gtk.Printing.PrintContext, + module Graphics.UI.Gtk.Printing.PrintOperation, + module Graphics.UI.Gtk.Printing.PrintOperationPreview, + module Graphics.UI.Gtk.Printing.PrintSettings, + hunk ./gtk/Graphics/UI/Gtk.hs.pp 528 +-- printing modules +import Graphics.UI.Gtk.Printing.PageSetup +import Graphics.UI.Gtk.Printing.PaperSize +import Graphics.UI.Gtk.Printing.PrintContext +import Graphics.UI.Gtk.Printing.PrintOperation +import Graphics.UI.Gtk.Printing.PrintOperationPreview +import Graphics.UI.Gtk.Printing.PrintSettings + adddir ./gtk/Graphics/UI/Gtk/Printing addfile ./gtk/Graphics/UI/Gtk/Printing/PageSetup.chs.pp hunk ./gtk/Graphics/UI/Gtk/Printing/PageSetup.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget PageSetup +-- +-- Author : Andy Stewart +-- +-- Created: 28 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) +-- +-- Stores page setup information +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.Printing.PageSetup ( + +-- * Detail +-- +-- | A 'PageSetup' object stores the page size, orientation and margins. The +-- idea is that you can get one of these from the page setup dialog and then +-- pass it to the 'PrintOperation' when printing. The benefit of splitting this +-- out of the 'PrintSettings' is that these affect the actual layout of the +-- page, and thus need to be set long before user prints. +-- +-- The margins specified in this object are the \"print margins\", i.e. the +-- parts of the page that the printer cannot print on. These are different from +-- the layout margins that a word processor uses; they are typically used to +-- determine the /minimal/ size for the layout margins. +-- +-- To obtain a 'PageSetup' use 'pageSetupNew' to get the defaults, or use +-- 'printRunPageSetupDialog' to show the page setup dialog and receive the +-- resulting page setup. +-- +-- Printing support was added in Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----PageSetup +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + PageSetup, + PageSetupClass, + castToPageSetup, + toPageSetup, + +-- * Constructors + pageSetupNew, +#if GTK_CHECK_VERSION(2,12,0) + pageSetupNewFromFile, + -- pageSetupNewFromKeyFile, +#endif + +-- * Methods + pageSetupCopy, + pageSetupGetTopMargin, + pageSetupSetTopMargin, + pageSetupGetBottomMargin, + pageSetupSetBottomMargin, + pageSetupGetLeftMargin, + pageSetupSetLeftMargin, + pageSetupGetRightMargin, + pageSetupSetRightMargin, + -- pageSetupSetPaperSizeAndDefaultMargins, + pageSetupGetPaperWidth, + pageSetupGetPaperHeight, + pageSetupGetPageWidth, + pageSetupGetPageHeight, +#if GTK_CHECK_VERSION(2,14,0) + pageSetupLoadFile, + -- pageSetupLoadKeyFile, +#endif +#if GTK_CHECK_VERSION(2,12,0) + pageSetupToFile, + -- pageSetupToKeyFile, +#endif + + pageSetupGetOrientation, + pageSetupSetOrientation, + pageSetupGetPaperSize, + -- pageSetupSetPaperSize, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.GError +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.UTFString +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Printing.PaperSize#} (PaperSize, mkPaperSize, Unit(..)) +import Graphics.UI.Gtk.Printing.PrintSettings (PageOrientation(..)) + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Constructors + +-- | Creates a new 'PageSetup'. +-- +pageSetupNew :: IO PageSetup +pageSetupNew = + constructNewGObject mkPageSetup $ + {# call gtk_page_setup_new #} + +#if GTK_CHECK_VERSION(2,12,0) +-- | Reads the page setup from the file @fileName@. Returns a new 'PageSetup' +-- object with the restored page setup, or 'Nothing' if an error occurred. See +-- 'pageSetupToFile'. +-- +-- * Available since Gtk+ version 2.12 +-- +pageSetupNewFromFile :: + String -- ^ @fileName@ - the filename to read the page setup from + -> IO (Maybe PageSetup) +pageSetupNewFromFile fileName = + propagateGError $ \errorPtr -> + withUTFString fileName $ \fileNamePtr -> do + setupPtr <- {# call gtk_page_setup_new_from_file #} + fileNamePtr + errorPtr + if setupPtr == nullPtr + then return Nothing + else liftM Just (constructNewGObject mkPageSetup (return setupPtr)) [_$_] + +-- | Reads the page setup from the group @groupName@ in the key file +-- @keyFile@. Returns a new 'PageSetup' object with the restored page setup, or +-- {@NULL@, FIXME: this should probably be converted to a Maybe data type} if +-- an error occurred. +-- +-- * Available since Gtk+ version 2.12 +-- +-- pageSetupNewFromKeyFile :: +-- {-GKeyFile*-} -- ^ @keyFile@ - the 'KeyFile' to +-- -- retrieve the page_setup from +-- -> String -- ^ @groupName@ - the name of the group in the key_file to +-- -- read, or {@NULL@, FIXME: this should probably be converted +-- -- to a Maybe data type} to use the default name \"Page +-- -- Setup\" +-- -> IO PageSetup +-- pageSetupNewFromKeyFile keyFile groupName = +-- constructNewGObject mkPageSetup $ +-- propagateGError $ \errorPtr -> +-- withUTFString groupName $ \groupNamePtr -> +-- {# call gtk_page_setup_new_from_key_file #} +-- {-keyFile-} +-- groupNamePtr +-- errorPtr +#endif + +-------------------- +-- Methods + +-- | Copies a 'PageSetup'. +-- +pageSetupCopy :: PageSetupClass self => self + -> IO PageSetup -- ^ returns a copy of @other@ +pageSetupCopy self = + makeNewGObject mkPageSetup $ + {# call gtk_page_setup_copy #} + (toPageSetup self) + +-- | Gets the page orientation of the 'PageSetup'. +pageSetupGetOrientation :: PageSetupClass self => self + -> IO PageOrientation -- ^ returns the page orientation +pageSetupGetOrientation self = + liftM (toEnum . fromIntegral) $ + {# call gtk_page_setup_get_orientation #} + (toPageSetup self) + +-- | Sets the page orientation of the 'PageSetup'. +pageSetupSetOrientation :: PageSetupClass self => self + -> PageOrientation -- ^ @orientation@ - a 'PageOrientation' value + -> IO () +pageSetupSetOrientation self orientation = + {# call gtk_page_setup_set_orientation #} + (toPageSetup self) + ((fromIntegral . fromEnum) orientation) + +-- | Gets the paper size of the 'PageSetup'. +pageSetupGetPaperSize :: PageSetupClass self => self + -> IO PaperSize -- ^ returns the paper size +pageSetupGetPaperSize self = + {# call gtk_page_setup_get_paper_size #} + (toPageSetup self) + >>= mkPaperSize . castPtr + +-- pageSetupSetPaperSize :: PageSetupClass self => self +-- -> PaperSize -- ^ @size@ - a 'PaperSize' +-- -> IO () +-- pageSetupSetPaperSize self size = +-- {# call gtk_page_setup_set_paper_size #} +-- (toPageSetup self) +-- size + +-- | Gets the top margin in units of @unit@. +-- +pageSetupGetTopMargin :: PageSetupClass self => self + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the top margin +pageSetupGetTopMargin self unit = + liftM realToFrac $ + {# call gtk_page_setup_get_top_margin #} + (toPageSetup self) + ((fromIntegral . fromEnum) unit) + +-- | Sets the top margin of the 'PageSetup'. +-- +pageSetupSetTopMargin :: PageSetupClass self => self + -> Double -- ^ @margin@ - the new top margin in units of @unit@ + -> Unit -- ^ @unit@ - the units for @margin@ + -> IO () +pageSetupSetTopMargin self margin unit = + {# call gtk_page_setup_set_top_margin #} + (toPageSetup self) + (realToFrac margin) + ((fromIntegral . fromEnum) unit) + +-- | Gets the bottom margin in units of @unit@. +-- +pageSetupGetBottomMargin :: PageSetupClass self => self + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the bottom margin +pageSetupGetBottomMargin self unit = + liftM realToFrac $ + {# call gtk_page_setup_get_bottom_margin #} + (toPageSetup self) + ((fromIntegral . fromEnum) unit) + +-- | Sets the bottom margin of the 'PageSetup'. +-- +pageSetupSetBottomMargin :: PageSetupClass self => self + -> Double -- ^ @margin@ - the new bottom margin in units of @unit@ + -> Unit -- ^ @unit@ - the units for @margin@ + -> IO () +pageSetupSetBottomMargin self margin unit = + {# call gtk_page_setup_set_bottom_margin #} + (toPageSetup self) + (realToFrac margin) + ((fromIntegral . fromEnum) unit) + +-- | Gets the left margin in units of @unit@. +-- +pageSetupGetLeftMargin :: PageSetupClass self => self + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the left margin +pageSetupGetLeftMargin self unit = + liftM realToFrac $ + {# call gtk_page_setup_get_left_margin #} + (toPageSetup self) + ((fromIntegral . fromEnum) unit) + +-- | Sets the left margin of the 'PageSetup'. +-- +pageSetupSetLeftMargin :: PageSetupClass self => self + -> Double -- ^ @margin@ - the new left margin in units of @unit@ + -> Unit -- ^ @unit@ - the units for @margin@ + -> IO () +pageSetupSetLeftMargin self margin unit = + {# call gtk_page_setup_set_left_margin #} + (toPageSetup self) + (realToFrac margin) + ((fromIntegral . fromEnum) unit) + +-- | Gets the right margin in units of @unit@. +-- +pageSetupGetRightMargin :: PageSetupClass self => self + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the right margin +pageSetupGetRightMargin self unit = + liftM realToFrac $ + {# call gtk_page_setup_get_right_margin #} + (toPageSetup self) + ((fromIntegral . fromEnum) unit) + +-- | Sets the right margin of the 'PageSetup'. +-- +pageSetupSetRightMargin :: PageSetupClass self => self + -> Double -- ^ @margin@ - the new right margin in units of @unit@ + -> Unit -- ^ @unit@ - the units for @margin@ + -> IO () +pageSetupSetRightMargin self margin unit = + {# call gtk_page_setup_set_right_margin #} + (toPageSetup self) + (realToFrac margin) + ((fromIntegral . fromEnum) unit) + +-- | Sets the paper size of the 'PageSetup' and modifies the margins according +-- to the new paper size. +-- +-- pageSetupSetPaperSizeAndDefaultMargins :: PageSetupClass self => self +-- -> PaperSize -- ^ @size@ - a 'PaperSize' +-- -> IO () +-- pageSetupSetPaperSizeAndDefaultMargins self size = +-- {# call gtk_page_setup_set_paper_size_and_default_margins #} +-- (toPageSetup self) +-- size + +-- | Returns the paper width in units of @unit@. +-- +-- Note that this function takes orientation, but not margins into +-- consideration. See 'pageSetupGetPageWidth'. +-- +pageSetupGetPaperWidth :: PageSetupClass self => self + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the paper width. +pageSetupGetPaperWidth self unit = + liftM realToFrac $ + {# call gtk_page_setup_get_paper_width #} + (toPageSetup self) + ((fromIntegral . fromEnum) unit) + +-- | Returns the paper height in units of @unit@. +-- +-- Note that this function takes orientation, but not margins into +-- consideration. See 'pageSetupGetPageHeight'. +-- +pageSetupGetPaperHeight :: PageSetupClass self => self + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the paper height. +pageSetupGetPaperHeight self unit = + liftM realToFrac $ + {# call gtk_page_setup_get_paper_height #} + (toPageSetup self) + ((fromIntegral . fromEnum) unit) + +-- | Returns the page width in units of @unit@. +-- +-- Note that this function takes orientation and margins into consideration. +-- See 'pageSetupGetPaperWidth'. +-- +pageSetupGetPageWidth :: PageSetupClass self => self + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the page width. +pageSetupGetPageWidth self unit = + liftM realToFrac $ + {# call gtk_page_setup_get_page_width #} + (toPageSetup self) + ((fromIntegral . fromEnum) unit) + +-- | Returns the page height in units of @unit@. +-- +-- Note that this function takes orientation and margins into consideration. +-- See 'pageSetupGetPaperHeight'. +-- +pageSetupGetPageHeight :: PageSetupClass self => self + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the page height. +pageSetupGetPageHeight self unit = + liftM realToFrac $ + {# call gtk_page_setup_get_page_height #} + (toPageSetup self) + ((fromIntegral . fromEnum) unit) + +#if GTK_CHECK_VERSION(2,14,0) +-- | Reads the page setup from the file @fileName@. See 'pageSetupToFile'. +-- +-- * Available since Gtk+ version 2.14 +-- +pageSetupLoadFile :: PageSetupClass self => self + -> String -- ^ @fileName@ - the filename to read the page setup from + -> IO Bool -- ^ returns @True@ on success +pageSetupLoadFile self fileName = + liftM toBool $ + propagateGError $ \errorPtr -> + withUTFString fileName $ \fileNamePtr -> + {# call gtk_page_setup_load_file #} + (toPageSetup self) + fileNamePtr + errorPtr + +-- | Reads the page setup from the group @groupName@ in the key file +-- @keyFile@. +-- +-- * Available since Gtk+ version 2.14 +-- +-- pageSetupLoadKeyFile :: PageSetupClass self => self +-- -> {-GKeyFile*-} -- ^ @keyFile@ - the 'KeyFile' to +-- -- retrieve the page_setup from +-- -> String -- ^ @groupName@ - the name of the group in the key_file to +-- -- read, or {@NULL@, FIXME: this should probably be converted +-- -- to a Maybe data type} to use the default name \"Page +-- -- Setup\" +-- -> IO Bool -- ^ returns @True@ on success +-- pageSetupLoadKeyFile self keyFile groupName = +-- liftM toBool $ +-- propagateGError $ \errorPtr -> +-- withUTFString groupName $ \groupNamePtr -> +-- {# call gtk_page_setup_load_key_file #} +-- (toPageSetup self) +-- {-keyFile-} +-- groupNamePtr +-- errorPtr +#endif + +#if GTK_CHECK_VERSION(2,12,0) +-- | This function saves the information from @setup@ to @fileName@. +-- +-- * Available since Gtk+ version 2.12 +-- +pageSetupToFile :: PageSetupClass self => self + -> String -- ^ @fileName@ - the file to save to + -> IO Bool -- ^ returns @True@ on success +pageSetupToFile self fileName = + liftM toBool $ + propagateGError $ \errorPtr -> + withUTFString fileName $ \fileNamePtr -> + {# call gtk_page_setup_to_file #} + (toPageSetup self) + fileNamePtr + errorPtr + +-- | This function adds the page setup from @setup@ to @keyFile@. +-- +-- * Available since Gtk+ version 2.12 +-- +-- pageSetupToKeyFile :: PageSetupClass self => self +-- -> {-GKeyFile*-} -- ^ @keyFile@ - the 'KeyFile' to save +-- -- the page setup to +-- -> String -- ^ @groupName@ - the group to add the settings to in +-- -- @keyFile@, or {@NULL@, FIXM: Ethis should probably be +-- -- converted to a Maybe data type} to use the default name +-- -- \"Page Setup\" +-- -> IO () +-- pageSetupToKeyFile self keyFile groupName = +-- withUTFString groupName $ \groupNamePtr -> +-- {# call gtk_page_setup_to_key_file #} +-- (toPageSetup self) +-- {-keyFile-} +-- groupNamePtr +#endif +#endif addfile ./gtk/Graphics/UI/Gtk/Printing/PaperSize.chs.pp hunk ./gtk/Graphics/UI/Gtk/Printing/PaperSize.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget PaperSize +-- +-- Author : Andy Stewart +-- +-- Created: 28 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) +-- +-- Support for named paper sizes +-- +module Graphics.UI.Gtk.Printing.PaperSize ( + +-- * Detail +-- +-- | 'PaperSize' handles paper sizes. It uses the +-- standard called \"PWG 5101.1-2002 PWG: Standard for Media Standardized +-- Names\" to name the paper sizes (and to get the data for the page sizes). In +-- addition to standard paper sizes, 'PaperSize' allows +-- to construct custom paper sizes with arbitrary dimensions. +-- +-- The 'PaperSize' object stores not only the +-- dimensions (width and height) of a paper size and its name, it also provides +-- default print margins. +-- +-- Printing support has been added in Gtk+ 2.10. + +-- * Types + PaperSize, + mkPaperSize, + +-- * Enums + Unit(..), + +-- * Constructors +#if GTK_CHECK_VERSION(2,10,0) + paperSizeNew, + paperSizeNewFromPpd, + paperSizeNewCustom, +#if GTK_CHECK_VERSION(2,12,0) + -- paperSizeNewFromKeyFile, +#endif +#endif + +-- * Methods +#if GTK_CHECK_VERSION(2,10,0) + paperSizeCopy, + paperSizeFree, + paperSizeIsEqual, +#if GTK_CHECK_VERSION(2,12,0) + paperSizeGetPaperSizes, +#endif + paperSizeGetName, + paperSizeGetDisplayName, + paperSizeGetPpdName, + paperSizeGetWidth, + paperSizeGetHeight, +#endif + paperSizeIsCustom, +#if GTK_CHECK_VERSION(2,10,0) + paperSizeSetSize, + paperSizeGetDefaultTopMargin, + paperSizeGetDefaultBottomMargin, + paperSizeGetDefaultLeftMargin, + paperSizeGetDefaultRightMargin, + paperSizeGetDefault, +#if GTK_CHECK_VERSION(2,12,0) + -- paperSizeToKeyFile, +#endif +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.GList +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Types +{#pointer *PaperSize foreign newtype#} + +-------------------- +-- Enums +{#enum Unit {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-------------------- +-- Constructors + +mkPaperSize :: Ptr PaperSize -> IO PaperSize +mkPaperSize size = liftM PaperSize $ newForeignPtr_ size + +#if GTK_CHECK_VERSION(2,10,0) +-- | Creates a new 'PaperSize' object by parsing a PWG +-- 5101.1-2002 paper name. +-- +-- If @name@ is empty, the default paper size is returned, see 'paperSizeGetDefault'. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeNew :: + String -- ^ @name@ - a paper size name + -> IO PaperSize +paperSizeNew name = + withUTFString name $ \namePtr -> + {# call gtk_paper_size_new #} + namePtr + >>= mkPaperSize + +-- | Creates a new 'PaperSize' object by using PPD +-- information. +-- +-- If @ppdName@ is not a recognized PPD paper name, @ppdDisplayName@, +-- @width@ and @height@ are used to construct a custom 'PaperSize' object. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeNewFromPpd :: + String -- ^ @ppdName@ - a PPD paper name + -> String -- ^ @ppdDisplayName@ - the corresponding human-readable name + -> Double -- ^ @width@ - the paper width, in points + -> Double -- ^ @height@ - the paper height in points + -> IO PaperSize +paperSizeNewFromPpd ppdName ppdDisplayName width height = + withUTFString ppdDisplayName $ \ppdDisplayNamePtr -> + withUTFString ppdName $ \ppdNamePtr -> + {# call gtk_paper_size_new_from_ppd #} + ppdNamePtr + ppdDisplayNamePtr + (realToFrac width) + (realToFrac height) + >>= mkPaperSize + +-- | Creates a new 'PaperSize' object with the given +-- parameters. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeNewCustom :: + String -- ^ @name@ - the paper name + -> String -- ^ @displayName@ - the human-readable name + -> Double -- ^ @width@ - the paper width, in units of @unit@ + -> Double -- ^ @height@ - the paper height, in units of @unit@ + -> Unit -- ^ @unit@ - the unit for @width@ and @height@ + -> IO PaperSize +paperSizeNewCustom name displayName width height unit = + withUTFString displayName $ \displayNamePtr -> + withUTFString name $ \namePtr -> + {# call gtk_paper_size_new_custom #} + namePtr + displayNamePtr + (realToFrac width) + (realToFrac height) + ((fromIntegral . fromEnum) unit) + >>= mkPaperSize + +#if GTK_CHECK_VERSION(2,12,0) +-- | Reads a paper size from the group @groupName@ in the key file @keyFile@. +-- +-- * Available since Gtk+ version 2.12 +-- +-- paperSizeNewFromKeyFile :: +-- {-GKeyFile*-} -- ^ @keyFile@ - the 'KeyFile' to +-- -- retrieve the papersize from +-- -> String -- ^ @groupName@ - the name ofthe group in the key file to +-- -- read, emptry to read the first group +-- -> IO PaperSize +-- paperSizeNewFromKeyFile keyFile groupName = +-- propagateGError $ \errorPtr -> +-- withUTFString groupName $ \groupNamePtr -> +-- {# call gtk_paper_size_new_from_key_file #} +-- {-keyFile-} +-- groupNamePtr +-- errorPtr +#endif +#endif + +-------------------- +-- Methods + +#if GTK_CHECK_VERSION(2,10,0) +-- | Copies an existing 'PaperSize'. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeCopy :: PaperSize + -> IO PaperSize -- ^ returns a copy of @other@ +paperSizeCopy self = + {# call gtk_paper_size_copy #} self >>= mkPaperSize + +-- | Free the given 'PaperSize' object. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeFree :: PaperSize -> IO () +paperSizeFree self = + {# call gtk_paper_size_free #} + self + +-- | Compares two 'PaperSize' objects. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeIsEqual :: PaperSize + -> PaperSize -- ^ @size2@ - another 'PaperSize' + -- object + -> IO Bool -- ^ returns @True@, if @size1@ and @size2@ represent + -- the same paper size +paperSizeIsEqual self size2 = + liftM toBool $ + {# call gtk_paper_size_is_equal #} + self + size2 + +#if GTK_CHECK_VERSION(2,12,0) +-- | Creates a list of known paper sizes. +-- +-- * Available since Gtk+ version 2.12 +-- +paperSizeGetPaperSizes :: + Bool -- ^ @includeCustom@ - whether to include custom + -- paper sizes as defined in the page setup dialog + -> IO [PaperSize] -- ^ returns a newly allocated list of newly + -- allocated 'PaperSize' objects +paperSizeGetPaperSizes includeCustom = do + glist <- {# call gtk_paper_size_get_paper_sizes #} (fromBool includeCustom) + list <- fromGList glist + mapM mkPaperSize list +#endif + +-- | Gets the name of the 'PaperSize'. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetName :: PaperSize + -> IO String -- ^ returns the name of @size@ +paperSizeGetName self = + {# call gtk_paper_size_get_name #} + self + >>= peekUTFString + +-- | Gets the human-readable name of the 'PaperSize'. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetDisplayName :: PaperSize + -> IO String -- ^ returns the human-readable name of @size@ +paperSizeGetDisplayName self = + {# call gtk_paper_size_get_display_name #} + self + >>= peekUTFString + +-- | Gets the PPD name of the 'PaperSize', which may be +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetPpdName :: PaperSize + -> IO String -- ^ returns the PPD name of @size@ +paperSizeGetPpdName self = + {# call gtk_paper_size_get_ppd_name #} + self + >>= peekUTFString + +-- | Gets the paper width of the 'PaperSize', in units +-- of @unit@. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetWidth :: PaperSize + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the paper width +paperSizeGetWidth self unit = + liftM realToFrac $ + {# call gtk_paper_size_get_width #} + self + ((fromIntegral . fromEnum) unit) + +-- | Gets the paper height of the 'PaperSize', in units +-- of @unit@. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetHeight :: PaperSize + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the paper height +paperSizeGetHeight self unit = + liftM realToFrac $ + {# call gtk_paper_size_get_height #} + self + ((fromIntegral . fromEnum) unit) +#endif + +-- | Returns @True@ if @size@ is not a standard paper size. +-- +paperSizeIsCustom :: PaperSize + -> IO Bool -- ^ returns whether @size@ is a custom paper size. +paperSizeIsCustom self = + liftM toBool $ + {# call gtk_paper_size_is_custom #} + self + +#if GTK_CHECK_VERSION(2,10,0) +-- | Changes the dimensions of a @size@ to @width@ x @height@. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeSetSize :: PaperSize + -> Double -- ^ @width@ - the new width in units of @unit@ + -> Double -- ^ @height@ - the new height in units of @unit@ + -> Unit -- ^ @unit@ - the unit for @width@ and @height@ + -> IO () +paperSizeSetSize self width height unit = + {# call gtk_paper_size_set_size #} + self + (realToFrac width) + (realToFrac height) + ((fromIntegral . fromEnum) unit) + +-- | Gets the default top margin for the 'PaperSize'. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetDefaultTopMargin :: PaperSize + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the default top margin +paperSizeGetDefaultTopMargin self unit = + liftM realToFrac $ + {# call gtk_paper_size_get_default_top_margin #} + self + ((fromIntegral . fromEnum) unit) + +-- | Gets the default bottom margin for the 'PaperSize'. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetDefaultBottomMargin :: PaperSize + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the default bottom margin +paperSizeGetDefaultBottomMargin self unit = + liftM realToFrac $ + {# call gtk_paper_size_get_default_bottom_margin #} + self + ((fromIntegral . fromEnum) unit) + +-- | Gets the default left margin for the 'PaperSize'. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetDefaultLeftMargin :: PaperSize + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the default left margin +paperSizeGetDefaultLeftMargin self unit = + liftM realToFrac $ + {# call gtk_paper_size_get_default_left_margin #} + self + ((fromIntegral . fromEnum) unit) + +-- | Gets the default right margin for the 'PaperSize'. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetDefaultRightMargin :: PaperSize + -> Unit -- ^ @unit@ - the unit for the return value + -> IO Double -- ^ returns the default right margin +paperSizeGetDefaultRightMargin self unit = + liftM realToFrac $ + {# call gtk_paper_size_get_default_right_margin #} + self + ((fromIntegral . fromEnum) unit) + +-- | Returns the name of the default paper size, which depends on the current +-- locale. +-- +-- * Available since Gtk+ version 2.10 +-- +paperSizeGetDefault :: + IO String -- ^ returns the name of the default paper size. The string is + -- owned by Gtk+ and should not be modified. +paperSizeGetDefault = + {# call gtk_paper_size_get_default #} + >>= peekUTFString + +#if GTK_CHECK_VERSION(2,12,0) +-- | This function adds the paper size from @size@ to @keyFile@. +-- +-- * Available since Gtk+ version 2.12 +-- +-- paperSizeToKeyFile :: PaperSize +-- -> {-GKeyFile*-} -- ^ @keyFile@ - the 'KeyFile' to save +-- -- the paper size to +-- -> String -- ^ @groupName@ - the group to add the settings to in +-- -- @keyFile@ +-- -> IO () +-- paperSizeToKeyFile self keyFile groupName = +-- withUTFString groupName $ \groupNamePtr -> +-- {# call gtk_paper_size_to_key_file #} +-- self +-- {-keyFile-} +-- groupNamePtr +#endif +#endif addfile ./gtk/Graphics/UI/Gtk/Printing/PrintContext.chs.pp hunk ./gtk/Graphics/UI/Gtk/Printing/PrintContext.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget PrintContext +-- +-- Author : Andy Stewart +-- +-- Created: 28 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) +-- +-- Encapsulates context for drawing pages +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.Printing.PrintContext ( + +-- * Detail +-- +-- | A 'PrintContext' encapsulates context information that is required when +-- drawing pages for printing, such as the cairo context and important +-- parameters like page size and resolution. It also lets you easily create +-- 'PangoLayout' and 'Context' objects that match the font metrics of the cairo +-- surface. +-- +-- 'PrintContext' objects gets passed to the ::begin-print, ::end-print, +-- ::request-page-setup and ::draw-page signals on the 'PrintOperation'. +-- +-- Printing support was added in Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----PrintContext +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + PrintContext, + PrintContextClass, + castToPrintContext, + toPrintContext, + +-- * Methods + -- printContextGetCairoContext, + -- printContextSetCairoContext, + printContextGetPageSetup, + printContextGetWidth, + printContextGetHeight, + printContextGetDpiX, + printContextGetDpiY, + printContextGetPangoFontmap, + printContextCreatePangoContext, + printContextCreatePangoLayout, +#endif + ) where + +import Control.Monad (liftM) +import Data.IORef (newIORef) + +import System.Glib.FFI +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Pango.Types#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Methods + +-- | Obtains the cairo context that is associated with the 'PrintContext'. +-- +-- printContextGetCairoContext :: PrintContextClass self => self +-- -> IO {-cairo_t*-} -- ^ returns the cairo context of @context@ +-- printContextGetCairoContext self = +-- {# call gtk_print_context_get_cairo_context #} +-- (toPrintContext self) + +-- | Sets a new cairo context on a print context. +-- +-- This function is intended to be used when implementing an internal print +-- preview, it is not needed for printing, since Gtk+ itself creates a suitable +-- cairo context in that case. +-- +-- printContextSetCairoContext :: PrintContextClass self => self +-- -> {-cairo_t*-} -- ^ @cr@ - the cairo context +-- -> Double -- ^ @dpiX@ - the horizontal resolution to use with @cr@ +-- -> Double -- ^ @dpiY@ - the vertical resolution to use with @cr@ +-- -> IO () +-- printContextSetCairoContext self cr dpiX dpiY = +-- {# call gtk_print_context_set_cairo_context #} +-- (toPrintContext self) +-- {-cr-} +-- (realToFrac dpiX) +-- (realToFrac dpiY) + +-- | Obtains the 'PageSetup' that determines the page dimensions of the +-- 'PrintContext'. +-- +printContextGetPageSetup :: PrintContextClass self => self + -> IO PageSetup -- ^ returns the page setup of @context@ +printContextGetPageSetup self = + makeNewGObject mkPageSetup $ + {# call gtk_print_context_get_page_setup #} + (toPrintContext self) + +-- | Obtains the width of the 'PrintContext', in pixels. +-- +printContextGetWidth :: PrintContextClass self => self + -> IO Double -- ^ returns the width of @context@ +printContextGetWidth self = + liftM realToFrac $ + {# call gtk_print_context_get_width #} + (toPrintContext self) + +-- | Obtains the height of the 'PrintContext', in pixels. +-- +printContextGetHeight :: PrintContextClass self => self + -> IO Double -- ^ returns the height of @context@ +printContextGetHeight self = + liftM realToFrac $ + {# call gtk_print_context_get_height #} + (toPrintContext self) + +-- | Obtains the horizontal resolution of the 'PrintContext', in dots per +-- inch. +-- +printContextGetDpiX :: PrintContextClass self => self + -> IO Double -- ^ returns the horizontal resolution of @context@ +printContextGetDpiX self = + liftM realToFrac $ + {# call gtk_print_context_get_dpi_x #} + (toPrintContext self) + +-- | Obtains the vertical resolution of the 'PrintContext', in dots per inch. +-- +printContextGetDpiY :: PrintContextClass self => self + -> IO Double -- ^ returns the vertical resolution of @context@ +printContextGetDpiY self = + liftM realToFrac $ + {# call gtk_print_context_get_dpi_y #} + (toPrintContext self) + +-- | Returns a 'FontMap' that is suitable for use with the 'PrintContext'. +-- +printContextGetPangoFontmap :: PrintContextClass self => self + -> IO FontMap -- ^ returns the font map of @context@ +printContextGetPangoFontmap self = + makeNewGObject mkFontMap $ + {# call gtk_print_context_get_pango_fontmap #} + (toPrintContext self) + +-- | Creates a new 'Context' that can be used with the 'PrintContext'. +-- +printContextCreatePangoContext :: PrintContextClass self => self + -> IO PangoContext -- ^ returns a new Pango context for @context@ +printContextCreatePangoContext self = + makeNewGObject mkPangoContext $ + {# call gtk_print_context_create_pango_context #} + (toPrintContext self) + +-- | Creates a new 'PangoLayout' that is suitable for use with the +-- 'PrintContext'. +-- +printContextCreatePangoLayout :: PrintContextClass self => self + -> IO PangoLayout -- ^ returns a new Pango layout for @context@ +printContextCreatePangoLayout self = do + pl <- constructNewGObject mkPangoLayoutRaw $ + {# call gtk_print_context_create_pango_layout #} + (toPrintContext self) + ps <- makeNewPangoString "" + psRef <- newIORef ps + return (PangoLayout psRef pl) +#endif addfile ./gtk/Graphics/UI/Gtk/Printing/PrintOperation.chs.pp hunk ./gtk/Graphics/UI/Gtk/Printing/PrintOperation.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget PrintOperation +-- +-- Author : Andy Stewart +-- +-- Created: 28 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) +-- +-- High-level Printing API +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.Printing.PrintOperation ( + +-- * Detail +-- +-- | 'PrintOperation' is the high-level, portable printing API. It looks a bit +-- different than other Gtk+ dialogs such as the 'FileChooser', since some +-- platforms don't expose enough infrastructure to implement a good print +-- dialog. On such platforms, 'PrintOperation' uses the native print dialog. On +-- platforms which do not provide a native print dialog, Gtk+ uses its own, see +-- 'PrintUnixDialog'. +-- +-- The typical way to use the high-level printing API is to create a +-- 'PrintOperation' object with 'printOperationNew' when the user selects to +-- print. Then you set some properties on it, e.g. the page size, any +-- 'PrintSettings' from previous print operations, the number of pages, the +-- current page, etc. +-- +-- Then you start the print operation by calling 'printOperationRun'. It +-- will then show a dialog, let the user select a printer and options. When the +-- user finished the dialog various signals will be emitted on the +-- 'PrintOperation', the main one being ::draw-page, which you are supposed to +-- catch and render the page on the provided 'PrintContext' using Cairo. +-- +-- By default 'PrintOperation' uses an external application to do print +-- preview. To implement a custom print preview, an application must connect to +-- the preview signal. The functions 'printOperationPrintPreviewRenderPage', +-- 'printOperationPreviewEndPreview' and 'printOperationPreviewIsSelected' are +-- useful when implementing a print preview. +-- +-- Printing support was added in Gtk+ 2.10. +-- +-- The following functions don't bind, use corresponding attributes instead: +-- printOperationSetDefaultPageSetup, +-- printOperationGetDefaultPageSetup, +-- printOperationSetPrintSettings, +-- printOperationGetPrintSettings, +-- printOperationSetSupportSelection, +-- printOperationGetSupportSelection, +-- printOperationSetHasSelection, +-- printOperationGetHasSelection, +-- printOperationSetEmbedPageSetup, +-- printOperationGetEmbedPageSetup, + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----PrintOperation +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + PrintOperation, + PrintOperationClass, + castToPrintOperation, + toPrintOperation, + +-- * Enums + PrintStatus(..), + PrintOperationAction(..), + PrintOperationResult(..), + PrintError(..), + +-- * Constructors + printOperationNew, + +-- * Methods + printOperationSetAllowAsync, + printOperationGetError, + printOperationSetJobName, + printOperationSetNPages, +#if GTK_CHECK_VERSION(2,18,0) + printOperationGetNPagesToPrint, +#endif + printOperationSetCurrentPage, + printOperationSetUseFullPage, + printOperationSetUnit, + printOperationSetExportFilename, + printOperationSetShowProgress, + printOperationSetTrackPrintStatus, + printOperationSetCustomTabLabel, + printOperationRun, + printOperationCancel, +#if GTK_CHECK_VERSION(2,16,0) + printOperationDrawPageFinish, + printOperationSetDeferDrawing, +#endif + printOperationGetStatus, + printOperationGetStatusString, + printOperationIsFinished, + +-- * Attributes + printOperationDefaultPageSetup, + printOperationPrintSettings, + printOperationJobName, + printOperationNPages, + printOperationCurrentPage, + printOperationUseFullPage, + printOperationTrackPrintStatus, + printOperationUnit, + printOperationShowProgress, + printOperationAllowAsync, + printOperationExportFilename, + printOperationStatus, + printOperationStatusString, + printOperationCustomTabLabel, + printOperationSupportSelection, + printOperationHasSelection, + printOperationEmbedPageSetup, + printOperationNPagesToPrint, + +-- * Signals + done, + beginPrint, + paginate, + requestPageSetup, + drawPage, + endPrint, + statusChanged, + createCustomWidget, +#if GTK_CHECK_VERSION(2,18,0) + updateCustomWidget, +#endif + customWidgetApply, + preview, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.UTFString +import System.Glib.GError +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} +import Graphics.UI.Gtk.Printing.PaperSize (Unit(..)) + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Interfaces + +instance PrintOperationPreviewClass PrintOperation + +-------------------- +-- Enums +-- | The status gives a rough indication of the completion of a running print operation. +{#enum PrintStatus {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | The action parameter to 'printOperationRun' determines what action the print operation should +-- perform. +{#enum PrintOperationAction {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | A value of this type is returned by 'printOperationRun'. +{#enum PrintOperationResult {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-- | Error codes that identify various errors that can occur while using the GTK+ printing support. +{#enum PrintError {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-------------------- +-- Constructors + +-- | Creates a new 'PrintOperation'. +-- +printOperationNew :: IO PrintOperation +printOperationNew = + constructNewGObject mkPrintOperation $ + {# call gtk_print_operation_new #} + +-------------------- +-- Methods + +-- | Sets whether the 'printOperationRun' may return before the print +-- operation is completed. Note that some platforms may not allow asynchronous +-- operation. +-- +printOperationSetAllowAsync :: PrintOperationClass self => self + -> Bool -- ^ @allowAsync@ - @True@ to allow asynchronous operation + -> IO () +printOperationSetAllowAsync self allowAsync = + {# call gtk_print_operation_set_allow_async #} + (toPrintOperation self) + (fromBool allowAsync) + +-- | Call this when the result of a print operation is +-- 'PrintOperationResultError', either as returned by 'printOperationRun', or +-- in the 'done' signal handler. The returned +-- 'GError' will contain more details on what went wrong. +-- +printOperationGetError :: PrintOperationClass self => self -> IO () +printOperationGetError self = + propagateGError $ \errorPtr -> + {# call gtk_print_operation_get_error #} + (toPrintOperation self) + errorPtr + +-- | Sets the name of the print job. The name is used to identify the job +-- (e.g. in monitoring applications like eggcups). +-- +-- If you don't set a job name, Gtk+ picks a default one by numbering +-- successive print jobs. +-- +printOperationSetJobName :: PrintOperationClass self => self + -> String -- ^ @jobName@ - a string that identifies the print job + -> IO () +printOperationSetJobName self jobName = + withUTFString jobName $ \jobNamePtr -> + {# call gtk_print_operation_set_job_name #} + (toPrintOperation self) + jobNamePtr + +-- | Sets the number of pages in the document. +-- +-- This /must/ be set to a positive number before the rendering starts. It +-- may be set in a 'beginPrint' signal hander. +-- +-- Note that the page numbers passed to the 'requestPageSetup' [_$_] +-- and 'drawPage' signals +-- are 0-based, i.e. if the user chooses to print all pages, the last +-- ::draw-page signal will be for page @nPages@ - 1. +-- +printOperationSetNPages :: PrintOperationClass self => self + -> Int -- ^ @nPages@ - the number of pages + -> IO () +printOperationSetNPages self nPages = + {# call gtk_print_operation_set_n_pages #} + (toPrintOperation self) + (fromIntegral nPages) + +#if GTK_CHECK_VERSION(2,18,0) +-- | Returns the number of pages that will be printed. +-- +-- Note that this value is set during print preparation phase +-- ('PrintStatusPreparing'), so this function should never be called before the +-- data generation phase ('PrintStatusGeneratingData'). You can connect to the +-- 'statusChanged' signal and call +-- 'printOperationGetNPagesToPrint' when print status is +-- 'PrintStatusGeneratingData'. This is typically used to track the progress of +-- print operation. +-- +-- * Available since Gtk+ version 2.18 +-- +printOperationGetNPagesToPrint :: PrintOperationClass self => self + -> IO Int -- ^ returns the number of pages that will be printed +printOperationGetNPagesToPrint self = + liftM fromIntegral $ + {# call gtk_print_operation_get_n_pages_to_print #} + (toPrintOperation self) +#endif + +-- | Sets the current page. +-- +-- If this is called before 'printOperationRun', the user will be able to +-- select to print only the current page. +-- +-- Note that this only makes sense for pre-paginated documents. +-- +printOperationSetCurrentPage :: PrintOperationClass self => self + -> Int -- ^ @currentPage@ - the current page, 0-based + -> IO () +printOperationSetCurrentPage self currentPage = + {# call gtk_print_operation_set_current_page #} + (toPrintOperation self) + (fromIntegral currentPage) + +-- | If @fullPage@ is @True@, the transformation for the cairo context +-- obtained from 'PrintContext' puts the origin at the top left corner of the +-- page (which may not be the top left corner of the sheet, depending on page +-- orientation and the number of pages per sheet). Otherwise, the origin is at +-- the top left corner of the imageable area (i.e. inside the margins). +-- +printOperationSetUseFullPage :: PrintOperationClass self => self + -> Bool -- ^ @fullPage@ - @True@ to set up the 'PrintContext' for the full + -- page + -> IO () +printOperationSetUseFullPage self fullPage = + {# call gtk_print_operation_set_use_full_page #} + (toPrintOperation self) + (fromBool fullPage) + +-- | Sets up the transformation for the cairo context obtained from +-- 'PrintContext' in such a way that distances are measured in units of @unit@. +-- +printOperationSetUnit :: PrintOperationClass self => self + -> Unit -- ^ @unit@ - the unit to use + -> IO () +printOperationSetUnit self unit = + {# call gtk_print_operation_set_unit #} + (toPrintOperation self) + ((fromIntegral . fromEnum) unit) + +-- | Sets up the 'PrintOperation' to generate a file instead of showing the +-- print dialog. The indended use of this function is for implementing \"Export +-- to PDF\" actions. Currently, PDF is the only supported format. +-- +-- \"Print to PDF\" support is independent of this and is done by letting +-- the user pick the \"Print to PDF\" item from the list of printers in the +-- print dialog. +-- +printOperationSetExportFilename :: PrintOperationClass self => self + -> String -- ^ @filename@ - the filename for the exported file + -> IO () +printOperationSetExportFilename self filename = + withUTFString filename $ \filenamePtr -> + {# call gtk_print_operation_set_export_filename #} + (toPrintOperation self) + filenamePtr + +-- | If @showProgress@ is @True@, the print operation will show a progress +-- dialog during the print operation. +-- +printOperationSetShowProgress :: PrintOperationClass self => self + -> Bool -- ^ @showProgress@ - @True@ to show a progress dialog + -> IO () +printOperationSetShowProgress self showProgress = + {# call gtk_print_operation_set_show_progress #} + (toPrintOperation self) + (fromBool showProgress) + +-- | If track_status is @True@, the print operation will try to continue +-- report on the status of the print job in the printer queues and printer. +-- This can allow your application to show things like \"out of paper\" issues, +-- and when the print job actually reaches the printer. +-- +-- This function is often implemented using some form of polling, so it +-- should not be enabled unless needed. +-- +printOperationSetTrackPrintStatus :: PrintOperationClass self => self + -> Bool -- ^ @trackStatus@ - @True@ to track status after printing + -> IO () +printOperationSetTrackPrintStatus self trackStatus = + {# call gtk_print_operation_set_track_print_status #} + (toPrintOperation self) + (fromBool trackStatus) + +-- | Sets the label for the tab holding custom widgets. +-- +printOperationSetCustomTabLabel :: PrintOperationClass self => self + -> String -- ^ @label@ - the label to use, or empty to use the default + -- label + -> IO () +printOperationSetCustomTabLabel self label = + withUTFString label $ \labelPtr -> + {# call gtk_print_operation_set_custom_tab_label #} + (toPrintOperation self) + labelPtr + +-- | Runs the print operation, by first letting the user modify print settings +-- in the print dialog, and then print the document. +-- +-- Normally that this function does not return until the rendering of all +-- pages is complete. You can connect to the 'statusChanged' signal on @op@ to obtain some information about the +-- progress of the print operation. Furthermore, it may use a recursive +-- mainloop to show the print dialog. +-- +-- If you call 'printOperationSetAllowAsync' or set the 'allowAsync' [_$_] +-- property the operation will run asynchronously +-- if this is supported on the platform. The 'done' signal will be emitted with the result of the operation when +-- the it is done (i.e. when the dialog is canceled, or when the print succeeds +-- or fails). +-- +printOperationRun :: (PrintOperationClass self, WindowClass parent) => self + -> PrintOperationAction -- ^ @action@ - the action to start + -> parent -- ^ @parent@ - Transient parent of the dialog + -> IO PrintOperationResult -- ^ returns the result of the print operation. A + -- return value of 'PrintOperationResultApply' + -- indicates that the printing was completed + -- successfully. In this case, it is a good idea to + -- obtain the used print settings with + -- 'printOperationGetPrintSettings' and store them + -- for reuse with the next print operation. A value + -- of 'PrintOperationResultInProgress' means the + -- operation is running asynchronously, and will + -- emit the 'done' signal when done. +printOperationRun self action parent = + liftM (toEnum . fromIntegral) $ + propagateGError $ \errorPtr -> + {# call gtk_print_operation_run #} + (toPrintOperation self) + ((fromIntegral . fromEnum) action) + (toWindow parent) + errorPtr + +-- | Cancels a running print operation. This function may be called from a +-- 'beginPrint', 'paginate' or 'drawPage' signal handler +-- to stop the currently running print operation. +-- +printOperationCancel :: PrintOperationClass self => self -> IO () +printOperationCancel self = + {# call gtk_print_operation_cancel #} + (toPrintOperation self) + +#if GTK_CHECK_VERSION(2,16,0) +-- | Signalize that drawing of particular page is complete. +-- +-- It is called after completion of page drawing (e.g. drawing in another +-- thread). If 'printOperationSetDeferDrawing' was called before, then this +-- function has to be called by application. In another case it is called by +-- the library itself. +-- +-- * Available since Gtk+ version 2.16 +-- +printOperationDrawPageFinish :: PrintOperationClass self => self -> IO () +printOperationDrawPageFinish self = + {# call gtk_print_operation_draw_page_finish #} + (toPrintOperation self) + +-- | Sets up the 'PrintOperation' to wait for calling of +-- 'printOperationDrawPageFinish' from application. It can be used for drawing +-- page in another thread. +-- +-- This function must be called in the callback of \"draw-page\" signal. +-- +-- * Available since Gtk+ version 2.16 +-- +printOperationSetDeferDrawing :: PrintOperationClass self => self -> IO () +printOperationSetDeferDrawing self = + {# call gtk_print_operation_set_defer_drawing #} + (toPrintOperation self) +#endif + +-- | Returns the status of the print operation. Also see +-- 'printOperationGetStatusString'. +-- +printOperationGetStatus :: PrintOperationClass self => self + -> IO PrintStatus -- ^ returns the status of the print operation +printOperationGetStatus self = + liftM (toEnum . fromIntegral) $ + {# call gtk_print_operation_get_status #} + (toPrintOperation self) + +-- | Returns a string representation of the status of the print operation. The +-- string is translated and suitable for displaying the print status e.g. in a +-- 'Statusbar'. +-- +-- Use 'printOperationGetStatus' to obtain a status value that is suitable +-- for programmatic use. +-- +printOperationGetStatusString :: PrintOperationClass self => self + -> IO String -- ^ returns a string representation of the status of the print + -- operation +printOperationGetStatusString self = + {# call gtk_print_operation_get_status_string #} + (toPrintOperation self) + >>= peekUTFString + +-- | A convenience function to find out if the print operation is finished, +-- either successfu... [truncated message content] |
From: Andy S. <And...@co...> - 2010-03-30 17:21:27
|
Tue Mar 30 13:19:11 EDT 2010 Andy Stewart <laz...@gm...> * Update `Gdk` modules to Gtk+ 2.18.3 Ignore-this: 870089e75e1e9f3430bf074a1beea7e4 hunk ./ApiUpdateTodoList.txt 24 -*** TODO AppLaunchContext.chs +*** DONE AppLaunchContext.chs hunk ./ApiUpdateTodoList.txt 40 -*** TODO Cursor.chs +*** DONE Cursor.chs hunk ./ApiUpdateTodoList.txt 58 -*** TODO Gc.chs -*** TODO GC.chs +*** DONE Gc.chs +*** DONE GC.chs hunk ./ApiUpdateTodoList.txt 79 -*** TODO Key.chs +*** DONE Key.chs hunk ./ApiUpdateTodoList.txt 81 -*** TODO Keyval.chs +*** DONE Keyval.chs hunk ./ApiUpdateTodoList.txt 96 -*** TODO PixbufAniAnim.chs -*** TODO PixbufAniAnimIter.chs -*** TODO PixbufAnimation.chs -*** TODO PixbufAnimationIter.chs -*** TODO Pixbuf.chs -*** TODO PixbufGdipAnim.chs -*** TODO PixbufGdipAnimIter.chs -*** TODO PixbufGifAnim.chs -*** TODO PixbufGifAnimIter.chs -*** TODO PixbufLoader.chs -*** TODO PixbufSimpleAnim.chs +*** DONE PixbufAniAnim.chs +*** DONE PixbufAniAnimIter.chs +*** DONE PixbufAnimation.chs +*** DONE PixbufAnimationIter.chs +*** DONE Pixbuf.chs +*** DONE PixbufGdipAnim.chs +*** DONE PixbufGdipAnimIter.chs +*** DONE PixbufGifAnim.chs +*** DONE PixbufGifAnimIter.chs +*** DONE PixbufLoader.chs +*** DONE PixbufSimpleAnim.chs hunk ./ApiUpdateTodoList.txt 137 -*** TODO Rectangle.chs +*** DONE Rectangle.chs hunk ./ApiUpdateTodoList.txt 170 -*** TODO Visual.chs +*** DONE Visual.chs hunk ./ApiUpdateTodoList.txt 173 -*** TODO Win32EmbedWidget.chs -*** TODO WindowImpl.chs +*** DONE Win32EmbedWidget.chs +*** DONE WindowImpl.chs hunk ./Makefile.am 800 + gtk/Graphics/UI/Gtk/Gdk/PixbufLoader.chs.pp \ hunk ./Makefile.am 803 + gtk/Graphics/UI/Gtk/Gdk/Keymap.chs.pp \ hunk ./Makefile.am 805 + gtk/Graphics/UI/Gtk/Gdk/DisplayManager.chs.pp \ + gtk/Graphics/UI/Gtk/Gdk/Visual.chs.pp \ + gtk/Graphics/UI/Gtk/Gdk/AppLaunchContext.chs.pp \ hunk ./Makefile.am 880 + gtk/Graphics/UI/Gtk/Gdk/Region_stub.o \ + gtk/Graphics/UI/Gtk/Gdk/Screen_stub.o \ + gtk/Graphics/UI/Gtk/Gdk/Pixbuf_stub.o \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 64 + module Graphics.UI.Gtk.Gdk.PixbufLoader, hunk ./gtk/Graphics/UI/Gtk.hs.pp 68 + module Graphics.UI.Gtk.Gdk.DisplayManager, hunk ./gtk/Graphics/UI/Gtk.hs.pp 70 + module Graphics.UI.Gtk.Gdk.Visual, + module Graphics.UI.Gtk.Gdk.Keymap, + module Graphics.UI.Gtk.Gdk.AppLaunchContext, hunk ./gtk/Graphics/UI/Gtk.hs.pp 283 -import Graphics.UI.Gtk.Gdk.DrawWindow +import Graphics.UI.Gtk.Gdk.DrawWindow hiding (DrawWindowType(..)) hunk ./gtk/Graphics/UI/Gtk.hs.pp 290 +import Graphics.UI.Gtk.Gdk.PixbufLoader hunk ./gtk/Graphics/UI/Gtk.hs.pp 294 +import Graphics.UI.Gtk.Gdk.DisplayManager hunk ./gtk/Graphics/UI/Gtk.hs.pp 296 +import Graphics.UI.Gtk.Gdk.Visual +import Graphics.UI.Gtk.Gdk.Keymap +import Graphics.UI.Gtk.Gdk.AppLaunchContext addfile ./gtk/Graphics/UI/Gtk/Gdk/AppLaunchContext.chs.pp hunk ./gtk/Graphics/UI/Gtk/Gdk/AppLaunchContext.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget AppLaunchContext +-- +-- Author : Andy Stewart +-- +-- Created: 30 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) +-- +-- +module Graphics.UI.Gtk.Gdk.AppLaunchContext ( + +-- * Types + AppLaunchContext, + +-- * Constructors + appLaunchContextNew, + +-- * Methods + appLaunchContextSetDesktop, + appLaunchContextSetDisplay, + -- appLaunchContextSetIcon, + appLaunchContextSetIconName, + appLaunchContextSetScreen, + appLaunchContextSetTimestamp, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.GObject (constructNewGObject, makeNewGObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gdk" prefix="gdk" #} + + +-------------------- +-- Types +{#pointer *AppLaunchContext foreign newtype#} + +-------------------- +-- Constructors + +-- | +-- +appLaunchContextNew :: IO AppLaunchContext +appLaunchContextNew = do + ptr <- {# call gdk_app_launch_context_new #} + liftM AppLaunchContext $ newForeignPtr_ ptr + +-------------------- +-- Methods + +-- | +-- +appLaunchContextSetDesktop :: AppLaunchContext -> Int -> IO () +appLaunchContextSetDesktop self desktop = + {# call gdk_app_launch_context_set_desktop #} + self + (fromIntegral desktop) + +-- | +-- +appLaunchContextSetDisplay :: AppLaunchContext -> Display -> IO () +appLaunchContextSetDisplay self display = + {# call gdk_app_launch_context_set_display #} + self + display + +-- | +-- +-- appLaunchContextSetIcon :: AppLaunchContext -> {-GIcon*-} -> IO () +-- appLaunchContextSetIcon self icon = +-- {# call gdk_app_launch_context_set_icon #} +-- self +-- {-icon-} + +-- | +-- +appLaunchContextSetIconName :: AppLaunchContext -> String -> IO () +appLaunchContextSetIconName self iconName = + withUTFString iconName $ \iconNamePtr -> + {# call gdk_app_launch_context_set_icon_name #} + self + iconNamePtr + +-- | +-- +appLaunchContextSetScreen :: AppLaunchContext -> Screen -> IO () +appLaunchContextSetScreen self screen = + {# call gdk_app_launch_context_set_screen #} + self + screen + +-- | +-- +appLaunchContextSetTimestamp :: AppLaunchContext -> Word32 -> IO () +appLaunchContextSetTimestamp self timestamp = + {# call gdk_app_launch_context_set_timestamp #} + self + (fromIntegral timestamp) hunk ./gtk/Graphics/UI/Gtk/Gdk/Cursor.chs 45 - cursorGetImage + cursorGetImage, + +-- * Internal. + makeNewCursor, -- internal function, don't us hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 78 + -- displayGetEvent, + -- displayPeekEvent, + -- displayPutEvent, hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 126 +import Graphics.UI.Gtk.Gdk.Events hiding (TimeStamp) hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 285 - addfile ./gtk/Graphics/UI/Gtk/Gdk/DisplayManager.chs.pp hunk ./gtk/Graphics/UI/Gtk/Gdk/DisplayManager.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget DisplayManager +-- +-- Author : Andy Stewart +-- +-- Created: 29 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) +-- +-- Maintains a list of all open GdkDisplays +-- +-- * Module available since Gdk version 2.2 +-- +-- The following function don't bind, use corresponding attributes instead: +-- gdk_display_manager_get_default_display +-- gdk_display_manager_set_default_display +-- +module Graphics.UI.Gtk.Gdk.DisplayManager ( hunk ./gtk/Graphics/UI/Gtk/Gdk/DisplayManager.chs.pp 35 +-- * Detail +-- +-- | The purpose of the 'DisplayManager' singleton object is to offer +-- notification when displays appear or disappear or the default display +-- changes. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----DisplayManager +-- @ + +#if GTK_CHECK_VERSION(2,2,0) +-- * Types + DisplayManager, + DisplayManagerClass, + castToDisplayManager, + toDisplayManager, + +-- * Methods + displayManagerGet, + displayManagerListDisplays, + +-- * Attributes + displayManagerDefaultDisplay, + +-- * Signals + opened, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.GList +import System.Glib.GObject (constructNewGObject, makeNewGObject) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gdk" prefix="gdk" #} + +#if GTK_CHECK_VERSION(2,2,0) +-------------------- +-- Methods + +-- | Returns the global 'DisplayManager' singleton; 'parsePargs', 'init', or +-- 'initCheck' must have been called first. +-- +displayManagerGet :: + IO DisplayManager -- ^ returns the singleton 'DisplayManager' object. +displayManagerGet = + makeNewGObject mkDisplayManager $ + {# call gdk_display_manager_get #} + +-- | List all currently open displays. +-- +displayManagerListDisplays :: DisplayManagerClass self => self + -> IO [Display] -- ^ returns a newly allocated list of 'Display' objects. Free this + -- list with 'gSlistFree' when you are done with + -- it. +displayManagerListDisplays self = + {# call gdk_display_manager_list_displays #} + (toDisplayManager self) + >>= fromGSList + >>= mapM (makeNewGObject mkDisplay . return) + +-------------------- +-- Attributes + +-- | +-- +displayManagerDefaultDisplay :: DisplayManagerClass self => Attr self Display +displayManagerDefaultDisplay = newAttrFromObjectProperty "default-display" + {# call pure unsafe gdk_display_get_type #} + +-------------------- +-- Signals + +-- | The ::display_opened signal is emitted when a display is opened. +-- +opened :: DisplayManagerClass self => Signal self (Display -> IO ()) +opened = Signal (connect_OBJECT__NONE "display-opened") +#endif hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 4 --- Author : Axel Simon +-- Author : Axel Simon, Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 9 +-- Copyright (C) 2010 Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 28 +-- The following function not useful, don't bind it: +-- gdk_window_withdraw +-- gdk_window_invalidate_maybe_recurse +-- gdk_window_set_user_data +-- gdk_window_get_user_data +-- gdk_window_get_internal_paint_info +-- gdk_window_peek_children +-- gdk_set_pointer_hooks +-- hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 59 - WindowState(..), hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 60 + DrawWindowAttr, + Geometry, + +-- * Enums + DrawWindowState(..), + DrawWindowType(..), + hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 83 + drawWindowProcessAllUpdates, + drawWindowSetDebugUpdates, hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 95 - drawWindowForeignNew + drawWindowForeignNew, + + drawWindowNew, + drawWindowShow, + drawWindowShowUnraised, + drawWindowHide, + drawWindowIsDestroyed, + drawWindowIsVisible, + drawWindowIsViewable, + drawWindowIconify, + drawWindowDeiconify, + drawWindowStick, + drawWindowUnstick, + drawWindowMaximize, + drawWindowUnmaximize, + drawWindowFullscreen, + drawWindowUnfullscreen, + drawWindowSetKeepAbove, + drawWindowSetKeepBelow, + drawWindowSetOpacity, + drawWindowSetComposited, + drawWindowMove, + drawWindowResize, + drawWindowMoveResize, + drawWindowMoveRegion, + drawWindowFlush, + drawWindowEnsureNative, + drawWindowReparent, + drawWindowRestack, + drawWindowFocus, + drawWindowBeginResizeDrag, + drawWindowBeginMoveDrag, + drawWindowConstrainSize, + drawWindowBeep, + drawWindowEnableSynchronizedConfigure, + drawWindowConfigureFinished, + drawWindowSetFocusOnMap, + drawWindowInputShapeCombineMask, + drawWindowInputShapeCombineRegion, + drawWindowMergeChildInputShapes, + drawWindowSetStaticGravities, + drawWindowSetTitle, + drawWindowSetBackground, + drawWindowSetBackPixmap, + drawWindowSetCursor, + drawWindowGetCursor, + drawWindowGetGeometry, + drawWindowSetGeometryHints, + drawWindowSetIconList, + drawWindowSetTypeHint, + drawWindowGetTypeHint, + drawWindowSetSkipTaskbarHint, + drawWindowSetSkipPagerHint, + drawWindowSetUrgencyHint, + drawWindowGetPosition, + drawWindowGetFrameExtents, + drawWindowGetRootCoords, + drawWindowGetParent, + drawWindowGetToplevel, + drawWindowGetChildren, + drawWindowSetIcon, + drawWindowSetIconName, + drawWindowSetTransientFor, + drawWindowSetRole, + drawWindowSetGroup, + drawWindowGetGroup, + drawWindowSetDecorations, + drawWindowSetFunctions, + drawWindowGeometryChanged, + drawWindowRedirectToDrawable, + drawWindowRemoveRedirection, + +-- * Attributes + drawWindowCursor, hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 174 +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.UTFString +import System.Glib.GList hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 183 +import Graphics.UI.Gtk.Gdk.Cursor (Cursor, makeNewCursor) hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 188 +{#import Graphics.UI.Gtk.Gdk.Pixmap#} (Bitmap) +{#import Graphics.UI.Gtk.Gdk.Cursor#} (Cursor(..)) hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 193 +-------------------- +-- Types +{#pointer *GdkWindowAttr as DrawWindowAttr foreign newtype#} + +-- | The 'Geometry' struct gives the window manager information about a window's geometry +-- constraints. Normally you would set these on the GTK+ level using +-- 'windowSetGeometryHints'. 'Window' then sets the hints on the 'Window' it creates. +-- [_$_] +-- 'windowSetGeometryHints' expects the hints to be fully valid already and simply passes them +-- to the window manager; in contrast, 'windowSetGeometryHints' performs some +-- interpretation. For example, 'Window' will apply the hints to the geometry widget instead of the +-- toplevel window, if you set a geometry widget. Also, the @minWidth@/@minHeight@/@maxWidth@/@maxHeight@ +-- fields may be set to -1, and 'Window' will substitute the size request of the window or geometry +-- widget. If the minimum size hint is not provided, 'Window' will use its requisition as the minimum +-- size. If the minimum size is provided and a geometry widget is set, 'Window' will take the minimum +-- size as the minimum size of the geometry widget rather than the entire window. The base size is +-- treated similarly. +-- [_$_] +-- The canonical use-case for 'windowSetGeometryHints' is to get a terminal widget to resize +-- properly. Here, the terminal text area should be the geometry widget; 'Window' will then +-- automatically set the base size to the size of other widgets in the terminal window, such as the +-- menubar and scrollbar. Then, the @widthInc@ and @heightInc@ fields should be set to the size of one +-- character in the terminal. Finally, the base size should be set to the size of one character. The +-- net effect is that the minimum size of the terminal will have a 1x1 character terminal area, and +-- only terminal sizes on the "character grid" will be allowed. +{#pointer *Geometry foreign newtype#} + hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 221 --- the 'WindowState' enumeration. +-- the 'DrawWindowState' enumeration. hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 224 - -> IO [WindowState] -- ^ returns @DrawWindow@ flags + -> IO [DrawWindowState] -- ^ returns @DrawWindow@ flags hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 487 +-- | Calls 'windowProcessUpdates' in the application. +drawWindowProcessAllUpdates :: IO () +drawWindowProcessAllUpdates = {#call gdk_window_process_all_updates#} + +-- | With update debugging enabled, calls to 'windowInvalidateRegion' clear the invalidated region +-- of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to +-- windows during 'windowProcessUpdates'. The net effect is that you can see the invalid region +-- for each window and watch redraws as they occur. This allows you to diagnose inefficiencies in your +-- application. +-- [_$_] +-- In essence, because the GDK rendering model prevents all flicker, if you are redrawing the same +-- region 400 times you may never notice, aside from noticing a speed problem. Enabling update +-- debugging causes GTK to flicker slowly and noticeably, so you can see exactly what's being redrawn +-- when, in what order. +-- [_$_] +-- The --gtk-debug=updates command line option passed to GTK+ programs enables this debug option at +-- application startup time. That's usually more useful than calling 'windowSetDebugUpdates' +-- yourself, though you might want to use this function to enable updates sometime after application +-- startup time. +drawWindowSetDebugUpdates :: Bool -> IO () +drawWindowSetDebugUpdates setting = + {#call gdk_window_set_debug_updates#} (fromBool setting) + hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 684 -drawWindowGetOrigin :: DrawWindow +drawWindowGetOrigin :: DrawWindowClass self => self hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 704 + +-- | Creates a new 'Window' using the attributes from attributes. See 'WindowAttr' and +-- 'WindowAttributesType' for more details. Note: to use this on displays other than the default +-- display, parent must be specified. +drawWindowNew :: DrawWindowClass self => self -> DrawWindowAttr -> Int -> IO DrawWindow +drawWindowNew parent attr mask = + makeNewGObject mkDrawWindow $ [_$_] + {#call gdk_window_new#} [_$_] + (toDrawWindow parent) [_$_] + attr + (fromIntegral mask) + +-- | Gets the type of the window. See 'DrawWindowType'. +drawWindowGetWindowType :: DrawWindowClass self => self -> IO DrawWindowType +drawWindowGetWindowType window = + liftM (toEnum . fromIntegral) $ + {#call gdk_window_get_window_type#} + (toDrawWindow window) + +-- | Like 'windowShowUnraised', but also raises the window to the top of the window stack (moves +-- the window to the front of the Z-order). +-- [_$_] +-- This function maps a window so it's visible onscreen. Its opposite is 'windowHide'. +-- [_$_] +-- When implementing a 'Widget', you should call this function on the widget's 'Window' as part of +-- the "map" method. +drawWindowShow :: DrawWindowClass self => self -> IO () +drawWindowShow window = {#call gdk_window_show#} (toDrawWindow window) + +-- | Shows a 'Window' onscreen, but does not modify its stacking order. In contrast, 'windowShow' +-- will raise the window to the top of the window stack. +-- [_$_] +-- On the X11 platform, in Xlib terms, this function calls XMapWindow() (it also updates some internal +-- GDK state, which means that you can't really use XMapWindow() directly on a GDK window). +drawWindowShowUnraised :: DrawWindowClass self => self -> IO () +drawWindowShowUnraised window = {#call gdk_window_show_unraised#} (toDrawWindow window) + +-- | For toplevel windows, withdraws them, so they will no longer be known to the window manager; for all +-- windows, unmaps them, so they won't be displayed. Normally done automatically as part of +-- 'widgetHide'. +drawWindowHide :: DrawWindowClass self => self -> IO () +drawWindowHide window = {#call gdk_window_hide#} (toDrawWindow window) + +-- | Check to see if a window is destroyed.. +drawWindowIsDestroyed :: DrawWindowClass self => self -> IO Bool +drawWindowIsDestroyed window = + liftM toBool $ {#call gdk_window_is_destroyed#} (toDrawWindow window) + +-- | Checks whether the window has been mapped (with 'windowShow'. +drawWindowIsVisible :: DrawWindowClass self => self -> IO Bool +drawWindowIsVisible window = [_$_] + liftM toBool $ {#call gdk_window_is_visible#} (toDrawWindow window) + +-- | Check if the window and all ancestors of the window are mapped. (This is not necessarily "viewable" +-- in the X sense, since we only check as far as we have GDK window parents, not to the root window.) +drawWindowIsViewable :: DrawWindowClass self => self -> IO Bool +drawWindowIsViewable window = [_$_] + liftM toBool $ {#call gdk_window_is_viewable#} (toDrawWindow window) + [_$_] +-- | Asks to iconify (minimize) window. The window manager may choose to ignore the request, but normally +-- will honor it. Using 'windowIconify' is preferred, if you have a 'Window' widget. +-- [_$_] +-- This function only makes sense when window is a toplevel window. +drawWindowIconify :: DrawWindowClass self => self -> IO () +drawWindowIconify window = + {#call gdk_window_iconify#} (toDrawWindow window) + +-- | Attempt to deiconify (unminimize) window. On X11 the window manager may choose to ignore the request +-- to deiconify. When using GTK+, use 'windowDeiconify' instead of the 'Window' variant. Or +-- better yet, you probably want to use 'windowPresent', which raises the window, focuses it, +-- unminimizes it, and puts it on the current desktop. +drawWindowDeiconify :: DrawWindowClass self => self -> IO () +drawWindowDeiconify window = + {#call gdk_window_deiconify#} (toDrawWindow window) + +-- | "Pins" a window such that it's on all workspaces and does not scroll with viewports, for window +-- managers that have scrollable viewports. (When using 'Window', 'windowStick' may be more +-- useful.) +-- [_$_] +-- On the X11 platform, this function depends on window manager support, so may have no effect with +-- many window managers. However, GDK will do the best it can to convince the window manager to stick +-- the window. For window managers that don't support this operation, there's nothing you can do to +-- force it to happen. +drawWindowStick :: DrawWindowClass self => self -> IO () +drawWindowStick window = + {#call gdk_window_stick#} (toDrawWindow window) + +-- | Reverse operation for 'windowStick'. +drawWindowUnstick :: DrawWindowClass self => self -> IO () +drawWindowUnstick window = + {#call gdk_window_unstick#} (toDrawWindow window) + +-- | Maximizes the window. If the window was already maximized, then this function does nothing. +-- [_$_] +-- On X11, asks the window manager to maximize window, if the window manager supports this +-- operation. Not all window managers support this, and some deliberately ignore it or don't have a +-- concept of "maximized"; so you can't rely on the maximization actually happening. But it will happen +-- with most standard window managers, and GDK makes a best effort to get it to happen. +-- [_$_] +-- On Windows, reliably maximizes the window. +drawWindowMaximize :: DrawWindowClass self => self -> IO () +drawWindowMaximize window = + {# call gdk_window_maximize#} (toDrawWindow window) + +-- | Unmaximizes the window. If the window wasn't maximized, then this function does nothing. +-- [_$_] +-- On X11, asks the window manager to unmaximize window, if the window manager supports this +-- operation. Not all window managers support this, and some deliberately ignore it or don't have a +-- concept of "maximized"; so you can't rely on the unmaximization actually happening. But it will +-- happen with most standard window managers, and GDK makes a best effort to get it to happen. +-- [_$_] +-- On Windows, reliably unmaximizes the window. +drawWindowUnmaximize :: DrawWindowClass self => self -> IO () +drawWindowUnmaximize window = + {#call gdk_window_unmaximize#} (toDrawWindow window) + +-- | Moves the window into fullscreen mode. This means the window covers the entire screen and is above +-- any panels or task bars. +-- [_$_] +-- If the window was already fullscreen, then this function does nothing. +-- [_$_] +-- On X11, asks the window manager to put window in a fullscreen state, if the window manager supports +-- this operation. Not all window managers support this, and some deliberately ignore it or don't have +-- a concept of "fullscreen"; so you can't rely on the fullscreenification actually happening. But it +-- will happen with most standard window managers, and GDK makes a best effort to get it to happen. +drawWindowFullscreen :: DrawWindowClass self => self -> IO () +drawWindowFullscreen window = + {# call gdk_window_fullscreen#} (toDrawWindow window) + +-- | Moves the window out of fullscreen mode. If the window was not fullscreen, does nothing. +-- [_$_] +-- On X11, asks the window manager to move window out of the fullscreen state, if the window manager +-- supports this operation. Not all window managers support this, and some deliberately ignore it or +-- don't have a concept of "fullscreen"; so you can't rely on the unfullscreenification actually +-- happening. But it will happen with most standard window managers, and GDK makes a best effort to get +-- it to happen. +drawWindowUnfullscreen :: DrawWindowClass self => self -> IO () +drawWindowUnfullscreen window = + {# call gdk_window_unfullscreen#} (toDrawWindow window) + +-- | Set if window must be kept above other windows. If the window was already above, then this function +-- does nothing. +-- [_$_] +-- On X11, asks the window manager to keep window above, if the window manager supports this +-- operation. Not all window managers support this, and some deliberately ignore it or don't have a +-- concept of "keep above"; so you can't rely on the window being kept above. But it will happen with +-- most standard window managers, and GDK makes a best effort to get it to happen. +drawWindowSetKeepAbove :: DrawWindowClass self => self -> Bool -> IO () +drawWindowSetKeepAbove window setting = + {#call gdk_window_set_keep_above#} + (toDrawWindow window) + (fromBool setting) + +-- | Set if window must be kept below other windows. If the window was already below, then this function +-- does nothing. +-- [_$_] +-- On X11, asks the window manager to keep window below, if the window manager supports this +-- operation. Not all window managers support this, and some deliberately ignore it or don't have a +-- concept of "keep below"; so you can't rely on the window being kept below. But it will happen with +-- most standard window managers, and GDK makes a best effort to get it to happen. +drawWindowSetKeepBelow :: DrawWindowClass self => self -> Bool -> IO () +drawWindowSetKeepBelow window setting = + {#call gdk_window_set_keep_below#} + (toDrawWindow window) + (fromBool setting) + +-- | Request the windowing system to make window partially transparent, with opacity 0 being fully +-- transparent and 1 fully opaque. (Values of the opacity parameter are clamped to the [0,1] range.) +-- [_$_] +-- On X11, this works only on X screens with a compositing manager running. +-- [_$_] +-- For setting up per-pixel alpha, see 'screenGetRgbaColormap'. For making non-toplevel windows +-- translucent, see 'windowSetComposited'. +drawWindowSetOpacity :: DrawWindowClass self => self -> Double -> IO () +drawWindowSetOpacity window opacity = + {#call gdk_window_set_opacity#} + (toDrawWindow window) + (realToFrac opacity) + +-- | Sets a 'Window' as composited, or unsets it. Composited windows do not automatically have their +-- contents drawn to the screen. Drawing is redirected to an offscreen buffer and an expose event is +-- emitted on the parent of the composited window. It is the responsibility of the parent's expose +-- handler to manually merge the off-screen content onto the screen in whatever way it sees fit. See +-- Example[_\c2_][_\a0_]7, [_\e2_][_\80_][_\9c_]Composited windows[_\e2_][_\80_][_\9d_] for an example. +-- [_$_] +-- It only makes sense for child windows to be composited; see 'windowSetOpacity' if you need +-- translucent toplevel windows. +-- [_$_] +-- An additional effect of this call is that the area of this window is no longer clipped from regions +-- marked for invalidation on its parent. Draws done on the parent window are also no longer clipped +-- by the child. +-- [_$_] +-- This call is only supported on some systems (currently, only X11 with new enough Xcomposite and +-- Xdamage extensions). You must call 'displaySupportsComposite' to check if setting a window as +-- composited is supported before attempting to do so. +drawWindowSetComposited :: DrawWindowClass self => self -> Bool -> IO () +drawWindowSetComposited window composited = + {#call gdk_window_set_composited#} + (toDrawWindow window) + (fromBool composited) + +-- | Repositions a window relative to its parent window. For toplevel windows, window managers may ignore +-- or modify the move; you should probably use 'windowMove' on a 'Window' widget anyway, instead +-- of using GDK functions. For child windows, the move will reliably succeed. +-- [_$_] +-- If you're also planning to resize the window, use 'windowMoveResize' to both move and resize +-- simultaneously, for a nicer visual effect. +drawWindowMove :: DrawWindowClass self => self -> Int -> Int -> IO () +drawWindowMove window x y = + {#call gdk_window_move#} [_$_] + (toDrawWindow window) + (fromIntegral x) + (fromIntegral y) + +-- | Resizes window; for toplevel windows, asks the window manager to resize the window. The window +-- manager may not allow the resize. When using GTK+, use 'windowResize' instead of this low-level +-- GDK function. +-- [_$_] +-- Windows may not be resized below 1x1. +-- [_$_] +-- If you're also planning to move the window, use 'windowMoveResize' to both move and resize +-- simultaneously, for a nicer visual effect. +drawWindowResize :: DrawWindowClass self => self -> Int -> Int -> IO () +drawWindowResize window x y = + {#call gdk_window_resize#} [_$_] + (toDrawWindow window) + (fromIntegral x) + (fromIntegral y) + +-- | Equivalent to calling 'windowMove', except that both operations are +-- performed at once, avoiding strange visual effects. (i.e. the user may be able to see the window +-- first move, then resize, if you don't use 'windowMoveResize' +drawWindowMoveResize :: DrawWindowClass self => self -> Int -> Int -> Int -> Int -> IO () +drawWindowMoveResize window x y width height = + {#call gdk_window_move_resize#} + (toDrawWindow window) + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) + +-- | Move the part of window indicated by region by dy pixels in the Y direction and dx pixels in the X +-- direction. The portions of region that not covered by the new position of region are invalidated. +drawWindowMoveRegion :: DrawWindowClass self => self -> Region -> Int -> Int -> IO () +drawWindowMoveRegion window region dx dy = + {#call gdk_window_move_region#} + (toDrawWindow window) + region + (fromIntegral dx) + (fromIntegral dy) + +-- | Flush all outstanding cached operations on a window, leaving the window in a state which reflects +-- all that has been drawn before. +-- [_$_] +-- Gdk uses multiple kinds of caching to get better performance and nicer drawing. For instance, during +-- exposes all paints to a window using double buffered rendering are keep on a pixmap until the last +-- window has been exposed. It also delays window moves/scrolls until as long as possible until next +-- update to avoid tearing when moving windows. +-- [_$_] +-- Normally this should be completely invisible to applications, as we automatically flush the windows +-- when required, but this might be needed if you for instance mix direct native drawing with gdk +-- drawing. For Gtk widgets that don't use double buffering this will be called automatically before +-- sending the expose event. +drawWindowFlush :: DrawWindowClass self => self -> IO () +drawWindowFlush window = {#call gdk_window_flush#} (toDrawWindow window) + +-- | Tries to ensure that there is a window-system native window for this 'Window'. This may fail in +-- some situations, returning 'False'. +-- [_$_] +-- Offscreen window and children of them can never have native windows. +-- [_$_] +-- Some backends may not support native child windows. +drawWindowEnsureNative :: DrawWindowClass self => self -> IO Bool +drawWindowEnsureNative window = + liftM toBool $ + {#call gdk_window_ensure_native#} (toDrawWindow window) + +-- | Reparents window into the given @newParent@. The window being reparented will be unmapped as a side +-- effect. +drawWindowReparent :: (DrawWindowClass window, DrawWindowClass parent) => window -> parent -> Int -> Int -> IO () +drawWindowReparent window newParent x y = + {#call gdk_window_reparent#} [_$_] + (toDrawWindow window) [_$_] + (toDrawWindow newParent) + (fromIntegral x) + (fromIntegral y) + +-- | Changes the position of window in the Z-order (stacking order), so that it is above sibling (if +-- above is 'True') or below sibling (if above is 'False'). +-- [_$_] +-- If sibling is 'Nothing', then this either raises (if above is 'True') or lowers the window. +-- [_$_] +-- If window is a toplevel, the window manager may choose to deny the request to move the window in the +-- Z-order, 'windowRestack' only requests the restack, does not guarantee it. +drawWindowRestack :: (DrawWindowClass window, DrawWindowClass sibling) => window -> sibling -> Bool -> IO () +drawWindowRestack window sibling above = + {#call gdk_window_restack#} + (toDrawWindow window) + (toDrawWindow sibling) + (fromBool above) + +-- | Sets keyboard focus to window. In most cases, 'windowPresent' should be used on a 'Window', +-- rather than calling this function. +drawWindowFocus :: DrawWindowClass self => self -> Int -> IO () +drawWindowFocus window timestamp = + {#call gdk_window_focus#} + (toDrawWindow window) + (fromIntegral timestamp) + +-- | Begins a window resize operation (for a toplevel window). You might use this function to implement a +-- "window resize grip," for example; in fact 'Statusbar' uses it. The function works best with window +-- managers that support the Extended Window Manager Hints, but has a fallback implementation for other +-- window managers. +drawWindowBeginResizeDrag :: DrawWindowClass self => self -> DrawWindowEdge -> Int -> Int -> Int -> Int -> IO () +drawWindowBeginResizeDrag window edge button rootX rootY timestamp = + {#call gdk_window_begin_resize_drag#} + (toDrawWindow window) + ((fromIntegral . fromEnum) edge) + (fromIntegral button) + (fromIntegral rootX) + (fromIntegral rootY) + (fromIntegral timestamp) + +-- | Begins a window move operation (for a toplevel window). You might use this function to implement a +-- "window move grip," for example. The function works best with window managers that support the +-- Extended Window Manager Hints, but has a fallback implementation for other window managers. +drawWindowBeginMoveDrag :: DrawWindowClass self => self -> Int -> Int -> Int -> Int -> IO () +drawWindowBeginMoveDrag window button rootX rootY timestamp = + {#call gdk_window_begin_move_drag#} + (toDrawWindow window) + (fromIntegral button) + (fromIntegral rootX) + (fromIntegral rootY) + (fromIntegral timestamp) + +-- | Constrains a desired width and height according to a set of geometry hints (such as minimum and +-- maximum size). +drawWindowConstrainSize :: Geometry -> Int -> Int -> Int -> IO (Int , Int) +drawWindowConstrainSize geometry flags width height = + alloca $ \ newWidthPtr -> [_$_] + alloca $ \ newHeightPtr -> do + {#call gdk_window_constrain_size#} + geometry + (fromIntegral flags) + (fromIntegral width) + (fromIntegral height) + newWidthPtr + newHeightPtr + newWidth <- peek newWidthPtr + newHeight <- peek newHeightPtr + return (fromIntegral newWidth, fromIntegral newHeight) + +-- | Emits a short beep associated to window in the appropriate display, if supported. Otherwise, emits a +-- short beep on the display just as 'displayBeep'. +drawWindowBeep :: DrawWindowClass self => self -> IO () +drawWindowBeep window = {#call gdk_window_beep#} (toDrawWindow window) + +-- | Indicates that the application will cooperate with the window system in synchronizing the window +-- repaint with the window manager during resizing operations. After an application calls this +-- function, it must call 'windowConfigureFinished' every time it has finished all processing +-- associated with a set of Configure events. Toplevel GTK+ windows automatically use this protocol. +-- [_$_] +-- On X, calling this function makes window participate in the _'NetWmSyncRequest' window manager +-- protocol. +drawWindowEnableSynchronizedConfigure :: DrawWindowClass self => self -> IO () +drawWindowEnableSynchronizedConfigure window = + {#call gdk_window_enable_synchronized_configure#} (toDrawWindow window) + +-- | Signal to the window system that the application has finished handling Configure events it has +-- received. Window Managers can use this to better synchronize the frame repaint with the +-- application. GTK+ applications will automatically call this function when appropriate. +-- [_$_] +-- This function can only be called if 'windowEnableSynchronizedConfigure' was called +-- previously. +-- [_$_] +drawWindowConfigureFinished :: DrawWindowClass self => self -> IO () +drawWindowConfigureFinished window = + {#call gdk_window_configure_finished#} (toDrawWindow window) + +-- | An override redirect window is not under the control of the window manager. This means it won't have +-- a titlebar, won't be minimizable, etc. - it will be entirely under the control of the +-- application. The window manager can't see the override redirect window at all. +-- [_$_] +-- Override redirect should only be used for short-lived temporary windows, such as popup +-- menus. 'Menu' uses an override redirect window in its implementation, for example. +drawWindowSetOverrideRedirect :: DrawWindowClass self => self -> Bool -> IO () +drawWindowSetOverrideRedirect window override = + {#call gdk_window_set_override_redirect#} + (toDrawWindow window) + (fromBool override) + +-- | Setting @focusOnMap@ to 'False' hints the desktop environment that the window doesn't want to receive +-- input focus when it is mapped. @focusOnMap@ should be turned off for windows that aren't triggered +-- interactively (such as popups from network activity). +-- [_$_] +-- On X, it is the responsibility of the window manager to interpret this hint. Window managers +-- following the freedesktop.org window manager extension specification should respect it. +drawWindowSetFocusOnMap :: DrawWindowClass self => self -> Bool -> IO () +drawWindowSetFocusOnMap window focus = + {#call gdk_window_set_focus_on_map #} + (toDrawWindow window) + (fromBool focus) + +-- | Like 'windowShapeCombineMask', but the shape applies only to event handling. Mouse events +-- which happen while the pointer position corresponds to an unset bit in the mask will be passed on +-- the window below window. +-- [_$_] +-- An input shape is typically used with RGBA windows. The alpha channel of the window defines which +-- pixels are invisible and allows for nicely antialiased borders, and the input shape controls where +-- the window is "clickable". +-- [_$_] +-- On the X11 platform, this requires version 1.1 of the shape extension. +-- [_$_] +-- On the Win32 platform, this functionality is not present and the function does nothing. +drawWindowInputShapeCombineMask :: DrawWindowClass self => self -> Bitmap -> Int -> Int -> IO () +drawWindowInputShapeCombineMask window (Pixmap bitmap) x y = + withForeignPtr bitmap $ \bitmapPtr -> + {#call gdk_window_input_shape_combine_mask#} + (toDrawWindow window) + (castPtr bitmapPtr) + (fromIntegral x) + (fromIntegral y) + +-- | Like 'windowShapeCombineRegion', but the shape applies only to event handling. Mouse events +-- which happen while the pointer position corresponds to an unset bit in the mask will be passed on +-- the window below window. +-- [_$_] +-- An input shape is typically used with RGBA windows. The alpha channel of the window defines which +-- pixels are invisible and allows for nicely antialiased borders, and the input shape controls where +-- the window is "clickable". +-- [_$_] +-- On the X11 platform, this requires version 1.1 of the shape extension. +-- [_$_] +-- On the Win32 platform, this functionality is not present and the function does nothing. +drawWindowInputShapeCombineRegion :: DrawWindowClass self => self -> Region -> Int -> Int -> IO () +drawWindowInputShapeCombineRegion window region x y = + {#call gdk_window_input_shape_combine_region#} + (toDrawWindow window) + region + (fromIntegral x) + (fromIntegral y) + +-- | Sets the input shape mask of window to the union of input shape masks for all children of window, +-- ignoring the input shape mask of window itself. Contrast with 'windowMergeChildInputShapes' +-- which includes the input shape mask of window in the masks to be merged. +drawWindowSetChildInputShapes :: DrawWindowClass self => self -> IO () +drawWindowSetChildInputShapes window = + {#call gdk_window_set_child_input_shapes#} + (toDrawWindow window) + +-- | Merges the input shape masks for any child windows into the input shape mask for window. i.e. the +-- union of all input masks for window and its children will become the new input mask for window. See +-- 'windowInputShapeCombineMask'. +-- [_$_] +-- This function is distinct from 'windowSetChildInputShapes' because it includes window's +-- input shape mask in the set of shapes to be merged. +drawWindowMergeChildInputShapes :: DrawWindowClass self => self -> IO () +drawWindowMergeChildInputShapes window = + {#call gdk_window_merge_child_input_shapes#} + (toDrawWindow window) + +-- | Set the bit gravity of the given window to static, and flag it so all children get static subwindow +-- gravity. This is used if you are implementing scary features that involve deep knowledge of the +-- windowing system. Don't worry about it unless you have to. +drawWindowSetStaticGravities :: DrawWindowClass self => self -> Bool -> IO Bool +drawWindowSetStaticGravities window useStatic = + liftM toBool $ + {#call gdk_window_set_static_gravities#} + (toDrawWindow window) + (fromBool useStatic) + +-- | Sets the title of a toplevel window, to be displayed in the titlebar. If you haven't explicitly set +-- the icon name for the window (using 'windowSetIconName', the icon name will be set to title +-- as well. title must be in UTF-8 encoding (as with all user-readable strings in GDK/GTK+). title may +-- not be 'Nothing'. +drawWindowSetTitle :: DrawWindowClass self => self -> String -> IO () +drawWindowSetTitle window title = + withUTFString title $ \ titlePtr -> [_$_] + {#call gdk_window_set_title#} + (toDrawWindow window) + titlePtr + +-- | Sets the background color of window. (However, when using GTK+, set the background of a widget with +-- 'widgetModifyBg' - if you're +-- implementing a custom widget.) +-- [_$_] +-- The color must be allocated; 'rgbFindColor' is the best way to allocate a color. +drawWindowSetBackground :: DrawWindowClass self => self -> Color -> IO () +drawWindowSetBackground window color = + with color $ \ colorPtr -> [_$_] + {#call gdk_window_set_background#} + (toDrawWindow window) + (castPtr colorPtr) + +-- | Sets the background pixmap of window. May also be used to set a background of "None" on window, by +-- setting a background pixmap of 'Nothing'. +-- [_$_] +-- A background pixmap will be tiled, positioning the first tile at the origin of window, or if +-- @parentRelative@ is 'True', the tiling will be done based on the origin of the parent window (useful to +-- align tiles in a parent with tiles in a child). +-- [_$_] +-- A background pixmap of 'Nothing' means that the window will have no background. A window with no +-- background will never have its background filled by the windowing system, instead the window will +-- contain whatever pixels were already in the corresponding area of the display. +-- [_$_] +-- The windowing system will normally fill a window with its background when the window is obscured +-- then exposed, and when you call 'windowClear'. +drawWindowSetBackPixmap :: DrawWindowClass self => self -> Pixmap -> Bool -> IO () +drawWindowSetBackPixmap window pixmap parentRelative = + {#call gdk_window_set_back_pixmap#} + (toDrawWindow window) + pixmap + (fromBool parentRelative) + +-- | Sets the mouse pointer for a 'Window'. Use 'cursorNewForDisplay' or +-- 'cursorNewFromPixmap' to create the cursor. To make the cursor invisible, use +-- ''BlankCursor''. Passing 'Nothing' for the cursor argument to 'windowSetCursor' means that window +-- will use the cursor of its parent window. Most windows should use this default. +drawWindowSetCursor :: DrawWindowClass self => self -> Cursor -> IO () +drawWindowSetCursor window cur = + {#call gdk_window_set_cursor#} [_$_] + (toDrawWindow window) + cur + +-- | Retrieves a 'Cursor' pointer for the cursor currently set on the specified 'Window', or 'Nothing'. If +-- the return value is 'Nothing' then there is no custom cursor set on the specified window, and it is using +-- the cursor for its parent window. +drawWindowGetCursor :: DrawWindowClass self => self -> IO Cursor +drawWindowGetCursor window = do + cursorPtr <- {#call gdk_window_get_cursor#} (toDrawWindow window) + makeNewCursor $ castPtr cursorPtr + [_$_] +-- | Any of the return location arguments to this function may be 'Nothing', if you aren't interested in +-- getting the value of that field. +-- [_$_] +-- The X and Y coordinates returned are relative to the parent window of window, which for toplevels +-- usually means relative to the window decorations (titlebar, etc.) rather than relative to the root +-- window (screen-size background window). +-- [_$_] +-- On the X11 platform, the geometry is obtained from the X server, so reflects the latest position of +-- window; this may be out-of-sync with the position of window delivered in the most-recently-processed +-- 'EventConfigure'. 'windowGetPosition' in contrast gets the position from the most recent +-- configure event. +-- [_$_] +-- Note +-- [_$_] +-- If window is not a toplevel, it is much better to call 'windowGetPosition' and +-- 'drawableGetSize' instead, because it avoids the roundtrip to the X server and because +-- 'drawableGetSize' +-- is restricted to the 16-bit coordinates of X11. +drawWindowGetGeometry :: DrawWindowClass self => self -> IO (Int, Int, Int, Int, Int) +drawWindowGetGeometry window = [_$_] + alloca $ \ xPtr -> [_$_] + alloca $ \ yPtr -> [_$_] + alloca $ \ widthPtr -> [_$_] + alloca $ \ heightPtr -> [_$_] + alloca $ \ depthPtr -> do + {#call gdk_window_get_geometry#} + (toDrawWindow window) + xPtr yPtr widthPtr heightPtr depthPtr + x <- peek xPtr + y <- peek yPtr + width <- peek widthPtr + height <- peek heightPtr + depth <- peek depthPtr + return (fromIntegral x, fromIntegral y, fromIntegral width, fromIntegral height, fromIntegral depth) + +-- | Sets the geometry hints for window. Hints flagged in @geomMask@ are set, hints not flagged in +-- @geomMask@ are unset. To unset all hints, use a @geomMask@ of 0 and a geometry of 'Nothing'. +-- [_$_] +-- This function provides hints to the windowing system about acceptable sizes for a toplevel +-- window. The purpose of this is to constrain user resizing, but the windowing system will typically +-- (but is not required to) also constrain the current size of the window to the provided values and +-- constrain programatic resizing via 'windowResize'. +-- [_$_] +-- Note that on X11, this effect has no effect on windows of type ''WindowTemp'' or windows where +-- override redirect has been turned on via 'windowSetOverrideRedirect' since these windows are +-- not resizable by the user. +-- [_$_] +-- Since you can't count on the windowing system doing the constraints for programmatic resizes, you +-- should generally call 'windowConstrainSize' yourself to determine appropriate sizes. +drawWindowSetGeometryHints :: DrawWindowClass self => self -> Geometry -> DrawWindowHints -> IO () +drawWindowSetGeometryHints window geometry mask = + {#call gdk_window_set_geometry_hints#} + (toDrawWindow window) + geometry + ((fromIntegral . fromEnum) mask) + +-- | Sets a list of icons for the window. One of these will be used to represent the window when it has +-- been iconified. The icon is usually shown in an icon box or some sort of task bar. Which icon size +-- is shown depends on the window manager. The window manager can scale the icon but setting several +-- size icons can give better image quality since the window manager may only need to scale the icon by +-- a small amount or not at all. +drawWindowSetIconList :: DrawWindowClass self => self -> [Pixbuf] -> IO () +drawWindowSetIconList window list = [_$_] + withForeignPtrs (map unPixbuf list) $ \ptrList -> + withGList ptrList $ \glist -> + {#call gdk_window_set_icon_list#} + (toDrawWindow window) + glist + +-- | The application can use this hint to tell the window manager that a certain window has modal +-- behaviour. The window manager can use this information to handle modal windows in a special way. +-- [_$_] +-- You should only use this on windows for which you have previously called +-- 'windowSetTransientFor' +drawWindowSetModalHint :: DrawWindowClass self => self -> Bool -> IO () +drawWindowSetModalHint window modal = + {#call gdk_window_set_modal_hint#} + (toDrawWindow window) + (fromBool modal) + +-- | The application can use this call to provide a hint to the window manager about the functionality of +-- a window. The window manager can use this information when determining the decoration and behaviour +-- of the window. +-- [_$_] +-- The hint must be set before the window is mapped. +drawWindowSetTypeHint :: DrawWindowClass self => self -> DrawWindowTypeHint -> IO () +drawWindowSetTypeHint window hint = + {#call gdk_window_set_type_hint#} + (toDrawWindow window) + ((fromIntegral . fromEnum) hint) + +-- | This function returns the type hint set for a window. +drawWindowGetTypeHint :: DrawWindowClass self => self -> IO DrawWindowTypeHint +drawWindowGetTypeHint window = + liftM (toEnum . fromIntegral) $ + {#call gdk_window_get_type_hint#} (toDrawWindow window) + +-- | Toggles whether a window should appear in a task list or window list. If a window's semantic type as +-- specified with 'windowSetTypeHint' already fully describes the window, this function should +-- not be called in addition, instead you should allow the window to be treated according to standard +-- policy for its semantic type. +drawWindowSetSkipTaskbarHint :: DrawWindowClass self => self -> Bool -> IO () +drawWindowSetSkipTaskbarHint window skip = + {#call gdk_window_set_skip_taskbar_hint#} + (toDrawWindow window) + (fromBool skip) + +-- | Toggles whether a window should appear in a pager (workspace switcher, or other desktop utility +-- program that displays a small thumbnail representation of the windows on the desktop). If a window's +-- semantic type as specified with 'windowSetTypeHint' already fully describes the window, this +-- function should not be called in addition, instead you should allow the window to be treated +-- according to standard policy for its semantic type. +drawWindowSetSkipPagerHint :: DrawWindowClass self => self -> Bool -> IO () +drawWindowSetSkipPagerHint window skip = + {#call gdk_window_set_skip_pager_hint#} + (toDrawWindow window) + (fromBool skip) + +-- | Toggles whether a window needs the user's urgent attention. +drawWindowSetUrgencyHint :: DrawWindowClass self => self -> Bool -> IO () +drawWindowSetUrgencyHint window urgent = + {#call gdk_window_set_urgency_hint#} + (toDrawWindow window) + (fromBool urgent) + +-- | Obtains the position of the window as reported in the most-recently-processed +-- 'EventConfigure'. Contrast with 'windowGetGeometry' which queries the X server for the +-- current window position, regardless of which events have been received or processed. +-- [_$_] +-- The position coordinates are relative to the window's parent window. +drawWindowGetPosition :: DrawWindowClass self => self -> IO (Int, Int) +drawWindowGetPosition window = + alloca $ \ xPtr -> [_$_] + alloca $ \ yPtr -> do + {#call gdk_window_get_position#} + (toDrawWindow window) + xPtr + yPtr + x <- peek xPtr + y <- peek yPtr + return (fromIntegral x, fromIntegral y) + +-- | Obtains the top-left corner of the window manager frame in root window coordinates. +drawWindowGetRootOrigin :: DrawWindowClass self => self -> IO (Int, Int) +drawWindowGetRootOrigin window = + alloca $ \ xPtr -> [_$_] + alloca $ \ yPtr -> do + {#call gdk_window_get_root_origin#} + (toDrawWindow window) + xPtr + yPtr + x <- peek xPtr + y <- peek yPtr + return (fromIntegral x, fromIntegral y) + +-- | Obtains the bounding box of the window, including window manager titlebar/borders if any. The frame +-- position is given in root window coordinates. To get the position of the window itself (rather than +-- the frame) in root window coordinates, use 'windowGetOrigin'. +drawWindowGetFrameExtents :: DrawWindowClass self => self -> IO Rectangle +drawWindowGetFrameExtents window = + alloca $ \ rectPtr -> do + {#call gdk_window_get_frame_extents#} (toDrawWindow window) (castPtr rectPtr) + peek rectPtr + +-- | Obtains the position of a window position in root window coordinates. This is similar to +-- 'windowGetOrigin' but allows you go pass in any position in the window, not just the origin. +drawWindowGetRootCoords :: DrawWindowClass self => self -> Int -> Int -> IO (Int, Int) +drawWindowGetRootCoords window x y = [_$_] + alloca $ \ rootXPtr -> [_$_] + alloca $ \ rootYPtr -> do + {#call gdk_window_get_root_coords#} + (toDrawWindow window) + (fromIntegral x) + (fromIntegral y) + rootXPtr rootYPtr + rootX <- peek rootXPtr + rootY <- peek rootYPtr + return (fromIntegral rootX, fromIntegral rootY) + +-- | Obtains the parent of window, as known to GDK. Does not query the X server; thus this returns the +-- parent as passed to 'windowNew', not the actual parent. This should never matter unless you're +-- using Xlib calls mixed with GDK calls on the X11 platform. It may also matter for toplevel windows, +-- because the window manager may choose to reparent them. +drawWindowGetParent :: DrawWindowClass self => self -> IO DrawWindow +drawWindowGetParent window = + makeNewGObject mkDrawWindow $ + {#call gdk_window_get_parent#} (toDrawWindow window) + +-- | Gets the toplevel window that's an ancestor of window. +-- [_$_] +-- Any window type but ''WindowChild'' is considered a toplevel window, as is a ''WindowChild'' +-- window that has a root window as parent. +-- [_$_] +drawWindowGetToplevel :: DrawWindowClass self => self -> IO DrawWindow +drawWindowGetToplevel window = [_$_] + makeNewGObject mkDrawWindow $ + {#call gdk_window_get_toplevel#} (toDrawWindow window) + +-- | Gets the list of children of window known to GDK. This function only returns children created via +-- GDK, so for example it's useless when used with the root window; it only returns windows an +-- application created itself. +-- [_$_] +-- The returned list must be freed, but the elements in the list need not be. +drawWindowGetChildren :: DrawWindowClass self => self -> IO [DrawWindow] +drawWindowGetChildren window = do + glist <- {#call gdk_window_get_children#} (toDrawWindow window) + mapM (makeNewGObject mkDrawWindow . return) =<< fromGList glist + +-- | Sets the icon of window as a pixmap or window. If using GTK+, investigate +-- 'windowSetDefaultIconList' and +-- 'windowSetIcon'. O... [truncated message content] |
From: Andy S. <And...@co...> - 2010-03-30 10:21:57
|
Tue Mar 30 06:20:44 EDT 2010 Andy Stewart <laz...@gm...> * Fix a bug of function `treeRowReferenceNew`. Thanks "Oleg Belozeorov"! :) Ignore-this: 75a75a5a8292189b1f456fb5d0a79ee hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeRowReference.chs.pp 71 - {#call unsafe gtk_tree_row_reference_new#} (toTreeModel self) path + {#call gtk_tree_row_reference_new#} (toTreeModel self) path |
From: Andy S. <And...@co...> - 2010-03-29 03:24:50
|
Sun Mar 28 23:24:07 EDT 2010 Andy Stewart <laz...@gm...> * Update `General` modules to Gtk+ 2.18.3 Ignore-this: 86fe7b99cb2d935d7a7514a89a6b47d3 hunk ./ApiUpdateTodoList.txt 90 -*** TODO Orientable.chs +*** DONE Orientable.chs hunk ./ApiUpdateTodoList.txt 229 -*** TODO Drag.chs.pp -*** TODO IconFactory.chs.pp -*** TODO Selection.chs.pp +*** DONE Drag.chs.pp +*** DONE IconFactory.chs.pp +*** DONE Selection.chs.pp hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 111 -{- + hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 115 --} hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 134 +#if GTK_CHECK_VERSION(2,14,0) + clipboardRequestURIs, +#endif + clipboardWaitForContents, hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 140 +import Data.Maybe (fromMaybe) + hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 145 -{#import Graphics.UI.Gtk.General.DNDTypes#} (SelectionTag, TargetTag, - atomNew, Atom(..)) -{#import Graphics.UI.Gtk.General.Selection#} (InfoId, SelectionDataM) +{#import Graphics.UI.Gtk.General.DNDTypes#} (SelectionTag, SelectionData, TargetTag, atomNew, Atom(..)) +{#import Graphics.UI.Gtk.General.Selection#} (InfoId, SelectionDataM) [_$_] hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 611 + +#if GTK_CHECK_VERSION(2,14,0) +-- | Requests the contents of the clipboard as URIs. When the URIs are later +-- received @callback@ will be called. +-- +-- The @uris@ parameter to @callback@ will contain the resulting array of +-- URIs if the request succeeded, or {@NULL@, FIXME: this should probably be +-- converted to a Maybe data type} if it failed. This could happen for various +-- reasons, in particular if the clipboard was empty or if the contents of the +-- clipboard could not be converted into URI form. +-- +-- * Available since Gtk+ version 2.14 +-- +clipboardRequestURIs :: ClipboardClass self => self + -> ([String] -> IO ()) -- ^ @callback@ - a function to call when + -- the URIs are received, or the retrieval + -- fails. (It will always be called one way + -- or the other.) + -> IO () +clipboardRequestURIs self callback = do + callbackPtr <- mkClipboardUriReceivedFunc $ \_ strPtr _ -> do [_$_] + uriList <- peekArray 0 strPtr [_$_] + uris <- mapM peekCString uriList + callback uris + {# call gtk_clipboard_request_uris #} + (toClipboard self) + callbackPtr + (castFunPtrToPtr callbackPtr) + +{#pointer ClipboardURIReceivedFunc#} + +foreign import ccall "wrapper" mkClipboardUriReceivedFunc :: + (Ptr Clipboard -> Ptr CString -> Ptr () -> IO ()) + -> IO ClipboardURIReceivedFunc +#endif + +-- | Requests the contents of the clipboard using the given target. This +-- function waits for the data to be received using the main loop, so events, +-- timeouts, etc, may be dispatched during the wait. +-- +clipboardWaitForContents :: ClipboardClass self => self + -> Atom -- ^ @target@ - an atom representing the form + -- into which the clipboard owner should convert + -- the selection. + -> IO SelectionData -- ^ returns a newly-allocated {GtkSelectionData, + -- FIXME: boxed type} object or {@NULL@, FIXME: + -- this should probably be converted to a Maybe + -- data type} if retrieving the given target + -- failed. If non-{@NULL@, FIXME: this should + -- probably be converted to a Maybe data type}, + -- this value must be freed with + -- 'selectionDataFree' when you are finished with + -- it. +clipboardWaitForContents self (Atom target) = + {# call gtk_clipboard_wait_for_contents #} + (toClipboard self) + target + +-- | Requests the contents of the clipboard as text and converts the result to +-- UTF-8 if necessary. This function waits for the data to be received using +-- the main loop, so events, timeouts, etc, may be dispatched during the wait. +-- +clipboardWaitForText :: ClipboardClass self => self + -> IO String -- ^ returns a newly-allocated UTF-8 string which must be freed + -- with 'gFree', or {@NULL@, FIXME: this should probably be + -- converted to a Maybe data type} if retrieving the selection + -- data failed. (This could happen for various reasons, in + -- particular if the clipboard was empty or if the contents of + -- the clipboard could not be converted into text form.) +clipboardWaitForText self = + {# call gtk_clipboard_wait_for_text #} + (toClipboard self) + >>= readUTFString + +#if GTK_CHECK_VERSION(2,6,0) +-- | Requests the contents of the clipboard as image and converts the result +-- to a 'Pixbuf'. This function waits for the data to be received using the +-- main loop, so events, timeouts, etc, may be dispatched during the wait. +-- +-- * Available since Gtk+ version 2.6 +-- +clipboardWaitForImage :: ClipboardClass self => self + -> IO Pixbuf -- ^ returns a newly-allocated 'Pixbuf' object which must be + -- disposed with 'gObjectUnref', or {@NULL@, FIXME: this should + -- probably be converted to a Maybe data type} if retrieving the + -- selection data failed. (This could happen for various reasons, + -- in particular if the clipboard was empty or if the contents of + -- the clipboard could not be converted into an image.) +clipboardWaitForImage self = + makeNewGObject mkPixbuf $ + {# call gtk_clipboard_wait_for_image #} + (toClipboard self) + +#if GTK_CHECK_VERSION(2,10,0) +-- | Requests the contents of the clipboard as rich text. This function waits +-- for the data to be received using the main loop, so events, timeouts, etc, +-- may be dispatched during the wait. +-- +-- * Available since Gtk+ version 2.10 +-- +clipboardWaitForRichText :: (ClipboardClass self, TextBufferClass buffer) => self + -> buffer -- ^ @buffer@ - a 'TextBuffer' + -> IO (Atom, Int, String) +clipboardWaitForRichText self buffer = + alloca $ \formatPtr -> + alloca $ \lengthPtr -> do + textPtr <- {# call gtk_clipboard_wait_for_rich_text #} + (toClipboard self) + (toTextBuffer buffer) + formatPtr + lengthPtr + format <- peek formatPtr + length <- peek lengthPtr + text <- peekUTFString $ castPtr textPtr + return (Atom format, fromIntegral length, text) + +#if GTK_CHECK_VERSION(2,14,0) +-- | Requests the contents of the clipboard as URIs. This function waits for +-- the data to be received using the main loop, so events, timeouts, etc, may +-- be dispatched during the wait. +-- +-- * Available since Gtk+ version 2.14 +-- +clipboardWaitForURIs :: ClipboardClass self => self + -> IO [String] -- ^ returns a newly-allocated {@NULL@, FIXME: this should + -- probably be converted to a Maybe data type}-terminated + -- array of strings which must be freed with 'gStrfreev', or + -- {@NULL@, FIXME: this should probably be converted to a + -- Maybe data type} if retrieving the selection data failed. + -- (This could happen for various reasons, in particular if + -- the clipboard was empty or if the contents of the + -- clipboard could not be converted into URI form.) +clipboardWaitForURIs self = + {# call gtk_clipboard_wait_for_uris #} (toClipboard self) >>= + liftM (fromMaybe []) . maybePeek peekUTFStringArray0 +#endif +#endif +#endif + +-- | Test to see if there is text available to be pasted This is done by +-- requesting the TARGETS atom and checking if it contains any of the supported +-- text targets. This function waits for the data to be received using the main +-- loop, so events, timeouts, etc, may be dispatched during the wait. +-- +-- This function is a little faster than calling 'clipboardWaitForText' +-- since it doesn't need to retrieve the actual text. +-- +clipboardWaitIsTextAvailable :: ClipboardClass self => self + -> IO Bool -- ^ returns @True@ is there is text available, @False@ otherwise. +clipboardWaitIsTextAvailable self = + liftM toBool $ + {# call gtk_clipboard_wait_is_text_available #} + (toClipboard self) + +#if GTK_CHECK_VERSION(2,6,0) +-- | Test to see if there is an image available to be pasted This is done by +-- requesting the TARGETS atom and checking if it contains any of the supported +-- image targets. This function waits for the data to be received using the +-- main loop, so events, timeouts, etc, may be dispatched during the wait. +-- +-- This function is a little faster than calling 'clipboardWaitForImage' +-- since it doesn't need to retrieve the actual image data. +-- +-- * Available since Gtk+ version 2.6 +-- +clipboardWaitIsImageAvailable :: ClipboardClass self => self + -> IO Bool -- ^ returns @True@ is there is an image available, @False@ + -- otherwise. +clipboardWaitIsImageAvailable self = + liftM toBool $ + {# call gtk_clipboard_wait_is_image_available #} + (toClipboard self) + +#if GTK_CHECK_VERSION(2,10,0) +-- | Test to see if there is rich text available to be pasted This is done by +-- requesting the TARGETS atom and checking if it contains any of the supported +-- rich text targets. This function waits for the data to be received using the +-- main loop, so events, timeouts, etc, may be dispatched during the wait. +-- +-- This function is a little faster than calling 'clipboardWaitForRichText' +-- since it doesn't need to retrieve the actual text. +-- +-- * Available since Gtk+ version 2.10 +-- +clipboardWaitIsRichTextAvailable :: (ClipboardClass self, TextBufferClass buffer) => self + -> buffer -- ^ @buffer@ - a 'TextBuffer' + -> IO Bool -- ^ returns @True@ is there is rich text available, @False@ + -- otherwise. +clipboardWaitIsRichTextAvailable self buffer = + liftM toBool $ + {# call gtk_clipboard_wait_is_rich_text_available #} + (toClipboard self) + (toTextBuffer buffer) + +#if GTK_CHECK_VERSION(2,14,0) +-- | Test to see if there is a list of URIs available to be pasted This is +-- done by requesting the TARGETS atom and checking if it contains the URI +-- targets. This function waits for the data to be received using the main +-- loop, so events, timeouts, etc, may be dispatched during the wait. +-- +-- This function is a little faster than calling 'clipboardWaitForURIs' +-- since it doesn't need to retrieve the actual URI data. +-- +-- * Available since Gtk+ version 2.14 +-- +clipboardWaitIsURIsAvailable :: ClipboardClass self => self + -> IO Bool -- ^ returns @True@ is there is an URI list available, @False@ + -- otherwise. +clipboardWaitIsURIsAvailable self = + liftM toBool $ + {# call gtk_clipboard_wait_is_uris_available #} + (toClipboard self) +#endif +#endif +#endif + +#if GTK_CHECK_VERSION(2,4,0) +-- | Returns a list of targets that are present on the clipboard, or {@NULL@, +-- FIXME: this should probably be converted to a Maybe data type} if there +-- aren't any targets available. The returned list must be freed with 'gFree'. +-- This function waits for the data to be received using the main loop, so +-- events, timeouts, etc, may be dispatched during the wait. +-- +-- * Available since Gtk+ version 2.4 +-- +clipboardWaitForTargets :: ClipboardClass self => self + -> IO (Maybe ([Atom], Int)) +clipboardWaitForTargets self = + alloca $ \nTargetsPtr -> + allocaArray 0 $ \targetsPtr -> do + success <- liftM toBool $ [_$_] + {# call gtk_clipboard_wait_for_targets #} + (toClipboard self) + (castPtr targetsPtr) + nTargetsPtr + if success + then do [_$_] + nTargets <- peek nTargetsPtr + targetsList <- liftM (map Atom) (peekArray 0 targetsPtr) + return (Just (targetsList, fromIntegral nTargets)) + else return Nothing + +#if GTK_CHECK_VERSION(2,6,0) +-- | Checks if a clipboard supports pasting data of a given type. This +-- function can be used to determine if a \"Paste\" menu item should be +-- insensitive or not. +-- +-- If you want to see if there's text available on the clipboard, use +-- 'clipboardWaitIsTextAvailable' instead. +-- +-- * Available since Gtk+ version 2.6 +-- +clipboardWaitIsTargetAvailable :: ClipboardClass self => self + -> Atom -- ^ @target@ - A {GdkAtom, FIXME: struct type} indicating + -- which target to look for. + -> IO Bool -- ^ returns @True@ if the target is available, @False@ + -- otherwise. +clipboardWaitIsTargetAvailable self (Atom target) = + liftM toBool $ + {# call gtk_clipboard_wait_is_target_available #} + (toClipboard self) + target +#endif +#endif hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 8 --- Copyright (C) 2007 Axel Simon +-- Copyright (C) 2007-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 20 --- hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 39 --- --- drag_set_icon_pixmap : colormaps are a pain, they migth be useful here --- drag_set_default_icon : obsolete drag_source_set_icon : colormap problem --- + hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 83 + dragDestSetTrackMotion, + dragDestGetTrackMotion, hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 93 + dragSetIconPixmap, hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 101 + dragSourceSetIcon, hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 133 +import Data.Maybe (fromMaybe) hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 141 +{#import Graphics.UI.Gtk.Gdk.Pixmap#} (Bitmap) hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 317 +-- | Tells the widget to emit 'dragMotion' and 'dragLeave' events regardless of the targets and the +-- ''DestDefaultMotion'' flag. +-- [_$_] +-- This may be used when a widget wants to do generic actions regardless of the targets that the source +-- offers. +dragDestSetTrackMotion :: WidgetClass widget => widget -> Bool -> IO () +dragDestSetTrackMotion self motion = + {#call drag_dest_set_track_motion#} + (toWidget self) + (fromBool motion) + +-- | Returns whether the widget has been configured to always emit 'dragMotion' signals. +dragDestGetTrackMotion :: WidgetClass widget => widget -> IO Bool +dragDestGetTrackMotion self = + liftM toBool $ {#call drag_dest_get_track_motion#} (toWidget self) + hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 435 +-- | Sets pixmap as the icon for a given drag. GTK+ retains references for the arguments, and will +-- release them when they are no longer needed. In general, 'dragSetIconPixbuf' will be more +-- convenient to use. +dragSetIconPixmap :: DragContextClass context => context + -> Colormap + -> Pixmap + -> Maybe Bitmap + -> Int + -> Int + -> IO () +dragSetIconPixmap context colormap pixmap shapeMask x y = + case (fromMaybe (Pixmap nullForeignPtr) shapeMask) of + Pixmap fPtr -> withForeignPtr fPtr $ \bitmapPtr -> + {#call drag_set_icon_pixmap #} + (toDragContext context) + colormap + pixmap + (castPtr bitmapPtr) + (fromIntegral x) + (fromIntegral y) + hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 535 +-- | Sets the icon that will be used for drags from a particular widget from a pixmap/mask. GTK+ retains +-- references for the arguments, and will release them when they are no longer needed. Use +-- 'dragSourceSetIconPixbuf' instead. +dragSourceSetIcon :: WidgetClass widget => widget -> Colormap -> Pixmap -> Maybe Bitmap -> IO () +dragSourceSetIcon widget colormap pixmap shapeMask = + case (fromMaybe (Pixmap nullForeignPtr) shapeMask) of + Pixmap fPtr -> withForeignPtr fPtr $ \bitmapPtr -> + {#call drag_source_set_icon#} + (toWidget widget) + colormap + pixmap + (castPtr bitmapPtr) + hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 8 --- Copyright (C) 2007 Axel Simon +-- Copyright (C) 2007-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 64 + targetListFind, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 67 + selectionAddTargets, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 69 + selectionConvert, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 94 + selectionDataGetSelection, + selectionDataGetData, + selectionDataGetDataType, + selectionDataGetDisplay, + selectionDataGetFormat, + + targetsIncludeImage, + targetsIncludeText, + targetsIncludeUri, + targetsIncludeRichText, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 124 - selectionDataGetType) + selectionDataGetType, + withTargetEntries) hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 137 - hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 203 +-- | Looks up a given target in a 'TargetList'. +targetListFind :: TargetList -> Atom -> IO (Maybe InfoId) +targetListFind list (Atom target) = + alloca $ \ infoPtr -> do + success <- liftM toBool $ {#call target_list_find#} list target infoPtr + if success [_$_] + then liftM Just (peek infoPtr) + else return Nothing hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 225 +-- | Prepends a table of targets to the list of supported targets for a given widget and selection. +selectionAddTargets :: WidgetClass widget => widget -> Atom -> [(TargetTag, InfoId)] -> IO () +selectionAddTargets widget (Atom selection) targets = + withTargetEntries targets $ \nTargets targets -> + {#call selection_add_targets#} + (toWidget widget) + selection + targets + (fromIntegral nTargets) + hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 244 +-- | Requests the contents of a selection. When received, a 'selectionReceived' signal will be +-- generated. +selectionConvert :: WidgetClass widget => widget -> Atom -> Atom -> Int -> IO Bool +selectionConvert widget (Atom selection) (Atom target) time = + liftM toBool $ + {#call selection_convert#} [_$_] + (toWidget widget) + selection + target + (fromIntegral time) + hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 505 +-- | Retrieves the selection 'Atom' of the selection data. +selectionDataGetSelection :: SelectionDataM Atom +selectionDataGetSelection = do + selPtr <- ask + liftM Atom $ liftIO $ {#call selection_data_get_selection#} selPtr + +-- | Retrieves the selection 'Atom' of the selection data. +-- [_$_] +selectionDataGetData :: SelectionDataM String +selectionDataGetData = do + selPtr <- ask + strPtr <- liftIO $ {#call selection_data_get_data#} selPtr + liftIO $ peekUTFString (castPtr strPtr) + +-- | Retrieves the data type of the selection. +selectionDataGetDataType :: SelectionDataM Atom +selectionDataGetDataType = do + selPtr <- ask + liftM Atom $ liftIO $ {#call selection_data_get_data_type#} selPtr + +-- | Retrieves the display of the selection. +selectionDataGetDisplay :: SelectionDataM Display +selectionDataGetDisplay = do + selPtr <- ask + liftIO $ makeNewGObject mkDisplay $ {#call selection_data_get_display#} selPtr + +-- | Retrieves the format of the selection. +selectionDataGetFormat :: SelectionDataM Int +selectionDataGetFormat = do + selPtr <- ask + liftM fromIntegral $ liftIO $ {#call selection_data_get_format#} selPtr + [_$_] +-- | Determines if any of the targets in targets can be used to provide a 'Pixbuf'. +targetsIncludeImage :: [Atom] -> Int -> Bool -> IO Bool +targetsIncludeImage targets nTargets writable = do + let targetsList = map (\(Atom x) -> x) targets + withArray targetsList $ \targetsPtr -> + liftM toBool $ {#call targets_include_image#} targetsPtr (fromIntegral nTargets) (fromBool writable) + +-- | Determines if any of the targets in targets can be used to provide text. +targetsIncludeText :: [Atom] -> Int -> IO Bool +targetsIncludeText targets nTargets = do + let targetsList = map (\(Atom x) -> x) targets + withArray targetsList $ \targetsPtr -> + liftM toBool $ {#call targets_include_text#} targetsPtr (fromIntegral nTargets) + +-- | Determines if any of the targets in targets can be used to provide an uri list. +targetsIncludeUri :: [Atom] -> Int -> IO Bool +targetsIncludeUri targets nTargets = do + let targetsList = map (\(Atom x) -> x) targets + withArray targetsList $ \targetsPtr -> + liftM toBool $ {#call targets_include_uri#} targetsPtr (fromIntegral nTargets) + +-- | Determines if any of the targets in targets can be used to provide rich text. +targetsIncludeRichText :: TextBufferClass textbuffer => [Atom] -> Int -> textbuffer -> IO Bool +targetsIncludeRichText targets nTargets tb = do + let targetsList = map (\(Atom x) -> x) targets + withArray targetsList $ \targetsPtr -> + liftM toBool $ {#call targets_include_rich_text#} targetsPtr (fromIntegral nTargets) (toTextBuffer tb) + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 33 +-- The following function not useful, don't binding: +-- gtk_combo_box_get_row_separator_func +-- |
From: Andy S. <And...@co...> - 2010-03-28 14:50:40
|
Sun Mar 28 10:48:38 EDT 2010 Andy Stewart <laz...@gm...> * Add `IconTheme` module, Update `Recent` modules, and fix doc. Ignore-this: 95b29182ca1fe9378f75b1f577529270 hunk ./ApiUpdateTodoList.txt 129 -*** TODO RecentChooser.chs +*** DONE RecentChooser.chs hunk ./ApiUpdateTodoList.txt 136 -*** TODO RecentManager.chs +*** DONE RecentManager.chs hunk ./Makefile.am 654 + gtk/Graphics/UI/Gtk/General/IconTheme.chs.pp \ + gtk/Graphics/UI/Gtk/General/IconInfo.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 45 + module Graphics.UI.Gtk.General.IconTheme, + module Graphics.UI.Gtk.General.IconInfo, hunk ./gtk/Graphics/UI/Gtk.hs.pp 266 +import Graphics.UI.Gtk.General.IconTheme +import Graphics.UI.Gtk.General.IconInfo addfile ./gtk/Graphics/UI/Gtk/General/IconInfo.chs.pp hunk ./gtk/Graphics/UI/Gtk/General/IconInfo.chs.pp 1 +{-# LANGUAGE ScopedTypeVariables #-} +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget IconInfo +-- +-- Author : Andy Stewart +-- +-- Created: 28 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) +-- +-- +module Graphics.UI.Gtk.General.IconInfo ( + +-- * Types + IconInfo, + mkIconInfo, + +-- * Constructors + iconInfoNewForPixbuf, + +-- * Methods + iconInfoCopy, + iconInfoFree, + -- iconInfoGetAttachPoints, + iconInfoGetBaseSize, + iconInfoGetBuiltinPixbuf, + iconInfoGetDisplayName, + iconInfoGetEmbeddedRect, + iconInfoGetFilename, + iconInfoLoadIcon, + iconInfoSetRawCoordinates, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.UTFString +import Graphics.UI.Gtk.General.Structs (Rectangle, Point) +import System.Glib.GError (GErrorDomain, GErrorClass(..), propagateGError) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Types +{#pointer *IconInfo foreign newtype#} + +-- | Helper function for build 'IconInfo' +mkIconInfo :: Ptr IconInfo -> IO IconInfo +mkIconInfo info = liftM IconInfo $ newForeignPtr_ info + +-------------------- +-- Constructors + +-- | +-- +iconInfoNewForPixbuf :: IconThemeClass iconTheme => iconTheme -> Pixbuf -> IO IconInfo +iconInfoNewForPixbuf iconTheme pixbuf = do + iiPtr <- {# call gtk_icon_info_new_for_pixbuf #} + (toIconTheme iconTheme) + pixbuf + liftM IconInfo (newForeignPtr_ iiPtr) + +-------------------- +-- Methods + +-- | +-- +iconInfoCopy :: IconInfo -> IO IconInfo +iconInfoCopy self = do + iiPtr <- {# call gtk_icon_info_copy #} self + liftM IconInfo (newForeignPtr_ iiPtr) + +-- | Free a 'IconInfo' and associated information +iconInfoFree :: IconInfo -> IO () +iconInfoFree self = + {# call gtk_icon_info_free #} + self + +-- | +-- +-- iconInfoGetAttachPoints :: IconInfo -> IO (Maybe ([Point], Int)) +-- iconInfoGetAttachPoints self = +-- alloca $ \nPointsPtr -> +-- allocaArray 0 $ \pointPtr -> do +-- -- alloca $ \ (pointPtr :: Ptr (Ptr Point)) -> do +-- success <- liftM toBool $ [_$_] +-- {# call gtk_icon_info_get_attach_points #} +-- self +-- pointPtr +-- nPointsPtr +-- if success [_$_] +-- then do +-- nPoints <- peek nPointsPtr +-- pointList <- peekArray 0 (castPtr pointPtr :: Ptr (Ptr Point)) +-- return (Just (pointList, (fromIntegral nPoints))) +-- else return Nothing + +-- | Gets the base size for the icon. The base size is a size for the icon that was specified by the icon +-- theme creator. This may be different than the actual size of image; an example of this is small +-- emblem icons that can be attached to a larger icon. These icons will be given the same base size as +-- the larger icons to which they are attached. +-- [_$_] +iconInfoGetBaseSize :: IconInfo -> IO Int +iconInfoGetBaseSize self = + liftM fromIntegral $ + {# call gtk_icon_info_get_base_size #} + self + +-- | Gets the built-in image for this icon, if any. To allow GTK+ to use built in icon images, you must +-- pass the ''IconLookupUseBuiltin'' to 'iconThemeLookupIcon'. +iconInfoGetBuiltinPixbuf :: IconInfo -> IO Pixbuf +iconInfoGetBuiltinPixbuf self = + makeNewGObject mkPixbuf $ + {# call gtk_icon_info_get_builtin_pixbuf #} + self + +-- | Gets the display name for an icon. A display name is a string to be used in place of the icon name +-- in a user visible context like a list of icons. +iconInfoGetDisplayName :: IconInfo -> IO String +iconInfoGetDisplayName self = + {# call gtk_icon_info_get_display_name #} + self + >>= peekUTFString + +-- | Gets the coordinates of a rectangle within the icon that can be used for display of information such +-- as a preview of the contents of a text file. See 'iconInfoSetRawCoordinates' for further +-- information about the coordinate system. +iconInfoGetEmbeddedRect :: IconInfo -> Rectangle -> IO Bool +iconInfoGetEmbeddedRect self rectangle = + liftM toBool $ + with rectangle $ \ rectanglePtr -> [_$_] + {# call gtk_icon_info_get_embedded_rect #} + self + (castPtr rectanglePtr) + +-- | Gets the filename for the icon. If the ''IconLookupUseBuiltin'' flag was passed to +-- 'iconThemeLookupIcon', there may be no filename if a builtin icon is returned; in this case, +-- you should use 'iconInfoGetBuiltinPixbuf'. +iconInfoGetFilename :: IconInfo -> IO String +iconInfoGetFilename self = + {# call gtk_icon_info_get_filename #} + self + >>= peekUTFString + +-- | Looks up an icon in an icon theme, scales it to the given size and renders it into a pixbuf. This is +-- a convenience function; if more details about the icon are needed, use 'iconThemeLookupIcon' +-- followed by 'iconInfoLoadIcon'. +-- [_$_] +-- Note that you probably want to listen for icon theme changes and update the icon. This is usually +-- done by connecting to the 'styleSet' signal. If for some reason you do not want to update +-- the icon when the icon theme changes, you should consider using 'pixbufCopy' to make a private +-- copy of the pixbuf returned by this function. Otherwise GTK+ may need to keep the old icon theme +-- loaded, which would be a waste of memory. +iconInfoLoadIcon :: IconInfo -> IO Pixbuf +iconInfoLoadIcon self = + makeNewGObject mkPixbuf $ + propagateGError $ \errorPtr -> + {# call gtk_icon_info_load_icon #} + self + errorPtr + +-- | Sets whether the coordinates returned by 'iconInfoGetEmbeddedRect' and +-- 'iconInfoGetAttachPoints' should be returned in their original form as specified in the icon +-- theme, instead of scaled appropriately for the pixbuf returned by 'iconInfoLoadIcon'. +-- [_$_] +-- Raw coordinates are somewhat strange; they are specified to be with respect to the unscaled pixmap +-- for PNG and XPM icons, but for SVG icons, they are in a 1000x1000 coordinate space that is scaled to +-- the final size of the icon. You can determine if the icon is an SVG icon by using +-- 'iconInfoGetFilename', and seeing if it is non-'Nothing' and ends in '.svg'. +-- [_$_] +-- This function is provided primarily to allow compatibility wrappers for older API's, and is not +-- expected to be useful for applications. +iconInfoSetRawCoordinates :: IconInfo -> Bool -> IO () +iconInfoSetRawCoordinates self rawCoordinates = + {# call gtk_icon_info_set_raw_coordinates #} + self + (fromBool rawCoordinates) addfile ./gtk/Graphics/UI/Gtk/General/IconTheme.chs.pp hunk ./gtk/Graphics/UI/Gtk/General/IconTheme.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget IconTheme +-- +-- Author : Andy Stewart +-- +-- Created: 28 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) +-- +-- Looking up icons by name +-- +-- * Module available since Gtk+ version 2.4 +-- +module Graphics.UI.Gtk.General.IconTheme ( + +-- * Detail +-- +-- | 'IconTheme' provides a facility for looking up icons by name and size. The main reason for using a +-- name rather than simply providing a filename is to allow different icons to be used depending on +-- what icon theme is selecetd by the user. The operation of icon themes on Linux and Unix follows the +-- Icon Theme Specification. There is a default icon theme, named hicolor where applications should +-- install their icons, but more additional application themes can be installed as operating system +-- vendors and users choose. +-- [_$_] +-- Named icons are similar to the Themeable Stock Images(3) facility, and the distinction between the +-- two may be a bit confusing. A few things to keep in mind: +-- [_$_] +-- [_\e2_][_\97_][_\8f_] Stock images usually are used in conjunction with Stock Items(3)., such as ''StockOk'' or +-- ''StockOpen''. Named icons are easier to set up and therefore are more useful for new icons +-- that an application wants to add, such as application icons or window icons. +-- [_$_] +-- [_\e2_][_\97_][_\8f_] Stock images can only be loaded at the symbolic sizes defined by the 'IconSize' enumeration, or +-- by custom sizes defined by 'iconSizeRegister', while named icons are more flexible and any +-- pixel size can be specified. +-- [_$_] +-- [_\e2_][_\97_][_\8f_] Because stock images are closely tied to stock items, and thus to actions in the user interface, +-- stock images may come in multiple variants for different widget states or writing directions. +-- [_$_] +-- A good rule of thumb is that if there is a stock image for what you want to use, use it, otherwise +-- use a named icon. It turns out that internally stock images are generally defined in terms of one or +-- more named icons. (An example of the more than one case is icons that depend on writing direction; +-- ''StockGoForward'' uses the two themed icons 'gtkStockGoForwardLtr' and +-- 'gtkStockGoForwardRtl'.) +-- [_$_] +-- In many cases, named themes are used indirectly, via 'Image' or stock items, rather than directly, +-- but looking up icons directly is also simple. The 'IconTheme' object acts as a database of all the +-- icons in the current theme. You can create new 'IconTheme' objects, but its much more efficient to +-- use the standard icon theme for the 'Screen' so that the icon information is shared with other +-- people looking up icons. In the case where the default screen is being used, looking up an icon can +-- be as simple as: +-- +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----IconTheme +-- @ + +#if GTK_CHECK_VERSION(2,4,0) +-- * Types + IconTheme, + IconThemeClass, + castToIconTheme, + toIconTheme, + +-- * Enums + IconLookupFlags(..), + IconThemeError(..), + +-- * Constructors + iconThemeNew, + +-- * Methods + iconThemeGetDefault, + iconThemeGetForScreen, + iconThemeSetScreen, + iconThemeSetSearchPath, + iconThemeGetSearchPath, + iconThemeAppendSearchPath, + iconThemePrependSearchPath, + iconThemeSetCustomTheme, + iconThemeHasIcon, + iconThemeLookupIcon, +#if GTK_CHECK_VERSION(2,12,0) + iconThemeChooseIcon, +#if GTK_CHECK_VERSION(2,14,0) + -- iconThemeLookupByGicon, +#endif +#endif + iconThemeLoadIcon, +#if GTK_CHECK_VERSION(2,12,0) + iconThemeListContexts, +#endif + iconThemeListIcons, +#if GTK_CHECK_VERSION(2,6,0) + iconThemeGetIconSizes, +#endif + iconThemeGetExampleIconName, + iconThemeRescanIfNeeded, + iconThemeAddBuiltinIcon, + iconThemeErrorQuark, + +-- * Signals + iconThemeChanged, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.UTFString +import System.Glib.GList +import System.Glib.Flags +import System.Glib.GObject (constructNewGObject, makeNewGObject, Quark) +import System.Glib.GError (GErrorDomain, GErrorClass(..), propagateGError) +import Graphics.UI.Gtk.General.IconInfo (IconInfo, mkIconInfo) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,4,0) +-------------------- +-- Enums +{#enum IconLookupFlags {underscoreToCase} deriving (Bounded,Eq,Show)#} + +{#enum IconThemeError {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-------------------- +-- Constructors + +-- | Creates a new icon theme object. Icon theme objects are used to lookup up +-- an icon by name in a particular icon theme. Usually, you'll want to use +-- 'iconThemeGetDefault' or 'iconThemeGetForScreen' rather than creating a new +-- icon theme object for scratch. +-- +iconThemeNew :: IO IconTheme +iconThemeNew = + constructNewGObject mkIconTheme $ + {# call gtk_icon_theme_new #} + +-------------------- +-- Methods + +-- | Gets the icon theme for the default screen. See 'iconThemeGetForScreen'. +-- +iconThemeGetDefault :: + IO IconTheme -- ^ returns A unique 'IconTheme' associated with the default + -- screen. This icon theme is associated with the screen and + -- can be used as long as the screen is open. Do not ref or + -- unref it. +iconThemeGetDefault = + makeNewGObject mkIconTheme $ + {# call gtk_icon_theme_get_default #} + +-- | Gets the icon theme object associated with @screen@; if this function has +-- not previously been called for the given screen, a new icon theme object +-- will be created and associated with the screen. Icon theme objects are +-- fairly expensive to create, so using this function is usually a better +-- choice than calling than 'iconThemeNew' and setting the screen yourself; by +-- using this function a single icon theme object will be shared between users. +-- +iconThemeGetForScreen :: + Screen -- ^ @screen@ - a 'Screen' + -> IO IconTheme -- ^ returns A unique 'IconTheme' associated with the given + -- screen. This icon theme is associated with the screen and + -- can be used as long as the screen is open. Do not ref or + -- unref it. +iconThemeGetForScreen screen = + makeNewGObject mkIconTheme $ + {# call gtk_icon_theme_get_for_screen #} + screen + +-- | Sets the screen for an icon theme; the screen is used to track the user's +-- currently configured icon theme, which might be different for different +-- screens. +-- +iconThemeSetScreen :: IconThemeClass self => self + -> Screen -- ^ @screen@ - a 'Screen' + -> IO () +iconThemeSetScreen self screen = + {# call gtk_icon_theme_set_screen #} + (toIconTheme self) + screen + +-- | Sets the search path for the icon theme object. When looking for an icon +-- theme, Gtk+ will search for a subdirectory of one or more of the directories +-- in @path@ with the same name as the icon theme. (Themes from multiple of the +-- path elements are combined to allow themes to be extended by adding icons in +-- the user's home directory.) +-- +-- In addition if an icon found isn't found either in the current icon theme +-- or the default icon theme, and an image file with the right name is found +-- directly in one of the elements of @path@, then that image will be used for +-- the icon name. (This is legacy feature, and new icons should be put into the +-- default icon theme, which is called DEFAULT_THEME_NAME, rather than directly +-- on the icon path.) +-- +iconThemeSetSearchPath :: IconThemeClass self => self + -> [String] -- ^ @path@ - array of directories that are searched for icon + -- themes + -> Int -- ^ @nElements@ - number of elements in @path@. + -> IO () +iconThemeSetSearchPath self path nElements = + withUTFStringArray path $ \pathPtr -> + {# call gtk_icon_theme_set_search_path #} + (toIconTheme self) + pathPtr + (fromIntegral nElements) + +-- | Gets the current search path. See 'iconThemeSetSearchPath'. +-- +iconThemeGetSearchPath :: IconThemeClass self => self + -> IO ([String], Int) -- ^ @(path, nElements)@ [_$_] + -- @path@ - location to store a list of icon theme path + -- directories. The stored value should + -- be freed with 'gStrfreev'. @nElements@ - location to + -- store number of elements in @path@ +iconThemeGetSearchPath self = + alloca $ \nElementsPtr -> [_$_] + allocaArray 0 $ \pathPtr -> do + {# call gtk_icon_theme_get_search_path #} + (toIconTheme self) + pathPtr + nElementsPtr + list <- peekArray 0 pathPtr + pathList <- mapM (peekArray 0) list + pathStr <- mapM peekCString (concat pathList) + nElements <- peek nElementsPtr + return (pathStr, fromIntegral nElements) + +-- | Appends a directory to the search path. See 'iconThemeSetSearchPath'. +-- +iconThemeAppendSearchPath :: IconThemeClass self => self + -> String -- ^ @path@ - directory name to append to the icon path + -> IO () +iconThemeAppendSearchPath self path = + withUTFString path $ \pathPtr -> + {# call gtk_icon_theme_append_search_path #} + (toIconTheme self) + pathPtr + +-- | Prepends a directory to the search path. See 'iconThemeSetSearchPath'. +-- +iconThemePrependSearchPath :: IconThemeClass self => self + -> String -- ^ @path@ - directory name to prepend to the icon path + -> IO () +iconThemePrependSearchPath self path = + withUTFString path $ \pathPtr -> + {# call gtk_icon_theme_prepend_search_path #} + (toIconTheme self) + pathPtr + +-- | Sets the name of the icon theme that the 'IconTheme' object uses +-- overriding system configuration. This function cannot be called on the icon +-- theme objects returned from 'iconThemeGetDefault' and +-- 'iconThemeGetForScreen'. +-- +iconThemeSetCustomTheme :: IconThemeClass self => self + -> String -- ^ @themeName@ - name of icon theme to use instead of configured + -- theme + -> IO () +iconThemeSetCustomTheme self themeName = + withUTFString themeName $ \themeNamePtr -> + {# call gtk_icon_theme_set_custom_theme #} + (toIconTheme self) + themeNamePtr + +-- | Checks whether an icon theme includes an icon for a particular name. +-- +iconThemeHasIcon :: IconThemeClass self => self + -> String -- ^ @iconName@ - the name of an icon + -> IO Bool -- ^ returns @True@ if @iconTheme@ includes an icon for + -- @iconName@. +iconThemeHasIcon self iconName = + liftM toBool $ + withUTFString iconName $ \iconNamePtr -> + {# call gtk_icon_theme_has_icon #} + (toIconTheme self) + iconNamePtr + +-- | Looks up a named icon and returns a structure containing information such +-- as the filename of the icon. The icon can then be rendered into a pixbuf +-- using 'iconInfoLoadIcon'. ('iconThemeLoadIcon' combines these two steps if +-- all you need is the pixbuf.) +-- +iconThemeLookupIcon :: IconThemeClass self => self + -> String -- ^ @iconName@ - the name of the icon to lookup + -> Int -- ^ @size@ - desired icon size + -> IconLookupFlags -- ^ @flags@ - flags modifying the behavior of the + -- icon lookup + -> IO (Maybe IconInfo) -- ^ returns a 'IconInfo' + -- structure containing information about the icon, or + -- 'Nothing' if the icon wasn't found. Free + -- with 'iconInfoFree' +iconThemeLookupIcon self iconName size flags = + withUTFString iconName $ \iconNamePtr -> do + iiPtr <- {# call gtk_icon_theme_lookup_icon #} + (toIconTheme self) + iconNamePtr + (fromIntegral size) + ((fromIntegral . fromEnum) flags) + if iiPtr == nullPtr [_$_] + then return Nothing + else liftM Just (mkIconInfo (castPtr iiPtr)) + +#if GTK_CHECK_VERSION(2,12,0) +-- | Looks up a named icon and returns a structure containing information such +-- as the filename of the icon. The icon can then be rendered into a pixbuf +-- using 'iconInfoLoadIcon'. ('iconThemeLoadIcon' combines these two steps if +-- all you need is the pixbuf.) +-- +-- If @iconNames@ contains more than one name, this function tries them all +-- in the given order before falling back to inherited icon themes. +-- +-- * Available since Gtk+ version 2.12 +-- +iconThemeChooseIcon :: IconThemeClass self => self + -> [String] -- ^ @iconNames@ terminated array of icon names to lookup + -> Int -- ^ @size@ - desired icon size + -> IconLookupFlags -- ^ @flags@ - flags modifying the behavior of the + -- icon lookup + -> IO (Maybe IconInfo) -- ^ returns a 'IconInfo' + -- structure containing information about the icon, or + -- 'Nothing' if the icon wasn't found. Free + -- with 'iconInfoFree' +iconThemeChooseIcon self iconNames size flags = + withUTFStringArray iconNames $ \iconNamesPtr -> do + iiPtr <- {# call gtk_icon_theme_choose_icon #} + (toIconTheme self) + iconNamesPtr + (fromIntegral size) + ((fromIntegral . fromEnum) flags) + if iiPtr == nullPtr [_$_] + then return Nothing + else liftM Just (mkIconInfo (castPtr iiPtr)) + +#if GTK_CHECK_VERSION(2,14,0) +-- | Looks up an icon and returns a structure containing information such as +-- the filename of the icon. The icon can then be rendered into a pixbuf using +-- 'iconInfoLoadIcon'. +-- +-- * Available since Gtk+ version 2.14 +-- +-- iconThemeLookupByGicon :: IconThemeClass self => self +-- -> {-GIcon*-} -- ^ @icon@ - the {GIcon, FIXME: unknown type\/value} +-- -- to look up +-- -> Int -- ^ @size@ - desired icon size +-- -> [IconLookupFlags] -- ^ @flags@ - flags modifying the behavior of the +-- -- icon lookup +-- -> IO IconInfo -- ^ returns a 'IconInfo' +-- -- structure containing information about the icon, or +-- -- {@NULL@, FIXME: this should probably be converted to +-- -- a Maybe data type} if the icon wasn't found. Free +-- -- with 'iconInfoFree' +-- iconThemeLookupByGicon self icon size flags = +-- {# call gtk_icon_theme_lookup_by_gicon #} +-- (toIconTheme self) +-- {-icon-} +-- (fromIntegral size) +-- ((fromIntegral . fromFlags) flags) +#endif +#endif + +-- | Looks up an icon in an icon theme, scales it to the given size and +-- renders it into a pixbuf. This is a convenience function; if more details +-- about the icon are needed, use 'iconThemeLookupIcon' followed by +-- 'iconInfoLoadIcon'. +-- +-- Note that you probably want to listen for icon theme changes and update +-- the icon. This is usually done by connecting to the 'Widget'::style-set +-- signal. If for some reason you do not want to update the icon when the icon +-- theme changes, you should consider using 'pixbufCopy' to make a private copy +-- of the pixbuf returned by this function. Otherwise Gtk+ may need to keep the +-- old icon theme loaded, which would be a waste of memory. +-- +iconThemeLoadIcon :: IconThemeClass self => self + -> String -- ^ @iconName@ - the name of the icon to lookup + -> Int -- ^ @size@ - the desired icon size. The resulting icon + -- may not be exactly this size; see 'iconInfoLoadIcon'. + -> IconLookupFlags -- ^ @flags@ - flags modifying the behavior of the icon + -- lookup + -> IO Pixbuf -- ^ returns the rendered icon; this may be a newly + -- created icon or a new reference to an internal icon, + -- so you must not modify the icon. Use 'gObjectUnref' to + -- release your reference to the icon +iconThemeLoadIcon self iconName size flags = + makeNewGObject mkPixbuf $ + propagateGError $ \errorPtr -> + withUTFString iconName $ \iconNamePtr -> + {# call gtk_icon_theme_load_icon #} + (toIconTheme self) + iconNamePtr + (fromIntegral size) + ((fromIntegral . fromEnum) flags) + errorPtr + +#if GTK_CHECK_VERSION(2,12,0) +-- | Gets the list of contexts available within the current hierarchy of icon +-- themes +-- +-- * Available since Gtk+ version 2.12 +-- +iconThemeListContexts :: IconThemeClass self => self + -> IO [String] -- ^ returns a String list + -- holding the names of all the contexts in the + -- theme. You must first free each element in the + -- list with 'gFree', then free the list itself + -- with 'gListFree'. +iconThemeListContexts self = do + glist <- {# call gtk_icon_theme_list_contexts #} (toIconTheme self) + list <- fromGList glist + mapM (\strPtr -> do str <- peekUTFString strPtr + {# call unsafe g_free #} (castPtr strPtr) + return str) list [_$_] +#endif + +-- | Lists the icons in the current icon theme. Only a subset of the icons can +-- be listed by providing a context string. The set of values for the context +-- string is system dependent, but will typically include such values as +-- \"Applications\" and \"MimeTypes\". +-- +iconThemeListIcons :: IconThemeClass self => self + -> String -- ^ @context@ - a string identifying a particular + -- type of icon + -> IO [String] -- ^ returns a String list + -- holding the names of all the icons in the theme. + -- You must first free each element in the list + -- with 'gFree', then free the list itself with + -- 'gListFree'. +iconThemeListIcons self context = + withUTFString context $ \contextPtr -> do + glist <- {# call gtk_icon_theme_list_icons #} + (toIconTheme self) + contextPtr + list <- fromGList glist + mapM (\strPtr -> do str <- peekUTFString strPtr + {# call unsafe g_free #} (castPtr strPtr) + return str) list [_$_] + +#if GTK_CHECK_VERSION(2,6,0) +-- | Returns an array of integers describing the sizes at which the icon is +-- available without scaling. A size of -1 means that the icon is available in +-- a scalable format. The array is zero-terminated. +-- +-- * Available since Gtk+ version 2.6 +-- +iconThemeGetIconSizes :: IconThemeClass self => self + -> String -- ^ @iconName@ - the name of an icon + -> IO [Int] -- ^ returns An newly allocated array describing the sizes at + -- which the icon is available. The array should be freed with + -- 'gFree' when it is no longer needed. +iconThemeGetIconSizes self iconName = + withUTFString iconName $ \iconNamePtr -> do + listPtr <- {# call gtk_icon_theme_get_icon_sizes #} + (toIconTheme self) + iconNamePtr + list <- peekArray 0 listPtr + return (map fromIntegral list) +#endif + +-- | Gets the name of an icon that is representative of the current theme (for +-- instance, to use when presenting a list of themes to the user.) +-- +iconThemeGetExampleIconName :: IconThemeClass self => self + -> IO String -- ^ returns the name of an example icon [_$_] +iconThemeGetExampleIconName self = + {# call gtk_icon_theme_get_example_icon_name #} + (toIconTheme self) + >>= readUTFString + +-- | Checks to see if the icon theme has changed; if it has, any currently +-- cached information is discarded and will be reloaded next time @iconTheme@ +-- is accessed. +-- +iconThemeRescanIfNeeded :: IconThemeClass self => self + -> IO Bool -- ^ returns @True@ if the icon theme has changed and needed to be + -- reloaded. +iconThemeRescanIfNeeded self = + liftM toBool $ + {# call gtk_icon_theme_rescan_if_needed #} + (toIconTheme self) + +-- | Registers a built-in icon for icon theme lookups. The idea of built-in +-- icons is to allow an application or library that uses themed icons to +-- function requiring files to be present in the file system. For instance, the +-- default images for all of Gtk+'s stock icons are registered as built-icons. +-- +-- In general, if you use 'iconThemeAddBuiltinIcon' you should also install +-- the icon in the icon theme, so that the icon is generally available. +-- +-- This function will generally be used with pixbufs loaded via +-- 'pixbufNewFromInline'. +-- +iconThemeAddBuiltinIcon :: + String -- ^ @iconName@ - the name of the icon to register + -> Int -- ^ @size@ - the size at which to register the icon (different + -- images can be registered for the same icon name at different + -- sizes.) + -> Pixbuf -- ^ @pixbuf@ - 'Pixbuf' that contains the image to use for + -- @iconName@. + -> IO () +iconThemeAddBuiltinIcon iconName size pixbuf = + withUTFString iconName $ \iconNamePtr -> + {# call gtk_icon_theme_add_builtin_icon #} + iconNamePtr + (fromIntegral size) + pixbuf + +-- | +-- +iconThemeErrorQuark :: IO Quark +iconThemeErrorQuark = + {# call gtk_icon_theme_error_quark #} + +-------------------- +-- Signals + +-- | Emitted when the current icon theme is switched or Gtk+ detects that a +-- change has occurred in the contents of the current icon theme. +-- +iconThemeChanged :: IconThemeClass self => Signal self (IO ()) +iconThemeChanged = Signal (connect_NONE__NONE "changed") + +#endif hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 80 - -- recentChooserSetSortFunc, + recentChooserSetSortFunc, hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 83 - -- recentChooserGetCurrentItem, + recentChooserGetCurrentItem, hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 88 - -- recentChooserGetItems, + recentChooserGetItems, hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 122 -{#import Graphics.UI.Gtk.Recent.RecentInfo#} (RecentInfo) +{#import Graphics.UI.Gtk.Recent.RecentInfo#} (RecentInfo, mkRecentInfo) hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 146 --- recentChooserSetSortFunc :: RecentChooserClass self => self --- -> (Maybe (RecentInfo -> IO Int)) --- -> IO () --- recentChooserSetSortFunc self Nothing = --- {# call gtk_recent_chooser_set_sort_func #} --- (toRecentChooser self) nullFunPtr nullPtr nullFunPtr --- recentChooserSetSortFunc self (Just func) = do --- fPtr <- mkRecentSortFunc $ \_ info _ -> func info --- {# call gtk_recent_chooser_set_sort_func #} --- (toRecentChooser self) --- fPtr --- (castFunPtrToPtr fPtr) --- destroyFunPtr +recentChooserSetSortFunc :: RecentChooserClass self => self + -> (Maybe (RecentInfo -> IO Int)) + -> IO () +recentChooserSetSortFunc self Nothing = + {# call gtk_recent_chooser_set_sort_func #} + (toRecentChooser self) nullFunPtr nullPtr nullFunPtr +recentChooserSetSortFunc self (Just func) = do + fPtr <- mkRecentSortFunc $ \_ infoPtr _ -> do + info <- mkRecentInfo infoPtr + liftM fromIntegral (func info) + {# call gtk_recent_chooser_set_sort_func #} + (toRecentChooser self) + fPtr + (castFunPtrToPtr fPtr) + destroyFunPtr hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 194 --- recentChooserGetCurrentItem :: RecentChooserClass self => self --- -> IO RecentInfo -- ^ returns a 'RecentInfo'. --- -- Use 'recentInfoUnref' when when you have finished --- -- using it. --- recentChooserGetCurrentItem self = --- {# call gtk_recent_chooser_get_current_item #} --- (toRecentChooser self) +recentChooserGetCurrentItem :: RecentChooserClass self => self + -> IO RecentInfo -- ^ returns a 'RecentInfo'. + -- Use 'recentInfoUnref' when when you have finished + -- using it. +recentChooserGetCurrentItem self = do + info <- {# call gtk_recent_chooser_get_current_item #} (toRecentChooser self) + mkRecentInfo info hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 247 --- recentChooserGetItems :: RecentChooserClass self => self --- -> IO [RecentInfo] -- ^ returns A newly allocated list of --- -- 'RecentInfo' objects. You --- -- should use 'recentInfoUnref' on every item of --- -- the list, and then free the list itself using --- -- 'gListFree'. --- recentChooserGetItems self = --- {# call gtk_recent_chooser_get_items #} --- (toRecentChooser self) --- >>= fromGList - -- >>= mapM (\elemPtr -> RecentInfo elemPtr) +recentChooserGetItems :: RecentChooserClass self => self + -> IO [RecentInfo] -- ^ returns A newly allocated list of + -- 'RecentInfo' objects. You + -- should use 'recentInfoUnref' on every item of + -- the list, and then free the list itself using + -- 'gListFree'. +recentChooserGetItems self = do + glist <- {# call gtk_recent_chooser_get_items #} (toRecentChooser self) + list <- fromGList glist + mapM mkRecentInfo list hunk ./gtk/Graphics/UI/Gtk/Recent/RecentInfo.chs.pp 30 + mkRecentInfo, hunk ./gtk/Graphics/UI/Gtk/Recent/RecentInfo.chs.pp 73 +-- | Helper function for build 'RecentInfo' +mkRecentInfo :: Ptr RecentInfo -> IO RecentInfo +mkRecentInfo info = liftM RecentInfo $ newForeignPtr_ info + hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 73 - -- recentManagerLookupItem, + recentManagerLookupItem, hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 76 - -- recentManagerGetItems, + recentManagerGetItems, hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 99 -{#import Graphics.UI.Gtk.Recent.RecentInfo#} (RecentInfo) +{#import Graphics.UI.Gtk.Recent.RecentInfo#} (RecentInfo, mkRecentInfo) hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 209 --- recentManagerLookupItem :: RecentManagerClass self => self --- -> String -- ^ @uri@ - a URI --- -> IO RecentInfo -- ^ returns a 'RecentInfo' --- -- structure containing information about the --- -- resource pointed by @uri@, or {@NULL@, FIXME: this --- -- should probably be converted to a Maybe data type} --- -- if the URI was not registered in the recently used --- -- resources list. Free with 'recentInfoUnref'. --- recentManagerLookupItem self uri = --- propagateGError $ \errorPtr -> --- withUTFString uri $ \uriPtr -> do --- result <- {# call unsafe gtk_recent_manager_lookup_item #} --- (toRecentManager self) --- uriPtr --- errorPtr --- makeNewRecentInfo result +recentManagerLookupItem :: RecentManagerClass self => self + -> String -- ^ @uri@ - a URI + -> IO RecentInfo -- ^ returns a 'RecentInfo' + -- structure containing information about the + -- resource pointed by @uri@, or {@NULL@, FIXME: this + -- should probably be converted to a Maybe data type} + -- if the URI was not registered in the recently used + -- resources list. Free with 'recentInfoUnref'. +recentManagerLookupItem self uri = + propagateGError $ \errorPtr -> + withUTFString uri $ \uriPtr -> do + result <- {# call unsafe gtk_recent_manager_lookup_item #} + (toRecentManager self) + uriPtr + errorPtr + mkRecentInfo result hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 261 --- recentManagerGetItems :: RecentManagerClass self => self --- -> IO [RecentInfo] -- ^ returns a list of newly allocated --- -- 'RecentInfo' objects. Use --- -- 'recentInfoUnref' on each item inside the list, --- -- and then free the list itself using 'gListFree'. --- recentManagerGetItems self = do --- glist <- {# call gtk_recent_manager_get_items #} --- (toRecentManager self) --- list <- fromGList glist --- return list +recentManagerGetItems :: RecentManagerClass self => self + -> IO [RecentInfo] -- ^ returns a list of newly allocated + -- 'RecentInfo' objects. Use + -- 'recentInfoUnref' on each item inside the list, + -- and then free the list itself using 'gListFree'. +recentManagerGetItems self = do + glist <- {# call gtk_recent_manager_get_items #} + (toRecentManager self) + list <- fromGList glist + mapM mkRecentInfo list hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 117 - -- maxSize)@ {FIXME: merge return value - -- docs} @lower@ - location to store - -- lower limit of the ruler, or - -- {@NULL@, FIXME: this should probably - -- be converted to a Maybe data - -- type}@upper@ - location to store - -- upper limit of the ruler, or - -- {@NULL@, FIXME: this should probably - -- be converted to a Maybe data - -- type}@position@ - location to store + -- maxSize)@ @loewr@ - location to store + -- lower limit of the ruler + -- @upper@ - location to store + -- upper limit of the ruler, [_$_] + -- @position@ - location to store hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 123 - -- the ruler, or {@NULL@, FIXME: this - -- should probably be converted to a - -- Maybe data type}@maxSize@ - location + -- the ruler, [_$_] + -- @maxSize@ - location hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 127 - -- space to leave for the text, or - -- {@NULL@, FIXME: this should probably - -- be converted to a Maybe data type}. + -- space to leave for the text + hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 163 --- | --- +-- | Lower limit of ruler. +-- [_$_] +-- Default value: 0 hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 169 --- | --- +-- | Upper limit of ruler. +-- [_$_] +-- Default value: 0 hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 175 --- | --- +-- | Position of mark on the ruler. +-- [_$_] +-- Default value: 0 hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 181 --- | --- +-- | Maximum size of the ruler. +-- [_$_] +-- Default value: 0 hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 187 --- | --- +-- | The metric used for the ruler. +-- [_$_] +-- Default value: ''Pixels'' +-- [_$_] +-- Since 2.8 hunk ./tools/hierarchyGen/hierarchy.list 208 + GtkIconTheme |
From: Andy S. <And...@co...> - 2010-03-28 07:05:44
|
Sun Mar 28 03:04:40 EDT 2010 Andy Stewart <laz...@gm...> * Add `Speical` modules (include GtkRuler, GtkHRuler, GtkVRuler). Ignore-this: 59613cc2fd00c5b54a2f0d567c115ba0 hunk ./ApiUpdateTodoList.txt 41 -*** TODO Curve.chs +*** DEPRECATED Curve.chs hunk ./ApiUpdateTodoList.txt 57 -*** TODO GammaCurve.chs +*** DEPRECATED GammaCurve.chs hunk ./ApiUpdateTodoList.txt 62 -*** TODO HRuler.chs +*** DONE HRuler.chs hunk ./ApiUpdateTodoList.txt 140 -*** TODO Ruler.chs +*** DONE Ruler.chs hunk ./ApiUpdateTodoList.txt 172 -*** TODO VRuler.chs +*** DONE VRuler.chs hunk ./Makefile.am 734 + gtk/Graphics/UI/Gtk/Special/HRuler.chs.pp \ + gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp \ + gtk/Graphics/UI/Gtk/Special/VRuler.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 181 + -- * Speical [_$_] + module Graphics.UI.Gtk.Special.Ruler, + module Graphics.UI.Gtk.Special.HRuler, + module Graphics.UI.Gtk.Special.VRuler, hunk ./gtk/Graphics/UI/Gtk.hs.pp 409 +-- Speical +import Graphics.UI.Gtk.Special.Ruler +import Graphics.UI.Gtk.Special.HRuler +import Graphics.UI.Gtk.Special.VRuler adddir ./gtk/Graphics/UI/Gtk/Special addfile ./gtk/Graphics/UI/Gtk/Special/HRuler.chs.pp hunk ./gtk/Graphics/UI/Gtk/Special/HRuler.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget HRuler +-- +-- Author : Andy Stewart +-- +-- Created: 28 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 horizontal ruler +-- +module Graphics.UI.Gtk.Special.HRuler ( + +-- * Detail +-- +-- | The HRuler widget is a widget arranged horizontally creating a ruler that +-- is utilized around other widgets such as a text widget. The ruler is used to +-- show the location of the mouse on the window and to show the size of the +-- window in specified units. The available units of measurement are 'Pixels', +-- 'Inches' and 'Centimeters'. 'Pixels' is the default. rulers. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Ruler' +-- | +----HRuler +-- @ + +-- * Types + HRuler, + HRulerClass, + castToHRuler, + toHRuler, + +-- * Constructors + hrulerNew, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Constructors + +-- | Creates a new horizontal ruler. +-- +hrulerNew :: IO HRuler +hrulerNew = + makeNewObject mkHRuler $ + liftM (castPtr :: Ptr Widget -> Ptr HRuler) $ + {# call gtk_hruler_new #} addfile ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Ruler +-- +-- Author : Andy Stewart +-- +-- Created: 28 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) +-- +-- Base class for horizontal or vertical rulers +-- +module Graphics.UI.Gtk.Special.Ruler ( + +-- * Detail +-- +-- | The GTKRuler widget is a base class for horizontal and vertical rulers. +-- Rulers are used to show the mouse pointer's location in a window. The ruler +-- can either be horizontal or vertical on the window. Within the ruler a small +-- triangle indicates the location of the mouse relative to the horizontal or +-- vertical ruler. See 'HRuler' to learn how to create a new horizontal ruler. +-- See 'VRuler' to learn how to create a new vertical ruler. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----Ruler +-- | +----'HRuler' +-- | +----'VRuler' +-- @ + +-- * Types + Ruler, + RulerClass, + castToRuler, + toRuler, + +-- * Enums + MetricType, + +-- * Methods + rulerSetRange, + rulerGetRange, + rulerDrawPos, + rulerDrawTicks, + +-- * Attributes + rulerLower, + rulerUpper, + rulerPosition, + rulerMaxSize, + rulerMetric, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Enums +{#enum MetricType {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-------------------- +-- Interfaces + +-- instance OrientableClass Ruler + +-------------------- +-- Methods + +-- | This sets the range of the ruler. +-- +rulerSetRange :: RulerClass self => self + -> Double -- ^ @lower@ - the lower limit of the ruler + -> Double -- ^ @upper@ - the upper limit of the ruler + -> Double -- ^ @position@ - the mark on the ruler + -> Double -- ^ @maxSize@ - the maximum size of the ruler used when + -- calculating the space to leave for the text + -> IO () +rulerSetRange self lower upper position maxSize = + {# call gtk_ruler_set_range #} + (toRuler self) + (realToFrac lower) + (realToFrac upper) + (realToFrac position) + (realToFrac maxSize) + +-- | Retrieves values indicating the range and current position of a 'Ruler'. +-- See 'rulerSetRange'. +-- +rulerGetRange :: RulerClass self => self + -> IO (Double, Double, Double, Double) -- ^ @(lower, upper, position, + -- maxSize)@ {FIXME: merge return value + -- docs} @lower@ - location to store + -- lower limit of the ruler, or + -- {@NULL@, FIXME: this should probably + -- be converted to a Maybe data + -- type}@upper@ - location to store + -- upper limit of the ruler, or + -- {@NULL@, FIXME: this should probably + -- be converted to a Maybe data + -- type}@position@ - location to store + -- the current position of the mark on + -- the ruler, or {@NULL@, FIXME: this + -- should probably be converted to a + -- Maybe data type}@maxSize@ - location + -- to store the maximum size of the + -- ruler used when calculating the + -- space to leave for the text, or + -- {@NULL@, FIXME: this should probably + -- be converted to a Maybe data type}. +rulerGetRange self = + alloca $ \lowerPtr -> + alloca $ \upperPtr -> + alloca $ \positionPtr -> + alloca $ \maxSizePtr -> do + {# call gtk_ruler_get_range #} + (toRuler self) + lowerPtr + upperPtr + positionPtr + maxSizePtr + lower <- peek lowerPtr + upper <- peek upperPtr + position <- peek positionPtr + maxSize <- peek maxSizePtr + return (realToFrac lower, realToFrac upper, realToFrac position, realToFrac maxSize) + +-- | +-- +rulerDrawPos :: RulerClass self => self -> IO () +rulerDrawPos self = + {# call gtk_ruler_draw_pos #} + (toRuler self) + +-- | +-- +rulerDrawTicks :: RulerClass self => self -> IO () +rulerDrawTicks self = + {# call gtk_ruler_draw_ticks #} + (toRuler self) + +-------------------- +-- Attributes + +-- | +-- +rulerLower :: RulerClass self => Attr self Double +rulerLower = newAttrFromDoubleProperty "lower" + +-- | +-- +rulerUpper :: RulerClass self => Attr self Double +rulerUpper = newAttrFromDoubleProperty "upper" + +-- | +-- +rulerPosition :: RulerClass self => Attr self Double +rulerPosition = newAttrFromDoubleProperty "position" + +-- | +-- +rulerMaxSize :: RulerClass self => Attr self Double +rulerMaxSize = newAttrFromDoubleProperty "max-size" + +-- | +-- +rulerMetric :: RulerClass self => Attr self MetricType +rulerMetric = newAttrFromEnumProperty "metric" + {# call pure unsafe gtk_metric_type_get_type #} addfile ./gtk/Graphics/UI/Gtk/Special/VRuler.chs.pp hunk ./gtk/Graphics/UI/Gtk/Special/VRuler.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget VRuler +-- +-- Author : Andy Stewart +-- +-- Created: 28 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 vertical ruler +-- +module Graphics.UI.Gtk.Special.VRuler ( + +-- * Detail +-- +-- | The VRuler widget is a widget arranged vertically creating a ruler that +-- is utilized around other widgets such as a text widget. The ruler is used to +-- show the location of the mouse on the window and to show the size of the +-- window in specified units. The available units of measurement are 'Pixels', +-- 'Inches' and 'Centimeters'. 'Pixels' is the default. rulers. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Ruler' +-- | +----VRuler +-- @ + +-- * Types + VRuler, + VRulerClass, + castToVRuler, + toVRuler, + +-- * Constructors + vrulerNew, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Constructors + +-- | Creates a new vertical ruler +-- +vrulerNew :: IO VRuler +vrulerNew = + makeNewObject mkVRuler $ + liftM (castPtr :: Ptr Widget -> Ptr VRuler) $ + {# call gtk_vruler_new #} |
From: Andy S. <And...@co...> - 2010-03-28 04:47:32
|
Sun Mar 28 00:45:22 EDT 2010 Andy Stewart <laz...@gm...> * Fix docs and change some function with Maybe Ignore-this: 6b9df4a768aad7f4be7b0a8a8f9daf6e hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 538 - -> IO Widget -- ^ returns The child widget which has the focus inside - -- @container@, or {@NULL@, FIXME: this should probably be - -- converted to a Maybe data type} if none is set. -containerGetFocusChild self = - makeNewObject mkWidget $ - {# call gtk_container_get_focus_child #} - (toContainer self) + -> IO (Maybe Widget) -- ^ returns The child widget which has the focus inside + -- @container@, or 'Nothing' if none is set. +containerGetFocusChild self = do + childPtr <- {# call gtk_container_get_focus_child #} + (toContainer self) + if childPtr == nullPtr [_$_] + then return Nothing + else liftM Just $ makeNewObject mkWidget (return childPtr) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 2126 - -> Atom -- ^ @selection@ - a {GdkAtom, FIXME: struct type} which + -> Atom -- ^ @selection@ - a 'Atom' which hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 339 - -> IO Widget -- ^ returns the menu item provided by the action, or {@NULL@, - -- FIXME: this should probably be converted to a Maybe data - -- type}. -actionCreateMenu self = - makeNewObject mkWidget $ - {# call gtk_action_create_menu #} - (toAction self) + -> IO (Maybe Widget) -- ^ returns the menu item provided by the action, or 'Nothing' +actionCreateMenu self = do + widgetPtr <- {# call gtk_action_create_menu #} + (toAction self) + if widgetPtr == nullPtr + then return Nothing + else liftM Just (makeNewObject mkWidget (return widgetPtr)) hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Activatable.chs.pp 43 --- '{FIXME: gtk-doc cross reference to:}' hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Activatable.chs.pp 83 --- --- When implementing 'Activatable' you must call this when handling changes --- of the {\"related-action\", FIXME: unknown type\/value}, and you must also --- use this to break references in {GObject-, FIXME: unknown --- type\/value}>'dispose'. --- --- This function adds a reference to the currently set related action for --- you, it also makes sure the {GtkActivatable-, FIXME: unknown --- type\/value}>'update' method is called when the related 'Action' properties --- change and registers to the action's proxy list. --- +-- [_$_] +-- When implementing 'Activatable' you must call this when handling changes of the 'relatedAction', +-- and you must also use this to break references in GObject->dispose(). +-- [_$_] +-- This function adds a reference to the currently set related action for you, it also makes sure the +-- 'Activatable'->update() method is called when the related 'Action' properties change and registers +-- to the action's proxy list. +-- [_$_] +-- Note +-- [_$_] +-- Be careful to call this before setting the local copy of the 'Action' property, since this function +-- uses 'activatableGetAction' to retrieve the previous action hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Activatable.chs.pp 103 --- | This is called to update the activatable completely, this is called --- internally when the {\"related-action\", FIXME: unknown type\/value} --- property is set or unset and by the implementing class when --- {\"use-action-appearance\", FIXME: unknown type\/value} changes. +-- | This is called to update the activatable completely, this is called internally when the +-- 'relatedAction' property is set or unset and by the implementing class when 'useActionAppearance' +-- changes. hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Activatable.chs.pp 108 - -> action -- ^ @action@ - the related 'Action' or {@NULL@, FIXME: this should - -- probably be converted to a Maybe data type} + -> action -- ^ @action@ - the related 'Action' hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs.pp 63 - -- recentActionNewForManager, + recentActionNewForManager, hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs.pp 71 +import Data.Maybe (fromMaybe) hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs.pp 92 - -> String -- ^ @label@ - the label displayed in menu items and on buttons, or - -- {@NULL@, FIXME: this should probably be converted to a Maybe data - -- type} - -> String -- ^ @tooltip@ - a tooltip for the action, or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type} - -> String -- ^ @stockId@ - the stock icon to display in widgets representing - -- the action, or {@NULL@, FIXME: this should probably be converted - -- to a Maybe data type} + -> Maybe String -- ^ @label@ - the label displayed in menu items and on buttons, or 'Nothing' + -> Maybe String -- ^ @tooltip@ - a tooltip for the action, or 'Nothing' [_$_] + -> Maybe String -- ^ @stockId@ - the stock icon to display in widgets representing + -- the action, or 'Nothing' hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs.pp 100 - withUTFString stockId $ \stockIdPtr -> - withUTFString tooltip $ \tooltipPtr -> - withUTFString label $ \labelPtr -> hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs.pp 101 + maybeWith withUTFString label $ \labelPtr -> + maybeWith withUTFString tooltip $ \tooltipPtr -> + maybeWith withUTFString stockId $ \stockIdPtr -> hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs.pp 114 --- recentActionNewForManager :: RecentManagerClass manager => --- String -- ^ @name@ - a unique name for the action --- -> String -- ^ @label@ - the label displayed in menu items and on buttons, --- -- or {@NULL@, FIXME: this should probably be converted to a Maybe --- -- data type} --- -> String -- ^ @tooltip@ - a tooltip for the action, or {@NULL@, FIXME: this --- -- should probably be converted to a Maybe data type} --- -> String -- ^ @stockId@ - the stock icon to display in widgets representing --- -- the action, or {@NULL@, FIXME: this should probably be converted --- -- to a Maybe data type} --- -> manager -- ^ @manager@ - a 'RecentManager', or {@NULL@, FIXME: this should --- -- probably be converted to a Maybe data type} for using the --- -- default 'RecentManager' --- -> IO RecentAction --- recentActionNewForManager name label tooltip stockId manager = --- constructNewGObject mkRecentAction $ --- withUTFString stockId $ \stockIdPtr -> --- withUTFString tooltip $ \tooltipPtr -> --- withUTFString label $ \labelPtr -> --- withUTFString name $ \namePtr -> --- {# call gtk_recent_action_new_for_manager #} --- namePtr --- labelPtr --- tooltipPtr --- stockIdPtr --- (toRecentAction manager) +recentActionNewForManager :: RecentManagerClass manager => + String -- ^ @name@ - a unique name for the action + -> Maybe String -- ^ @label@ - the label displayed in menu items and on buttons, + -- or 'Nothing' + -> Maybe String -- ^ @tooltip@ - a tooltip for the action, or 'Nothing' + -> Maybe String -- ^ @stockId@ - the stock icon to display in widgets representing + -- the action, or 'Nothing' + -> Maybe manager -- ^ @manager@ - a 'RecentManager', or 'Nothing' for using the + -- default 'RecentManager' + -> IO RecentAction +recentActionNewForManager name label tooltip stockId Nothing = + constructNewGObject mkRecentAction $ liftM castPtr $ + withUTFString name $ \namePtr -> + maybeWith withUTFString label $ \labelPtr -> + maybeWith withUTFString tooltip $ \tooltipPtr -> + maybeWith withUTFString stockId $ \stockIdPtr -> do + {# call gtk_recent_action_new_for_manager #} + namePtr + labelPtr + tooltipPtr + stockIdPtr + (RecentManager nullForeignPtr) +recentActionNewForManager name label tooltip stockId (Just manager) = + constructNewGObject mkRecentAction $ liftM castPtr $ + withUTFString name $ \namePtr -> + maybeWith withUTFString label $ \labelPtr -> + maybeWith withUTFString tooltip $ \tooltipPtr -> + maybeWith withUTFString stockId $ \stockIdPtr -> do + {# call gtk_recent_action_new_for_manager #} + namePtr + labelPtr + tooltipPtr + stockIdPtr + (toRecentManager manager) hunk ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs.pp 52 --- * Simple GtkInfoBar usage. --- --- > FIXME: if the follwing is a C code example, port it to Haskell or remove it --- > [_$_] --- > /* set up info bar */ --- > info_bar = gtk_info_bar_new (); --- > gtk_widget_set_no_show_all (info_bar, TRUE); --- > message_label = gtk_label_new (""); --- > gtk_widget_show (message_label); --- > content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar)); --- > gtk_container_add (GTK_CONTAINER (content_area), message_label); --- > gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), --- > GTK_STOCK_OK, GTK_RESPONSE_OK); --- > g_signal_connect (info_bar, "response", --- > G_CALLBACK (gtk_widget_hide), NULL); --- > gtk_table_attach (GTK_TABLE (table), --- > info_bar, --- > 0, 1, 2, 3, --- > GTK_EXPAND | GTK_FILL, 0, --- > 0, 0); --- > [_$_] --- > /* ... */ --- > [_$_] --- > /* show an error message */ --- > gtk_label_set_text (GTK_LABEL (message_label), error_message); --- > gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), --- > GTK_MESSAGE_ERROR); --- > gtk_widget_show (info_bar); --- --- '{FIXME: gtk-doc cross reference to:}' - hunk ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs.pp 135 --- | Add an activatable widget to the action area of a 'InfoBar', connecting a --- signal handler that will emit the {\"response\", FIXME: unknown type\/value} --- signal on the message area when the widget is activated. The widget is --- appended to the end of the message areas action area. +-- | Add an activatable widget to the action area of a 'InfoBar', connecting a signal handler that will +-- emit the "response" signal on the message area when the widget is activated. The widget is appended +-- to the end of the message areas action area. hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 464 --- FIXME: it's a partial binding, the potentially returned Screen is ignored --- %hash c:7939 d:5ea hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 192 - -> IO DrawWindow -- ^ returns the window of the plug if available, or - -- {@NULL@, FIXME: this should probably be converted to a - -- Maybe data type} -socketGetPlugWindow self = - makeNewGObject mkDrawWindow $ - {# call gtk_socket_get_plug_window #} - (toSocket self) + -> IO (Maybe DrawWindow) -- ^ returns the window of the plug if available, [_$_] + -- or 'Nothing' [_$_] +socketGetPlugWindow self = do + winPtr <- {# call gtk_socket_get_plug_window #} + (toSocket self) + if winPtr == nullPtr + then return Nothing + else liftM Just $ (makeNewGObject mkDrawWindow (return winPtr)) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 222 +import Data.Maybe (fromMaybe) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 404 - -- the cursor is moved, or {@NULL@, FIXME: this should probably - -- be converted to a Maybe data type} + -- the cursor is moved hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 412 - -> IO Adjustment -- ^ returns the horizontal cursor adjustment, or {@NULL@, - -- FIXME: this should probably be converted to a Maybe data - -- type} if none has been set. + -> IO Adjustment -- ^ returns the horizontal cursor adjustment hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 657 --- If @pixbuf@ is {@NULL@, FIXME: this should probably be converted to a --- Maybe data type}, no icon will be shown in the specified position. +-- If @pixbuf@ is 'Nothing', no icon will be shown in the specified position. hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 663 - -> Pixbuf -- ^ @pixbuf@ - A 'Pixbuf', or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type} + -> Maybe Pixbuf -- ^ @pixbuf@ - A 'Pixbuf', or 'Nothing' hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 669 - pixbuf + (fromMaybe (Pixbuf nullForeignPtr) pixbuf) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 674 --- If @stockId@ is {@NULL@, FIXME: this should probably be converted to a --- Maybe data type}, no icon will be shown in the specified position. +-- If @stockId@ is 'Nothing', no icon will be shown in the specified position. hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 680 - -> String -- ^ @stockId@ - The name of the stock item, or {@NULL@, - -- FIXME: this should probably be converted to a Maybe - -- data type} + -> Maybe String -- ^ @stockId@ - The name of the stock item, or 'Nothing' hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 683 - withUTFString stockId $ \stockIdPtr -> + maybeWith withUTFString stockId $ \stockIdPtr -> hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 695 --- If @iconName@ is {@NULL@, FIXME: this should probably be converted to a --- Maybe data type}, no icon will be shown in the specified position. +-- If @iconName@ is 'Nothing', no icon will be shown in the specified position. hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 701 - -> String -- ^ @iconName@ - An icon name, or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type} + -> Maybe String -- ^ @iconName@ - An icon name, or 'Nothing' hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 704 - withUTFString iconName $ \iconNamePtr -> + maybeWith withUTFString iconName $ \iconNamePtr -> hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 714 --- If @icon@ is {@NULL@, FIXME: this should probably be converted to a Maybe --- data type}, no icon will be shown in the specified position. +-- If @icon@ is 'Nothing', no icon will be shown in the specified position. hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 720 --- -> GIcon -- ^ @icon@ - The icon to set, or {@NULL@, FIXME: this --- -- should probably be converted to a Maybe data type} +-- -> Maybe GIcon -- ^ @icon@ - The icon to set, or 'Nothing' hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 743 --- --- Unlike the other methods of setting and getting icon data, this method --- will work regardless of whether the icon was set using a 'Pixbuf', a {GIcon, --- FIXME: unknown type\/value}, a stock item, or an icon name. +-- [_$_] +-- Unlike the other methods of setting and getting icon data, this method will work regardless of +-- whether the icon was set using a 'Pixbuf', a GIcon, a stock item, or an icon name. hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 751 - -> IO Pixbuf -- ^ returns A 'Pixbuf', or {@NULL@, FIXME: this should - -- probably be converted to a Maybe data type} if no icon + -> IO (Maybe Pixbuf) -- ^ returns A 'Pixbuf', or 'Nothing' if no icon hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 753 -entryGetIconPixbuf self iconPos = - makeNewGObject mkPixbuf $ - {# call entry_get_icon_pixbuf #} - (toEntry self) - ((fromIntegral . fromEnum) iconPos) +entryGetIconPixbuf self iconPos = do + pixbufPtr <- {# call entry_get_icon_pixbuf #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + if pixbufPtr == nullPtr + then return Nothing + else liftM Just (makeNewGObject mkPixbuf (return pixbufPtr)) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 761 --- | Retrieves the stock id used for the icon, or {@NULL@, FIXME: this should --- probably be converted to a Maybe data type} if there is no icon or if the --- icon was set by some other method (e.g., by pixbuf, icon name or gicon). +-- | Retrieves the stock id used for the icon, or 'Nothing' if there is no icon or if the icon was set by some +-- other method (e.g., by pixbuf, icon name or gicon). hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 768 - -> IO String -- ^ returns A stock id, or {@NULL@, FIXME: this should - -- probably be converted to a Maybe data type} if no icon + -> IO (Maybe String) -- ^ returns A stock id, or 'Nothing' if no icon hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 770 -entryGetIconStock self iconPos = - {# call entry_get_icon_stock #} - (toEntry self) - ((fromIntegral . fromEnum) iconPos) - >>= peekUTFString +entryGetIconStock self iconPos = do + strPtr <- {# call entry_get_icon_stock #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + if strPtr == nullPtr + then return Nothing + else liftM Just (peekUTFString strPtr) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 778 --- | Retrieves the icon name used for the icon, or {@NULL@, FIXME: this should --- probably be converted to a Maybe data type} if there is no icon or if the --- icon was set by some other method (e.g., by pixbuf, stock or gicon). +-- | Retrieves the icon name used for the icon, or 'Nothing' if there is no icon or if the icon was set by +-- some other method (e.g., by pixbuf, stock or gicon). hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 785 - -> IO String -- ^ returns An icon name, or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type} if + -> IO (Maybe String) -- ^ returns An icon name, or 'Nothing' if hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 788 -entryGetIconName self iconPos = - {# call entry_get_icon_name #} - (toEntry self) - ((fromIntegral . fromEnum) iconPos) - >>= peekUTFString +entryGetIconName self iconPos = do + strPtr <- {# call entry_get_icon_name #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + if strPtr == nullPtr + then return Nothing + else liftM Just (peekUTFString strPtr) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 796 --- | Retrieves the {GIcon, FIXME: unknown type\/value} used for the icon, or --- {@NULL@, FIXME: this should probably be converted to a Maybe data type} if --- there is no icon or if the icon was set by some other method (e.g., by --- stock, pixbuf, or icon name). +-- | Retrieves the GIcon used for the icon, or 'Nothing' if there is no icon or if the icon was set by some +-- other method (e.g., by stock, pixbuf, or icon name). hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 868 --- | Finds the icon at the given position and return its index. If @x@, @y@ --- doesn't lie inside an icon, -1 is returned. This function is intended for --- use in a {\"query-tooltip\", FIXME: unknown type\/value} signal handler. +-- | Finds the icon at the given position and return its index. If x, y doesn't lie inside an icon, -1 is +-- returned. This function is intended for use in a 'queryTooltip' signal handler. hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 884 --- | Sets @tooltip@ as the contents of the tooltip for the icon at the --- specified position. --- --- Use {@NULL@, FIXME: this should probably be converted to a Maybe data --- type} for @tooltip@ to remove an existing tooltip. --- +-- | Sets tooltip as the contents of the tooltip for the icon at the specified position. +-- [_$_] hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 892 - -> String -- ^ @tooltip@ - the contents of the tooltip for the - -- icon, or {@NULL@, FIXME: this should probably be - -- converted to a Maybe data type} + -> String -- ^ @tooltip@ - the contents of the tooltip for the icon hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 908 - -> IO String -- ^ returns the tooltip text, or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type}. - -- Free the returned string with 'gFree' when done. + -> IO String -- ^ returns the tooltip text hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 915 --- | Sets @tooltip@ as the contents of the tooltip for the icon at the --- specified position. @tooltip@ is assumed to be marked up with the Pango text --- markup language. --- --- Use {@NULL@, FIXME: this should probably be converted to a Maybe data --- type} for @tooltip@ to remove an existing tooltip. --- --- See also 'widgetSetTooltipMarkup' and 'entySetIconTooltipText'. +-- | Sets tooltip as the contents of the tooltip for the icon at the specified position. tooltip is +-- assumed to be marked up with the Pango text markup language. +-- [_$_] +-- See also 'widgetSetTooltipMarkup'. hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 925 - -- icon, or {@NULL@, FIXME: this should probably be - -- converted to a Maybe data type} + -- icon hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 941 - -> IO String -- ^ returns the tooltip text, or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type}. - -- Free the returned string with 'gFree' when done. + -> IO String -- ^ returns the tooltip text hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 948 --- | Sets up the icon at the given position so that Gtk+ will start a drag --- operation when the user clicks and drags the icon. --- --- To handle the drag operation, you need to connect to the usual --- {\"drag-data-get\", FIXME: unknown type\/value} (or possibly --- {\"drag-data-delete\", FIXME: unknown type\/value}) signal, and use --- 'entryGetCurrentIconDragSource' in your signal handler to find out if the --- drag was started from an icon. --- --- By default, Gtk+ uses the icon as the drag icon. You can use the --- {\"drag-begin\", FIXME: unknown type\/value} signal to set a different icon. --- Note that you have to use 'gSignalConnectAfter' to ensure that your signal +-- | Sets up the icon at the given position so that GTK+ will start a drag operation when the user clicks +-- and drags the icon. +-- [_$_] +-- To handle the drag operation, you need to connect to the usual 'dragDataGet' (or possibly +-- 'dragDataDelete') signal, and use 'entryGetCurrentIconDragSource' in your signal handler +-- to find out if the drag was started from an icon. +-- [_$_] +-- By default, GTK+ uses the icon as the drag icon. You can use the 'dragBegin' signal to set a +-- different icon. Note that you have to use 'signalConnectAfter' to ensure that your signal hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 985 --- | Returns the index of the icon which is the source of the current DND --- operation, or -1. --- --- This function is meant to be used in a {\"drag-data-get\", FIXME: unknown --- type\/value} callback. +-- | Returns the index of the icon which is the source of the current DND operation, or -1. +-- [_$_] +-- This function is meant to be used in a 'dragDataGet' callback. hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 490 --- or {@NULL@, FIXME: this should probably be converted to a Maybe data type} hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 412 --- | Emits the signal {\"toolbar_reconfigured\", FIXME: unknown type\/value} --- on @toolItem@. 'Toolbar' and other 'ToolShell' implementations use this --- function to notify children, when some aspect of their configuration +-- | Emits the signal "@toolbarReconfigured@" on @toolItem@. 'Toolbar' and other 'ToolShell' +-- implementations use this function to notify children, when some aspect of their configuration hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 487 --- {@NULL@, FIXME: this should probably be converted to a Maybe data type} hunk ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp 71 --- | Begins editing on a @cellEditable@. @event@ is the {GdkEvent, FIXME: +-- | Begins editing on a @cellEditable@. @event@ is the 'Event'{GdkEvent, FIXME: hunk ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp 86 --- | Emits the {\"editing-done\", FIXME: unknown type\/value} signal. +-- | Emits the 'editingDone' signal. hunk ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp 93 --- | Emits the {\"remove-widget\", FIXME: unknown type\/value} signal. +-- | Emits the 'removeWidget' signal. hunk ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp 121 --- {\"editing-done\", FIXME: unknown type\/value} signal, to give the cell +-- 'editingDone' signal, to give the cell hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 286 - -> IO (Float, Float) -- ^ @(xalign, yalign)@ {FIXME: merge return value docs} - -- @xalign@ - location to fill in with the x alignment of - -- the cell, or {@NULL@, FIXME: this should probably be - -- converted to a Maybe data type}@yalign@ - location to - -- fill in with the y alignment of the cell, or {@NULL@, - -- FIXME: this should probably be converted to a Maybe - -- data type} + -> IO (Float, Float) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 317 - -> IO (Int, Int) -- ^ @(xpad, ypad)@ {FIXME: merge return value docs} @xpad@ - -- - location to fill in with the x padding of the cell, or - -- {@NULL@, FIXME: this should probably be converted to a - -- Maybe data type}@ypad@ - location to fill in with the y - -- padding of the cell, or {@NULL@, FIXME: this should - -- probably be converted to a Maybe data type} + -> IO (Int, Int) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 160 +-- | Returns the model for @cellView@. If no model is used 'Nothing' is returned. hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 162 - -> IO TreeModel -- ^ returns a 'TreeModel' used or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type} -cellViewGetModel self = - makeNewGObject mkTreeModel $ - {# call gtk_cell_view_get_model #} - (toCellView self) + -> IO (Maybe TreeModel) -- ^ returns a 'TreeModel' used or 'Nothing' +cellViewGetModel self = do + modelPtr <- {# call gtk_cell_view_get_model #} + (toCellView self) + if modelPtr == nullPtr + then return Nothing + else liftM Just (makeNewGObject mkTreeModel (return modelPtr)) hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 864 - -> IO (Int, Int) -- ^ @(bx, by)@ {FIXME: merge return value docs} @bx@ - - -- return location for bin_window X coordinate @by@ - return - -- location for bin_window Y coordinate + -> IO (Int, Int) -- ^ @(bx, by)@ @bx@ - return location for bin_window X coordinate [_$_] + -- @by@ - return location for bin_window Y coordinate hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 905 - -> cell -- ^ @cell@ - a 'CellRenderer' or {@NULL@, FIXME: this should - -- probably be converted to a Maybe data type} + -> cell -- ^ @cell@ - a 'CellRenderer' [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 915 --- | This function is supposed to be used in a {\"query-tooltip\", FIXME: --- unknown type\/value} signal handler for 'IconView'. The @x@, @y@ and --- @keyboardTip@ values which are received in the signal handler, should be --- passed to this function without modification. --- --- The return value indicates whether there is an icon view item at the --- given coordinates (@True@) or not (@False@) for mouse tooltips. For keyboard --- tooltips the item returned will be the cursor item. When @True@, then any of --- @model@, @path@ and @iter@ which have been provided will be set to point to --- that row and the corresponding model. @x@ and @y@ will always be converted --- to be relative to @iconView@'s bin_window if @keyboardTooltip@ is @False@. +-- | This function is supposed to be used in a 'queryTooltip' signal handler for 'IconView'. The x, y +-- and @keyboardTip@ values which are received in the signal handler, should be passed to this function +-- without modification. +-- [_$_] +-- The return value indicates whether there is an icon view item at the given coordinates ('True') or not +-- ('False') for mouse tooltips. For keyboard tooltips the item returned will be the cursor item. When +-- 'True', then any of model, path and iter which have been provided will be set to point to that row and +-- the corresponding model. x and y will always be converted to be relative to @iconView@'s @binWindow@ +-- if @keyboardTooltip@ is 'False'. hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 969 - -> TreePath -- ^ @path@ - The path of the item to highlight, or - -- {@NULL@, FIXME: this should probably be converted - -- to a Maybe data type}. + -> TreePath -- ^ @path@ - The path of the item to highlight hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1021 - -> IO DrawWindow -- ^ returns A 'DrawWindow', or {@NULL@, FIXME: this should - -- probably be converted to a Maybe data type} when + -> IO (Maybe DrawWindow) -- ^ returns A 'DrawWindow', or 'Nothing' when hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1023 -treeViewGetBinWindow self = - makeNewGObject mkDrawWindow $ - {# call gtk_tree_view_get_bin_window #} - (toTreeView self) +treeViewGetBinWindow self = do + winPtr <- {# call gtk_tree_view_get_bin_window #} + (toTreeView self) + if winPtr == nullPtr + then return Nothing + else liftM Just (makeNewGObject mkDrawWindow (return winPtr)) [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1059 - -> IO (Int, Int) -- ^ @(tx, ty)@ {FIXME: merge return value docs} @tx@ - + -> IO (Int, Int) -- ^ @(tx, ty)@ @tx@ - hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1083 - -> IO (Int, Int) -- ^ @(wx, wy)@ {FIXME: merge return value docs} @wx@ - + -> IO (Int, Int) -- ^ @(wx, wy)@ @wx@ - hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1107 - -> IO (Int, Int) -- ^ @(bx, by)@ {FIXME: merge return value docs} @bx@ - + -> IO (Int, Int) -- ^ @(bx, by)@ @bx@ - hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1132 - -> IO (Int, Int) -- ^ @(wx, wy)@ {FIXME: merge return value docs} @wx@ - + -> IO (Int, Int) -- ^ @(wx, wy)@ @wx@ - hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1156 - -> IO (Int, Int) -- ^ @(bx, by)@ {FIXME: merge return value docs} @bx@ - + -> IO (Int, Int) -- ^ @(bx, by)@ @bx@ - hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1180 - -> IO (Int, Int) -- ^ @(tx, ty)@ {FIXME: merge return value docs} @tx@ - + -> IO (Int, Int) -- ^ @(tx, ty)@ @tx@ - hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1714 --- | Sets the tip area of @tooltip@ to the area @path@, @column@ and @cell@ --- have in common. For example if @path@ is {@NULL@, FIXME: this should --- probably be converted to a Maybe data type} and @column@ is set, the tip --- area will be set to the full area covered by @column@. See also +-- | Sets the tip area of tooltip to the area path, column and cell have in common. For example if path +-- is 'Nothing' and column is set, the tip area will be set to the full area covered by column. See also hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1717 --- --- Note that if @path@ is not specified and @cell@ is set and part of a --- column containing the expander, the tooltip might not show and hide at the --- correct position. In such cases @path@ must be set to the current node under --- the mouse cursor for this function to operate correctly. --- +-- [_$_] +-- Note that if path is not specified and cell is set and part of a column containing the expander, the +-- tooltip might not show and hide at the correct position. In such cases path must be set to the +-- current node under the mouse cursor for this function to operate correctly. +-- [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 1728 - -> TreePath -- ^ @path@ - a 'TreePath' or {@NULL@, FIXME: this should - -- probably be converted to a Maybe data type} - -> TreeViewColumn -- ^ @column@ - a 'TreeViewColumn' or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type} - -> cell -- ^ @cell@ - a 'CellRenderer' or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type} + -> TreePath -- ^ @path@ - a 'TreePath' [_$_] + -> TreeViewColumn -- ^ @column@ - a 'TreeViewColumn' + -> cell -- ^ @cell@ - a 'CellRenderer' [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeViewColumn.chs.pp 607 - -- will be allocated, or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data - -- type} - -> IO (Int, Int, Int, Int) -- ^ @(xOffset, yOffset, width, height)@ {FIXME: - -- merge return value docs} @xOffset@ - location to - -- return x offset of a cell relative to - -- @cellArea@, or {@NULL@, FIXME: this should - -- probably be converted to a Maybe data - -- type}@yOffset@ - location to return y offset of - -- a cell relative to @cellArea@, or {@NULL@, - -- FIXME: this should probably be converted to a - -- Maybe data type}@width@ - location to return - -- width needed to render a cell, or {@NULL@, - -- FIXME: this should probably be converted to a - -- Maybe data type}@height@ - location to return - -- height needed to render a cell, or {@NULL@, - -- FIXME: this should probably be converted to a - -- Maybe data type} + -- will be allocated, [_$_] + -> IO (Int, Int, Int, Int) -- ^ @(xOffset, yOffset, width, height)@ [_$_] + -- @xOffset@ - location to return x offset of a cell relative to + -- @cellArea@, @yOffset@ - location to return y offset of + -- a cell relative to @cellArea@, @width@ - location to return + -- width needed to render a cell, @height@ - location to return + -- height needed to render a cell, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeViewColumn.chs.pp 639 - -> IO (Maybe (Int, Int)) -- ^ @(_, startPos, width)@ {FIXME: merge return value - -- docs} returns @True@ if @cell@ belongs to + -> IO (Maybe (Int, Int)) -- ^ @(_, startPos, width)@ returns @True@ if @cell@ belongs to hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeViewColumn.chs.pp 642 - -- may be {@NULL@, FIXME: this should probably be - -- converted to a Maybe data type}@width@ - return - -- location for the width of @cell@, may be {@NULL@, - -- FIXME: this should probably be converted to a Maybe - -- data type} + -- may be 'Nothing' @width@ - return + -- location for the width of @cell@, may be 'Nothing' hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeViewColumn.chs.pp 735 --- @column@ is currently not inserted in any tree view, {@NULL@, FIXME: this --- should probably be converted to a Maybe data type} is returned. +-- @column@ is currently not inserted in any tree view, 'Nothing' is returned. hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeViewColumn.chs.pp 740 - -> IO Widget -- ^ returns The tree view wherein @column@ has been inserted if - -- any, {@NULL@, FIXME: this should probably be converted to a - -- Maybe data type} otherwise. -treeViewColumnGetTreeView self = - makeNewObject mkWidget $ - {# call gtk_tree_view_column_get_tree_view #} - self + -> IO (Maybe TreeView) -- ^ returns The tree view wherein @column@ has been inserted if + -- any, 'Nothing' +treeViewColumnGetTreeView self = do + treeViewPtr <- {# call gtk_tree_view_column_get_tree_view #} self + if treeViewPtr == nullPtr + then return Nothing + else liftM Just (makeNewObject mkTreeView (return $ castPtr treeViewPtr)) hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 142 --- To the comparison function will be passed two {GtkRecentInfo, FIXME: --- boxed type} structs and @sortData@; @sortFunc@ should return a positive +-- To the comparison function will be passed two 'RecentInfo' structs and @sortData@; @sortFunc@ should return a positive hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 189 --- | Gets the {GtkRecentInfo, FIXME: boxed type} currently selected by +-- | Gets the 'RecentInfo' currently selected by hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 193 --- -> IO RecentInfo -- ^ returns a {GtkRecentInfo, FIXME: boxed type}. +-- -> IO RecentInfo -- ^ returns a 'RecentInfo'. hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 240 --- | Gets the list of recently used resources in form of {GtkRecentInfo, --- FIXME: boxed type} objects. +-- | Gets the list of recently used resources in form of 'RecentInfo' hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 247 --- -- {GtkRecentInfo, FIXME: boxed type} objects. You +-- -- 'RecentInfo' objects. You hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 262 --- Since the returned array is {@NULL@, FIXME: this should probably be --- converted to a Maybe data type} terminated, @length@ may be {@NULL@, FIXME: --- this should probably be converted to a Maybe data type}. +-- Since the returned array [_$_] hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 265 - -> IO ([String], Int) -- ^ returns A newly allocated, {@NULL@, FIXME: this should - -- probably be converted to a Maybe data type} terminated - -- array of strings. Use 'gStrfreev' to free it. + -> IO ([String], Int) hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooserDialog.chs.pp 40 --- {GtkRecentChooserIface, FIXME: unknown type\/value} interface, so you can +-- 'RecentChooserIface' interface, so you can hunk ./gtk/Graphics/UI/Gtk/Recent/RecentFilter.chs.pp 118 --- > FIXME: if the follwing is a C code example, port it to Haskell or remove it --- > [_$_] --- > GtkRecentFilter *filter = gtk_recent_filter_new (); --- > gtk_recent_filter_add_pattern (filter, "*"); +-- > filter <- recentFilterNew +-- > recentFilterAddPattern filter "*" hunk ./gtk/Graphics/UI/Gtk/Recent/RecentFilter.chs.pp 130 - -> IO String -- ^ returns the name of the filter, or {@NULL@, FIXME: this - -- should probably be converted to a Maybe data type}. The - -- returned string is owned by the filter object and should not - -- be freed. + -> IO String -- ^ returns the name of the filter hunk ./gtk/Graphics/UI/Gtk/Recent/RecentFilter.chs.pp 257 --- {GtkRecentFilterInfo, FIXME: struct type} structure @filterInfo@ should +-- 'RecentFilterInfo' structure @filterInfo@ should hunk ./gtk/Graphics/UI/Gtk/Recent/RecentFilter.chs.pp 264 - -> RecentFilterInfo -- ^ @filterInfo@ - a {GtkRecentFilterInfo, - -- FIXME: struct type} structure containing + -> RecentFilterInfo -- ^ @filterInfo@ - a 'RecentFilterInfo' structure containing hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 158 --- list, using the metadata specified inside the {GtkRecentData, FIXME: struct --- type} structure passed in @recentData@. +-- list, using the metadata specified inside the 'RecentData' structure passed in @recentData@. hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 164 --- {GtkRecentData, FIXME: struct type} structure, which must contain the MIME +-- 'RecentData' structure, which must contain the MIME hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 168 --- Optionally, a {GtkRecentData, FIXME: struct type} structure might contain +-- Optionally, a 'RecentData' structure might contain hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 211 --- -> IO RecentInfo -- ^ returns a {GtkRecentInfo, FIXME: boxed type} +-- -> IO RecentInfo -- ^ returns a 'RecentInfo' hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 246 - -> String -- ^ @newUri@ - the new URI of the recently used resource, or - -- {@NULL@, FIXME: this should probably be converted to a Maybe - -- data type} to remove the item pointed by @uri@ in the list + -> String -- ^ @newUri@ - the new URI of the recently used resource to remove the item pointed by @uri@ in the list hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 263 --- -- {GtkRecentInfo, FIXME: boxed type} objects. Use +-- -- 'RecentInfo' objects. Use hunk ./gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs 256 - -> IO ([Color], Int, Bool) -- ^ @(_, nColors)@ {FIXME: merge return value docs} + -> IO ([Color], Int, Bool) -- ^ @(_, nColors)@ [_$_] hunk ./gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs.pp 1151 --- Please see the example code in '{FIXME: gtk-doc cross reference --- to:gtkfilechooser-preview}'. --- hunk ./gtk/Graphics/UI/Gtk/Selectors/FontSelection.chs 235 --- | This returns the {GtkTreeeView, FIXME: unknown type\/value} used to list +-- | This returns the 'TreeeView' used to list hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs.pp 119 - -> IO (Double, Double, Double) -- ^ @(h, s, v)@ {FIXME: merge return value - -- docs} @h@ - Return value for the hue @s@ - + -> IO (Double, Double, Double) -- ^ @(h, s, v)@ @h@ - Return value for the hue @s@ - hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs.pp 151 - -> IO (Int, Int) -- ^ @(size, ringWidth)@ {FIXME: merge return value docs} + -> IO (Int, Int) -- ^ @(size, ringWidth)@ [_$_] hunk ./gtk/Graphics/UI/Gtk/Selectors/HSV.chs.pp 186 - -> IO (Double, Double, Double) -- ^ @(r, g, b)@ {FIXME: merge return value - -- docs} @r@ - Return value for the red + -> IO (Double, Double, Double) -- ^ @(r, g, b)@ @r@ - Return value for the red hunk ./gtk/Graphics/UI/Gtk/Selectors/InputDialog.chs.pp 106 --- 'ModeScreen' or 'ModeWindow' to {GDK_MODE_ENABLED, FIXME: unknown --- type\/value}. +-- 'ModeScreen' or 'ModeWindow' to 'ModeEnabled' |
From: Andy S. <And...@co...> - 2010-03-28 02:39:42
|
Sat Mar 27 22:38:46 EDT 2010 Andy Stewart <laz...@gm...> * Fix all mk.*Func functions. Ignore-this: 2c2dd04dc0c5a2a903fae72f08e44419 hunk ./gtk/Graphics/UI/Gtk.hs.pp 457 - destory ) + destroy ) hunk ./gtk/Graphics/UI/Gtk/Abstract/Object.chs.pp 72 - destory, + destroy, hunk ./gtk/Graphics/UI/Gtk/Abstract/Object.chs.pp 159 -destory :: ObjectClass self => Signal self (IO ()) -destory = Signal (connect_NONE__NONE "destroy") +destroy :: ObjectClass self => Signal self (IO ()) +destroy = Signal (connect_NONE__NONE "destroy") hunk ./gtk/Graphics/UI/Gtk/Buttons/LinkButton.chs.pp 66 - LinkButtonUri, hunk ./gtk/Graphics/UI/Gtk/Buttons/LinkButton.chs.pp 74 - linkButtonSetURIHook, + linkButtonSetUriHook, hunk ./gtk/Graphics/UI/Gtk/Buttons/LinkButton.chs.pp 106 --------------------- --- Types [_$_] -type LinkButtonUri = String -> () - -{#pointer LinkButtonUriFunc#} - -foreign import ccall "wrapper" mkLinkButtonUriFunc :: - (Ptr LinkButton -> CString -> Ptr () -> IO ()) - -> IO LinkButtonUriFunc - hunk ./gtk/Graphics/UI/Gtk/Buttons/LinkButton.chs.pp 166 -linkButtonSetURIHook :: Maybe LinkButtonUri - -> DestroyNotify [_$_] - -> IO () -linkButtonSetURIHook func destroy = do - pfPtr <- case func of - Just pf -> mkLinkButtonUriFunc $ \_ cstr _ -> do +linkButtonSetUriHook :: (String -> IO ()) -> IO () +linkButtonSetUriHook func = do + pfPtr <- mkLinkButtonUriFunc $ \_ cstr _ -> do hunk ./gtk/Graphics/UI/Gtk/Buttons/LinkButton.chs.pp 170 - return (pf str) - Nothing -> return nullFunPtr - {# call gtk_link_button_set_uri_hook #} pfPtr nullPtr destroy - unless (pfPtr == nullFunPtr) $ freeHaskellFunPtr pfPtr - [_$_] + func str + {# call link_button_set_uri_hook #} pfPtr (castFunPtrToPtr pfPtr) destroyFunPtr + freeHaskellFunPtr pfPtr + [_$_] +{#pointer LinkButtonUriFunc#} + +foreign import ccall "wrapper" mkLinkButtonUriFunc :: + (Ptr LinkButton -> CString -> Ptr () -> IO ()) + -> IO LinkButtonUriFunc + hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 71 - NotebookWindowCreation, hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 202 --------------------- --- Types. --- | A function used by 'Notebook' when a detachable tab is dropped in the root window, it's used to --- create a window containing a notebook where the tab will be attached. This function will also be --- responsible of moving/resizing the window and adding the necessary properties to the notebook (i.e.: --- group-id) -type NotebookWindowCreation = Widget -> Int -> Int -> Notebook - -{#pointer NotebookWindowCreationFunc#} - -foreign import ccall "wrapper" mkNotebookWindowCreationFunc :: - (Ptr Notebook -> Ptr Widget -> {#type glong#} -> {#type glong#} -> Ptr () -> IO (Ptr Notebook)) - -> IO NotebookWindowCreationFunc - hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 984 -notebookSetWindowCreationHook :: [_$_] - Maybe NotebookWindowCreation - -> DestroyNotify [_$_] - -> IO () -notebookSetWindowCreationHook func destroy = do - funcPtr <- case func of - Just fc -> mkNotebookWindowCreationFunc $ \_ widgetPtr x y _ -> do - widget <- makeNewObject mkWidget (return widgetPtr) - return (unsafeForeignPtrToPtr $ unNotebook (fc widget (fromIntegral x) (fromIntegral y))) - Nothing -> return nullFunPtr - {#call notebook_set_window_creation_hook#} funcPtr nullPtr destroy - unless (funcPtr == nullFunPtr) $ freeHaskellFunPtr funcPtr +notebookSetWindowCreationHook :: (Widget -> Int -> Int -> IO Notebook) -> IO () +notebookSetWindowCreationHook func = do + funcPtr <- mkNotebookWindowCreationFunc $ \_ widgetPtr x y _ -> do + widget <- makeNewObject mkWidget (return widgetPtr) + notebook <- func widget (fromIntegral x) (fromIntegral y) + return (unsafeForeignPtrToPtr $ unNotebook notebook) + {#call notebook_set_window_creation_hook#} funcPtr (castFunPtrToPtr funcPtr) destroyFunPtr + freeHaskellFunPtr funcPtr + +{#pointer NotebookWindowCreationFunc#} + +foreign import ccall "wrapper" mkNotebookWindowCreationFunc :: + (Ptr Notebook -> Ptr Widget -> {#type glong#} -> {#type glong#} -> Ptr () -> IO (Ptr Notebook)) + -> IO NotebookWindowCreationFunc hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 70 -#if GTK_CHECK_VERSION(2,14,0) - CalendarDetail, -#endif hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 153 --------------------- --- Types -#if GTK_CHECK_VERSION(2,14,0) -type CalendarDetail = Int -> Int -> Int -> String - -{#pointer CalendarDetailFunc#} - -foreign import ccall "wrapper" mkCalendarDetailFunc :: [_$_] - (Ptr Calendar -> {#type guint#} -> {#type guint#} -> {#type guint#} -> Ptr () -> IO CString) - -> IO CalendarDetailFunc -#endif - hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 300 - -> CalendarDetail [_$_] - -> DestroyNotify + -> (Int -> Int -> Int -> IO String) hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 302 -calendarSetDetailFunc self function notify = do - func <- mkCalendarDetailFunc $ \_ year month day _ -> - newCString (function (fromIntegral year) (fromIntegral month) (fromIntegral day)) +calendarSetDetailFunc self function = do + func <- mkCalendarDetailFunc $ \_ year month day _ -> do + str <- function (fromIntegral year) (fromIntegral month) (fromIntegral day) + newCString str hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 309 - nullPtr - notify + (castFunPtrToPtr func) + destroyFunPtr + freeHaskellFunPtr func + +{#pointer CalendarDetailFunc#} + +foreign import ccall "wrapper" mkCalendarDetailFunc :: [_$_] + (Ptr Calendar -> {#type guint#} -> {#type guint#} -> {#type guint#} -> Ptr () -> IO CString) + -> IO CalendarDetailFunc hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 343 - func path - ) + func path) hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 347 - nullPtr + (castFunPtrToPtr funcPtr) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModel.chs.pp 430 - liftM (fromIntegral.fromBool) $ fun iter - ) + liftM (fromIntegral.fromBool) $ fun iter) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModel.chs.pp 434 - nullPtr + (castFunPtrToPtr fPtr) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 67 - TreeSelectionCB, - TreeSelectionForeachCB, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 149 - -> TreeSelectionCB -> IO () + -> (TreePath -> IO Bool) -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 153 - liftM fromBool $ fun path - ) + liftM fromBool $ fun path) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 159 + freeHaskellFunPtr fPtr hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 164 -type TreeSelectionCB = TreePath -> IO Bool hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 195 - -> TreeSelectionForeachCB + -> (TreeIter -> IO ()) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 204 - fun iter - ) + fun iter) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 208 - nullPtr + (castFunPtrToPtr fPtr) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 213 -type TreeSelectionForeachCB = TreeIter -> IO () hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 75 - TextBufferDeserialize, hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 231 -import System.Glib.GObject (DestroyNotify, constructNewGObject, +import System.Glib.GObject (constructNewGObject, hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 243 --------------------- --- Types -type TextBufferDeserialize = TextBuffer -> TextIter -> Int -> Int -> Bool -> Bool - -{#pointer TextBufferDeserializeFunc#} - -foreign import ccall "wrapper" mkTextBufferDeserializeFunc :: - (Ptr TextBuffer -> Ptr TextBuffer -> Ptr TextIter -> {#type guint#} -> {#type glong#} -> {#type gboolean#} -> Ptr () -> IO {#type gboolean#}) - -> IO TextBufferDeserializeFunc - -type TextBufferSerialize = TextBuffer -> TextIter -> TextIter -> Int -> String - -{#pointer TextBufferSerializeFunc#} - -foreign import ccall "wrapper" mkTextBufferSerializeFunc :: - (Ptr TextBuffer -> Ptr TextBuffer -> Ptr TextIter -> Ptr TextIter -> {#type glong#} -> Ptr () -> IO CString) - -> IO TextBufferSerializeFunc - hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1229 - -> TextBufferDeserialize -- ^ @function@ - the deserialize + -> (TextBuffer -> TextIter -> Int -> Int -> Bool -> IO Bool) -- ^ @function@ - the deserialize hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1231 - -> DestroyNotify -- ^ @userDataDestroy@ - a function to - -- call when @userData@ is no longer - -- needed hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1233 -textBufferRegisterDeserializeFormat self mimeType function notify = +textBufferRegisterDeserializeFormat self mimeType function = hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1238 - return (fromBool (function buffer iter (fromIntegral dat) (fromIntegral length) (toBool tags))) + liftM fromBool $ function buffer iter (fromIntegral dat) (fromIntegral length) (toBool tags) hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1243 - nullPtr - notify + (castFunPtrToPtr func) + destroyFunPtr hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1247 +{#pointer TextBufferDeserializeFunc#} + +foreign import ccall "wrapper" mkTextBufferDeserializeFunc :: + (Ptr TextBuffer -> Ptr TextBuffer -> Ptr TextIter -> {#type guint#} -> {#type glong#} -> {#type gboolean#} -> Ptr () -> IO {#type gboolean#}) + -> IO TextBufferDeserializeFunc + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1277 - -> TextBufferSerialize -- ^ @function@ - the serialize function to + -> (TextBuffer -> TextIter -> TextIter -> Int -> IO String) -- ^ @function@ - the serialize function to hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1279 - -> DestroyNotify -- ^ @userDataDestroy@ - a function to call - -- when @userData@ is no longer needed hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1281 -textBufferRegisterSerializeFormat self mimeType function notify = +textBufferRegisterSerializeFormat self mimeType function = hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1287 - newCString $ function buffer startIter endIter (fromIntegral length) + str <- function buffer startIter endIter (fromIntegral length) + newCString str hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1293 - nullPtr - notify + (castFunPtrToPtr func) + destroyFunPtr hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1297 +{#pointer TextBufferSerializeFunc#} + +foreign import ccall "wrapper" mkTextBufferSerializeFunc :: + (Ptr TextBuffer -> Ptr TextBuffer -> Ptr TextIter -> Ptr TextIter -> {#type glong#} -> Ptr () -> IO CString) + -> IO TextBufferSerializeFunc + hunk ./gtk/Graphics/UI/Gtk/Windows/Assistant.chs.pp 62 - AssistantPage, hunk ./gtk/Graphics/UI/Gtk/Windows/Assistant.chs.pp 125 --------------------- --- Types [_$_] -type AssistantPage = Int -> Int - -{#pointer AssistantPageFunc#} - -foreign import ccall "wrapper" mkAssistantPageFunc :: - (Ptr Assistant -> {#type glong#} -> Ptr () -> IO {#type glong#}) - -> IO AssistantPageFunc - hunk ./gtk/Graphics/UI/Gtk/Windows/Assistant.chs.pp 229 - -> Maybe AssistantPage -- ^ @pageFunc@ - the 'AssistantPage' - -> DestroyNotify -- ^ @destroy@ - destroy notifier for @data@ + -> (Int -> IO Int) -- ^ @pageFunc@ - the 'AssistantPage' hunk ./gtk/Graphics/UI/Gtk/Windows/Assistant.chs.pp 231 -assistantSetForwardPageFunc self pageFunc destroy = do - pfPtr <- case pageFunc of - Just pf -> mkAssistantPageFunc $ \_ c _ -> - return (fromIntegral (pf (fromIntegral c))) - Nothing -> return nullFunPtr +assistantSetForwardPageFunc self pageFunc = do + pfPtr <- mkAssistantPageFunc $ \_ c _ -> do + result <- pageFunc (fromIntegral c) + return $ fromIntegral result hunk ./gtk/Graphics/UI/Gtk/Windows/Assistant.chs.pp 238 - nullPtr - destroy - unless (pfPtr == nullFunPtr) $ freeHaskellFunPtr pfPtr + (castFunPtrToPtr pfPtr) + destroyFunPtr + freeHaskellFunPtr pfPtr + +{#pointer AssistantPageFunc#} + +foreign import ccall "wrapper" mkAssistantPageFunc :: + (Ptr Assistant -> {#type glong#} -> Ptr () -> IO {#type glong#}) + -> IO AssistantPageFunc |
From: Andy S. <And...@co...> - 2010-03-28 01:39:29
|
Sat Mar 27 21:37:19 EDT 2010 Andy Stewart <laz...@gm...> * Add new `Recent` modules Ignore-this: abf96166e4822118c76ca07a592fa960 hunk ./ApiUpdateTodoList.txt 128 -*** TODO RecentAction.chs +*** DONE RecentAction.chs hunk ./ApiUpdateTodoList.txt 130 -*** TODO RecentChooserDefault.chs +*** DONE RecentChooserDefault.chs hunk ./ApiUpdateTodoList.txt 132 -*** TODO RecentChooserMenu.chs -*** TODO RecentChooserWidget.chs -*** TODO RecentFilter.chs -*** TODO RecentInfo.chs +*** DONE RecentChooserMenu.chs +*** DONE RecentChooserWidget.chs +*** DONE RecentFilter.chs +*** DONE RecentInfo.chs hunk ./Makefile.am 806 + gtk/Graphics/UI/Gtk/Recent/RecentChooserDialog.chs.pp \ + gtk/Graphics/UI/Gtk/Recent/RecentChooserMenu.chs.pp \ + gtk/Graphics/UI/Gtk/Recent/RecentChooserWidget.chs.pp \ + gtk/Graphics/UI/Gtk/Recent/RecentFilter.chs.pp \ + gtk/Graphics/UI/Gtk/Recent/RecentInfo.chs.pp \ + gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp \ + gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp \ hunk ./Makefile.am 884 - gtk/Graphics/UI/Gtk/ModelView/CustomStore_stub.o + gtk/Graphics/UI/Gtk/ModelView/CustomStore_stub.o \ + gtk/Graphics/UI/Gtk/Recent/RecentChooser_stub.o \ + gtk/Graphics/UI/Gtk/Recent/RecentFilter_stub.o hunk ./gtk/Graphics/UI/Gtk.hs.pp 245 - module Graphics.UI.Gtk.Pango.Enums + module Graphics.UI.Gtk.Pango.Enums, + + -- * Recent modules + module Graphics.UI.Gtk.Recent.RecentChooser, + module Graphics.UI.Gtk.Recent.RecentChooserDialog, + module Graphics.UI.Gtk.Recent.RecentChooserMenu, + module Graphics.UI.Gtk.Recent.RecentChooserWidget, + module Graphics.UI.Gtk.Recent.RecentFilter, + module Graphics.UI.Gtk.Recent.RecentInfo, + module Graphics.UI.Gtk.Recent.RecentManager, hunk ./gtk/Graphics/UI/Gtk.hs.pp 497 + +-- recent modules +import Graphics.UI.Gtk.Recent.RecentChooser +import Graphics.UI.Gtk.Recent.RecentChooserDialog +import Graphics.UI.Gtk.Recent.RecentChooserMenu +import Graphics.UI.Gtk.Recent.RecentChooserWidget +import Graphics.UI.Gtk.Recent.RecentFilter +import Graphics.UI.Gtk.Recent.RecentInfo +import Graphics.UI.Gtk.Recent.RecentManager adddir ./gtk/Graphics/UI/Gtk/Recent addfile ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Interface RecentChooser +-- +-- Author : Andy Stewart +-- +-- Created: 27 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) +-- +-- Interface implemented by widgets displaying recently used files +-- +-- * Module available since Gtk+ version 2.10 +-- +-- The follwing functions don't bind, use corresponding attributes instead: +-- gtk_recent_chooser_set_show_private +-- gtk_recent_chooser_get_show_private +-- gtk_recent_chooser_set_show_not_found +-- gtk_recent_chooser_get_show_not_found +-- gtk_recent_chooser_set_show_icons +-- gtk_recent_chooser_get_show_icons +-- gtk_recent_chooser_set_select_multiple +-- gtk_recent_chooser_get_select_multiple +-- gtk_recent_chooser_set_local_only +-- gtk_recent_chooser_get_local_only +-- gtk_recent_chooser_set_limit +-- gtk_recent_chooser_get_limit +-- gtk_recent_chooser_set_show_tips +-- gtk_recent_chooser_get_show_tips +-- gtk_recent_chooser_set_sort_type +-- gtk_recent_chooser_get_sort_type +-- gtk_recent_chooser_set_filter +-- gtk_recent_chooser_get_filter +-- +module Graphics.UI.Gtk.Recent.RecentChooser ( + +-- * Detail +-- +-- | 'RecentChooser' is an interface that can be implemented by widgets +-- displaying the list of recently used files. In Gtk+, the main objects that +-- implement this interface are 'RecentChooserWidget', 'RecentChooserDialog' +-- and 'RecentChooserMenu'. +-- +-- Recently used files are supported since Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GInterface' +-- | +----RecentChooser +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + RecentChooser, + RecentChooserClass, + castToRecentChooser, + toRecentChooser, + +-- * Enums + RecentChooserError(..), + RecentSortType(..), + +-- * Methods + -- recentChooserSetSortFunc, + recentChooserSetCurrentURI, + recentChooserGetCurrentURI, + -- recentChooserGetCurrentItem, + recentChooserSelectURI, + recentChooserUnselectURI, + recentChooserSelectAll, + recentChooserUnselectAll, + -- recentChooserGetItems, + recentChooserGetURIs, + recentChooserAddFilter, + recentChooserRemoveFilter, + recentChooserListFilters, + recentChooserErrorQuark, + +-- * Attributes + recentChooserShowPrivate, + recentChooserShowTips, + recentChooserShowIcons, + recentChooserShowNotFound, + recentChooserSelectMultiple, + recentChooserLocalOnly, + recentChooserLimit, + recentChooserSortType, + recentChooserFilter, + +-- * Signals + recentChooserSelectionChanged, + recentChooserItemActivated, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.GList +import System.Glib.GObject (Quark, quarkFromString) +import System.Glib.GError (GErrorDomain, GErrorClass(..), propagateGError) +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Recent.RecentInfo#} (RecentInfo) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Enums +{#enum RecentChooserError {underscoreToCase} deriving (Bounded,Eq,Show)#} + +{#enum RecentSortType {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-------------------- +-- Methods + +-- | Sets the comparison function used when sorting to be @sortFunc@. If the +-- @chooser@ has the sort type set to 'RecentSortCustom' then the chooser will +-- sort using this function. +-- +-- To the comparison function will be passed two {GtkRecentInfo, FIXME: +-- boxed type} structs and @sortData@; @sortFunc@ should return a positive +-- integer if the first item comes before the second, zero if the two items are +-- equal and a negative integer if the first item comes after the second. +-- +-- recentChooserSetSortFunc :: RecentChooserClass self => self +-- -> (Maybe (RecentInfo -> IO Int)) +-- -> IO () +-- recentChooserSetSortFunc self Nothing = +-- {# call gtk_recent_chooser_set_sort_func #} +-- (toRecentChooser self) nullFunPtr nullPtr nullFunPtr +-- recentChooserSetSortFunc self (Just func) = do +-- fPtr <- mkRecentSortFunc $ \_ info _ -> func info +-- {# call gtk_recent_chooser_set_sort_func #} +-- (toRecentChooser self) +-- fPtr +-- (castFunPtrToPtr fPtr) +-- destroyFunPtr + +{#pointer RecentSortFunc#} + +foreign import ccall "wrapper" mkRecentSortFunc :: + (Ptr RecentInfo -> Ptr RecentInfo -> Ptr () -> IO {#type gint#}) + -> IO RecentSortFunc + +-- | Sets @uri@ as the current URI for @chooser@. +-- +recentChooserSetCurrentURI :: RecentChooserClass self => self + -> String -- ^ @uri@ - a URI + -> IO Bool -- ^ returns @True@ if the URI was found. +recentChooserSetCurrentURI self uri = + liftM toBool $ + propagateGError $ \errorPtr -> + withUTFString uri $ \uriPtr -> + {# call gtk_recent_chooser_set_current_uri #} + (toRecentChooser self) + uriPtr + errorPtr + +-- | Gets the URI currently selected by @chooser@. +-- +recentChooserGetCurrentURI :: RecentChooserClass self => self + -> IO String -- ^ returns a newly allocated string holding a URI. +recentChooserGetCurrentURI self = + {# call gtk_recent_chooser_get_current_uri #} + (toRecentChooser self) + >>= readUTFString + +-- | Gets the {GtkRecentInfo, FIXME: boxed type} currently selected by +-- @chooser@. +-- +-- recentChooserGetCurrentItem :: RecentChooserClass self => self +-- -> IO RecentInfo -- ^ returns a {GtkRecentInfo, FIXME: boxed type}. +-- -- Use 'recentInfoUnref' when when you have finished +-- -- using it. +-- recentChooserGetCurrentItem self = +-- {# call gtk_recent_chooser_get_current_item #} +-- (toRecentChooser self) + +-- | Selects @uri@ inside @chooser@. +-- +recentChooserSelectURI :: RecentChooserClass self => self + -> String -- ^ @uri@ - a URI + -> IO Bool -- ^ returns @True@ if @uri@ was found. +recentChooserSelectURI self uri = + liftM toBool $ + propagateGError $ \errorPtr -> + withUTFString uri $ \uriPtr -> + {# call gtk_recent_chooser_select_uri #} + (toRecentChooser self) + uriPtr + errorPtr + +-- | Unselects @uri@ inside @chooser@. +-- +recentChooserUnselectURI :: RecentChooserClass self => self + -> String -- ^ @uri@ - a URI + -> IO () +recentChooserUnselectURI self uri = + withUTFString uri $ \uriPtr -> + {# call gtk_recent_chooser_unselect_uri #} + (toRecentChooser self) + uriPtr + +-- | Selects all the items inside @chooser@, if the @chooser@ supports +-- multiple selection. +-- +recentChooserSelectAll :: RecentChooserClass self => self -> IO () +recentChooserSelectAll self = + {# call gtk_recent_chooser_select_all #} + (toRecentChooser self) + +-- | Unselects all the items inside @chooser@. +-- +recentChooserUnselectAll :: RecentChooserClass self => self -> IO () +recentChooserUnselectAll self = + {# call gtk_recent_chooser_unselect_all #} + (toRecentChooser self) + +-- | Gets the list of recently used resources in form of {GtkRecentInfo, +-- FIXME: boxed type} objects. +-- +-- The return value of this function is affected by the \"sort-type\" and +-- \"limit\" properties of @chooser@. +-- +-- recentChooserGetItems :: RecentChooserClass self => self +-- -> IO [RecentInfo] -- ^ returns A newly allocated list of +-- -- {GtkRecentInfo, FIXME: boxed type} objects. You +-- -- should use 'recentInfoUnref' on every item of +-- -- the list, and then free the list itself using +-- -- 'gListFree'. +-- recentChooserGetItems self = +-- {# call gtk_recent_chooser_get_items #} +-- (toRecentChooser self) +-- >>= fromGList + -- >>= mapM (\elemPtr -> RecentInfo elemPtr) + +-- | Gets the URI of the recently used resources. +-- +-- The return value of this function is affected by the \"sort-type\" and +-- \"limit\" properties of @chooser@. +-- +-- Since the returned array is {@NULL@, FIXME: this should probably be +-- converted to a Maybe data type} terminated, @length@ may be {@NULL@, FIXME: +-- this should probably be converted to a Maybe data type}. +-- +recentChooserGetURIs :: RecentChooserClass self => self + -> IO ([String], Int) -- ^ returns A newly allocated, {@NULL@, FIXME: this should + -- probably be converted to a Maybe data type} terminated + -- array of strings. Use 'gStrfreev' to free it. +recentChooserGetURIs self = [_$_] + alloca $ \lengthPtr -> do + str <- {# call gtk_recent_chooser_get_uris #} + (toRecentChooser self) + lengthPtr + length <- peek lengthPtr + uris <- mapM peekCString =<< peekArray 0 str + return (uris, fromIntegral length) + +-- | Adds @filter@ to the list of 'RecentFilter' objects held by @chooser@. +-- +-- If no previous filter objects were defined, this function will call +-- 'recentChooserSetFilter'. +-- +recentChooserAddFilter :: (RecentChooserClass self, RecentFilterClass filter) => self + -> filter -- ^ @filter@ - a 'RecentFilter' + -> IO () +recentChooserAddFilter self filter = + {# call gtk_recent_chooser_add_filter #} + (toRecentChooser self) + (toRecentFilter filter) + +-- | Removes @filter@ from the list of 'RecentFilter' objects held by +-- @chooser@. +-- +recentChooserRemoveFilter :: (RecentChooserClass self, RecentFilterClass filter) => self + -> filter -- ^ @filter@ - a 'RecentFilter' + -> IO () +recentChooserRemoveFilter self filter = + {# call gtk_recent_chooser_remove_filter #} + (toRecentChooser self) + (toRecentFilter filter) + +-- | Gets the 'RecentFilter' objects held by @chooser@. +-- +recentChooserListFilters :: RecentChooserClass self => self + -> IO [RecentFilter] -- ^ returns A singly linked list of + -- 'RecentFilter' objects. You should just free the + -- returned list using 'gSlistFree'. +recentChooserListFilters self = do + glist <- {# call gtk_recent_chooser_list_filters #} + (toRecentChooser self) + list <- fromGList glist + mapM (\x -> makeNewObject mkRecentFilter (return (castPtr x))) list + +-- | +-- +recentChooserErrorQuark :: IO Quark +recentChooserErrorQuark = + {# call gtk_recent_chooser_error_quark #} + +-------------------- +-- Attributes + +-- | Whether the private items should be displayed. +-- [_$_] +-- Default value: 'False' +recentChooserShowPrivate :: RecentChooserClass self => Attr self Bool +recentChooserShowPrivate = newAttrFromBoolProperty "show-private" + +-- | Whether this 'RecentChooser' should display a tooltip containing the full path of the recently used +-- resources. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.10 +recentChooserShowTips :: RecentChooserClass self => Attr self Bool +recentChooserShowTips = newAttrFromBoolProperty "show-tips" + +-- | Whether this 'RecentChooser' should display an icon near the item. +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.10 +recentChooserShowIcons :: RecentChooserClass self => Attr self Bool +recentChooserShowIcons = newAttrFromBoolProperty "show-icons" + +-- | Whether this 'RecentChooser' should display the recently used resources even if not present +-- anymore. Setting this to 'False' will perform a potentially expensive check on every local resource +-- (every remote resource will always be displayed). +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.10 +recentChooserShowNotFound :: RecentChooserClass self => Attr self Bool +recentChooserShowNotFound = newAttrFromBoolProperty "show-not-found" + +-- | Allow the user to select multiple resources. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.10 +recentChooserSelectMultiple :: RecentChooserClass self => Attr self Bool +recentChooserSelectMultiple = newAttrFromBoolProperty "select-multiple" + +-- | Whether this 'RecentChooser' should display only local (file:) resources. +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.10 +recentChooserLocalOnly :: RecentChooserClass self => Attr self Bool +recentChooserLocalOnly = newAttrFromBoolProperty "local-only" + +-- | The maximum number of recently used resources to be displayed, or -1 to display all items. By +-- default, the 'Setting':gtk-recent-files-limit setting is respected: you can override that limit on +-- a particular instance of 'RecentChooser' by setting this property. +-- [_$_] +-- Allowed values: >= 'GMaxulong' +-- [_$_] +-- Default value: -1 +-- [_$_] +-- Since 2.10 +recentChooserLimit :: RecentChooserClass self => Attr self Int +recentChooserLimit = newAttrFromIntProperty "limit" + +-- | Sorting order to be used when displaying the recently used resources. +-- [_$_] +-- Default value: ''RecentSortNone'' +-- [_$_] +-- Since 2.10 +recentChooserSortType :: RecentChooserClass self => Attr self RecentSortType +recentChooserSortType = newAttrFromEnumProperty "sort-type" + {# call pure unsafe gtk_recent_sort_type_get_type #} + +-- | The 'RecentFilter' object to be used when displaying the recently used resources. +-- [_$_] +-- Since 2.10 +recentChooserFilter :: (RecentChooserClass self, RecentFilterClass recentFilter) => ReadWriteAttr self RecentFilter recentFilter +recentChooserFilter = newAttrFromObjectProperty "filter" + {# call pure unsafe gtk_recent_filter_get_type #} + +-------------------- +-- Signals + +-- | This signal is emitted when there is a change in the set of selected +-- recently used resources. This can happen when a user modifies the selection +-- with the mouse or the keyboard, or when explicitely calling functions to +-- change the selection. +-- +recentChooserSelectionChanged :: RecentChooserClass self => Signal self (IO ()) +recentChooserSelectionChanged = Signal (connect_NONE__NONE "selection-changed") + +-- | This signal is emitted when the user \"activates\" a recent item in the +-- recent chooser. This can happen by double-clicking on an item in the +-- recently used resources list, or by pressing Enter. +-- +recentChooserItemActivated :: RecentChooserClass self => Signal self (IO ()) +recentChooserItemActivated = Signal (connect_NONE__NONE "item-activated") +#endif addfile ./gtk/Graphics/UI/Gtk/Recent/RecentChooserDialog.chs.pp hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooserDialog.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget RecentChooserDialog +-- +-- Author : Andy Stewart +-- +-- Created: 27 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. +-- +-- TODO: the following varargs functions were not bound +-- gtk_recent_chooser_dialog_new +-- gtk_recent_chooser_dialog_new_for_manager +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Displays recently used files in a dialog +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.Recent.RecentChooserDialog ( + +-- * Detail +-- +-- | 'RecentChooserDialog' is a dialog box suitable for displaying the +-- recently used documents. This widgets works by putting a +-- 'RecentChooserWidget' inside a 'Dialog'. It exposes the +-- {GtkRecentChooserIface, FIXME: unknown type\/value} interface, so you can +-- use all the 'RecentChooser' functions on the recent chooser dialog as well +-- as those for 'Dialog'. +-- +-- Note that 'RecentChooserDialog' does not have any methods of its own. +-- Instead, you should use the functions that work on a 'RecentChooser'. +-- +-- Recently used files are supported since Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Container' +-- | +----'Bin' +-- | +----'Window' +-- | +----'Dialog' +-- | +----RecentChooserDialog +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + RecentChooserDialog, + RecentChooserDialogClass, + castToRecentChooserDialog, + toRecentChooserDialog, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +{#import Graphics.UI.Gtk.Types#} +-- CHECKME: extra imports may be required + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Interfaces + +instance RecentChooserClass RecentChooserDialog +#endif addfile ./gtk/Graphics/UI/Gtk/Recent/RecentChooserMenu.chs.pp hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooserMenu.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget RecentChooserMenu +-- +-- Author : Andy Stewart +-- +-- Created: 27 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) +-- +-- Displays recently used files in a menu +-- +-- * Module available since Gtk+ version 2.10 +-- +-- The follwing functions don't bind, use corresponding attributes instead: +-- gtk_recent_chooser_menu_get_show_numbers +-- gtk_recent_chooser_menu_set_show_numbers +-- +module Graphics.UI.Gtk.Recent.RecentChooserMenu ( + +-- * Detail +-- +-- | 'RecentChooserMenu' is a widget suitable for displaying recently used +-- files inside a menu. It can be used to set a sub-menu of a 'MenuItem' using +-- 'menuItemSetSubmenu', or as the menu of a 'MenuToolButton'. +-- +-- Note that 'RecentChooserMenu' does not have any methods of its own. +-- Instead, you should use the functions that work on a 'RecentChooser'. +-- +-- Note also that 'RecentChooserMenu' does not support multiple filters, as +-- it has no way to let the user choose between them as the +-- 'RecentChooserWidget' and 'RecentChooserDialog' widgets do. Thus using +-- 'recentChooserAddFilter' on a 'RecentChooserMenu' widget will yield the same +-- effects as using 'recentChooserSetFilter', replacing any currently set +-- filter with the supplied filter; 'recentChooserRemoveFilter' will remove any +-- currently set 'RecentFilter' object and will unset the current filter; +-- 'recentChooserListFilters' will return a list containing a single +-- 'RecentFilter' object. +-- +-- Recently used files are supported since Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Container' +-- | +----'MenuShell' +-- | +----'Menu' +-- | +----RecentChooserMenu +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + RecentChooserMenu, + RecentChooserMenuClass, + castToRecentChooserMenu, + toRecentChooserMenu, + +-- * Constructors + recentChooserMenuNew, + recentChooserMenuNewForManager, + +-- * Attributes + recentChooserMenuShowNumbers, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Interfaces + +instance RecentChooserClass RecentChooserMenu + +instance ActivatableClass RecentChooserMenu + +-------------------- +-- Constructors + +-- | Creates a new 'RecentChooserMenu' widget. +-- +-- This kind of widget shows the list of recently used resources as a menu, +-- each item as a menu item. Each item inside the menu might have an icon, +-- representing its MIME type, and a number, for mnemonic access. +-- +-- This widget implements the 'RecentChooser' interface. +-- +-- This widget creates its own 'RecentManager' object. See the +-- 'recentChooserMenuNewForManager' function to know how to create a +-- 'RecentChooserMenu' widget bound to another 'RecentManager' object. +-- +recentChooserMenuNew :: IO RecentChooserMenu +recentChooserMenuNew = + makeNewObject mkRecentChooserMenu $ + liftM (castPtr :: Ptr Widget -> Ptr RecentChooserMenu) $ + {# call gtk_recent_chooser_menu_new #} + +-- | Creates a new 'RecentChooserMenu' widget using @manager@ as the +-- underlying recently used resources manager. +-- +-- This is useful if you have implemented your own recent manager, or if you +-- have a customized instance of a 'RecentManager' object or if you wish to +-- share a common 'RecentManager' object among multiple 'RecentChooser' +-- widgets. +-- +recentChooserMenuNewForManager :: RecentManagerClass manager => + manager -- ^ @manager@ - a 'RecentManager' + -> IO RecentChooserMenu +recentChooserMenuNewForManager manager = + makeNewObject mkRecentChooserMenu $ + liftM (castPtr :: Ptr Widget -> Ptr RecentChooserMenu) $ + {# call gtk_recent_chooser_menu_new_for_manager #} + (toRecentManager manager) + +-------------------- +-- Methods + +-------------------- +-- Attributes + +-- | Whether the first ten items in the menu should be prepended by a number acting as a unique mnemonic. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.10 +recentChooserMenuShowNumbers :: RecentChooserMenuClass self => Attr self Bool +recentChooserMenuShowNumbers = newAttrFromBoolProperty "show-numbers" +#endif addfile ./gtk/Graphics/UI/Gtk/Recent/RecentChooserWidget.chs.pp hunk ./gtk/Graphics/UI/Gtk/Recent/RecentChooserWidget.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget RecentChooserWidget +-- +-- Author : Andy Stewart +-- +-- Created: 27 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) +-- +-- Displays recently used files +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.Recent.RecentChooserWidget ( + +-- * Detail +-- +-- | 'RecentChooserWidget' is a widget suitable for selecting recently used +-- files. It is the main building block of a 'RecentChooserDialog'. Most +-- applications will only need to use the latter; you can use +-- 'RecentChooserWidget' as part of a larger window if you have special needs. +-- +-- Note that 'RecentChooserWidget' does not have any methods of its own. +-- Instead, you should use the functions that work on a 'RecentChooser'. +-- +-- Recently used files are supported since Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Container' +-- | +----'Box' +-- | +----'VBox' +-- | +----RecentChooserWidget +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + RecentChooserWidget, + RecentChooserWidgetClass, + castToRecentChooserWidget, + toRecentChooserWidget, + +-- * Constructors + recentChooserWidgetNew, + recentChooserWidgetNewForManager, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Types#} +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Interfaces + +instance RecentChooserClass RecentChooserWidget + +-------------------- +-- Constructors + +-- | Creates a new 'RecentChooserWidget' object. This is an embeddable widget +-- used to access the recently used resources list. +-- +recentChooserWidgetNew :: IO RecentChooserWidget +recentChooserWidgetNew = + makeNewObject mkRecentChooserWidget $ + liftM (castPtr :: Ptr Widget -> Ptr RecentChooserWidget) $ + {# call gtk_recent_chooser_widget_new #} + +-- | Creates a new 'RecentChooserWidget' with a specified recent manager. +-- +-- This is useful if you have implemented your own recent manager, or if you +-- have a customized instance of a 'RecentManager' object. +-- +recentChooserWidgetNewForManager :: RecentManagerClass manager => + manager -- ^ @manager@ - a 'RecentManager' + -> IO RecentChooserWidget +recentChooserWidgetNewForManager manager = + makeNewObject mkRecentChooserWidget $ + liftM (castPtr :: Ptr Widget -> Ptr RecentChooserWidget) $ + {# call gtk_recent_chooser_widget_new_for_manager #} + (toRecentManager manager) +#endif addfile ./gtk/Graphics/UI/Gtk/Recent/RecentFilter.chs.pp hunk ./gtk/Graphics/UI/Gtk/Recent/RecentFilter.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget RecentFilter +-- +-- Author : Andy Stewart +-- +-- Created: 27 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 filter for selecting a subset of recently used files +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.Recent.RecentFilter ( + +-- * Detail +-- +-- | A 'RecentFilter' can be used to restrict the files being shown in a +-- 'RecentChooser'. Files can be filtered based on their name (with +-- 'recentFilterAddPattern'), on their mime type (with +-- 'fileFilterAddMimeType'), on the application that has registered them (with +-- 'recentFilterAddApplication'), or by a custom filter function (with +-- 'recentFilterAddCustom'). +-- +-- Filtering by mime type handles aliasing and subclassing of mime types; +-- e.g. a filter for text\/plain also matches a file with mime type +-- application\/rtf, since application\/rtf is a subclass of text\/plain. Note +-- that 'RecentFilter' allows wildcards for the subtype of a mime type, so you +-- can e.g. filter for image\/. +-- +-- Normally, filters are used by adding them to a 'RecentChooser', see +-- 'recentChooserAddFilter', but it is also possible to manually use a filter +-- on a file with 'recentFilterFilter'. +-- +-- Recently used files are supported since Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----RecentFilter +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + RecentFilter, + RecentFilterClass, + castToRecentFilter, + toRecentFilter, + RecentFilterInfo, + +-- * Enums + RecentFilterFlags(..), + +-- * Constructors + recentFilterNew, + +-- * Methods + recentFilterGetName, + recentFilterSetName, + recentFilterAddMimeType, + recentFilterAddPattern, + recentFilterAddPixbufFormats, + recentFilterAddApplication, + recentFilterAddGroup, + recentFilterAddAge, + recentFilterAddCustom, + recentFilterGetNeeded, + recentFilterFilter, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Flags (Flags, toFlags, fromFlags) +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Types +{#pointer *RecentFilterInfo foreign newtype#} + +--------------------- +-- Enums +{#enum RecentFilterFlags {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-------------------- +-- Constructors + +-- | Creates a new 'RecentFilter' with no rules added to it. Such filter does +-- not accept any recently used resources, so is not particularly useful until +-- you add rules with 'recentFilterAddPattern', 'recentFilterAddMimeType', +-- 'recentFilterAddApplication', 'recentFilterAddAge'. To create a filter that +-- accepts any recently used resource, use: +-- +-- > FIXME: if the follwing is a C code example, port it to Haskell or remove it +-- > [_$_] +-- > GtkRecentFilter *filter = gtk_recent_filter_new (); +-- > gtk_recent_filter_add_pattern (filter, "*"); +-- +recentFilterNew :: IO RecentFilter +recentFilterNew = + makeNewObject mkRecentFilter $ + {# call gtk_recent_filter_new #} + +-------------------- +-- Methods + +recentFilterGetName :: RecentFilterClass self => self + -> IO String -- ^ returns the name of the filter, or {@NULL@, FIXME: this + -- should probably be converted to a Maybe data type}. The + -- returned string is owned by the filter object and should not + -- be freed. +recentFilterGetName self = + {# call gtk_recent_filter_get_name #} + (toRecentFilter self) + >>= peekUTFString + +recentFilterSetName :: RecentFilterClass self => self + -> String -- ^ @name@ - then human readable name of @filter@ + -> IO () +recentFilterSetName self name = + withUTFString name $ \namePtr -> + {# call gtk_recent_filter_set_name #} + (toRecentFilter self) + namePtr + +-- | Adds a rule that allows resources based on their registered MIME type. +-- +recentFilterAddMimeType :: RecentFilterClass self => self + -> String -- ^ @mimeType@ - a MIME type + -> IO () +recentFilterAddMimeType self mimeType = + withUTFString mimeType $ \mimeTypePtr -> + {# call gtk_recent_filter_add_mime_type #} + (toRecentFilter self) + mimeTypePtr + +-- | Adds a rule that allows resources based on a pattern matching their +-- display name. +-- +recentFilterAddPattern :: RecentFilterClass self => self + -> String -- ^ @pattern@ - a file pattern + -> IO () +recentFilterAddPattern self pattern = + withUTFString pattern $ \patternPtr -> + {# call gtk_recent_filter_add_pattern #} + (toRecentFilter self) + patternPtr + +-- | Adds a rule allowing image files in the formats supported by 'Pixbuf'. +-- +recentFilterAddPixbufFormats :: RecentFilterClass self => self -> IO () +recentFilterAddPixbufFormats self = + {# call gtk_recent_filter_add_pixbuf_formats #} + (toRecentFilter self) + +-- | Adds a rule that allows resources based on the name of the application +-- that has registered them. +-- +recentFilterAddApplication :: RecentFilterClass self => self + -> String -- ^ @application@ - an application name + -> IO () +recentFilterAddApplication self application = + withUTFString application $ \applicationPtr -> + {# call gtk_recent_filter_add_application #} + (toRecentFilter self) + applicationPtr + +-- | Adds a rule that allows resources based on the name of the group to which +-- they belong +-- +recentFilterAddGroup :: RecentFilterClass self => self + -> String -- ^ @group@ - a group name + -> IO () +recentFilterAddGroup self group = + withUTFString group $ \groupPtr -> + {# call gtk_recent_filter_add_group #} + (toRecentFilter self) + groupPtr + +-- | Adds a rule that allows resources based on their age - that is, the +-- number of days elapsed since they were last modified. +-- +recentFilterAddAge :: RecentFilterClass self => self + -> Int -- ^ @days@ - number of days + -> IO () +recentFilterAddAge self days = + {# call gtk_recent_filter_add_age #} + (toRecentFilter self) + (fromIntegral days) + +-- | Adds a rule to a filter that allows resources based on a custom callback +-- function. The bitfield @needed@ which is passed in provides information +-- about what sorts of information that the filter function needs; this allows +-- Gtk+ to avoid retrieving expensive information when it isn't needed by the +-- filter. +-- +recentFilterAddCustom :: RecentFilterClass self => self + -> RecentFilterFlags -- ^ @needed@ - bitfield of flags indicating the + -- information that the custom filter function + -- needs. + -> (IO Bool) + -> IO () +recentFilterAddCustom self needed func = do + fPtr <- mkRecentFilterFunc $ \_ _ -> liftM fromBool func [_$_] + {# call gtk_recent_filter_add_custom #} + (toRecentFilter self) + ((fromIntegral . fromEnum) needed) + fPtr + (castFunPtrToPtr fPtr) + destroyFunPtr + +{#pointer RecentFilterFunc#} + +foreign import ccall "wrapper" mkRecentFilterFunc :: + (Ptr RecentFilterInfo -> Ptr () -> IO {#type gboolean#}) + -> IO RecentFilterFunc + +-- | Gets the fields that need to be filled in for the structure passed to +-- 'recentFilterFilter' +-- +-- This function will not typically be used by applications; it is intended +-- principally for use in the implementation of 'RecentChooser'. +-- +recentFilterGetNeeded :: RecentFilterClass self => self + -> IO RecentFilterFlags -- ^ returns bitfield of flags indicating needed + -- fields when calling 'recentFilterFilter' +recentFilterGetNeeded self = [_$_] + liftM (toEnum . fromIntegral) $ [_$_] + {#call gtk_recent_filter_get_needed #} (toRecentFilter self) +-- recentFilterGetNeeded self = do + -- liftM (toFlags . fromIntegral) $ + -- restPtr <- {# call gtk_recent_filter_get_needed #} + -- (toRecentFilter self) + -- flagsList <- peekArray 0 restPtr + -- return flagsList + +-- | Tests whether a file should be displayed according to @filter@. The +-- {GtkRecentFilterInfo, FIXME: struct type} structure @filterInfo@ should +-- include the fields returned from 'recentFilterGetNeeded'. +-- +-- This function will not typically be used by applications; it is intended +-- principally for use in the implementation of 'RecentChooser'. +-- +recentFilterFilter :: RecentFilterClass self => self + -> RecentFilterInfo -- ^ @filterInfo@ - a {GtkRecentFilterInfo, + -- FIXME: struct type} structure containing + -- information about a recently used + -- resource + -> IO Bool -- ^ returns @True@ if the file should be + -- displayed +recentFilterFilter self filterInfo = + liftM toBool $ + {# call gtk_recent_filter_filter #} + (toRecentFilter self) + filterInfo + +#endif addfile ./gtk/Graphics/UI/Gtk/Recent/RecentInfo.chs.pp hunk ./gtk/Graphics/UI/Gtk/Recent/RecentInfo.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget RecentInfo +-- +-- Author : Andy Stewart +-- +-- Created: 27 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) +-- +-- +module Graphics.UI.Gtk.Recent.RecentInfo ( + +-- * Types + RecentInfo, + +-- * Methods + recentInfoExists, + recentInfoGetAdded, + recentInfoGetAge, + recentInfoGetApplicationInfo, + recentInfoGetApplications, + recentInfoGetDescription, + recentInfoGetDisplayName, + recentInfoGetGroups, + recentInfoGetIcon, + recentInfoGetMimeType, + recentInfoGetModified, + recentInfoGetPrivateHint, + recentInfoGetShortName, + recentInfoGetURI, + recentInfoGetURIDisplay, + recentInfoGetVisited, + recentInfoHasApplication, + recentInfoHasGroup, + recentInfoIsLocal, + recentInfoLastApplication, + recentInfoMatch, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.UTFString +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Types +{#pointer *RecentInfo foreign newtype#} + +-------------------- +-- Methods + +-- | +-- +recentInfoExists :: RecentInfo -> IO Bool +recentInfoExists self = + liftM toBool $ + {# call gtk_recent_info_exists #} + self + +-- | +-- +recentInfoGetAdded :: RecentInfo -> IO Int +recentInfoGetAdded self = + liftM fromIntegral $ + {# call gtk_recent_info_get_added #} + self + +-- | +-- +recentInfoGetAge :: RecentInfo -> IO Int +recentInfoGetAge self = + liftM fromIntegral $ + {# call gtk_recent_info_get_age #} + self + +-- | +-- +recentInfoGetApplicationInfo :: RecentInfo -> String -> IO (Maybe ([String], Int, Int)) +recentInfoGetApplicationInfo self appName = + alloca $ \countPtr -> + alloca $ \timePtr -> + allocaArray 0 $ \execPtr -> [_$_] + withUTFString appName $ \appNamePtr -> do + success <- liftM toBool $ + {# call gtk_recent_info_get_application_info #} + self + appNamePtr + execPtr + countPtr + timePtr + if success [_$_] + then do + exec <- mapM peekCString =<< peekArray 0 execPtr + count <- peek countPtr + time <- peek timePtr + return (Just (exec, fromIntegral count, fromIntegral time)) + else return Nothing + +-- | +-- +recentInfoGetApplications :: RecentInfo -> IO ([String], Int) +recentInfoGetApplications self = [_$_] + alloca $ \lengthPtr -> do + str <- {# call gtk_recent_info_get_applications #} self lengthPtr + application <- mapM peekCString =<< peekArray 0 str + length <- peek lengthPtr + return (application, fromIntegral length) + +-- | +-- +recentInfoGetDescription :: RecentInfo -> IO String +recentInfoGetDescription self = + {# call gtk_recent_info_get_description #} + self + >>= peekUTFString + +-- | +-- +recentInfoGetDisplayName :: RecentInfo -> IO String +recentInfoGetDisplayName self = + {# call gtk_recent_info_get_display_name #} + self + >>= peekUTFString + +-- | +-- +recentInfoGetGroups :: RecentInfo -> IO ([String], Int) +recentInfoGetGroups self = [_$_] + alloca $ \lengthPtr -> do + str <- {# call gtk_recent_info_get_groups #} self lengthPtr + group <- mapM peekCString =<< peekArray 0 str + length <- peek lengthPtr + return (group, fromIntegral length) + +-- | +-- +recentInfoGetIcon :: RecentInfo -> Int -> IO Pixbuf +recentInfoGetIcon self size = + makeNewGObject mkPixbuf $ + {# call gtk_recent_info_get_icon #} + self + (fromIntegral size) + +-- | +-- +recentInfoGetMimeType :: RecentInfo -> IO String +recentInfoGetMimeType self = + {# call gtk_recent_info_get_mime_type #} + self + >>= peekUTFString + +-- | +-- +recentInfoGetModified :: RecentInfo -> IO Int +recentInfoGetModified self = + liftM fromIntegral $ + {# call gtk_recent_info_get_modified #} + self + +-- | +-- +recentInfoGetPrivateHint :: RecentInfo -> IO Bool +recentInfoGetPrivateHint self = + liftM toBool $ + {# call gtk_recent_info_get_private_hint #} + self + +-- | +-- +recentInfoGetShortName :: RecentInfo -> IO String +recentInfoGetShortName self = + {# call gtk_recent_info_get_short_name #} + self + >>= readUTFString + +-- | +-- +recentInfoGetURI :: RecentInfo -> IO String +recentInfoGetURI self = + {# call gtk_recent_info_get_uri #} + self + >>= peekUTFString + +-- | +-- +recentInfoGetURIDisplay :: RecentInfo -> IO String +recentInfoGetURIDisplay self = + {# call gtk_recent_info_get_uri_display #} + self + >>= readUTFString + +-- | +-- +recentInfoGetVisited :: RecentInfo -> IO Int +recentInfoGetVisited self = + liftM fromIntegral $ + {# call gtk_recent_info_get_visited #} + self + +-- | +-- +recentInfoHasApplication :: RecentInfo -> String -> IO Bool +recentInfoHasApplication self appName = + liftM toBool $ + withUTFString appName $ \appNamePtr -> + {# call gtk_recent_info_has_application #} + self + appNamePtr + +-- | +-- +recentInfoHasGroup :: RecentInfo -> String -> IO Bool +recentInfoHasGroup self groupName = + liftM toBool $ + withUTFString groupName $ \groupNamePtr -> + {# call gtk_recent_info_has_group #} + self + groupNamePtr + +-- | +-- +recentInfoIsLocal :: RecentInfo -> IO Bool +recentInfoIsLocal self = + liftM toBool $ + {# call gtk_recent_info_is_local #} + self + +-- | +-- +recentInfoLastApplication :: RecentInfo -> IO String +recentInfoLastApplication self = + {# call gtk_recent_info_last_application #} + self + >>= readUTFString + +-- | +-- +recentInfoMatch :: RecentInfo -> RecentInfo -> IO Bool +recentInfoMatch self infoB = + liftM toBool $ + {# call gtk_recent_info_match #} + self + infoB addfile ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp hunk ./gtk/Graphics/UI/Gtk/Recent/RecentManager.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget RecentManager +-- +-- Author : Andy Stewart +-- +-- Created: 27 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) +-- +-- Managing Recently Used Files +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.Recent.RecentManager ( + +-- * Detail +-- +-- | 'RecentManager' provides a facility for adding, removing and looking up +-- recently used files. Each recently used file is identified by its URI, and +-- has meta-data associated to it, like the names and command lines of the +-- applications that have registered it, the number of time each application +-- has registered the same file, the mime type of the file and whether the file +-- should be displayed only by the applications that have registered it. +-- +-- The 'RecentManager' acts like a database of all the recently used files. +-- You can create new 'RecentManager' objects, but it is more efficient to use +-- the standard recent manager for the 'Screen' so that informations about the +-- recently used files is shared with other people using them. In case the +-- default screen is being used, adding a new recently used file is as simple +-- as: +-- +-- Recently used files are supported since Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----RecentManager +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + RecentManager, + RecentManagerClass, + castToRecentManager, + toRecentManager, + RecentData, + +-- * Constructors + recentManagerNew, + +-- * Methods + recentManagerGetDefault, + recentManagerAddItem, + recentManagerAddFull, + recentManagerRemoveItem, + -- recentManagerLookupItem, + recentManagerHasItem, + recentManagerMoveItem, + -- recentManagerGetItems, + recentManagerPurgeItems, + recentManagerErrorQuark, + +-- * Attributes + recentManagerFilename, + recentManagerLimit, + recentManagerSize, + +-- * Signals + recentManagerChanged, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.GList +import System.Glib.UTFString +import System.Glib.GObject (Quark, quarkFromString) +import System.Glib.GError (GErrorDomain, GErrorClass(..), propagateGError) +{#import Graphics.UI.Gtk.Recent.RecentInfo#} (RecentInfo) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) + +{#pointer *RecentData foreign newtype#} + +-------------------- +-- Constructors + +-- | Creates a new recent manager object. Recent manager objects are used to +-- handle the list of recently used resources. A 'RecentManager' object +-- monitors the recently used resources list, and emits the \"changed\" signal +-- each time something inside the list changes. +-- +recentManagerNew :: IO RecentManager +recentManagerNew = + constructNewGObject mkRecentManager $ + {# call gtk_recent_manager_new #} + +-------------------- +-- Methods + +-- | Gets a unique instance of 'RecentManager', that you can share in your +-- application without caring about memory management. The returned instance +-- will be freed when you application terminates. +-- +recentManagerGetDefault :: + IO RecentManager -- ^ returns A unique 'RecentManager'. Do not ref or + -- unref it. +recentManagerGetDefault = + makeNewGObject mkRecentManager $ + {# call gtk_recent_manager_get_default #} + +-- | Adds a new resource, pointed by @uri@, into the recently used resources +-- list. +-- +-- This function automatically retrieves some of the needed metadata and +-- setting other metadata to common default values; it then feeds the data to +-- 'recentManagerAddFull'. +-- +-- See 'recentManagerAddFull' if you want to explicitly define the metadata +-- for the resource pointed by @uri@. +-- +recentManagerAddItem :: RecentManagerClass self => self + -> String -- ^ @uri@ - a valid URI + -> IO Bool -- ^ returns @True@ if the new item was successfully added to the + -- recently used resources list +recentManagerAddItem self uri = + liftM toBool $ + withUTFString uri $ \uriPtr -> + {# call gtk_recent_manager_add_item #} + (toRecentManager self) + uriPtr + +-- | Adds a new resource, pointed by @uri@, into the recently used resources +-- list, using the metadata specified inside the {GtkRecentData, FIXME: struct +-- type} structure passed in @recentData@. +-- +-- The passed URI will be used to identify this resource inside the list. +-- +-- In order to register the new recently used resource, metadata about the +-- resource must be passed as well as the URI; the metadata is stored in a +-- {GtkRecentData, FIXME: struct type} structure, which must contain the MIME +-- type of the resource pointed by the URI; the name of the application that is +-- registering the item, and a command line to be used when launching the item. +-- +-- Optionally, a {GtkRecentData, FIXME: struct type} structure might contain +-- a UTF-8 string to be used when viewing the item instead of the last +-- component of the URI; a short description of the item; whether the item +-- should be considered private - that is, should be displayed only by the +-- applications that have registered it. +-- +recentManagerAddFull :: RecentManagerClass self => self + -> String -- ^ @uri@ - a valid URI + -> RecentData -- ^ @recentData@ - metadata of the resource + -> IO Bool -- ^ returns @True@ if the new item was + -- successfully added to the recently used + -- resources list, @False@ otherwise. +recentManagerAddFull self uri recentData = + liftM toBool $ + withUTFString uri $ \uriPtr -> + {# call gtk_recent_manager_add_full #} + (toRecentManager self) + uriPtr + recentData + +-- | Removes a resource pointed by @uri@ from the recently used resources list +-- handled by a recent manager. +-- +recentManagerRemoveItem :: RecentManagerClass self => self + -> String -- ^ @uri@ - the URI of the item you wish to remove + -> IO Bool -- ^ returns @True@ if the item pointed by @uri@ has been + -- successfully removed by the recently used resources list, and + -- @False@ otherwise. +recentManagerRemoveItem self uri = + liftM toBool $ + propagateGError $ \errorPtr -> + withUTFString uri $ \uriPtr -> + {# call gtk_recent_manager_remove_item #} + (toRecentManager self) + uriPtr + errorPtr + +-- | Searches for a URI inside the recently used resources list, and returns a +-- structure containing informations about the resource like its MIME type, or +-- its display name. +-- +-- recentManagerLookupItem :: RecentManagerClass self => self +-- -> String -- ^ @uri@ - a URI +-- -> IO RecentInfo -- ^ returns a {GtkRecentInfo, FIXME: boxed type} +-- -- structure containing information about the +-- -- resource pointed by @uri@, or {@NULL@, FIXME: this +-- -- should probably be converted to a Maybe data type} +-- -- if the URI was not registered in the recently used +-- -- resources list. Free with 'recentInfoUnref'. +-- recentManagerLookupItem self uri = +-- propagateGError $ \errorPtr -> +-- withUTFString uri $ \uriPtr -> do +-- result <- {# call unsafe gtk_recent_manager_lookup_item #} +-- (toRecentManager self) +-- uriPtr +-- errorPtr +-- makeNewRecentInfo result + +-- | Checks whether there is a recently used resource registered with @uri@ +-- inside the recent manager. +-- +recentManagerHasItem :: RecentManagerClass self => self + -> String -- ^ @uri@ - a URI + -> IO Bool -- ^ returns @True@ if the resource was found, @False@ otherwise. +recentManagerHasItem self uri = + liftM toBool $ + withUTFString uri $ \uriPtr -> + {# call gtk_recent_manager_has_item #} + (toRecentManager self) + uriPtr + +-- | Changes the location of a recently used resource from @uri@ to @newUri@. +-- +-- Please note that this function will not affect the resource pointed by +-- the URIs, but only the URI used in t... [truncated message content] |
From: Andy S. <And...@co...> - 2010-03-27 09:53:08
|
Sat Mar 27 05:52:10 EDT 2010 Andy Stewart <laz...@gm...> * Update all `Display` modules to Gtk+ 2.18.3 Ignore-this: bc4b7751282300d8dab998a53182cd57 hunk ./ApiUpdateTodoList.txt 71 -*** TODO InfoBar.chs +*** DONE InfoBar.chs hunk ./ApiUpdateTodoList.txt 210 -*** TODO Label.chs.pp -*** TODO ProgressBar.chs.pp -*** TODO Statusbar.chs +*** DONE Label.chs.pp +*** DONE ProgressBar.chs.pp +*** DONE Statusbar.chs hunk ./Makefile.am 637 + gtk/Graphics/UI/Gtk/Display/InfoBar.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 84 + module Graphics.UI.Gtk.Display.InfoBar, hunk ./gtk/Graphics/UI/Gtk.hs.pp 290 +import Graphics.UI.Gtk.Display.InfoBar addfile ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs.pp hunk ./gtk/Graphics/UI/Gtk/Display/InfoBar.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget InfoBar +-- +-- Author : Andy Stewart +-- +-- Created: 27 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. +-- +-- The following varargs functions can't bound: +-- gtk_info_bar_new_with_buttons +-- gtk_info_bar_add_buttons +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Report important messages to the user +-- +module Graphics.UI.Gtk.Display.InfoBar ( + +-- * Detail +-- +-- | 'InfoBar' is a widget that can be used to show messages to the user +-- without showing a dialog. It is often temporarily shown at the top or bottom +-- of a document. In contrast to 'Dialog', which has a horizontal action area +-- at the bottom, 'InfoBar' has a vertical action area at the side. +-- +-- The API of 'InfoBar' is very similar to 'Dialog', allowing you to add +-- buttons to the action area with 'infoBarAddButton' or +-- 'infoBarNewWithButtons'. The sensitivity of action widgets can be controlled +-- with 'infoBarSetResponseSensitive'. To add widgets to the main content area +-- of a 'InfoBar', use 'infoBarGetContentArea' and add your widgets to the +-- container. +-- +-- Similar to 'MessageDialog', the contents of a 'InfoBar' can by classified +-- as error message, warning, informational message, etc, by using +-- 'infoBarSetMessageType'. Gtk+ uses the message type to determine the +-- background color of the message area. +-- +-- * Simple GtkInfoBar usage. +-- +-- > FIXME: if the follwing is a C code example, port it to Haskell or remove it +-- > [_$_] +-- > /* set up info bar */ +-- > info_bar = gtk_info_bar_new (); +-- > gtk_widget_set_no_show_all (info_bar, TRUE); +-- > message_label = gtk_label_new (""); +-- > gtk_widget_show (message_label); +-- > content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar)); +-- > gtk_container_add (GTK_CONTAINER (content_area), message_label); +-- > gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), +-- > GTK_STOCK_OK, GTK_RESPONSE_OK); +-- > g_signal_connect (info_bar, "response", +-- > G_CALLBACK (gtk_widget_hide), NULL); +-- > gtk_table_attach (GTK_TABLE (table), +-- > info_bar, +-- > 0, 1, 2, 3, +-- > GTK_EXPAND | GTK_FILL, 0, +-- > 0, 0); +-- > [_$_] +-- > /* ... */ +-- > [_$_] +-- > /* show an error message */ +-- > gtk_label_set_text (GTK_LABEL (message_label), error_message); +-- > gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), +-- > GTK_MESSAGE_ERROR); +-- > gtk_widget_show (info_bar); +-- +-- '{FIXME: gtk-doc cross reference to:}' + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Container' +-- | +----'Box' +-- | +----'HBox' +-- | +----InfoBar +-- @ + +-- * Types + InfoBar, + InfoBarClass, + castToInfoBar, + toInfoBar, + +-- * Constructors +#if GTK_CHECK_VERSION(2,18,0) + infoBarNew, +#endif + +-- * Methods +#if GTK_CHECK_VERSION(2,18,0) + infoBarAddActionWidget, + infoBarAddButton, + infoBarSetResponseSensitive, + infoBarSetDefaultResponse, + infoBarResponse, + infoBarGetActionArea, + infoBarGetContentArea, +#endif + +-- * Attributes + infoBarMessageType, + +-- * Signals +#if GTK_CHECK_VERSION(2,18,0) + ibResponse, + ibClose, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +import Graphics.UI.Gtk.Windows.MessageDialog (MessageType) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Interfaces + +-- instance BuildableClass InfoBar + +-------------------- +-- Constructors + +#if GTK_CHECK_VERSION(2,18,0) +-- | Creates a new 'InfoBar' object. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarNew :: IO InfoBar +infoBarNew = + makeNewObject mkInfoBar $ + liftM (castPtr :: Ptr Widget -> Ptr InfoBar) $ + {# call gtk_info_bar_new #} +#endif + +-------------------- +-- Methods + +#if GTK_CHECK_VERSION(2,18,0) +-- | Add an activatable widget to the action area of a 'InfoBar', connecting a +-- signal handler that will emit the {\"response\", FIXME: unknown type\/value} +-- signal on the message area when the widget is activated. The widget is +-- appended to the end of the message areas action area. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarAddActionWidget :: (InfoBarClass self, WidgetClass child) => self + -> child -- ^ @child@ - an activatable widget + -> Int -- ^ @responseId@ - response ID for @child@ + -> IO () +infoBarAddActionWidget self child responseId = + {# call gtk_info_bar_add_action_widget #} + (toInfoBar self) + (toWidget child) + (fromIntegral responseId) + +-- | Adds a button with the given text (or a stock button, if button_text is a +-- stock ID) and sets things up so that clicking the button will emit the +-- \"response\" signal with the given response_id. The button is appended to +-- the end of the info bars's action area. The button widget is returned, but +-- usually you don't need it. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarAddButton :: InfoBarClass self => self + -> String -- ^ @buttonText@ - text of button, or stock ID + -> Int -- ^ @responseId@ - response ID for the button + -> IO Widget -- ^ returns the button widget that was added +infoBarAddButton self buttonText responseId = + makeNewObject mkWidget $ + withUTFString buttonText $ \buttonTextPtr -> + {# call gtk_info_bar_add_button #} + (toInfoBar self) + buttonTextPtr + (fromIntegral responseId) + +-- | Calls gtk_widget_set_sensitive (widget, setting) for each widget in the +-- info bars's action area with the given response_id. A convenient way to +-- sensitize\/desensitize dialog buttons. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarSetResponseSensitive :: InfoBarClass self => self + -> Int -- ^ @responseId@ - a response ID + -> Bool -- ^ @setting@ - @True@ for sensitive + -> IO () +infoBarSetResponseSensitive self responseId setting = + {# call gtk_info_bar_set_response_sensitive #} + (toInfoBar self) + (fromIntegral responseId) + (fromBool setting) + +-- | Sets the last widget in the info bar's action area with the given +-- response_id as the default widget for the dialog. Pressing \"Enter\" +-- normally activates the default widget. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarSetDefaultResponse :: InfoBarClass self => self + -> Int -- ^ @responseId@ - a response ID + -> IO () +infoBarSetDefaultResponse self responseId = + {# call gtk_info_bar_set_default_response #} + (toInfoBar self) + (fromIntegral responseId) + +-- | Emits the \'response\' signal with the given @responseId@. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarResponse :: InfoBarClass self => self + -> Int -- ^ @responseId@ - a response ID + -> IO () +infoBarResponse self responseId = + {# call gtk_info_bar_response #} + (toInfoBar self) + (fromIntegral responseId) + +-- | Returns the action area of @infoBar@. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarGetActionArea :: InfoBarClass self => self + -> IO Widget -- ^ returns the action area. +infoBarGetActionArea self = + makeNewObject mkWidget $ + {# call gtk_info_bar_get_action_area #} + (toInfoBar self) + +-- | Returns the content area of @infoBar@. +-- +-- * Available since Gtk+ version 2.18 +-- +infoBarGetContentArea :: InfoBarClass self => self + -> IO Widget -- ^ returns the content area. +infoBarGetContentArea self = + makeNewObject mkWidget $ + {# call gtk_info_bar_get_content_area #} + (toInfoBar self) +#endif + +-------------------- +-- Attributes + +-- | +-- +infoBarMessageType :: InfoBarClass self => Attr self MessageType +infoBarMessageType = newAttrFromEnumProperty "message-type" + {# call pure unsafe gtk_message_type_get_type #} + +-------------------- +-- Signals + +#if GTK_CHECK_VERSION(2,18,0) +-- | The 'close' signal is a keybinding signal which gets emitted when the user uses a keybinding to +-- dismiss the info bar. +-- [_$_] +-- The default binding for this signal is the Escape key. +-- [_$_] +-- Since 2.18 +ibClose :: InfoBarClass self => Signal self (IO ()) +ibClose = Signal (connect_NONE__NONE "close") + [_$_] + +-- | Emitted when an action widget is clicked or the application programmer +-- calls 'dialogResponse'. The @responseId@ depends on which action widget was +-- clicked. +-- +-- * Available since Gtk+ version 2.18 +-- +ibResponse :: InfoBarClass self => Signal self (Int -> IO ()) +ibResponse = Signal (connect_INT__NONE "response") +#endif + hunk ./gtk/Graphics/UI/Gtk/Display/Label.chs.pp 28 +-- The following functions don't bind, use correspond attributes instead: +-- gtk_label_set_track_visited_links +-- gtk_label_get_track_visited_links +-- hunk ./gtk/Graphics/UI/Gtk/Display/Label.chs.pp 171 +#if GTK_CHECK_VERSION(2,18,0) + labelGetCurrentURI, +#endif hunk ./gtk/Graphics/UI/Gtk/Display/Label.chs.pp 188 +#if GTK_CHECK_VERSION(2,18,0) + labelTrackVisitedLinks, +#endif hunk ./gtk/Graphics/UI/Gtk/Display/Label.chs.pp 201 + +-- * Signal + activateCurrentLink, + activateLink, + labelCopyClipboard, + labelMoveCursor, + labelPopulatePopup, hunk ./gtk/Graphics/UI/Gtk/Display/Label.chs.pp 221 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/Display/Label.chs.pp 224 -import Graphics.UI.Gtk.General.Enums (Justification(..)) +import Graphics.UI.Gtk.General.Enums (Justification(..), MovementStep(..)) hunk ./gtk/Graphics/UI/Gtk/Display/Label.chs.pp 735 +#if GTK_CHECK_VERSION(2,18,0) +-- | Returns the URI for the currently active link in the label. The active link is the one under the +-- mouse pointer or, in a selectable label, the link in which the text cursor is currently positioned. +-- [_$_] +-- This function is intended for use in a 'linkActivate' handler or for use in a 'queryTooltip' +-- handler. +-- +-- * Available since Gtk+ version 2.18 +-- +labelGetCurrentURI :: LabelClass self => self + -> IO String -- ^ returns the currently active URI. The string is owned by + -- Gtk+ and must not be freed or modified. +labelGetCurrentURI self = + {# call gtk_label_get_current_uri #} + (toLabel self) + >>= peekUTFString +#endif + hunk ./gtk/Graphics/UI/Gtk/Display/Label.chs.pp 889 +#if GTK_CHECK_VERSION(2,18,0) +-- | Set this property to 'True' to make the label track which links have been clicked. It will then apply +-- the 'visitedLinkColor' color, instead of 'linkColor'. +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.18 +labelTrackVisitedLinks :: LabelClass self => Attr self Bool +labelTrackVisitedLinks = newAttrFromBoolProperty "track-visited-links" +#endif + hunk ./gtk/Graphics/UI/Gtk/Display/Label.chs.pp 995 + +---------------- +-- Signals +-- | A keybinding signal which gets emitted when the user activates a link in the label. +-- [_$_] +-- Applications may also emit the signal with 'signalEmitByName' if they need to control +-- activation of URIs programmatically. +-- [_$_] +-- The default bindings for this signal are all forms of the Enter key. +-- [_$_] +-- Since 2.18 +activateCurrentLink :: LabelClass self => Signal self (IO ()) +activateCurrentLink = Signal (connect_NONE__NONE "activate-current-link") + [_$_] +-- | The signal which gets emitted to activate a URI. Applications may connect to it to override the +-- default behaviour, which is to call 'showUri'. +-- [_$_] +-- Since 2.18 +activateLink :: LabelClass self => Signal self (String -> IO Bool) +activateLink = Signal (connect_STRING__BOOL "activate-link") + [_$_] +-- | The 'labelCopyClipboard' signal is a keybinding signal which gets emitted to copy the selection to the +-- clipboard. +-- [_$_] +-- The default binding for this signal is Ctrl-c. +labelCopyClipboard :: LabelClass self => Signal self (IO ()) +labelCopyClipboard = Signal (connect_NONE__NONE "copy-clipboard") + +-- | The 'labelMoveCursor' signal is a keybinding signal which gets emitted when the user initiates a cursor +-- movement. If the cursor is not visible in entry, this signal causes the viewport to be moved +-- instead. +-- [_$_] +-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to +-- control the cursor programmatically. +-- [_$_] +-- The default bindings for this signal come in two variants, the variant with the Shift modifier +-- extends the selection, the variant without the Shift modifer does not. There are too many key +-- combinations to list them all here. +-- [_$_] +-- [_\e2_][_\97_][_\8f_] Arrow keys move by individual characters/lines [_$_] +-- [_\e2_][_\97_][_\8f_] Ctrl-arrow key combinations move by words/paragraphs [_$_] +-- [_\e2_][_\97_][_\8f_] Home/End keys move to the ends of the buffer +labelMoveCursor :: LabelClass self => Signal self (MovementStep -> Int -> Bool -> IO ()) +labelMoveCursor = Signal (connect_ENUM_INT_BOOL__NONE "move-cursor") + +-- | The 'labelPopulatePopup' signal gets emitted before showing the context menu of the label. Note that +-- only selectable labels have context menus. +-- [_$_] +-- If you need to add items to the context menu, connect to this signal and append your menuitems to +-- the menu. +labelPopulatePopup :: LabelClass self => Signal self (Menu -> IO ()) +labelPopulatePopup = Signal (connect_OBJECT__NONE "populate-popup") hunk ./gtk/Graphics/UI/Gtk/Display/ProgressBar.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Display/ProgressBar.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/Display/ProgressBar.chs.pp 55 +-- hunk ./gtk/Graphics/UI/Gtk/Display/ProgressBar.chs.pp 310 + hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 8 --- Copyright (C) 2007 Axel Simon +-- Copyright (C) 2007-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 29 +-- The following functions don't bind, use corresponding attributes instead: +-- gtk_status_icon_set_screen +-- gtk_status_icon_get_screen +-- gtk_status_icon_set_tooltip_text +-- gtk_status_icon_get_tooltip_text +-- gtk_status_icon_set_tooltip_markup +-- gtk_status_icon_get_tooltip_markup +-- gtk_status_icon_set_has_tooltip +-- gtk_status_icon_get_has_tooltip +-- gtk_status_icon_set_title +-- gtk_status_icon_get_title +-- gtk_status_icon_set_visible +-- gtk_status_icon_get_visible +-- gtk_status_icon_set_blinking +-- gtk_status_icon_get_blinking +-- hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 111 +#if GTK_CHECK_VERSION(2,14,0) + statusIconGetX11WindowId, +#endif hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 125 + statusIconScreen, + statusIconEmbedded, + statusIconOrientation, + statusIconHasTooltip, + statusIconTooltipText, + statusIconTooltipMarkup, + statusIconTitle, + hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 137 + statusIconButtonPressEvent, + statusIconButtonReleaseEvent, + statusIconQueryTooltip, + statusIconScrollEvent, hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 487 +#if GTK_CHECK_VERSION(2,14,0) +-- | This function is only useful on the X11\/freedesktop.org platform. It +-- returns a window ID for the widget in the underlying status icon +-- implementation. This is useful for the Galago notification service, which +-- can send a window ID in the protocol in order for the server to position +-- notification windows pointing to a status icon reliably. +-- +-- This function is not intended for other use cases which are more likely +-- to be met by one of the non-X11 specific methods, such as +-- 'statusIconPositionMenu'. +-- +-- * Available since Gtk+ version 2.14 +-- +statusIconGetX11WindowId :: StatusIconClass self => self + -> IO Int -- ^ returns An 32 bit unsigned integer identifier for the + -- underlying X11 Window +statusIconGetX11WindowId self = + liftM fromIntegral $ + {# call gtk_status_icon_get_x11_window_id #} + (toStatusIcon self) +#endif hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 578 +-- | The screen where this status icon will be displayed. +statusIconScreen :: StatusIconClass self => Attr self Screen +statusIconScreen = newAttrFromObjectProperty "screen" + {# call pure unsafe gdk_screen_get_type #} + +-- | 'True' if the statusicon is embedded in a notification area. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.12 +statusIconEmbedded :: StatusIconClass self => ReadAttr self Bool +statusIconEmbedded = readAttrFromBoolProperty "embedded" + +-- | The orientation of the tray in which the statusicon is embedded. +-- [_$_] +-- Default value: ''OrientationHorizontal'' +-- [_$_] +-- Since 2.12 +statusIconOrientation :: StatusIconClass self => ReadAttr self Orientation +statusIconOrientation = readAttrFromEnumProperty "orientation" + {# call pure unsafe gtk_orientation_get_type #} + +-- | Enables or disables the emission of 'queryTooltip' on @statusIcon@. A value of 'True' indicates that +-- @statusIcon@ can have a tooltip, in this case the status icon will be queried using 'queryTooltip' +-- to determine whether it will provide a tooltip or not. +-- [_$_] +-- Note that setting this property to 'True' for the first time will change the event masks of the +-- windows of this status icon to include leave-notify and motion-notify events. This will not be +-- undone when the property is set to 'False' again. +-- [_$_] +-- Whether this property is respected is platform dependent. For plain text tooltips, use +-- 'tooltipText' in preference. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.16 +statusIconHasTooltip :: StatusIconClass self => Attr self Bool +statusIconHasTooltip = newAttrFromBoolProperty "has-tooltip" + +-- | Sets the text of tooltip to be the given string. +-- [_$_] +-- Also see 'tooltipSetText'. +-- [_$_] +-- This is a convenience property which will take care of getting the tooltip shown if the given string +-- is not 'Nothing'. 'hasTooltip' will automatically be set to 'True' and the default handler for the +-- 'queryTooltip' signal will take care of displaying the tooltip. +-- [_$_] +-- Note that some platforms have limitations on the length of tooltips that they allow on status icons, +-- e.g. Windows only shows the first 64 characters. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +statusIconTooltipText :: StatusIconClass self => Attr self String +statusIconTooltipText = newAttrFromStringProperty "tooltip-text" + +-- | Sets the text of tooltip to be the given string, which is marked up with the Pango text markup +-- language. Also see 'tooltipSetMarkup' . +-- [_$_] +-- This is a convenience property which will take care of getting the tooltip shown if the given string +-- is not 'Nothing'. 'hasTooltip' will automatically be set to 'True' and the default handler for the +-- 'queryTooltip' signal will take care of displaying the tooltip. +-- [_$_] +-- On some platforms, embedded markup will be ignored. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +statusIconTooltipMarkup :: StatusIconClass self => Attr self String +statusIconTooltipMarkup = newAttrFromStringProperty "tooltip-markup" + +-- | The title of this tray icon. This should be a short, human-readable, localized string describing the +-- tray icon. It may be used by tools like screen readers to render the tray icon. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.18 +statusIconTitle :: StatusIconClass self => Attr self String +statusIconTitle = newAttrFromStringProperty "title" + hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 686 +-- | The 'buttonPressEvent' signal will be emitted when a button (typically from a mouse) is pressed. +-- [_$_] +-- Whether this event is emitted is platform-dependent. Use the 'activate' and 'popupMenu' signals in +-- preference. +-- [_$_] +-- Since 2.14 +statusIconButtonPressEvent :: StatusIconClass self => Signal self (Event -> IO Bool) +statusIconButtonPressEvent = Signal (connect_BOXED__BOOL "button_press_event" marshalEvent) + +-- | The 'buttonReleaseEvent' signal will be emitted when a button (typically from a mouse) is +-- released. +-- [_$_] +-- Whether this event is emitted is platform-dependent. Use the 'activate' and 'popupMenu' signals in +-- preference. +-- [_$_] +-- Since 2.14 +statusIconButtonReleaseEvent :: StatusIconClass self => Signal self (Event -> IO Bool) +statusIconButtonReleaseEvent = Signal (connect_BOXED__BOOL "button_release_event" marshalEvent) + +-- | The 'scrollEvent' signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are +-- usually configured to generate button press events for buttons 4 and 5 when the wheel is turned. +-- [_$_] +-- Whether this event is emitted is platform-dependent. +statusIconScrollEvent :: StatusIconClass self => Signal self (Event -> IO Bool) +statusIconScrollEvent = Signal (connect_BOXED__BOOL "scroll_event" marshalEvent) + +-- | Emitted when the 'gtkTooltipTimeout' has expired with the cursor hovering above @statusIcon@; or +-- emitted when @statusIcon@ got focus in keyboard mode. +-- [_$_] +-- Using the given coordinates, the signal handler should determine whether a tooltip should be shown +-- for @statusIcon@. If this is the case 'True' should be returned, 'False' otherwise. Note that if +-- @keyboardMode@ is 'True', the values of x and y are undefined and should not be used. +-- [_$_] +-- The signal handler is free to manipulate tooltip with the therefore destined function calls. +-- [_$_] +-- Whether this signal is emitted is platform-dependent. For plain text tooltips, use 'tooltipText' in +-- preference. +-- [_$_] +-- Since 2.16 +statusIconQueryTooltip :: StatusIconClass self => Signal self (Int -> Int -> Bool -> Tooltip -> IO Bool) +statusIconQueryTooltip = Signal (connect_INT_INT_BOOL_OBJECT__BOOL "query-tooltip") + [_$_] hunk ./gtk/Graphics/UI/Gtk/Display/Statusbar.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Display/Statusbar.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/Display/Statusbar.chs.pp 58 +-- hunk ./tools/hierarchyGen/hierarchy.list 123 + GtkInfoBar |
From: Andy S. <And...@co...> - 2010-03-27 04:10:09
|
Sat Mar 27 00:04:20 EDT 2010 Andy Stewart <laz...@gm...> * Apply Sergei Trofimovich's patch to add missing _stub.o files in Makefile.am Ignore-this: 9c74e06f876950dd687e512ae9f2407d hunk ./Makefile.am 457 - gio/System/GIO/Base_stub.o + gio/System/GIO/Base_stub.o \ + gio/System/GIO/File_stub.o hunk ./Makefile.am 875 + gtk/Graphics/UI/Gtk/ModelView/TreeViewColumn_stub.o \ hunk ./Makefile.am 893 +if HAVE_GTK_VERSION_2_10 +libHSgtk_a_LIBADD += \ + gtk/Graphics/UI/Gtk/Buttons/LinkButton_stub.o \ + gtk/Graphics/UI/Gtk/Layout/Notebook_stub.o \ + gtk/Graphics/UI/Gtk/Multiline/TextBuffer_stub.o \ + gtk/Graphics/UI/Gtk/Windows/Assistant_stub.o +endif + +if HAVE_GTK_VERSION_2_14 +libHSgtk_a_LIBADD += \ + gtk/Graphics/UI/Gtk/Misc/Calendar_stub.o +endif + hunk ./configure.ac 481 +HAVE_GTK_VERSION_2_14=`$PKG_CONFIG gtk+-2.0 --atleast-version=2.14 && echo yes || echo no` hunk ./configure.ac 489 +AM_CONDITIONAL(HAVE_GTK_VERSION_2_14, test "$HAVE_GTK_VERSION_2_14" = "yes") hunk ./configure.ac 497 +CREATE_TYPES="$CREATE_TYPES `test "$HAVE_GTK_VERSION_2_14" = "yes" && echo gtk-2.14`" |
From: Andy S. <And...@co...> - 2010-03-26 20:07:46
|
Fri Mar 26 16:06:17 EDT 2010 Andy Stewart <laz...@gm...> * Update all `ModelView` modules to Gtk+ 2.18.3 Ignore-this: 6bf56ab0074d24542c2d825ee3c0f074 hunk ./ApiUpdateTodoList.txt 31 -*** TODO CellEditable.chs -*** TODO CellRendererAccel.chs -*** TODO CellRendererSpin.chs +*** DONE CellEditable.chs +*** DONE CellRendererAccel.chs +*** DONE CellRendererSpin.chs hunk ./ApiUpdateTodoList.txt 283 + hunk ./ApiUpdateTodoList.txt 285 -*** TODO CellLayout.chs.pp -*** TODO CellRendererCombo.chs.pp -*** TODO CellRendererProgress.chs.pp -*** TODO TreeSortable.chs.pp +*** DONE CellLayout.chs.pp +*** TODO CellRenderer.chs.pp +*** DONE CellRendererCombo.chs.pp +*** TODO CellRendererPixbuf.chs.pp +*** DONE CellRendererProgress.chs.pp +*** TODO CellRendererText.chs.pp +*** DONE CellRendererToggle.chs.pp +*** DONE CellView.chs.pp +*** DONE CustomStore.chs +*** TODO IconView.chs.pp +*** TODO ListStore.hs.pp +*** TODO ListStoreStatic.hs +*** DONE Sequence.hs.pp +*** DONE TreeDrag.chs +*** DONE TreeModel.chs.pp +*** DONE TreeModelFilter.chs.pp +*** DONE TreeModelSort.chs.pp +*** DONE TreeRowReference.chs.pp +*** DONE TreeSelection.chs.pp +*** DONE TreeSortable.chs.pp +*** TODO TreeStore.hs +*** TODO TreeStoreStatic.hs +*** TODO TreeView.chs.pp +*** DONE TreeViewColumn.chs.pp hunk ./ApiUpdateTodoList.txt 342 -** TODO Directory: gtk-modules/Graphics/UI/Gtk/TreeList -*** TODO CellRenderer.hs -*** TODO CellRendererPixbuf.chs -*** TODO CellRendererText.chs -*** TODO CellRendererToggle.chs -*** TODO CellView.chs.pp -*** TODO IconView.chs.pp -*** TODO ListStore.chs.pp -*** TODO TreeIter.chs.pp -*** TODO TreeModel.chs.pp -*** TODO TreeModelSort.chs.pp -*** TODO TreePath.chs.pp -*** TODO TreeRowReference.chs.pp -*** TODO TreeSelection.chs.pp -*** TODO TreeStore.chs.pp -*** TODO TreeView.chs.pp -*** TODO TreeViewColumn.chs.pp +** DEPRECATED Directory: gtk-modules/Graphics/UI/Gtk/TreeList +*** DEPRECATED CellRenderer.hs +*** DEPRECATED CellRendererPixbuf.chs +*** DEPRECATED CellRendererText.chs +*** DEPRECATED CellRendererToggle.chs +*** DEPRECATED CellView.chs.pp +*** DEPRECATED IconView.chs.pp +*** DEPRECATED ListStore.chs.pp +*** DEPRECATED TreeIter.chs.pp +*** DEPRECATED TreeModel.chs.pp +*** DEPRECATED TreeModelSort.chs.pp +*** DEPRECATED TreePath.chs.pp +*** DEPRECATED TreeRowReference.chs.pp +*** DEPRECATED TreeSelection.chs.pp +*** DEPRECATED TreeStore.chs.pp +*** DEPRECATED TreeView.chs.pp +*** DEPRECATED TreeViewColumn.chs.pp hunk ./Makefile.am 757 + gtk/Graphics/UI/Gtk/ModelView/CellRendererAccel.chs.pp \ + gtk/Graphics/UI/Gtk/ModelView/CellRendererSpin.chs.pp \ hunk ./Makefile.am 760 + gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 116 + module Graphics.UI.Gtk.ModelView.CellRendererAccel, + module Graphics.UI.Gtk.ModelView.CellRendererSpin, hunk ./gtk/Graphics/UI/Gtk.hs.pp 119 + module Graphics.UI.Gtk.ModelView.CellEditable, hunk ./gtk/Graphics/UI/Gtk.hs.pp 331 +import Graphics.UI.Gtk.ModelView.CellRendererAccel +import Graphics.UI.Gtk.ModelView.CellRendererSpin hunk ./gtk/Graphics/UI/Gtk.hs.pp 334 +import Graphics.UI.Gtk.ModelView.CellEditable addfile ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp hunk ./gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Interface CellEditable +-- +-- Author : Andy Stewart +-- +-- Created: 26 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) +-- +-- Interface for widgets which can are used for editing cells +-- +module Graphics.UI.Gtk.ModelView.CellEditable ( + +-- * Detail +-- +-- | The 'CellEditable' interface must be implemented for widgets to be usable +-- when editing the contents of a 'TreeView' cell. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GInterface' +-- | +----CellEditable +-- @ + +-- * Types + CellEditable, + CellEditableClass, + castToCellEditable, + toCellEditable, + +-- * Methods + -- cellEditableStartEditing, + cellEditableEditingDone, + cellEditableRemoveWidget, + +-- * Signals + editingDone, + removeWidget, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Methods + +-- | Begins editing on a @cellEditable@. @event@ is the {GdkEvent, FIXME: +-- unknown type\/value} that began the editing process. It may be {@NULL@, +-- FIXME: this should probably be converted to a Maybe data type}, in the +-- instance that editing was initiated through programatic means. +-- +-- cellEditableStartEditing :: CellEditableClass self => self +-- -> {-GdkEvent*-} -- ^ @event@ - A {GdkEvent, FIXME: unknown type\/value}, or +-- -- {@NULL@, FIXME: this should probably be converted to a +-- -- Maybe data type} +-- -> IO () +-- cellEditableStartEditing self event = +-- {# call gtk_cell_editable_start_editing #} +-- (toCellEditable self) +-- {-event-} + +-- | Emits the {\"editing-done\", FIXME: unknown type\/value} signal. +-- +cellEditableEditingDone :: CellEditableClass self => self -> IO () +cellEditableEditingDone self = + {# call gtk_cell_editable_editing_done #} + (toCellEditable self) + +-- | Emits the {\"remove-widget\", FIXME: unknown type\/value} signal. +-- +cellEditableRemoveWidget :: CellEditableClass self => self -> IO () +cellEditableRemoveWidget self = + {# call gtk_cell_editable_remove_widget #} + (toCellEditable self) + +-------------------- +-- Signals + +-- | This signal is a sign for the cell renderer to update its value from the +-- @cellEditable@. +-- +-- Implementations of 'CellEditable' are responsible for emitting this +-- signal when they are done editing, e.g. 'Entry' is emitting it when the user +-- presses Enter. +-- +-- 'cellEditableEditingDone' is a convenience method for emitting +-- ::editing-done. +-- +editingDone :: CellEditableClass self => Signal self (IO ()) +editingDone = Signal (connect_NONE__NONE "editing-done") + +-- | This signal is meant to indicate that the cell is finished editing, and +-- the widget may now be destroyed. +-- +-- Implementations of 'CellEditable' are responsible for emitting this +-- signal when they are done editing. It must be emitted after the +-- {\"editing-done\", FIXME: unknown type\/value} signal, to give the cell +-- renderer a chance to update the cell's value before the widget is removed. +-- +-- 'cellEditableRemoveWidget' is a convenience method for emitting +-- ::remove-widget. +-- +removeWidget :: CellEditableClass self => Signal self (IO ()) +removeWidget = Signal (connect_NONE__NONE "remove-widget") hunk ./gtk/Graphics/UI/Gtk/ModelView/CellLayout.chs.pp 8 --- Copyright (C) 2006 Axel Simon +-- Copyright (C) 2006-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/ModelView/CellLayout.chs.pp 33 + hunk ./gtk/Graphics/UI/Gtk/ModelView/CellLayout.chs.pp 40 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 27 +-- The following functoins don't bind, use corresponding attributes instead +-- gtk_cell_renderer_get_visible +-- gtk_cell_renderer_set_visible +-- gtk_cell_renderer_get_sensitive +-- gtk_cell_renderer_set_sensitive +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 73 - CellRendererMode, + +-- * Enums + CellRendererState(..), + CellRendererMode(..), hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 84 + cellRendererGetSize, + cellRendererRender, + -- cellRendererActivate, + -- cellRendererStartEditing, +#if GTK_CHECK_VERSION(2,18,0) + cellRendererGetAlignment, + cellRendererSetAlignment, + cellRendererGetPadding, + cellRendererSetPadding, +#endif hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 108 + cellBackgroundGdk, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 111 + cellRendererEditing, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 134 +import Control.Monad (liftM) + hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 137 -import System.Glib.Attributes ( Attr, WriteAttr ) +import System.Glib.Attributes ( Attr, WriteAttr, ReadAttr ) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 139 +import System.Glib.UTFString +import Graphics.UI.Gtk.General.Structs (Rectangle) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 148 -{# enum CellRendererMode {underscoreToCase} deriving (Eq) #} - +{# enum CellRendererState {underscoreToCase} deriving (Bounded, Eq, Show) #} +{# enum CellRendererMode {underscoreToCase} deriving (Bounded,Eq,Show) #} hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 197 +-- | Obtains the width and height needed to render the cell. Used by view widgets to determine the +-- appropriate size for the @cellArea@ passed to 'cellRendererRender'. [_$_] +-- [_$_] +-- Please note that the values set in width and height, as well as those in @xOffset@ and @yOffset@ are +-- inclusive of the xpad and ypad properties. +cellRendererGetSize :: (CellRendererClass self, WidgetClass widget) => self -> widget + -> Rectangle + -> IO (Int, Int, Int, Int) +cellRendererGetSize self widget area = [_$_] + with area $ \ areaPtr -> [_$_] + alloca $ \xPtr -> + alloca $ \yPtr -> + alloca $ \wPtr -> + alloca $ \hPtr -> do + {#call cell_renderer_get_size#} + (toCellRenderer self) + (toWidget widget) + (castPtr areaPtr) + (castPtr xPtr) + (castPtr yPtr) + (castPtr wPtr) + (castPtr hPtr) + x <- peek xPtr + y <- peek yPtr + w <- peek wPtr + h <- peek hPtr + return (x, y, w, h) + +-- | Invokes the virtual render function of the 'CellRenderer'. The three passed-in rectangles are areas +-- of window. Most renderers will draw within @cellArea@; the xalign, yalign, xpad, and ypad fields of +-- the 'CellRenderer' should be honored with respect to @cellArea@. @backgroundArea@ includes the blank +-- space around the cell, and also the area containing the tree expander; so the @backgroundArea@ +-- rectangles for all cells tile to cover the entire window. @exposeArea@ is a clip rectangle. +cellRendererRender :: (CellRendererClass self, WidgetClass widget) => + self + -> DrawWindow + -> widget + -> Rectangle + -> Rectangle + -> Rectangle + -> CellRendererState + -> IO () +cellRendererRender self win widget background cell expose flags = [_$_] + with background $ \backgroundPtr -> + with cell $ \cellPtr -> + with expose $ \exposePtr -> + {#call cell_renderer_render#} + (toCellRenderer self) + win + (toWidget widget) + (castPtr backgroundPtr) + (castPtr cellPtr) + (castPtr exposePtr) + ((fromIntegral . fromEnum) flags) + +-- | Passes an activate event to the cell renderer for possible processing. Some cell renderers may use +-- events; for example, 'CellRendererToggle' toggles when it gets a mouse click. +-- cellRendererActivate :: (CellRendererClass self, WidgetClass widget) => [_$_] +-- cell +-- -> Event +-- -> widget +-- -> String +-- -> Rectangle +-- -> Rectangle +-- -> CellRendererState +-- -> IO Bool +-- cellRendererActivate self event widget path background cell flags = +-- liftM toBool $ +-- withUTFString path $ \ pathPtr -> [_$_] +-- with background $ \ backgroundPtr -> [_$_] +-- with cell $ \ cellPtr -> [_$_] +-- {#call cell_renderer_activate#} +-- (toCellRenderer self) +-- event +-- (toWidget widget) +-- pathPtr +-- backgroundPtr +-- cellPtr +-- ((fromIntegral . fromEnum) flags) + +-- | Passes an activate event to the cell renderer for possible processing. +-- cellRendererStartEditing + +#if GTK_CHECK_VERSION(2,18,0) +-- | Fills in @xalign@ and @yalign@ with the appropriate values of @cell@. +-- +-- * Available since Gtk+ version 2.18 +-- +cellRendererGetAlignment :: CellRendererClass self => self + -> IO (Float, Float) -- ^ @(xalign, yalign)@ {FIXME: merge return value docs} + -- @xalign@ - location to fill in with the x alignment of + -- the cell, or {@NULL@, FIXME: this should probably be + -- converted to a Maybe data type}@yalign@ - location to + -- fill in with the y alignment of the cell, or {@NULL@, + -- FIXME: this should probably be converted to a Maybe + -- data type} +cellRendererGetAlignment self = + alloca $ \xalignPtr -> + alloca $ \yalignPtr -> do + {# call gtk_cell_renderer_get_alignment #} + (toCellRenderer self) + xalignPtr + yalignPtr + xalign <- peek xalignPtr + yalign <- peek yalignPtr + return (realToFrac xalign, realToFrac yalign) + +-- | Sets the renderer's alignment within its available space. +-- +-- * Available since Gtk+ version 2.18 +-- +cellRendererSetAlignment :: CellRendererClass self => self + -> Float -- ^ @xalign@ - the x alignment of the cell renderer + -> Float -- ^ @yalign@ - the y alignment of the cell renderer + -> IO () +cellRendererSetAlignment self xalign yalign = + {# call gtk_cell_renderer_set_alignment #} + (toCellRenderer self) + (realToFrac xalign) + (realToFrac yalign) + +-- | Fills in @xpad@ and @ypad@ with the appropriate values of @cell@. +-- +-- * Available since Gtk+ version 2.18 +-- +cellRendererGetPadding :: CellRendererClass self => self + -> IO (Int, Int) -- ^ @(xpad, ypad)@ {FIXME: merge return value docs} @xpad@ + -- - location to fill in with the x padding of the cell, or + -- {@NULL@, FIXME: this should probably be converted to a + -- Maybe data type}@ypad@ - location to fill in with the y + -- padding of the cell, or {@NULL@, FIXME: this should + -- probably be converted to a Maybe data type} +cellRendererGetPadding self = + alloca $ \xpadPtr -> + alloca $ \ypadPtr -> do + {# call gtk_cell_renderer_get_padding #} + (toCellRenderer self) + xpadPtr + ypadPtr + xpad <- peek xpadPtr + ypad <- peek ypadPtr + return (fromIntegral xpad, fromIntegral ypad) + +-- | Sets the renderer's padding. +-- +-- * Available since Gtk+ version 2.18 +-- +cellRendererSetPadding :: CellRendererClass self => self + -> Int -- ^ @xpad@ - the x padding of the cell renderer + -> Int -- ^ @ypad@ - the y padding of the cell renderer + -> IO () +cellRendererSetPadding self xpad ypad = + {# call gtk_cell_renderer_set_padding #} + (toCellRenderer self) + (fromIntegral xpad) + (fromIntegral ypad) +#endif + hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 451 +-- | Cell background color as a 'Color'. +cellBackgroundGdk :: CellRendererClass self => Attr self Color +cellBackgroundGdk = newAttrFromBoxedStorableProperty "cell-background-gdk" + {# call pure unsafe gdk_color_get_type #} + hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRenderer.chs.pp 471 +-- | Whether the cell renderer is currently in editing mode. +-- [_$_] +-- Default value: 'False' +cellRendererEditing :: CellRendererClass self => ReadAttr self Bool +cellRendererEditing = readAttrFromBoolProperty "editing" addfile ./gtk/Graphics/UI/Gtk/ModelView/CellRendererAccel.chs.pp hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererAccel.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget CellRendererAccel +-- +-- 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) +-- +-- Renders a keyboard accelerator in a cell +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.ModelView.CellRendererAccel ( + +-- * Detail +-- +-- | 'CellRendererAccel' displays a keyboard accelerator (i.e. a key +-- combination like \<Control>-a). If the cell renderer is editable, the +-- accelerator can be changed by simply typing the new combination. +-- +-- The 'CellRendererAccel' cell renderer was added in Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'CellRenderer' +-- | +----'CellRendererText' +-- | +----CellRendererAccel +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + CellRendererAccel, + CellRendererAccelClass, + castToCellRendererAccel, + toCellRendererAccel, + +-- * Enums + CellRendererAccelMode(..), + +-- * Constructors + cellRendererAccelNew, + +-- * Attributes + cellRendererAccelAccelKey, + cellRendererAccelAccelMods, + cellRendererAccelKeycode, + cellRendererAccelAccelMode, + +-- * Signals + accelEdited, + accelCleared, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.Gdk.Enums (Modifier) +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,10,0) +-------------------- +-- Enums +{#enum CellRendererAccelMode {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-------------------- +-- Constructors + +-- | Creates a new 'CellRendererAccel'. +-- +cellRendererAccelNew :: IO CellRendererAccel +cellRendererAccelNew = + makeNewObject mkCellRendererAccel $ liftM castPtr $ + {# call gtk_cell_renderer_accel_new #} + +-------------------- +-- Attributes + +-- | +-- +cellRendererAccelAccelKey :: CellRendererAccelClass self => Attr self Int +cellRendererAccelAccelKey = newAttrFromUIntProperty "accel-key" + +-- | +-- +cellRendererAccelAccelMods :: CellRendererAccelClass self => Attr self [Modifier] +cellRendererAccelAccelMods = newAttrFromFlagsProperty "accel-mods" + {# call pure unsafe gdk_modifier_type_get_type #} + +-- | +-- +cellRendererAccelKeycode :: CellRendererAccelClass self => Attr self Int +cellRendererAccelKeycode = newAttrFromUIntProperty "keycode" + +-- | +-- +cellRendererAccelAccelMode :: CellRendererAccelClass self => Attr self CellRendererAccelMode +cellRendererAccelAccelMode = newAttrFromEnumProperty "accel-mode" + {# call pure unsafe gtk_cell_renderer_accel_mode_get_type #} + +-------------------- +-- Signals + +-- | Gets emitted when the user has selected a new accelerator. +-- +accelEdited :: CellRendererAccelClass self => Signal self (String -> Int -> Modifier -> Int -> IO ()) +accelEdited = Signal (connect_STRING_INT_ENUM_INT__NONE "accel-edited") + +-- | Gets emitted when the user has removed the accelerator. +-- +accelCleared :: CellRendererAccelClass self => Signal self (String -> IO ()) +accelCleared = Signal (connect_STRING__NONE "accel-cleared") +#endif hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 48 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 69 - cellComboHasEntry, - cellComboTextModel + cellRendererCombHasEntry, + cellRendererCombTextModel, + cellRendererComboModel, + +-- * Signal +#if GTK_CHECK_VERSION(2,14,0) + cellRendererComboChanged, +#endif hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 83 -import System.Glib.Attributes (Attr, WriteAttr, writeAttr) +import System.Glib.Attributes (Attr, WriteAttr, ReadWriteAttr, writeAttr) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 88 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 115 -cellComboHasEntry :: CellRendererComboClass self => Attr self Bool -cellComboHasEntry = newAttrFromBoolProperty "has-entry" +cellRendererCombHasEntry :: CellRendererComboClass self => Attr self Bool +cellRendererCombHasEntry = newAttrFromBoolProperty "has-entry" hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 125 -cellComboTextModel :: ( TreeModelClass (model row), +cellRendererCombTextModel :: ( TreeModelClass (model row), hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 129 -cellComboTextModel = writeAttr setter +cellRendererCombTextModel = writeAttr setter hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererCombo.chs.pp 137 +-- | Holds a tree model containing the possible values for the combo box. Use the @textColumn@ property to +-- specify the column holding the values. +-- [_$_] +-- Since 2.6 +cellRendererComboModel :: (CellRendererComboClass self, TreeModelClass treeModel) => ReadWriteAttr self TreeModel treeModel +cellRendererComboModel = newAttrFromObjectProperty "model" + {# call pure unsafe gtk_tree_model_get_type #} + +#endif + +----------------- +-- Signal + +#if GTK_CHECK_VERSION(2,14,0) +-- | This signal is emitted each time after the user selected an item in the +-- combo box, either by using the mouse or the arrow keys. Contrary to +-- 'ComboBox', 'CellRendererCombo'::changed is not emitted for changes made to +-- a selected item in the entry. The argument @newIter@ corresponds to the +-- newly selected item in the combo box and it is relative to the 'TreeModel' +-- set via the model property on 'CellRendererCombo'. +-- +-- Note that as soon as you change the model displayed in the tree view, the +-- tree view will immediately cease the editing operating. This means that you +-- most probably want to refrain from changing the model until the combo cell +-- renderer emits the edited or editing_canceled signal. +-- +-- * Available since Gtk+ version 2.14 +-- +cellRendererComboChanged :: CellRendererComboClass self => Signal self (String -> TreeIter -> IO ()) +cellRendererComboChanged = Signal (connect_STRING_BOXED__NONE "changed" peekTreeIter) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererPixbuf.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererPixbuf.chs.pp 44 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererProgress.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererProgress.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererProgress.chs.pp 38 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererProgress.chs.pp 58 - cellProgressValue, - cellProgressText, + cellRendererProgressValue, + cellRendererProgressText, + cellRendererProgressPulse, + cellRendererProgressTextXAlign, + cellRendererProgressTextYAlign, + cellRendererProgressOrientation, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererProgress.chs.pp 72 +import Graphics.UI.Gtk.General.Enums (ProgressBarOrientation(..)) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererProgress.chs.pp 75 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererProgress.chs.pp 94 --- | The \"value\" property determines the percentage to which the progress --- bar will be \"filled in\". --- --- Allowed values: @[0,100]@ --- --- Default value: @0@ --- -cellProgressValue :: CellRendererProgressClass self => Attr self Int -cellProgressValue = newAttrFromIntProperty "value" +-- | The "value" property determines the percentage to which the progress bar will be "filled in". +-- [_$_] +-- Allowed values: [0,100] +-- [_$_] +-- Default value: 0 +-- [_$_] +-- Since 2.6 +cellRendererProgressValue :: CellRendererProgressClass self => Attr self Int +cellRendererProgressValue = newAttrFromIntProperty "value" hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererProgress.chs.pp 104 --- | The 'cellProgressText' attribute determines the label which will be drawn --- over the progress bar. Setting this property to @Nothing@ causes the --- default label to be displayed. Setting this property to an empty string +-- | The "text" property determines the label which will be drawn over the progress bar. Setting this +-- property to 'Nothing' causes the default label to be displayed. Setting this property to an empty string hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererProgress.chs.pp 107 --- --- Default value: @Nothing@ --- -cellProgressText :: CellRendererProgressClass self => Attr self (Maybe String) -cellProgressText = newAttrFromMaybeStringProperty "text" +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.6 +cellRendererProgressText :: CellRendererProgressClass self => Attr self String +cellRendererProgressText = newAttrFromStringProperty "text" + +-- | Setting this to a non-negative value causes the cell renderer to enter "activity mode", where a +-- block bounces back and forth to indicate that some progress is made, without specifying exactly how +-- much. +-- [_$_] +-- Each increment of the property causes the block to move by a little bit. +-- [_$_] +-- To indicate that the activity has not started yet, set the property to zero. To indicate completion, +-- set the property to 'GMaxint'. +-- [_$_] +-- Allowed values: >= 'GMaxulong' +-- [_$_] +-- Default value: -1 +-- [_$_] +-- Since 2.12 +cellRendererProgressPulse :: CellRendererProgressClass self => Attr self Int +cellRendererProgressPulse = newAttrFromIntProperty "pulse" + +-- | The 'textXalign' property controls the horizontal alignment of the text in the progress bar. Valid +-- values range from 0 (left) to 1 (right). Reserved for RTL layouts. +-- [_$_] +-- Allowed values: [0,1] +-- [_$_] +-- Default value: 0.5 +-- [_$_] +-- Since 2.12 +cellRendererProgressTextXAlign :: CellRendererProgressClass self => Attr self Float +cellRendererProgressTextXAlign = newAttrFromFloatProperty "text-xalign" + +-- | The 'textYalign' property controls the vertical alignment of the text in the progress bar. Valid +-- values range from 0 (top) to 1 (bottom). +-- [_$_] +-- Allowed values: [0,1] +-- [_$_] +-- Default value: 0.5 +-- [_$_] +-- Since 2.12 +cellRendererProgressTextYAlign :: CellRendererProgressClass self => Attr self Float +cellRendererProgressTextYAlign = newAttrFromFloatProperty "text-yalign" + +-- | The "orientation" property controls the direction and growth direction of the progress bar +-- (left-to-right, right-to-left, top-to-bottom or bottom-to-top). +-- [_$_] +-- Default value: ''ProgressLeftToRight'' +-- [_$_] +-- Since 2.12 +cellRendererProgressOrientation :: CellRendererProgressClass self => Attr self ProgressBarOrientation +cellRendererProgressOrientation = newAttrFromEnumProperty "orientation" + {# call pure unsafe gtk_progress_bar_orientation_get_type #} + addfile ./gtk/Graphics/UI/Gtk/ModelView/CellRendererSpin.chs.pp hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererSpin.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget CellRendererSpin +-- +-- 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) +-- +-- Renders a spin button in a cell +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.ModelView.CellRendererSpin ( + +-- * Detail +-- +-- | 'CellRendererSpin' renders text in a cell like 'CellRendererText' from +-- which it is derived. But while 'CellRendererText' offers a simple entry to +-- edit the text, 'CellRendererSpin' offers a 'SpinButton' widget. Of course, +-- that means that the text has to be parseable as a floating point number. +-- +-- The range of the spinbutton is taken from the adjustment property of the +-- cell renderer, which can be set explicitly or mapped to a column in the tree +-- model, like all properties of cell renders. 'CellRendererSpin' also has +-- properties for the climb rate and the number of digits to display. Other +-- 'SpinButton' properties can be set in a handler for the start-editing +-- signal. +-- +-- The 'CellRendererSpin' cell renderer was added in Gtk+ 2.10. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'CellRenderer' +-- | +----'CellRendererText' +-- | +----CellRendererSpin +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + CellRendererSpin, + CellRendererSpinClass, + castToCellRendererSpin, + toCellRendererSpin, + +-- * Constructors + cellRendererSpinNew, + +-- * Attributes + cellRendererSpinAdjustment, + cellRendererSpinClimbRate, + cellRendererSpinDigits, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Constructors + +-- | Creates a new 'CellRendererSpin'. +-- +cellRendererSpinNew :: IO CellRendererSpin +cellRendererSpinNew = + makeNewObject mkCellRendererSpin $ liftM castPtr + {# call gtk_cell_renderer_spin_new #} + +-------------------- +-- Attributes + +-- | +-- +cellRendererSpinAdjustment :: CellRendererSpinClass self => Attr self Adjustment +cellRendererSpinAdjustment = newAttrFromObjectProperty "adjustment" + {# call pure unsafe gtk_adjustment_get_type #} + +-- | +-- +cellRendererSpinClimbRate :: CellRendererSpinClass self => Attr self Double +cellRendererSpinClimbRate = newAttrFromDoubleProperty "climb-rate" + +-- | +-- +cellRendererSpinDigits :: CellRendererSpinClass self => Attr self Int +cellRendererSpinDigits = newAttrFromUIntProperty "digits" +#endif hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 8 --- Copyright (C) 1999-2006 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 38 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 61 + cellTextAlignSet, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 64 - --cellTextAttributes, + -- cellTextAttributes, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 131 +-- {#import Graphics.UI.Gtk.Pango.Types#} hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 286 +-- | A list of style attributes to apply to the text of the renderer. +-- cellTextAttributes :: CellRendererClass cr => Attr cr PangoAttrList +-- cellTextAttributes = newAttrFromObjectProperty "attributes" + +-- | Whether this tag affects the alignment mode. +-- [_$_] +-- Default value: 'False' +cellTextAlignSet :: CellRendererTextClass self => Attr self Bool +cellTextAlignSet = newAttrFromBoolProperty "align-set" + hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 27 +-- The following functions don't bind, use corresponding attributes instead: +-- gtk_cell_renderer_toggle_get_activatable +-- gtk_cell_renderer_toggle_set_activatable +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 39 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 29 +-- The following functions don't bind, use corresponding attributes instead: +-- gtk_cell_view_set_displayed_row +-- gtk_cell_view_get_displayed_row +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 41 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 65 +#if GTK_CHECK_VERSION(2,16,0) + cellViewGetModel, +#endif hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 73 - cellViewBackground + cellViewBackground, + cellViewBackgroundColor, + cellViewBackgroundSet, + cellViewModel, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 84 -import System.Glib.Properties (writeAttrFromStringProperty) +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 159 +#if GTK_CHECK_VERSION(2,16,0) +cellViewGetModel :: CellViewClass self => self + -> IO TreeModel -- ^ returns a 'TreeModel' used or {@NULL@, FIXME: this + -- should probably be converted to a Maybe data type} +cellViewGetModel self = + makeNewGObject mkTreeModel $ + {# call gtk_cell_view_get_model #} + (toCellView self) +#endif + hunk ./gtk/Graphics/UI/Gtk/ModelView/CellView.chs.pp 214 +-- | Background color as a 'Color'. +cellViewBackgroundColor :: CellViewClass self => Attr self Color +cellViewBackgroundColor = newAttrFromBoxedStorableProperty "background-gdk" + {# call pure unsafe gdk_color_get_type #} + +-- | Whether this tag affects the background color. +-- [_$_] +-- Default value: 'False' +cellViewBackgroundSet :: CellViewClass self => Attr self Bool +cellViewBackgroundSet = newAttrFromBoolProperty "background-set" + +-- | The model for cell view +-- [_$_] +-- since 2.10 +cellViewModel :: (CellViewClass self, TreeModelClass treeModel) => ReadWriteAttr self TreeModel treeModel +cellViewModel = newAttrFromObjectProperty "model" + {# call pure unsafe gtk_tree_model_get_type #} + hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 8 --- Copyright (C) 2005-2007 Duncan Coutts, Axel Simon +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 29 +-- The following functions don't bind, use corresponding attributes instead: +-- gtk_icon_view_set_tooltip_column +-- gtk_icon_view_get_tooltip_column +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 61 +-- * Enums + IconViewDropPosition(..), + hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 117 +#if GTK_CHECK_VERSION(2,12,0) + iconViewConvertWidgetToBinWindowCoords, + iconViewSetTooltipItem, + iconViewSetTooltipCell, + -- iconViewGetTooltipContext, +#endif + iconViewSetDragDestItem, + -- iconViewGetDragDestItem, + -- iconViewGetDestItemAtPos, + iconViewCreateDragIcon, hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 144 +#if GTK_CHECK_VERSION(2,18,0) + iconViewItemPadding, +#endif + iconViewTooltipColumn, hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 152 - selectionChanged + selectionChanged, + activateCursorItem, + iconViewMoveCursor, [_$_] + iconViewSelectAllSignal, [_$_] + selectCursorItem, + toggleCursorItem, + unselectAll, [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 173 +import Graphics.UI.Gtk.General.Enums (DeleteType(..), MovementStep(..)) hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 192 +-------------------- +-- Enums +{#enum GtkIconViewDropPosition as IconViewDropPosition {underscoreToCase} deriving (Bounded,Eq,Show)#} + hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 856 +#if GTK_CHECK_VERSION(2,12,0) +-- | Converts widget coordinates to coordinates for the bin_window, as +-- expected by e.g. 'iconViewGetPathAtPos'. +-- +-- * Available since Gtk+ version 2.12 +-- +iconViewConvertWidgetToBinWindowCoords :: IconViewClass self => self + -> Int -- ^ @wx@ - X coordinate relative to the widget + -> Int -- ^ @wy@ - Y coordinate relative to the widget + -> IO (Int, Int) -- ^ @(bx, by)@ {FIXME: merge return value docs} @bx@ - + -- return location for bin_window X coordinate @by@ - return + -- location for bin_window Y coordinate +iconViewConvertWidgetToBinWindowCoords self wx wy = + alloca $ \bxPtr -> + alloca $ \byPtr -> do + {# call gtk_icon_view_convert_widget_to_bin_window_coords #} + (toIconView self) + (fromIntegral wx) + (fromIntegral wy) + bxPtr + byPtr + bx <- peek bxPtr + by <- peek byPtr + return (fromIntegral bx, fromIntegral by) +-- | Sets the tip area of @tooltip@ to be the area covered by the item at +-- @path@. See also 'iconViewSetTooltipColumn' for a simpler alternative. See +-- also 'tooltipSetTipArea'. +-- +-- * Available since Gtk+ version 2.12 +-- +iconViewSetTooltipItem :: (IconViewClass self, TooltipClass tooltip) => self + -> tooltip -- ^ @tooltip@ - a 'Tooltip' + -> TreePath -- ^ @path@ - a 'TreePath' + -> IO () +iconViewSetTooltipItem self tooltip path = + withTreePath path $ \path -> + {# call gtk_icon_view_set_tooltip_item #} + (toIconView self) + (toTooltip tooltip) + path + +-- | Sets the tip area of @tooltip@ to the area which @cell@ occupies in the +-- item pointed to by @path@. See also 'tooltipSetTipArea'. +-- +-- See also 'iconViewSetTooltipColumn' for a simpler alternative. +-- +-- * Available since Gtk+ version 2.12 +-- +iconViewSetTooltipCell :: (IconViewClass self, TooltipClass tooltip, CellRendererClass cell) => self + -> tooltip -- ^ @tooltip@ - a 'Tooltip' + -> TreePath -- ^ @path@ - a 'TreePath' + -> cell -- ^ @cell@ - a 'CellRenderer' or {@NULL@, FIXME: this should + -- probably be converted to a Maybe data type} + -> IO () +iconViewSetTooltipCell self tooltip path cell = + withTreePath path $ \path -> + {# call gtk_icon_view_set_tooltip_cell #} + (toIconView self) + (toTooltip tooltip) + path + (toCellRenderer cell) + +-- | This function is supposed to be used in a {\"query-tooltip\", FIXME: +-- unknown type\/value} signal handler for 'IconView'. The @x@, @y@ and +-- @keyboardTip@ values which are received in the signal handler, should be +-- passed to this function without modification. +-- +-- The return value indicates whether there is an icon view item at the +-- given coordinates (@True@) or not (@False@) for mouse tooltips. For keyboard +-- tooltips the item returned will be the cursor item. When @True@, then any of +-- @model@, @path@ and @iter@ which have been provided will be set to point to +-- that row and the corresponding model. @x@ and @y@ will always be converted +-- to be relative to @iconView@'s bin_window if @keyboardTooltip@ is @False@. +-- +-- * Available since Gtk+ version 2.12 +-- +-- iconViewGetTooltipContext :: (IconViewClass self, TreeModelClass model) => self +-- -> Bool -- ^ @keyboardTip@ - whether this is a keyboard +-- -- tooltip or not +-- -> model -- ^ @model@ - a pointer to receive a 'TreeModel' or +-- -- {@NULL@, FIXME: this should probably be converted to +-- -- a Maybe data type} +-- -> TreePath -- ^ @path@ - a pointer to receive a 'TreePath' or +-- -- {@NULL@, FIXME: this should probably be converted to +-- -- a Maybe data type} +-- -> TreeIter -- ^ @iter@ - a pointer to receive a 'TreeIter' or +-- -- {@NULL@, FIXME: this should probably be converted to +-- -- a Maybe data type} +-- -> IO (Bool, Int, Int) -- ^ @(_, x, y)@ {FIXME: merge return value docs} +-- -- returns whether or not the given tooltip context +-- -- points to a item @x@ - the x coordinate (relative to +-- -- widget coordinates) @y@ - the y coordinate (relative +-- -- to widget coordinates) +-- iconViewGetTooltipContext self keyboardTip model path iter = [_$_] +-- alloca $ \xPtr -> +-- alloca $ \yPtr -> +-- withTreePath path $ \pathPtr -> do +-- with iter $ \iterPtr -> do +-- success <- liftM toBool $ [_$_] +-- {# call gtk_icon_view_get_tooltip_context #} +-- (toIconView self) +-- xPtr +-- yPtr +-- (fromBool keyboardTip) +-- model +-- path +-- iterPtr +-- x <- peek xPtr +-- y <- peek yPtr +-- return (success, fromIntegral x, fromIntegral y) + +#endif + +-- | Sets the item that is highlighted for feedback. +-- +-- * Available since Gtk+ version 2.8 +-- +iconViewSetDragDestItem :: IconViewClass self => self + -> TreePath -- ^ @path@ - The path of the item to highlight, or + -- {@NULL@, FIXME: this should probably be converted + -- to a Maybe data type}. + -> IconViewDropPosition -- ^ @pos@ - Specifies where to drop, relative to the + -- item + -> IO () +iconViewSetDragDestItem self path pos = + withTreePath path $ \path -> + {# call gtk_icon_view_set_drag_dest_item #} + (toIconView self) + path + ((fromIntegral . fromEnum) pos) + +-- | Gets information about the item that is highlighted for feedback. +-- +-- * Available since Gtk+ version 2.8 +-- +-- iconViewGetDragDestItem :: IconViewClass self => self +-- -> TreePath -- ^ @path@ - Return location for the path of +-- -- the highlighted item, or {@NULL@, FIXME: +-- -- this should probably be converted to a +-- -- Maybe data type}. +-- -> IconViewDropPosition -- ^ @pos@ - Return location for the drop +-- -- position, or {@NULL@, FIXME: this should +-- -- probably be converted to a Maybe data type} +-- -> IO () +-- iconViewGetDragDestItem self path pos = +-- withTreePath path $ \pathPtr -> do +-- {# call gtk_icon_view_get_drag_dest_item #} +-- (toIconView self) +-- pathPtr +-- ((fromIntegral . fromEnum) pos) + +-- | Determines the destination item for a given position. +-- +-- * Available since Gtk+ version 2.8 +-- +-- iconViewGetDestItemAtPos :: IconViewClass self => self +-- -> Int -- ^ @dragX@ - the position to determine the +-- -- destination item for +-- -> Int -- ^ @dragY@ - the position to determine the +-- -- destination item for +-- -> TreePath -- ^ @path@ - Return location for the path of +-- -- the item, or {@NULL@, FIXME: this should +-- -- probably be converted to a Maybe data +-- -- type}. +-- -> IconViewDropPosition -- ^ @pos@ - Return location for the drop +-- -- position, or {@NULL@, FIXME: this should +-- -- probably be converted to a Maybe data type} +-- -> IO Bool -- ^ returns whether there is an item at the +-- -- given position. +-- iconViewGetDestItemAtPos self dragX dragY path pos = +-- liftM toBool $ +-- withTreePath path $ \path -> +-- {# call gtk_icon_view_get_dest_item_at_pos #} +-- (toIconView self) +-- (fromIntegral dragX) +-- (fromIntegral dragY) +-- path +-- ((fromIntegral . fromEnum) pos) + +-- | Creates a 'Pixmap' representation of the item at @path@. This image is +-- used for a drag icon. +-- +-- * Available since Gtk+ version 2.8 +-- +iconViewCreateDragIcon :: IconViewClass self => self + -> TreePath -- ^ @path@ - a 'TreePath' in @iconView@ + -> IO Pixmap -- ^ returns a newly-allocated pixmap of the drag icon. +iconViewCreateDragIcon self path = + makeNewGObject mkPixmap $ + withTreePath path $ \path -> + {# call gtk_icon_view_create_drag_icon #} + (toIconView self) + path + hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 1201 +#if GTK_CHECK_VERSION(2,18,0) +-- | The item-padding property specifies the padding around each of the icon view's item. +-- [_$_] +-- Allowed values: >= 0 +-- [_$_] +-- Default value: 6 +-- [_$_] +-- Since 2.18 +iconViewItemPadding :: IconViewClass self => Attr self Int +iconViewItemPadding = newAttrFromIntProperty "item-padding" +#endif + +-- | The column in the model containing the tooltip texts for the items. +-- [_$_] +-- Allowed values: >= 'GMaxulong' +-- [_$_] +-- Default value: -1 +iconViewTooltipColumn :: IconViewClass self => Attr self Int +iconViewTooltipColumn = newAttrFromIntProperty "tooltip-column" + hunk ./gtk/Graphics/UI/Gtk/ModelView/IconView.chs.pp 1242 +-- | A keybinding signal which gets emitted when the user activates the currently focused item. +-- [_$_] +-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to +-- control activation programmatically. +-- [_$_] +-- The default bindings for this signal are Space, Return and Enter. +activateCursorItem :: IconViewClass self => Signal self (IO Bool) +activateCursorItem = Signal (connect_NONE__BOOL "activate-cursor-item") + [_$_] + +-- | The 'iconViewMoveCursor' 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 'signalEmitByName' if they need to +-- control the cursor programmatically. +-- [_$_] +-- The default bindings for this signal include +-- [_$_] +-- [_\e2_][_\97_][_\8f_] Arrow keys which move by individual steps [_$_] +-- [_\e2_][_\97_][_\8f_] Home/End keys which move to the first/last item [_$_] +-- [_\e2_][_\97_][_\8f_] PageUp/PageDown which move by "pages" +-- [_$_] +-- All of these will extend the selection when combined with the Shift modifier. +iconViewMoveCursor :: IconViewClass self => Signal self (MovementStep -> Int -> IO Bool) +iconViewMoveCursor = Signal (connect_ENUM_INT__BOOL "move-cursor") + [_$_] +-- | A keybinding signal which gets emitted when the user selects all items. +-- [_$_] +-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to +-- control selection programmatically. +-- [_$_] +-- The default binding for this signal is Ctrl-a. +iconViewSelectAllSignal :: IconViewClass self => Signal self (IO ()) +iconViewSelectAllSignal = Signal (connect_NONE__NONE "select-all") + +-- | A keybinding signal which gets emitted when the user selects the item that is currently focused. +-- [_$_] +-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to +-- control selection programmatically. +-- [_$_] +-- There is no default binding for this signal. +selectCursorItem :: IconViewClass self => Signal self (IO ()) +selectCursorItem = Signal (connect_NONE__NONE "select-cursor-item") + [_$_] + +-- | A keybinding signal which gets emitted when the user toggles whether the currently focused item is +-- selected or not. The exact effect of this depend on the selection mode. +-- [_$_] +-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to +-- control selection programmatically. +-- [_$_] +-- There is no default binding for this signal is Ctrl-Space. +toggleCursorItem :: IconViewClass self => Signal self (IO ()) +toggleCursorItem = Signal (connect_NONE__NONE "toggle-cursor-item") + [_$_] +-- | A keybinding signal which gets emitted when the user unselects all items. +-- [_$_] +-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to +-- control selection programmatically. +-- [_$_] +-- The default binding for this signal is Ctrl-Shift-a. +unselectAll :: IconViewClass self => Signal self (IO ()) +unselectAll = Signal (connect_NONE__NONE "unselect-all") hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModel.chs.pp 8 --- Copyright (C) 1999-2007 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModel.chs.pp 27 +-- Current FFI don't support varargs functions: +-- gtk_tree_model_get +-- gtk_tree_model_get_valist +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModel.chs.pp 95 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModel.chs.pp 129 + treeModelGetNColumns, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModel.chs.pp 244 +-- | Returns the number of columns supported by @treeModel@. +treeModelGetNColumns :: TreeModelClass self => self -> IO Int +treeModelGetNColumns self = + liftM fromIntegral $ + {#call tree_model_get_n_columns#} (toTreeModel self) + hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModelFilter.chs.pp 66 + treeModelFilterSetModifyFunc, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModelFilter.chs.pp 88 +import System.Glib.GValue (GValue) +import System.Glib.GType hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModelFilter.chs.pp 172 +-- | With the @nColumns@ and types parameters, you give an array of column types for this model (which +-- will be exposed to the parent model/ view). The func, data and destroy parameters are for specifying +-- the modify function. The modify function will get called for each data access, the goal of the +-- modify function is to return the data which should be displayed at the location specified using the +-- parameters of the modify function. +treeModelFilterSetModifyFunc :: TreeModelFilterClass self => self [_$_] + -> Int [_$_] + -> [GType] + -> Maybe (TreeIter -> GValue -> Int -> IO ()) + -> IO () +treeModelFilterSetModifyFunc self column typ Nothing = [_$_] + withArray typ $ \typPtr -> [_$_] + {#call gtk_tree_model_filter_set_modify_func#} + (toTreeModelFilter self) (fromIntegral column) typPtr nullFunPtr nullPtr nullFunPtr +treeModelFilterSetModifyFunc self column typ (Just func) = do [_$_] + funcPtr <- mkTreeModelFilterModifyFunc $ \_ tiPtr value col _ -> do + ti <- peekTreeIter tiPtr + func ti value (fromIntegral col) + withArray typ $ \typPtr -> + {#call gtk_tree_model_filter_set_modify_func#} [_$_] + (toTreeModelFilter self) (fromIntegral column) typPtr funcPtr (castFunPtrToPtr funcPtr) destroyFunPtr + +{#pointer TreeModelFilterModifyFunc #} + +foreign import ccall "wrapper" mkTreeModelFilterModifyFunc :: + (Ptr TreeModelFilter -> Ptr TreeIter -> GValue -> {#type gint#} -> Ptr () -> IO ()) + -> IO TreeModelFilterModifyFunc + hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModelSort.chs.pp 8 --- Copyright (C) 2004-2005 Duncan Coutts, Axel Simon +-- Copyright (C) 2004-2009 Duncan Coutts, Axel Simon hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModelSort.chs.pp 38 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeRowReference.chs.pp 8 --- Copyright (C) 2005 Axel Simon, Duncan Coutts +-- Copyright (C) 2005-2009 Axel Simon, Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 54 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 98 + treeSelectionSelectionChanged, + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 103 +#endif hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 380 +-- | Emitted whenever the selection has (possibly) changed. Please note that +-- this signal is mostly a hint. It may only be emitted once when a range of +-- rows are selected, and it may occasionally be emitted when nothing has +-- happened. +-- +treeSelectionSelectionChanged :: TreeSelectionClass self => Signal self (IO ()) +treeSelectionSelectionChanged = Signal (connect_NONE__NONE "changed") [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 388 +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSelection.chs.pp 399 - +#endif hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeSortable.chs.pp 8 --- Copyright (C) 1999-2007 Duncan Coutts, Axel Simon +-- Copyright (C) 1999-2009 Duncan Coutts, Axel Simon hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 8 --- Copyright (C) 2001-2005 Axel Simon +-- Copyright (C) 2001-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 20 --- TODO +-- The following functions don't bind, use corresponding attributes instead: [_$_] +-- gtk_tree_view_get_level_indentation +-- gtk_tree_view_set_level_indentation +-- gtk_tree_view_get_show_expanders +-- gtk_tree_view_set_show_expanders +-- gtk_tree_view_get_tooltip_column +-- gtk_tree_view_set_tooltip_column hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 28 --- gtk_tree_view_get_bin_window is to compare the GDK window from incoming --- events. We don't marshal that window parameter, so this function is not --- bound either. +-- Current FFI don't support varages functions: +-- gtk_tree_view_insert_column_with_attributes +-- +-- The following function not useful don't bind: +-- gtk_tree_view_get_search_equal_func +-- gtk_tree_view_get_search_position_func +-- gtk_tree_view_set_destroy_count_func +-- gtk_tree_view_get_row_separator_func +-- +-- NOTE: hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 45 --- get_search_equal_func is missing: proper memory management is impossible --- --- gtk_tree_view_set_destroy_count_func is not meant to be useful --- --- expand-collapse-cursor-row needs to be bound if it is useful to expand --- and collapse rows in a user-defined manner. Would only work on Gtk 2.2 --- and higher since the return parameter changed --- --- move_cursor, select_all, select_cursor_parent, select_cursor_row --- toggle_cursor_row, unselect_all are not bound. --- These functions are only useful to change the widgets --- behaviour for these actions. Everything else can be done with --- cursor_changed and columns_changed --- --- set_scroll_adjustment makes sense if the user monitors the scroll bars --- and the scroll bars can be replaced anytime (the latter is odd) --- hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 65 +-- hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 107 + treeV... [truncated message content] |
From: Andy S. <And...@co...> - 2010-03-25 11:00:52
|
Thu Mar 25 06:59:46 EDT 2010 Andy Stewart <laz...@gm...> * Update all `menuComboToolbar` modules to Gtk+ 2.18.3 Ignore-this: 1d668db72284a7b99d9f9d74ea54dc97 hunk ./ApiUpdateTodoList.txt 162 -*** TODO ToolShell.chs +*** DONE ToolShell.chs hunk ./ApiUpdateTodoList.txt 250 -*** TODO CheckMenuItem.chs.pp +*** DONE CheckMenuItem.chs.pp hunk ./ApiUpdateTodoList.txt 252 -*** TODO ComboBoxEntry.chs.pp +*** DONE ComboBoxEntry.chs.pp hunk ./ApiUpdateTodoList.txt 254 -*** TODO ImageMenuItem.chs -*** TODO MenuBar.chs.pp -*** TODO Menu.chs.pp -*** TODO MenuItem.chs -*** TODO MenuShell.chs.pp -*** TODO MenuToolButton.chs.pp +*** DEPRECATED ImageMenuItem.chs +*** DONE MenuBar.chs.pp +*** DONE Menu.chs.pp +*** DONE MenuItem.chs +*** DONE MenuShell.chs.pp +*** DONE MenuToolButton.chs.pp hunk ./ApiUpdateTodoList.txt 261 -*** TODO RadioMenuItem.chs -*** TODO RadioToolButton.chs.pp -*** TODO SeparatorMenuItem.chs.pp -*** TODO SeparatorToolItem.chs.pp -*** TODO TearoffMenuItem.chs -*** TODO ToggleToolButton.chs.pp -*** TODO Toolbar.chs.pp -*** TODO ToolButton.chs.pp -*** TODO ToolItem.chs.pp +*** DONE RadioMenuItem.chs +*** DONE RadioToolButton.chs.pp +*** DONE SeparatorMenuItem.chs.pp +*** DONE SeparatorToolItem.chs.pp +*** DONE TearoffMenuItem.chs +*** DONE ToggleToolButton.chs.pp +*** DONE Toolbar.chs.pp +*** DONE ToolButton.chs.pp +*** DONE ToolItem.chs.pp hunk ./Makefile.am 686 + gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolShell.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 144 + module Graphics.UI.Gtk.MenuComboToolbar.ToolShell, hunk ./gtk/Graphics/UI/Gtk.hs.pp 357 +import Graphics.UI.Gtk.MenuComboToolbar.ToolShell hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/CheckMenuItem.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/CheckMenuItem.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/CheckMenuItem.chs.pp 39 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Combo.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Combo.chs.pp 37 --- [_$_] +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Combo.chs.pp 54 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 8 --- Copyright (C) 2004-2007 Duncan Coutts, Axel Simon +-- Copyright (C) 2004-2009 Duncan Coutts, Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 29 +-- The following functions don't bind, use correspond attributes instead: +-- gtk_combo_box_set_button_sensitivity +-- gtk_combo_box_get_button_sensitivity +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 123 +#if GTK_CHECK_VERSION(2,14,0) + comboBoxButtonSensitivity, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 149 + moveActive, + popdown, + popup, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 167 +import Graphics.UI.Gtk.Abstract.Range (SensitivityType) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 172 +import Graphics.UI.Gtk.General.Enums (ScrollType) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 600 + +#if GTK_CHECK_VERSION(2,14,0) +-- | Whether the dropdown button is sensitive when the model is empty. +-- [_$_] +-- Default value: ''SensitivityAuto'' +-- [_$_] +-- Since 2.14 +comboBoxButtonSensitivity :: ComboBoxClass self => Attr self SensitivityType +comboBoxButtonSensitivity = newAttrFromEnumProperty "button-sensitivity" + {# call pure unsafe gtk_sensitivity_type_get_type #} +#endif + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 754 +-- | The 'moveActive' signal is a keybinding signal which gets emitted to move the active selection. +-- [_$_] +-- widget[_\c2_][_\a0_]: the object that received the signal +-- [_$_] +-- @scrollType@[_\c2_][_\a0_]: a 'ScrollType' +-- [_$_] +-- @userData@[_\c2_][_\a0_]: user data set when the signal handler was connected. +-- [_$_] +-- Since 2.12 +moveActive :: ComboBoxClass self => Signal self (ScrollType -> IO ()) +moveActive = Signal (connect_ENUM__NONE "move-active") + [_$_] +-- | The 'popdown' signal is a keybinding signal which gets emitted to popdown the combo box list. +-- [_$_] +-- The default bindings for this signal are Alt+Up and Escape. +-- [_$_] +-- button[_\c2_][_\a0_]: the object which received the signal +-- [_$_] +-- @userData@[_\c2_][_\a0_]: user data set when the signal handler was connected. +-- [_$_] +-- Since 2.12 +popdown :: ComboBoxClass self => Signal self (IO Bool) +popdown = Signal (connect_NONE__BOOL "popdown") + +-- | The 'popup' signal is a keybinding signal which gets emitted to popup the combo box list. +-- [_$_] +-- The default binding for this signal is Alt+Down. +-- [_$_] +-- widget[_\c2_][_\a0_]: the object that received the signal +-- [_$_] +-- @userData@[_\c2_][_\a0_]: user data set when the signal handler was connected. +-- [_$_] +-- Since 2.12 +popup :: ComboBoxClass self => Signal self (IO ()) +popup = Signal (connect_NONE__NONE "popup") + [_$_] hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 54 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs 8 --- Copyright (C) 2002 Jonas Svensson +-- Copyright (C) 2002-2009 Jonas Svensson hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs 32 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs 42 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 20 --- TODO --- --- The following not bound functions might be useful: --- menuSetAccelGroup, menuSetAccelGroup, menuReposition --- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 33 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 50 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 59 +-- | +----'RecentChooserMenu' hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 77 +#if GTK_CHECK_VERSION(2,14,0) + menuGetAccelPath, + menuGetMonitor, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 104 +#if GTK_CHECK_VERSION(2,14,0) + menuAccelPath, + menuAttachWidget, + menuMonitor, +#endif + menuTearoffTitle, +#if GTK_CHECK_VERSION(2,18,0) + menuReserveToggleSize, +#endif + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 126 + +-- * Signal + moveScroll, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 140 +import Graphics.UI.Gtk.General.Enums (ScrollType) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 142 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 259 +#if GTK_CHECK_VERSION(2,14,0) +menuGetAccelPath :: MenuClass self => self + -> IO String -- ^ returns the accelerator path set on the menu. +menuGetAccelPath self = + {# call gtk_menu_get_accel_path #} + (toMenu self) + >>= peekUTFString + +menuGetMonitor :: MenuClass self => self + -> IO Int -- ^ returns the number of the monitor on which the menu should be + -- popped up or -1, if no monitor has been set +menuGetMonitor self = + liftM fromIntegral $ + {# call gtk_menu_get_monitor #} + (toMenu self) +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 479 +#if GTK_CHECK_VERSION(2,14,0) +-- | An accel path used to conveniently construct accel paths of child items. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.14 +menuAccelPath :: MenuClass self => Attr self String +menuAccelPath = newAttrFromStringProperty "accel-path" + +-- | The widget the menu is attached to. Setting this property attaches the menu without a +-- 'MenuDetachFunc'. If you need to use a detacher, use 'menuAttachToWidget' directly. +-- [_$_] +-- Since 2.14 +menuAttachWidget :: (MenuClass self, WidgetClass widget) => ReadWriteAttr self Widget widget +menuAttachWidget = newAttrFromObjectProperty "attach-widget" + {# call pure unsafe gtk_widget_get_type #} + +-- | The monitor the menu will be popped up on. +-- [_$_] +-- Allowed values: >= 'GMaxulong' +-- [_$_] +-- Default value: -1 +-- [_$_] +-- Since 2.14 +menuMonitor :: MenuClass self => Attr self Int +menuMonitor = newAttrFromIntProperty "monitor" + +#endif + +-- | A title that may be displayed by the window manager when this menu is torn-off. +-- [_$_] +-- Default value: 'Nothing' +menuTearoffTitle :: MenuClass self => Attr self String +menuTearoffTitle = newAttrFromStringProperty "tearoff-title" + +#if GTK_CHECK_VERSION(2,18,0) +-- | A boolean that indicates whether the menu reserves space for toggles and icons, regardless of their +-- actual presence. +-- [_$_] +-- This property should only be changed from its default value for special-purposes such as tabular +-- menus. Regular menus that are connected to a menu bar or context menus should reserve toggle space +-- for consistency. +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.18 +menuReserveToggleSize :: MenuClass self => Attr self Bool +menuReserveToggleSize = newAttrFromBoolProperty "reserve-toggle-size" + +#endif + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp 582 + +------------- +-- Signal +moveScroll :: MenuClass self => Signal self (ScrollType -> IO ()) +moveScroll = Signal (connect_ENUM__NONE "move-scroll") + [_$_] hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuBar.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuBar.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuBar.chs.pp 36 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 26 --- TODO --- --- figure out what the signals \"toggle-size-allocate\" and [_$_] --- \"toggle-size-request\" are good for and bind them if useful --- --- figure out if the connectToToggle signal is useful at all +-- The following functions don't bind, use corresponding attributes instead: +-- gtk_menu_item_get_label +-- gtk_menu_item_set_label +-- gtk_menu_item_get_use_underline +-- gtk_menu_item_set_use_underline hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 40 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 51 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 88 + menuItemToggleSizeRequest, + menuItemToggleSizeAllocate, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 94 + menuItemAccelPath, + menuItemLabel, + menuItemUseUnderline, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 99 + activateItem, + toggleSizeRequest, + toggleSizeAllocate, + +-- * Deprecated [_$_] hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 121 +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 265 +-- | Emits the \"toggle_size_request\" signal on the given item. +-- +menuItemToggleSizeRequest :: MenuItemClass self => self + -> IO Int -- ^ @requisition@ - the requisition to use as signal data. +menuItemToggleSizeRequest self = + alloca $ \requisitionPtr -> do + {# call gtk_menu_item_toggle_size_request #} + (toMenuItem self) + requisitionPtr + requisition <- peek requisitionPtr + return (fromIntegral requisition) + +-- | Emits the \"toggle_size_allocate\" signal on the given item. +-- +menuItemToggleSizeAllocate :: MenuItemClass self => self + -> Int -- ^ @allocation@ - the allocation to use as signal data. + -> IO () +menuItemToggleSizeAllocate self allocation = + {# call gtk_menu_item_toggle_size_allocate #} + (toMenuItem self) + (fromIntegral allocation) + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 305 +-- | Sets the accelerator path of the menu item, through which runtime changes of the menu item's +-- accelerator caused by the user can be identified and saved to persistant storage. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.14 +menuItemAccelPath :: MenuItemClass self => Attr self String +menuItemAccelPath = newAttrFromStringProperty "accel-path" + +-- | The text for the child label. +-- [_$_] +-- Default value: "" +-- [_$_] +-- Since 2.16 +menuItemLabel :: MenuItemClass self => Attr self String +menuItemLabel = newAttrFromStringProperty "label" + +-- | 'True' if underlines in the text indicate mnemonics +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.16 +menuItemUseUnderline :: MenuItemClass self => Attr self Bool +menuItemUseUnderline = newAttrFromBoolProperty "use-underline" + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs 333 +-- | Emitted when the item is activated, but also if the menu item has a +-- submenu. For normal applications, the relevant signal is \"activate\". +-- +activateItem :: MenuItemClass self => Signal self (IO ()) +activateItem = Signal (connect_NONE__NONE "activate-item") + +-- | +-- +toggleSizeRequest :: MenuItemClass self => Signal self (IO ()) +toggleSizeRequest = Signal (connect_NONE__NONE "toggle-size-request") + +-- | +-- +toggleSizeAllocate :: MenuItemClass self => Signal self (Int -> IO ()) +toggleSizeAllocate = Signal (connect_INT__NONE "toggle-size-allocate") + + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 40 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 57 + MenuDirectionType(..), hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 84 + activateCurrent, + msCancel, + cycleFocus, + deactivated, + moveCurrent, + moveSelected, + selectionDone, + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 99 - MenuDirectionType(..), hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 103 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 112 -import Graphics.UI.Gtk.General.Enums (MenuDirectionType(..)) +import Graphics.UI.Gtk.General.Enums (MenuDirectionType(..), DirectionType (..)) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 286 +-- | This signal is called if an item is +-- activated. The boolean flag @hide@ is True whenever the menu will +-- behidden after this action. +-- +activateCurrent :: MenuShellClass self => Signal self (Bool -> IO ()) +activateCurrent = Signal (connect_BOOL__NONE "activate-current") + +-- | This signal will be emitted when a selection is +-- aborted and thus does not lead to an activation. This is in contrast to the +-- @selection@ done signal which is always emitted. +-- +msCancel :: MenuShellClass self => Signal self (IO ()) +msCancel = Signal (connect_NONE__NONE "cancel") + +-- | +cycleFocus :: MenuShellClass self => Signal self (DirectionType -> IO ()) +cycleFocus = Signal (connect_ENUM__NONE "cycle-focus") + [_$_] hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 305 +-- | This signal is sent whenever the menu shell +-- is deactivated (hidden). +-- +deactivated :: MenuShellClass self => Signal self (IO ()) [_$_] +deactivated = Signal (connect_NONE__NONE "deactivate") + +-- | This signal is emitted for each move the +-- cursor makes. +-- +moveCurrent :: MenuShellClass self => Signal self (MenuDirectionType -> IO ()) +moveCurrent = Signal (connect_ENUM__NONE "move-current") + +-- | The 'moveSelected' signal is emitted to move the selection to another item. +moveSelected :: MenuShellClass self => Signal self (Int -> IO Bool) +moveSelected = Signal (connect_INT__BOOL "move-selected") + +-- | This signal is emitted when the user +-- finished using the menu. Note that this signal is emitted even if no menu +-- item was activated. +-- +selectionDone :: MenuShellClass self => Signal self (IO ()) +selectionDone = Signal (connect_NONE__NONE "selection-done") + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs.pp 376 - +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 42 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 69 - menuToolButtonSetArrowTooltip, +#if GTK_CHECK_VERSION(2,12,0) + menuToolButtonSetArrowTooltipText, + menuToolButtonSetArrowTooltipMarkup, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 78 + showMenu, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED + menuToolButtonSetArrowTooltip, +#endif + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 89 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 160 +#if GTK_CHECK_VERSION(2,12,0) +-- | Sets the tooltip text to be used as tooltip for the arrow button which +-- pops up the menu. See 'toolItemSetTooltip' for setting a tooltip on the +-- whole 'MenuToolButton'. +-- +-- * Available since Gtk+ version 2.12 +-- +menuToolButtonSetArrowTooltipText :: MenuToolButtonClass self => self + -> String -- ^ @text@ - text to be used as tooltip text for button's arrow + -- button + -> IO () +menuToolButtonSetArrowTooltipText self text = + withUTFString text $ \textPtr -> + {# call gtk_menu_tool_button_set_arrow_tooltip_text #} + (toMenuToolButton self) + textPtr hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 177 +-- | Sets the tooltip markup text to be used as tooltip for the arrow button +-- which pops up the menu. See 'toolItemSetTooltip' for setting a tooltip on +-- the whole 'MenuToolButton'. +-- +-- * Available since Gtk+ version 2.12 +-- +menuToolButtonSetArrowTooltipMarkup :: MenuToolButtonClass self => self + -> String -- ^ @markup@ - markup text to be used as tooltip text for button's + -- arrow button + -> IO () +menuToolButtonSetArrowTooltipMarkup self markup = + withUTFString markup $ \markupPtr -> + {# call gtk_menu_tool_button_set_arrow_tooltip_markup #} + (toMenuToolButton self) + markupPtr +#endif + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 212 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 226 +showMenu :: MenuToolButtonClass self => Signal self (IO ()) +showMenu = Signal (connect_NONE__NONE "show-menu") hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 229 +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs.pp 238 - +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs.pp 32 --- [_$_] +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs.pp 49 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs 24 +-- The following function don't bind, use corresponding attributes instead. +-- gtk_radio_menu_item_set_group +-- gtk_radio_menu_item_get_group +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs 36 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs 43 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs 75 + +-- * Attributes + radioMenuItemGroup, + [_$_] +-- * Signal [_$_] + radioMenuItemGroupChanged, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs 87 +import System.Glib.Attributes +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs 90 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs 189 + +-------------------- +-- Attributes + +-- | The radio menu item whose group this widget belongs to. +-- [_$_] +-- Since 2.8 +radioMenuItemGroup :: (RadioMenuItemClass self, RadioMenuItemClass radioMenuItem) => WriteAttr self radioMenuItem +radioMenuItemGroup = writeAttrFromObjectProperty "group" + {# call pure unsafe gtk_radio_menu_item_get_type #} + +-------------------- +-- Signals + +-- | +-- +radioMenuItemGroupChanged :: RadioMenuItemClass self => Signal self (IO ()) +radioMenuItemGroupChanged = Signal (connect_NONE__NONE "group-changed") + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioToolButton.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioToolButton.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioToolButton.chs.pp 44 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/SeparatorMenuItem.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/SeparatorMenuItem.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/SeparatorMenuItem.chs.pp 36 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/SeparatorToolItem.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/SeparatorToolItem.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/SeparatorToolItem.chs.pp 44 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/TearoffMenuItem.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/TearoffMenuItem.chs 28 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/TearoffMenuItem.chs 44 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs.pp 40 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs.pp 74 --- * Signals +-- * SignalslButton + toggleToolButtonToggled, + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs.pp 81 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs.pp 161 +-- | Emitted whenever the toggle tool button changes state. +-- +toggleToolButtonToggled :: ToggleToolButtonClass self => Signal self (IO ()) +toggleToolButtonToggled = Signal (connect_NONE__NONE "toggled") hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs.pp 166 +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs.pp 175 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolButton.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolButton.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolButton.chs.pp 54 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolButton.chs.pp 106 + toolButtonClicked, + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolButton.chs.pp 112 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolButton.chs.pp 380 +-- | This signal is emitted when the tool button is clicked with the mouse or +-- activated with the keyboard. +-- +toolButtonClicked :: ToolButtonClass self => Signal self (IO ()) +toolButtonClicked = Signal (connect_NONE__NONE "clicked") + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolButton.chs.pp 397 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 41 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 69 - toolItemSetTooltip, +#if GTK_CHECK_VERSION(2,12,0) + toolItemSetTooltipText, + toolItemSetTooltipMarkup, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 92 +#if GTK_CHECK_VERSION(2,6,0) + toolItemRebuildMenu, +#if GTK_CHECK_VERSION(2,14,0) + toolItemToolbarReconfigured, +#endif +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 100 + toolItemIsImportant, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 103 - toolItemIsImportant, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 106 + +-- * Signals + createMenuProxy, + toolbarReconfigured, + setTooltip, + +#ifndef DISABLE_DEPRECATED + toolItemSetTooltip, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 124 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 187 +#if GTK_CHECK_VERSION(2,12,0) +-- | Sets the text to be displayed as tooltip on the item. See +-- 'widgetSetTooltipText'. +-- +-- * Available since Gtk+ version 2.12 +-- +toolItemSetTooltipText :: ToolItemClass self => self + -> String -- ^ @text@ - text to be used as tooltip for @toolItem@ + -> IO () +toolItemSetTooltipText self text = + withUTFString text $ \textPtr -> + {# call gtk_tool_item_set_tooltip_text #} + (toToolItem self) + textPtr + +-- | Sets the markup text to be displayed as tooltip on the item. See +-- 'widgetSetTooltipMarkup'. +-- +-- * Available since Gtk+ version 2.12 +-- +toolItemSetTooltipMarkup :: ToolItemClass self => self + -> String -- ^ @markup@ - markup text to be used as tooltip for @toolItem@ + -> IO () +toolItemSetTooltipMarkup self markup = + withUTFString markup $ \markupPtr -> + {# call gtk_tool_item_set_tooltip_markup #} + (toToolItem self) + markupPtr +#endif + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 235 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 396 +#if GTK_CHECK_VERSION(2,6,0) +-- | Calling this function signals to the toolbar that the overflow menu item +-- for @toolItem@ has changed. If the overflow menu is visible when this +-- function it called, the menu will be rebuilt. +-- +-- The function must be called when the tool item changes what it will do in +-- response to the \"create_menu_proxy\" signal. +-- +-- * Available since Gtk+ version 2.6 +-- +toolItemRebuildMenu :: ToolItemClass self => self -> IO () +toolItemRebuildMenu self = + {# call gtk_tool_item_rebuild_menu #} + (toToolItem self) + +#if GTK_CHECK_VERSION(2,14,0) +-- | Emits the signal {\"toolbar_reconfigured\", FIXME: unknown type\/value} +-- on @toolItem@. 'Toolbar' and other 'ToolShell' implementations use this +-- function to notify children, when some aspect of their configuration +-- changes. +-- +-- * Available since Gtk+ version 2.14 +-- +toolItemToolbarReconfigured :: ToolItemClass self => self -> IO () +toolItemToolbarReconfigured self = + {# call gtk_tool_item_toolbar_reconfigured #} + (toToolItem self) +#endif +#endif + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp 481 + +-------------- +-- Signal + +-- | This signal is emitted when the toolbar needs information from @toolItem@ +-- about whether the item should appear in the toolbar overflow menu. In +-- response the tool item should either call 'toolItemSetProxyMenuItem' with a +-- {@NULL@, FIXME: this should probably be converted to a Maybe data type} +-- pointer and return @True@ to indicate that the item should not appear in the +-- overflow menu call 'toolItemSetProxyMenuItem' with a new menu item and +-- return @True@, or return @False@ to indicate that the signal was not handled +-- by the item. This means that the item will not appear in the overflow menu +-- unless a later handler installs a menu item. +-- +-- The toolbar may cache the result of this signal. When the tool item +-- changes how it will respond to this signal it must call +-- 'toolItemRebuildMenu' to invalidate the cache and ensure that the toolbar +-- rebuilds its overflow menu. +-- +createMenuProxy :: ToolItemClass self => Signal self (IO Bool) +createMenuProxy = Signal (connect_NONE__BOOL "create-menu-proxy") + +-- | This signal is emitted when some property of the toolbar that the item is +-- a child of changes. For custom subclasses of 'ToolItem', the default handler +-- of this signal use the functions +-- 'toolShellGetOrientation''toolShellGetStyle''toolShellGetIconSize''toolShellGetReliefStyle' +-- to find out what the toolbar should look like and change themselves +-- accordingly. +-- +toolbarReconfigured :: ToolItemClass self => Signal self (IO ()) +toolbarReconfigured = Signal (connect_NONE__NONE "toolbar-reconfigured") + +-- | This signal is emitted when the toolitem's tooltip changes. Application +-- developers can use 'toolItemSetTooltip' to set the item's tooltip. +-- +setTooltip :: ToolItemClass self => Signal self (Tooltips -> String -> String -> IO Bool) +setTooltip = Signal (connect_OBJECT_STRING_STRING__BOOL "set-tooltip") + addfile ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolShell.chs.pp hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolShell.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Interface ToolShell +-- +-- 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) +-- +-- Interface for containers containing 'ToolItem' widgets. +-- +-- * Module available since Gtk+ version 2.14 +-- +module Graphics.UI.Gtk.MenuComboToolbar.ToolShell ( + +-- * Detail +-- +-- | The 'ToolShell' interface allows container widgets to provide additional +-- information when embedding 'ToolItem' widgets. +-- +-- @seeAlso@: 'Toolbar', 'ToolItem' + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GInterface' +-- | +----ToolShell +-- @ + +#if GTK_CHECK_VERSION(2,14,0) +-- * Types + ToolShell, + ToolShellClass, + castToToolShell, + toToolShell, + +-- * Methods + toolShellGetIconSize, + toolShellGetOrientation, + toolShellGetReliefStyle, + toolShellGetStyle, + toolShellRebuildMenu, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import Graphics.UI.Gtk.General.Structs (IconSize(..)) +{#import Graphics.UI.Gtk.Types#} +import Graphics.UI.Gtk.General.Enums (Orientation(..), ToolbarStyle(..), ReliefStyle(..)) + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,14,0) +-------------------- +-- Methods + +-- | Retrieves the icon size for the tool shell. Tool items must not call this +-- function directly, but rely on 'toolItemGetIconSize' instead. +-- +toolShellGetIconSize :: ToolShellClass self => self + -> IO IconSize -- ^ returns the current size for icons of @shell@ +toolShellGetIconSize self = + liftM (toEnum . fromIntegral) $ + {# call gtk_tool_shell_get_icon_size #} + (toToolShell self) + +-- | Retrieves the current orientation for the tool shell. Tool items must not +-- call this function directly, but rely on 'toolItemGetOrientation' instead. +-- +toolShellGetOrientation :: ToolShellClass self => self + -> IO Orientation -- ^ returns the current orientation of @shell@ +toolShellGetOrientation self = + liftM (toEnum . fromIntegral) $ + {# call gtk_tool_shell_get_orientation #} + (toToolShell self) + +-- | Returns the relief style of buttons on @shell@. Tool items must not call +-- this function directly, but rely on 'toolItemGetReliefStyle' instead. +-- +toolShellGetReliefStyle :: ToolShellClass self => self + -> IO ReliefStyle -- ^ returns The relief style of buttons on @shell@. +toolShellGetReliefStyle self = + liftM (toEnum . fromIntegral) $ + {# call gtk_tool_shell_get_relief_style #} + (toToolShell self) + +-- | Retrieves whether the tool shell has text, icons, or both. Tool items +-- must not call this function directly, but rely on 'toolItemGetStyle' +-- instead. +-- +toolShellGetStyle :: ToolShellClass self => self + -> IO ToolbarStyle -- ^ returns the current style of @shell@ +toolShellGetStyle self = + liftM (toEnum . fromIntegral) $ + {# call gtk_tool_shell_get_style #} + (toToolShell self) + +-- | Calling this function signals the tool shell that the overflow menu item +-- for tool items have changed. If there is an overflow menu and if it is +-- visible when this function it called, the menu will be rebuilt. +-- +-- Tool items must not call this function directly, but rely on +-- 'toolItemRebuildMenu' instead. +-- +toolShellRebuildMenu :: ToolShellClass self => self -> IO () +toolShellRebuildMenu self = + {# call gtk_tool_shell_rebuild_menu #} + (toToolShell self) +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 73 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 116 + toolbarUnsetIconSize, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 136 + toolbarToolbarStyle, + toolbarIconSize, + toolbarIconSizeSet, + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 154 + focusHomeOrEnd, + orientationChanged, + popupContextMenu, + styleChanged, + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 166 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 505 +-- | Unsets toolbar icon size set with 'toolbarSetIconSize', so that user +-- preferences will be used to determine the icon size. +-- +toolbarUnsetIconSize :: ToolbarClass self => self -> IO () +toolbarUnsetIconSize self = + {# call gtk_toolbar_unset_icon_size #} + (toToolbar self) + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 680 +-- | How to draw the toolbar. +-- [_$_] +-- Default value: ''ToolbarBoth'' +toolbarToolbarStyle :: ToolbarClass self => Attr self ToolbarStyle +toolbarToolbarStyle = newAttrFromEnumProperty "toolbar-style" + {# call pure unsafe gtk_toolbar_style_get_type #} + +-- | The size of the icons in a toolbar is normally determined by the toolbar-icon-size setting. When +-- this property is set, it overrides the setting. +-- [_$_] +-- This should only be used for special-purpose toolbars, normal application toolbars should respect +-- the user preferences for the size of icons. +-- [_$_] +-- Allowed values: >= 0 +-- [_$_] +-- Default value: 3 +-- [_$_] +-- Since 2.10 +toolbarIconSize :: ToolbarClass self => Attr self Int +toolbarIconSize = newAttrFromIntProperty "icon-size" + +-- | Is 'True' if the icon-size property has been set. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.10 +toolbarIconSizeSet :: ToolbarClass self => Attr self Bool +toolbarIconSizeSet = newAttrFromBoolProperty "icon-size-set" + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 757 +-- | A keybinding signal used internally by GTK+. This signal can't be used in application code +focusHomeOrEnd :: ToolbarClass self => Signal self (Bool -> IO Bool) +focusHomeOrEnd = Signal (connect_BOOL__BOOL "focus-home-or-end") + +-- | Emitted when the orientation of the toolbar changes. +orientationChanged :: ToolbarClass self => Signal self (Orientation -> IO ()) +orientationChanged = Signal (connect_ENUM__NONE "orientation-changed") + +-- | Emitted when the user right-clicks the toolbar or uses the keybinding to display a popup menu. +-- [_$_] +-- Application developers should handle this signal if they want to display a context menu on the +-- toolbar. The context-menu should appear at the coordinates given by x and y. The mouse button number +-- is given by the button parameter. If the menu was popped up using the keybaord, button is -1. +popupContextMenu :: ToolbarClass self => Signal self (Int -> Int -> Int -> IO Bool) +popupContextMenu = Signal (connect_INT_INT_INT__BOOL "popup-context-menu") + [_$_] +-- | Emitted when the style of the toolbar changes. +styleChanged :: ToolbarClass self => Signal self (ToolbarStyle -> IO ()) +styleChanged = Signal (connect_ENUM__NONE "style-changed") + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp 810 - +#endif hunk ./tools/hierarchyGen/hierarchy.list 354 +# For GtkToolShell + GtkToolShell + |
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 |
From: Andy S. <And...@co...> - 2010-03-24 10:29:36
|
Wed Mar 24 06:28:58 EDT 2010 Andy Stewart <laz...@gm...> * Update all `ActionmenuToolbar` modules to Gtk+ 2.18.3 Ignore-this: dd177bf35acbcab3d75686df3f2f3c39 hunk ./ApiUpdateTodoList.txt 23 -*** TODO Activatable.chs +*** DONE Activatable.chs hunk ./ApiUpdateTodoList.txt 196 -*** TODO ActionGroup.chs.pp -*** TODO RadioAction.chs.pp -*** TODO ToggleAction.chs.pp -*** TODO UIManager.chs.pp +*** DONE ActionGroup.chs.pp +*** DONE RadioAction.chs.pp +*** DONE ToggleAction.chs.pp +*** DONE UIManager.chs.pp hunk ./Makefile.am 689 + gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs.pp \ + gtk/Graphics/UI/Gtk/ActionMenuToolbar/Activatable.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 155 + module Graphics.UI.Gtk.ActionMenuToolbar.RecentAction, hunk ./gtk/Graphics/UI/Gtk.hs.pp 158 + module Graphics.UI.Gtk.ActionMenuToolbar.Activatable, hunk ./gtk/Graphics/UI/Gtk.hs.pp 365 +import Graphics.UI.Gtk.ActionMenuToolbar.RecentAction hunk ./gtk/Graphics/UI/Gtk.hs.pp 368 +import Graphics.UI.Gtk.ActionMenuToolbar.Activatable hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 28 +-- [_$_] +-- The following don't need bind, use corresponding attributes instead: +-- [_$_] +-- gtk_action_set_label [_$_] +-- gtk_action_get_label [_$_] +-- gtk_action_set_short_label [_$_] +-- gtk_action_get_short_label [_$_] +-- gtk_action_set_tooltip [_$_] +-- gtk_action_get_tooltip [_$_] +-- gtk_action_set_stock_id [_$_] +-- gtk_action_get_stock_id [_$_] +-- gtk_action_set_gicon [_$_] +-- gtk_action_get_gicon [_$_] +-- gtk_action_set_icon_name [_$_] +-- gtk_action_get_icon_name [_$_] +-- gtk_action_set_visible_horizontal [_$_] +-- gtk_action_get_visible_horizontal [_$_] +-- gtk_action_set_visible_vertical [_$_] +-- gtk_action_get_visible_vertical [_$_] +-- gtk_action_set_is_important [_$_] +-- gtk_action_get_is_important [_$_] hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 51 + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 91 +-- hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 97 +-- | +----'RecentAction' hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 123 + actionCreateIcon, +#if GTK_CHECK_VERSION(2,12,0) + actionCreateMenu, +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 139 +#if GTK_CHECK_VERSION(2,16,0) + actionBlockActivate, + actionUnblockActivate, +#endif +#if GTK_CHECK_VERSION(2,8,0) + -- actionGetAccelClosure, +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 165 +#if GTK_CHECK_VERSION(2,10,0) + actionActionGroup, +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 192 +import Graphics.UI.Gtk.General.Structs (IconSize(..), Rectangle) hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 319 +-- | This function is intended for use by action implementations to create icons displayed in the proxy +-- widgets. +-- [_$_] +-- Since 2.4 +actionCreateIcon :: ActionClass self => self [_$_] + -> IconSize + -> IO Widget +actionCreateIcon self size = + makeNewObject mkWidget $ + {#call action_create_icon#} + (toAction self) + ((fromIntegral . fromEnum) size) + +#if GTK_CHECK_VERSION(2,12,0) +-- | If @action@ provides a 'Menu' widget as a submenu for the menu item or +-- the toolbar item it creates, this function returns an instance of that menu. +-- +-- * Available since Gtk+ version 2.12 +-- +actionCreateMenu :: ActionClass self => self + -> IO Widget -- ^ returns the menu item provided by the action, or {@NULL@, + -- FIXME: this should probably be converted to a Maybe data + -- type}. +actionCreateMenu self = + makeNewObject mkWidget $ + {# call gtk_action_create_menu #} + (toAction self) +#endif + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 457 +#if GTK_CHECK_VERSION(2,16,0) +-- | Disable activation signals from the action +-- +-- This is needed when updating the state of your proxy 'Activatable' widget +-- could result in calling 'actionActivate', this is a convenience function to +-- avoid recursing in those cases (updating toggle state for instance). +-- +-- * Available since Gtk+ version 2.16 +-- +actionBlockActivate :: ActionClass self => self -> IO () +actionBlockActivate self = + {# call gtk_action_block_activate #} + (toAction self) + +-- | Reenable activation signals from the action +-- +-- * Available since Gtk+ version 2.16 +-- +actionUnblockActivate :: ActionClass self => self -> IO () +actionUnblockActivate self = + {# call gtk_action_unblock_activate #} + (toAction self) +#endif + +#if GTK_CHECK_VERSION(2,8,0) +-- | Returns the accel closure for this action. +-- +-- * Available since Gtk+ version 2.8 +-- +-- actionGetAccelClosure :: ActionClass self => self +-- -> IO {-GClosure*-} -- ^ returns the accel closure for this action. The +-- -- returned closure is owned by Gtk+ and must not be +-- -- unreffed or modified. +-- actionGetAccelClosure self = +-- {# call gtk_action_get_accel_closure #} +-- (toAction self) +#endif + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 610 +-- | The 'ActionGroup' this 'Action' is associated with. +actionActionGroup :: ActionClass self => Attr self ActionGroup +actionActionGroup = newAttrFromObjectProperty "action-group" + {# call pure unsafe gtk_action_group_get_type #} + +-- | The name of the icon from the icon theme. +-- [_$_] +-- Note that the stock icon is preferred, if the 'stockId' property holds the id of an existing stock +-- icon, and the GIcon is preferred if the "gicon" property is set. +-- [_$_] +-- This is an appearance property and thus only applies if 'useActionAppearance' is 'True'. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.10 +actionIconName :: ActionClass self => Attr self String +actionIconName = newAttrFromStringProperty "icon-name" + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs.pp 53 +-- hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs.pp 99 + connectProxy, + disconnectProxy, + postActivate, + preActivate, + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs.pp 125 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs.pp 447 +-- | The 'connectProxy' signal is emitted after connecting a proxy to an action in the group. Note that +-- the proxy may have been connected to a different action before. +-- [_$_] +-- This is intended for simple customizations for which a custom action class would be too clumsy, +-- e.g. showing tooltips for menuitems in the statusbar. +-- [_$_] +-- 'UIManager' proxies the signal and provides global notification just before any action is connected +-- to a proxy, which is probably more convenient to use. +connectProxy :: ActionGroupClass self => Signal self (Action -> Widget -> IO ()) +connectProxy = Signal (connect_OBJECT_OBJECT__NONE "connect-proxy") + [_$_] +-- | The 'disconnectProxy' signal is emitted after disconnecting a proxy from an action in the group. +-- [_$_] +-- 'UIManager' proxies the signal and provides global notification just before any action is connected +-- to a proxy, which is probably more convenient to use. +-- [_$_] +-- Since 2.4 +disconnectProxy :: ActionGroupClass self => Signal self (Action -> Widget -> IO ()) +disconnectProxy = Signal (connect_OBJECT_OBJECT__NONE "disconnect-proxy") + +-- | The 'postActivate' signal is emitted just after the action in the @actionGroup@ is activated +-- [_$_] +-- This is intended for 'UIManager' to proxy the signal and provide global notification just after any +-- action is activated. +-- [_$_] +-- Since 2.4 +postActivate :: ActionGroupClass self => Signal self (Action -> IO ()) +postActivate = Signal (connect_OBJECT__NONE "post-activate") + [_$_] + +-- | The 'preActivate' signal is emitted just before the action in the @actionGroup@ is activated +-- [_$_] +-- This is intended for 'UIManager' to proxy the signal and provide global notification just before +-- any action is activated. +-- [_$_] +-- Since 2.4 +preActivate :: ActionGroupClass self => Signal self (Action -> IO ()) +preActivate = Signal (connect_OBJECT__NONE "pre-activate") + addfile ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Activatable.chs.pp hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Activatable.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Interface Activatable +-- +-- Author : Andy Stewart +-- +-- Created: 24 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) +-- +-- An interface for activatable widgets +-- +-- * Module available since Gtk+ version 2.16 +-- +-- The following functons don't bind, use corresponding attributes instead: +-- gtk_activatable_set_related_action +-- gtk_activatable_get_related_action +-- gtk_activatable_set_use_action_appearance +-- gtk_activatable_get_use_action_appearance +-- +module Graphics.UI.Gtk.ActionMenuToolbar.Activatable ( + +-- * Detail +-- +-- | Activatable widgets can be connected to a 'Action' and reflects the state +-- of its action. A 'Activatable' can also provide feedback through its action, +-- as they are responsible for activating their related actions. +-- +-- '{FIXME: gtk-doc cross reference to:}' + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GInterface' +-- | +----Activatable +-- @ + +#if GTK_CHECK_VERSION(2,16,0) +-- * Types + Activatable, + ActivatableClass, + castToActivatable, + toActivatable, + +-- * Methods + activatableDoSetRelatedAction, + activatableSyncActionProperties, + +-- * Attributes + activatableRelatedAction, + activatableUseActionAppearance, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,16,0) +-------------------- +-- Methods + +-- | This is a utility function for 'Activatable' implementors. +-- +-- When implementing 'Activatable' you must call this when handling changes +-- of the {\"related-action\", FIXME: unknown type\/value}, and you must also +-- use this to break references in {GObject-, FIXME: unknown +-- type\/value}>'dispose'. +-- +-- This function adds a reference to the currently set related action for +-- you, it also makes sure the {GtkActivatable-, FIXME: unknown +-- type\/value}>'update' method is called when the related 'Action' properties +-- change and registers to the action's proxy list. +-- +activatableDoSetRelatedAction :: (ActivatableClass self, ActionClass action) => self + -> action -- ^ @action@ - the 'Action' to set + -> IO () +activatableDoSetRelatedAction self action = + {# call gtk_activatable_do_set_related_action #} + (toActivatable self) + (toAction action) + +-- | This is called to update the activatable completely, this is called +-- internally when the {\"related-action\", FIXME: unknown type\/value} +-- property is set or unset and by the implementing class when +-- {\"use-action-appearance\", FIXME: unknown type\/value} changes. +-- +activatableSyncActionProperties :: (ActivatableClass self, ActionClass action) => self + -> action -- ^ @action@ - the related 'Action' or {@NULL@, FIXME: this should + -- probably be converted to a Maybe data type} + -> IO () +activatableSyncActionProperties self action = + {# call gtk_activatable_sync_action_properties #} + (toActivatable self) + (toAction action) + +-------------------- +-- Attributes + +-- | +-- +activatableRelatedAction :: (ActivatableClass self, ActionClass action) => ReadWriteAttr self Action action +activatableRelatedAction = newAttrFromObjectProperty "related-action" + {# call pure unsafe gtk_action_get_type #} + +-- | +-- +activatableUseActionAppearance :: ActivatableClass self => Attr self Bool +activatableUseActionAppearance = newAttrFromBoolProperty "use-action-appearance" +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 20 --- TODO --- I don't know what the elemnt type of the group GSList is for --- radioActionSetGroup / radioActionGetGroup --- --- Also, the signals clash with those from other modules +-- The following function don't need bind, use corresponding attributes instead: +-- gtk_radio_action_set_current_value hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 33 + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 40 +-- hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 71 +-- * Signal + radioActionChanged, + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 90 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 198 +-------------------- +-- Signals. +radioActionChanged :: RadioActionClass self => Signal self (RadioAction -> IO ()) +radioActionChanged = Signal (connect_OBJECT__NONE "changed") + addfile ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs.pp hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget RecentAction +-- +-- Author : Andy Stewart +-- +-- Created: 24 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) +-- +-- An action of which represents a list of recently used files +-- +-- * Module available since Gtk+ version 2.12 +-- +-- The following functons don't bind, use corresponding attributes instead: +-- gtk_recent_action_get_show_numbers +-- gtk_recent_action_set_show_numbers +-- +module Graphics.UI.Gtk.ActionMenuToolbar.RecentAction ( + +-- * Detail +-- +-- | A 'RecentAction' represents a list of recently used files, which can be +-- shown by widgets such as 'RecentChooserDialog' or 'RecentChooserMenu'. +-- +-- To construct a submenu showing recently used files, use a 'RecentAction' +-- as the action for a \<menuitem>. To construct a menu toolbutton showing the +-- recently used files in the popup menu, use a 'RecentAction' as the action +-- for a \<toolitem> element. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Action' +-- | +----RecentAction +-- @ + +#if GTK_CHECK_VERSION(2,12,0) +-- * Types + RecentAction, + RecentActionClass, + castToRecentAction, + toRecentAction, + +-- * Constructors + recentActionNew, + -- recentActionNewForManager, + +-- * Attributes + recentActionShowNumbers, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.UTFString +import System.Glib.GObject (constructNewGObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,12,0) +-------------------- +-- Constructors + +-- | Creates a new 'RecentAction' object. To add the action to a 'ActionGroup' +-- and set the accelerator for the action, call +-- 'actionGroupAddActionWithAccel'. +-- +recentActionNew :: + String -- ^ @name@ - a unique name for the action + -> String -- ^ @label@ - the label displayed in menu items and on buttons, or + -- {@NULL@, FIXME: this should probably be converted to a Maybe data + -- type} + -> String -- ^ @tooltip@ - a tooltip for the action, or {@NULL@, FIXME: this + -- should probably be converted to a Maybe data type} + -> String -- ^ @stockId@ - the stock icon to display in widgets representing + -- the action, or {@NULL@, FIXME: this should probably be converted + -- to a Maybe data type} + -> IO RecentAction +recentActionNew name label tooltip stockId = + constructNewGObject mkRecentAction $ [_$_] + liftM castPtr $ + withUTFString stockId $ \stockIdPtr -> + withUTFString tooltip $ \tooltipPtr -> + withUTFString label $ \labelPtr -> + withUTFString name $ \namePtr -> + {# call gtk_recent_action_new #} + namePtr + labelPtr + tooltipPtr + stockIdPtr + +-- | Creates a new 'RecentAction' object. To add the action to a 'ActionGroup' +-- and set the accelerator for the action, call +-- 'actionGroupAddActionWithAccel'. +-- +-- recentActionNewForManager :: RecentManagerClass manager => +-- String -- ^ @name@ - a unique name for the action +-- -> String -- ^ @label@ - the label displayed in menu items and on buttons, +-- -- or {@NULL@, FIXME: this should probably be converted to a Maybe +-- -- data type} +-- -> String -- ^ @tooltip@ - a tooltip for the action, or {@NULL@, FIXME: this +-- -- should probably be converted to a Maybe data type} +-- -> String -- ^ @stockId@ - the stock icon to display in widgets representing +-- -- the action, or {@NULL@, FIXME: this should probably be converted +-- -- to a Maybe data type} +-- -> manager -- ^ @manager@ - a 'RecentManager', or {@NULL@, FIXME: this should +-- -- probably be converted to a Maybe data type} for using the +-- -- default 'RecentManager' +-- -> IO RecentAction +-- recentActionNewForManager name label tooltip stockId manager = +-- constructNewGObject mkRecentAction $ +-- withUTFString stockId $ \stockIdPtr -> +-- withUTFString tooltip $ \tooltipPtr -> +-- withUTFString label $ \labelPtr -> +-- withUTFString name $ \namePtr -> +-- {# call gtk_recent_action_new_for_manager #} +-- namePtr +-- labelPtr +-- tooltipPtr +-- stockIdPtr +-- (toRecentAction manager) + +-------------------- +-- Attributes + +-- | +-- +recentActionShowNumbers :: RecentActionClass self => Attr self Bool +recentActionShowNumbers = newAttrFromBoolProperty "show-numbers" +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 37 +-- hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs.pp 8 --- Copyright (C) 2005 Duncan Coutts +-- Copyright (C) 2005-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs.pp 34 + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs.pp 194 +-- hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs.pp 238 + uiManagerConnectProxy, + uiManagerDisconnectProxy, + uiManagerPostActivate, + uiManagerPreActivate, hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs.pp 583 +-- | The @connectProxy@ signal is emitted after connecting a proxy to an action in the group. +-- [_$_] +-- This is intended for simple customizations for which a custom action class would be too clumsy, +-- e.g. showing tooltips for menuitems in the statusbar. +uiManagerConnectProxy :: UIManagerClass self => Signal self (Action -> Widget -> IO ()) +uiManagerConnectProxy = Signal (connect_OBJECT_OBJECT__NONE "connect-proxy") + [_$_] +-- | The @disconnectProxy@ signal is emitted after disconnecting a proxy from an action in the group. +uiManagerDisconnectProxy :: UIManagerClass self => Signal self (Action -> Widget -> IO ()) +uiManagerDisconnectProxy = Signal (connect_OBJECT_OBJECT__NONE "disconnect-proxy") + [_$_] +-- | The @postActivate@ signal is emitted just after the action is activated. +-- [_$_] +-- This is intended for applications to get notification just after any action is activated. +uiManagerPostActivate :: UIManagerClass self => Signal self (Action -> IO ()) +uiManagerPostActivate = Signal (connect_OBJECT__NONE "post-activate") + [_$_] +-- | The @preActivate@ signal is emitted just before the action is activated. +-- [_$_] +-- This is intended for applications to get notification just before any action is activated. +uiManagerPreActivate :: UIManagerClass self => Signal self (Action -> IO ()) +uiManagerPreActivate = Signal (connect_OBJECT__NONE "pre-activate") + hunk ./tools/hierarchyGen/hierarchy.list 206 + GtkRecentAction hunk ./tools/hierarchyGen/hierarchy.list 349 + +# For ActionMenuToolbar + GtkActivatable |
From: Andy S. <And...@co...> - 2010-03-24 07:59:42
|
Wed Mar 24 03:58:11 EDT 2010 Andy Stewart <laz...@gm...> * Update all `Misc` modules to Gtk+ 2.18.3 Ignore-this: ec4f88036ef4b99ee01b25c5ee5dd474 hunk ./ApiUpdateTodoList.txt 35 -*** TODO CList.chs +*** DEPRECATED CList.chs hunk ./ApiUpdateTodoList.txt 39 -*** TODO CTree.chs +*** DEPRECATED CTree.chs hunk ./ApiUpdateTodoList.txt 70 -*** TODO IMContextSimple.chs +*** DONE IMContextSimple.chs hunk ./ApiUpdateTodoList.txt 77 -*** TODO ItemFactory.chs +*** DEPRECATED ItemFactory.chs hunk ./ApiUpdateTodoList.txt 83 -*** TODO List.chs -*** TODO ListItem.chs +*** DEPRECATED List.chs +*** DEPRECATED ListItem.chs hunk ./ApiUpdateTodoList.txt 89 -*** TODO OldEditable.chs +*** DEPRECATED OldEditable.chs hunk ./ApiUpdateTodoList.txt 107 -*** TODO Pixmap.chs +*** DEPRECATED Pixmap.chs hunk ./ApiUpdateTodoList.txt 109 -*** TODO Preview.chs +*** DEPRECATED Preview.chs hunk ./ApiUpdateTodoList.txt 122 -*** TODO Progress.chs +*** DEPRECATED Progress.chs hunk ./ApiUpdateTodoList.txt 158 -*** TODO Text.chs +*** DEPRECATED Text.chs hunk ./ApiUpdateTodoList.txt 161 -*** TODO TipsQuery.chs +*** DEPRECATED TipsQuery.chs hunk ./ApiUpdateTodoList.txt 163 -*** TODO Tooltip.chs +*** DONE Tooltip.chs hunk ./ApiUpdateTodoList.txt 165 -*** TODO Tree.chs +*** DEPRECATED Tree.chs hunk ./ApiUpdateTodoList.txt 253 -*** TODO Combo.chs.pp +*** DEPRECATED Combo.chs.pp hunk ./ApiUpdateTodoList.txt 260 -*** TODO OptionMenu.chs.pp +*** DEPRECATED OptionMenu.chs.pp hunk ./ApiUpdateTodoList.txt 271 -** TODO Directory: gtk-modules/Graphics/UI/Gtk/Misc -*** TODO Adjustment.chs.pp -*** TODO Arrow.chs -*** TODO Calendar.chs.pp -*** TODO DrawingArea.chs -*** TODO EventBox.chs.pp -*** TODO HandleBox.chs -*** TODO IMMulticontext.chs.pp -*** TODO SizeGroup.chs.pp -*** TODO Tooltips.chs.pp -*** TODO Viewport.chs +** DONE Directory: gtk-modules/Graphics/UI/Gtk/Misc +*** DONE Adjustment.chs.pp +*** DONE Arrow.chs +*** DONE Calendar.chs.pp +*** DONE DrawingArea.chs +*** DONE EventBox.chs.pp +*** DONE HandleBox.chs +*** DONE IMMulticontext.chs.pp +*** DONE SizeGroup.chs.pp +*** DEPRECATED Tooltips.chs.pp +*** DONE Viewport.chs hunk ./Makefile.am 700 + gtk/Graphics/UI/Gtk/Misc/Tooltip.chs.pp \ + gtk/Graphics/UI/Gtk/Misc/IMContextSimple.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 202 + module Graphics.UI.Gtk.Misc.IMContextSimple, hunk ./gtk/Graphics/UI/Gtk.hs.pp 205 + module Graphics.UI.Gtk.Misc.Tooltip, hunk ./gtk/Graphics/UI/Gtk.hs.pp 409 +import Graphics.UI.Gtk.Misc.IMContextSimple hunk ./gtk/Graphics/UI/Gtk.hs.pp 412 +import Graphics.UI.Gtk.Misc.Tooltip hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 30 --- [_$_] +-- hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 46 +-- hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 79 +#if GTK_CHECK_VERSION(2,14,0) + adjustmentConfigure, +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 94 + adjChanged, + adjValueChanged, + +-- * Depecateds +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 103 +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 240 +#if GTK_CHECK_VERSION(2,14,0) +-- | Sets all properties of the adjustment at once. +-- +-- Use this function to avoid multiple emissions of the \"changed\" signal. +-- See 'adjustmentSetLower' for an alternative way of compressing multiple +-- emissions of \"changed\" into one. +-- +-- * Available since Gtk+ version 2.14 +-- +adjustmentConfigure :: Adjustment + -> Double -- ^ @value@ - the new value + -> Double -- ^ @lower@ - the new minimum value + -> Double -- ^ @upper@ - the new maximum value + -> Double -- ^ @stepIncrement@ - the new step increment + -> Double -- ^ @pageIncrement@ - the new page increment + -> Double -- ^ @pageSize@ - the new page size + -> IO () +adjustmentConfigure self value lower upper stepIncrement pageIncrement pageSize = + {# call gtk_adjustment_configure #} + self + (realToFrac value) + (realToFrac lower) + (realToFrac upper) + (realToFrac stepIncrement) + (realToFrac pageIncrement) + (realToFrac pageSize) +#endif + hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 326 +adjChanged :: Signal Adjustment (IO ()) [_$_] +adjChanged = Signal (connect_NONE__NONE "changed") + +-- | Emitted when the 'Adjustment' value field has been changed. +-- +adjValueChanged :: Signal Adjustment (IO ()) +adjValueChanged = Signal (connect_NONE__NONE "value-changed") + +#ifndef DISABLE_DEPRECATED +-- | Emitted when one or more of the 'Adjustment' fields have been changed, +-- other than the value field. +-- hunk ./gtk/Graphics/UI/Gtk/Misc/Adjustment.chs.pp 351 - +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/Arrow.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Misc/Arrow.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Misc/Arrow.chs 45 +-- hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 27 +-- The following functions don't need bind, use corresponding attributes instead: +-- gtk_calendar_get_detail_width_chars +-- gtk_calendar_set_detail_width_chars +-- gtk_calendar_get_detail_height_rows +-- gtk_calendar_set_detail_height_rows +-- hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 34 + hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 55 +-- hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 70 +#if GTK_CHECK_VERSION(2,14,0) + CalendarDetail, +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 94 +#if GTK_CHECK_VERSION(2,14,0) + calendarSetDetailFunc, +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 108 +#if GTK_CHECK_VERSION(2,14,0) + calendarDetailHeightRows, + calendarDetailWidthChars, + calendarShowDetails, +#endif + hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 117 + daySelected, + daySelectedDoubleClick, + monthChanged, + nextMonth, + nextYear, + prevMonth, + prevYear, + [_$_] +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 140 +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 156 +-------------------- +-- Types +#if GTK_CHECK_VERSION(2,14,0) +type CalendarDetail = Int -> Int -> Int -> String + +{#pointer CalendarDetailFunc#} + +foreign import ccall "wrapper" mkCalendarDetailFunc :: [_$_] + (Ptr Calendar -> {#type guint#} -> {#type guint#} -> {#type guint#} -> Ptr () -> IO CString) + -> IO CalendarDetailFunc +#endif + hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 313 +#if GTK_CHECK_VERSION(2,14,0) +calendarSetDetailFunc :: CalendarClass self => self + -> CalendarDetail [_$_] + -> DestroyNotify + -> IO () +calendarSetDetailFunc self function notify = do + func <- mkCalendarDetailFunc $ \_ year month day _ -> + newCString (function (fromIntegral year) (fromIntegral month) (fromIntegral day)) + {#call calendar_set_detail_func#} + (toCalendar self) + func + nullPtr + notify +#endif + hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 389 +#if GTK_CHECK_VERSION(2,14,0) +-- | Width of a detail cell, in characters. A value of 0 allows any width. See +-- 'calendarSetDetailFunc'. +-- [_$_] +-- Allowed values: [0,127] +-- [_$_] +-- Default value: 0 +-- [_$_] +-- Since 2.14 +calendarDetailWidthChars :: CalendarClass self => Attr self Int +calendarDetailWidthChars = newAttrFromIntProperty "detail-width-chars" + +-- | Height of a detail cell, in rows. A value of 0 allows any width. See 'calendarSetDetailFunc'. +-- [_$_] +-- Allowed values: [0,127] +-- [_$_] +-- Default value: 0 +-- [_$_] +-- Since 2.14 +calendarDetailHeightRows :: CalendarClass self => Attr self Int +calendarDetailHeightRows = newAttrFromIntProperty "detail-height-rows" + +-- | Determines whether details are shown directly in the widget, or if they are available only as +-- tooltip. When this property is set days with details are marked. +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.14 +calendarShowDetails :: CalendarClass self => Attr self Bool +calendarShowDetails = newAttrFromBoolProperty "show-details" +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 431 +-- | Emitted when the user clicks a button to change the selected month on a +-- calendar. +-- +monthChanged :: CalendarClass self => Signal self (IO ()) +monthChanged = Signal (connect_NONE__NONE "month-changed") + +-- | Emitted when the user selects a day. +-- +daySelected :: CalendarClass self => Signal self (IO ()) +daySelected = Signal (connect_NONE__NONE "day-selected") + +-- | +-- +daySelectedDoubleClick :: CalendarClass self => Signal self (IO ()) +daySelectedDoubleClick = Signal (connect_NONE__NONE "day-selected-double-click") + +-- | +-- +prevMonth :: CalendarClass self => Signal self (IO ()) +prevMonth = Signal (connect_NONE__NONE "prev-month") + +-- | +-- +nextMonth :: CalendarClass self => Signal self (IO ()) +nextMonth = Signal (connect_NONE__NONE "next-month") + +-- | +-- +prevYear :: CalendarClass self => Signal self (IO ()) +prevYear = Signal (connect_NONE__NONE "prev-year") + +-- | +-- +nextYear :: CalendarClass self => Signal self (IO ()) +nextYear = Signal (connect_NONE__NONE "next-year") + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp 525 - +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/DrawingArea.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Misc/DrawingArea.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Misc/DrawingArea.chs 65 +-- hunk ./gtk/Graphics/UI/Gtk/Misc/DrawingArea.chs 72 +-- | +----'Curve' hunk ./gtk/Graphics/UI/Gtk/Misc/EventBox.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Misc/EventBox.chs.pp 29 + hunk ./gtk/Graphics/UI/Gtk/Misc/EventBox.chs.pp 37 +-- hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 52 +-- hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 81 + handleBoxGetChildDetached, hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 88 + handleBoxShadow, + handleBoxChildDetached, hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 92 + childAttached, + childDetached, + +-- * Deprecated hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 196 +-- | Whether the handlebox's child is currently detached. +-- +-- * Available since Gtk+ version 2.14 +-- +handleBoxGetChildDetached :: HandleBoxClass self => self + -> IO Bool -- ^ returns @True@ if the child is currently detached, otherwise + -- @False@ +handleBoxGetChildDetached self = + liftM toBool $ + {# call gtk_handle_box_get_child_detached #} + (toHandleBox self) + hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 247 +-- | Deprecated property, use @shadowType@ instead. +-- [_$_] +-- Default value: ''ShadowOut'' +handleBoxShadow :: HandleBoxClass self => Attr self ShadowType +handleBoxShadow = newAttrFromEnumProperty "shadow" + {# call pure unsafe gtk_shadow_type_get_type #} + +-- | A boolean value indicating whether the handlebox's child is attached or detached. +-- [_$_] +-- Default value: 'False' +handleBoxChildDetached :: HandleBoxClass self => ReadAttr self Bool +handleBoxChildDetached = readAttrFromBoolProperty "child-detached" + hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 263 +-- | This signal is emitted when the contents of the handlebox are reattached +-- to the main window. +-- +childAttached :: HandleBoxClass self => Signal self (Widget -> IO ()) +childAttached = Signal (connect_OBJECT__NONE "child-attached") + +-- | This signal is emitted when the contents of the handlebox are detached +-- from the main window. +-- +childDetached :: HandleBoxClass self => Signal self (Widget -> IO ()) +childDetached = Signal (connect_OBJECT__NONE "child-detached") + + hunk ./gtk/Graphics/UI/Gtk/Misc/HandleBox.chs 295 - addfile ./gtk/Graphics/UI/Gtk/Misc/IMContextSimple.chs.pp hunk ./gtk/Graphics/UI/Gtk/Misc/IMContextSimple.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget IMContextSimple +-- +-- Author : Andy Stewart +-- +-- Created: 24 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) +-- +-- An input method context supporting table-based input methods +-- +module Graphics.UI.Gtk.Misc.IMContextSimple ( + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'IMContext' +-- | +----IMContextSimple +-- @ + +-- * Types + IMContextSimple, + IMContextSimpleClass, + castToIMContextSimple, + toIMContextSimple, + +-- * Constructors + imContextSimpleNew, + +-- * Methods + -- imContextSimpleAddTable, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +{#import Graphics.UI.Gtk.Types#} +-- CHECKME: extra imports may be required + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Constructors + +-- | Creates a new 'IMContextSimple'. +-- +imContextSimpleNew :: IO IMContextSimple +imContextSimpleNew = + constructNewGObject mkIMContextSimple $ + liftM castPtr {# call gtk_im_context_simple_new #} + +-------------------- +-- Methods + +-- | Adds an additional table to search to the input context. Each row of the +-- table consists of @maxSeqLen@ key symbols followed by two {guint16, FIXME: +-- unknown type\/value} interpreted as the high and low words of a {gunicode, +-- FIXME: unknown type\/value} value. Tables are searched starting from the +-- last added. +-- +-- The table must be sorted in dictionary order on the numeric value of the +-- key symbol fields. (Values beyond the length of the sequence should be +-- zero.) +-- +-- imContextSimpleAddTable :: IMContextSimpleClass self => self +-- -> {-guint16*-} -- ^ @data@ - the table +-- -> Int -- ^ @maxSeqLen@ - Maximum length of a sequence in the table +-- -- (cannot be greater than {GTK_MAX_COMPOSE_LEN, FIXME: +-- -- unknown type\/value}) +-- -> Int -- ^ @nSeqs@ - number of sequences in the table +-- -> IO () +-- imContextSimpleAddTable self data_ maxSeqLen nSeqs = +-- {# call gtk_im_context_simple_add_table #} +-- (toIMContextSimple self) +-- {-data_-} +-- (fromIntegral maxSeqLen) +-- (fromIntegral nSeqs) hunk ./gtk/Graphics/UI/Gtk/Misc/SizeGroup.chs.pp 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Misc/SizeGroup.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/Misc/SizeGroup.chs.pp 57 +-- hunk ./gtk/Graphics/UI/Gtk/Misc/SizeGroup.chs.pp 83 +#if GTK_CHECK_VERSION(2,10,0) + sizeGroupGetWidgets, +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/SizeGroup.chs.pp 99 +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +import System.Glib.GList (GList, fromGList, fromGSList) hunk ./gtk/Graphics/UI/Gtk/Misc/SizeGroup.chs.pp 197 +#if GTK_CHECK_VERSION(2,10,0) +-- | Returns the list of widgets associated with @sizeGroup@. +-- +-- * Available since Gtk+ version 2.10 +-- +sizeGroupGetWidgets :: SizeGroupClass self => self + -> IO [Widget] -- ^ returns a list of widgets. [_$_] + -- The list is owned by Gtk+ and should not be modified. +sizeGroupGetWidgets self = + {# call gtk_size_group_get_widgets #} + (toSizeGroup self) + >>= fromGSList + >>= mapM (\elemPtr -> makeNewObject mkWidget (return elemPtr)) +#endif + addfile ./gtk/Graphics/UI/Gtk/Misc/Tooltip.chs.pp hunk ./gtk/Graphics/UI/Gtk/Misc/Tooltip.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Tooltip +-- +-- Author : Andy Stewart +-- +-- Created: 24 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) +-- +-- Add tips to your widgets +-- +-- * Module available since Gtk+ version 2.12 +-- +module Graphics.UI.Gtk.Misc.Tooltip ( + +-- * Detail +-- +-- | 'Tooltip' belongs to the new tooltips API that was introduced in Gtk+ +-- 2.12 and which deprecates the old 'Tooltips' API. +-- +-- Basic tooltips can be realized simply by using 'widgetSetTooltipText' or +-- 'widgetSetTooltipMarkup' without any explicit tooltip object. +-- +-- When you need a tooltip with a little more fancy contents, like adding an +-- image, or you want the tooltip to have different contents per 'TreeView' row +-- or cell, you will have to do a little more work: +-- +-- Set the 'hasTooltip' property to 'True', this will make GTK+ monitor the widget for motion and +-- related events which are needed to determine when and where to show a tooltip. +-- [_$_] +-- Connect to the 'queryTooltip' signal. This signal will be emitted when a tooltip is supposed to +-- be shown. One of the arguments passed to the signal handler is a 'Tooltip' object. This is the +-- object that we are about to display as a tooltip, and can be manipulated in your callback using +-- functions like 'tooltipSetIcon'. There are functions for setting the tooltip's markup, +-- setting an image from a stock icon, or even putting in a custom widget. +-- [_$_] +-- Return 'True' from your query-tooltip handler. This causes the tooltip to be show. If you return +-- 'False', it will not be shown. +-- [_$_] +-- In the probably rare case where you want to have even more control over the tooltip that is about to +-- be shown, you can set your own 'Window' which will be used as tooltip window. This works as +-- follows: +-- [_$_] +-- Set 'hasTooltip' and connect to 'queryTooltip' as before. +-- [_$_] +-- Use 'widgetSetTooltipWindow' to set a 'Window' created by you as tooltip window. +-- [_$_] +-- In the 'queryTooltip' callback you can access your window using 'widgetGetTooltipWindow' +-- and manipulate as you wish. The semantics of the return value are exactly as before, return 'True' +-- to show the window, 'False' to not show it. +-- +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----Tooltip +-- @ + +#if GTK_CHECK_VERSION(2,12,0) +-- * Types + Tooltip, + TooltipClass, + castToTooltip, + toTooltip, + +-- * Methods + tooltipSetMarkup, + tooltipSetText, + tooltipSetIcon, + tooltipSetIconFromStock, +#if GTK_CHECK_VERSION(2,14,0) + tooltipSetIconFromIconName, +#endif + tooltipSetCustom, + tooltipTriggerTooltipQuery, + tooltipSetTipArea, +#endif + ) where + +import Control.Monad (liftM) +import Data.Maybe (fromMaybe) + +import System.Glib.FFI +import System.Glib.UTFString +import Graphics.UI.Gtk.General.Structs (IconSize(..), Rectangle) +{#import Graphics.UI.Gtk.Types#} +-- CHECKME: extra imports may be required + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,12,0) +-------------------- +-- Methods + +-- | Sets the text of the tooltip to be @markup@, which is marked up with the +-- Pango text markup language. If @markup@ is 'Nothing', the label will be hidden. +-- +tooltipSetMarkup :: TooltipClass self => self + -> Maybe String -- ^ @markup@ - a markup string (see Pango markup format) or 'Nothing' + -> IO () +tooltipSetMarkup self markup = + maybeWith withUTFString markup $ \markupPtr -> + {# call gtk_tooltip_set_markup #} + (toTooltip self) + markupPtr + +-- | Sets the text of the tooltip to be @text@. If @text@ is 'Nothing' +-- the label will be hidden. See also 'tooltipSetMarkup'. +-- +tooltipSetText :: TooltipClass self => self + -> Maybe String -- ^ @text@ - a text string or 'Nothing' + -- + -> IO () +tooltipSetText self text = + maybeWith withUTFString text $ \textPtr -> + {# call gtk_tooltip_set_text #} + (toTooltip self) + textPtr + +-- | Sets the icon of the tooltip (which is in front of the text) to be +-- @pixbuf@. If @pixbuf@ is 'Nothing' the image will be hidden. +-- +tooltipSetIcon :: TooltipClass self => self + -> Maybe Pixbuf + -> IO () +tooltipSetIcon self icon = + {#call tooltip_set_icon#} + (toTooltip self) + (fromMaybe (Pixbuf nullForeignPtr) icon) + +-- | Sets the icon of the tooltip (which is in front of the text) to be the +-- stock item indicated by @stockId@ with the size indicated by @size@. If +-- @stockId@ is 'Nothing' the image will be hidden. +-- +tooltipSetIconFromStock :: TooltipClass self => self + -> Maybe String + -> IconSize + -> IO () +tooltipSetIconFromStock self id size = + maybeWith withUTFString id $ \ idPtr -> [_$_] + {#call tooltip_set_icon_from_stock#} + (toTooltip self) + idPtr + ((fromIntegral . fromEnum) size) + +#if GTK_CHECK_VERSION(2,14,0) +-- | Sets the icon of the tooltip (which is in front of the text) to be the +-- icon indicated by @iconName@ with the size indicated by @size@. If +-- @iconName@ is 'Nothing' the image will be hidden. +-- +-- * Available since Gtk+ version 2.14 +-- +tooltipSetIconFromIconName :: TooltipClass self => self + -> Maybe String + -> IconSize + -> IO () +tooltipSetIconFromIconName self iconName size = + maybeWith withUTFString iconName $ \ iconPtr -> [_$_] + {#call tooltip_set_icon_from_icon_name#} + (toTooltip self) + iconPtr + ((fromIntegral . fromEnum) size) +#endif + +-- | Replaces the widget packed into the tooltip with @customWidget@. +-- @customWidget@ does not get destroyed when the tooltip goes away. By default +-- a box with a 'Image' and 'Label' is embedded in the tooltip, which can be +-- configured using 'tooltipSetMarkup' and 'tooltipSetIcon'. +-- +tooltipSetCustom :: (TooltipClass self, WidgetClass widget) => self -> Maybe widget -> IO () +tooltipSetCustom self widget = + {#call tooltip_set_custom#} [_$_] + (toTooltip self) + (maybe (Widget nullForeignPtr) toWidget widget) + +-- | Triggers a new tooltip query on @display@, in order to update the current +-- visible tooltip, or to show\/hide the current tooltip. This function is +-- useful to call when, for example, the state of the widget changed by a key +-- press. +-- +tooltipTriggerTooltipQuery :: + Display -- ^ @display@ - a 'Display' + -> IO () +tooltipTriggerTooltipQuery display = + {# call gtk_tooltip_trigger_tooltip_query #} + display + +-- | Sets the area of the widget, where the contents of this tooltip apply, to +-- be @rect@ (in widget coordinates). This is especially useful for properly +-- setting tooltips on 'TreeView' rows and cells, 'IconView' +-- +-- For setting tooltips on 'TreeView', please refer to the convenience +-- functions for this: 'treeViewSetTooltipRow' and 'treeViewSetTooltipCell'. +-- +tooltipSetTipArea :: TooltipClass self => self -> Rectangle -> IO () +tooltipSetTipArea self rect = + with rect $ \ rectPtr -> [_$_] + {#call tooltip_set_tip_area#} + (toTooltip self) + (castPtr rectPtr) +#endif hunk ./gtk/Graphics/UI/Gtk/Misc/Tooltips.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Misc/Tooltips.chs.pp 29 +-- +-- NOTE: +-- 'Tooltips' has been deprecated in GTK+ 2.12, in favor of the new 'Tooltip' API. +-- hunk ./gtk/Graphics/UI/Gtk/Misc/Tooltips.chs.pp 61 +-- hunk ./gtk/Graphics/UI/Gtk/Misc/Tooltips.chs.pp 88 + hunk ./gtk/Graphics/UI/Gtk/Misc/Tooltips.chs.pp 109 --- | Allows the user to see your tooltips as they navigate your application. +-- | allows the user to see your tooltips as they navigate your application. hunk ./gtk/Graphics/UI/Gtk/Misc/Viewport.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Misc/Viewport.chs 36 + hunk ./gtk/Graphics/UI/Gtk/Misc/Viewport.chs 44 +-- hunk ./gtk/Graphics/UI/Gtk/Misc/Viewport.chs 77 + +-- * Signals + viewportSetScrollAdjustments, hunk ./gtk/Graphics/UI/Gtk/Misc/Viewport.chs 87 +{#import Graphics.UI.Gtk.Signals#} hunk ./gtk/Graphics/UI/Gtk/Misc/Viewport.chs 193 +viewportSetScrollAdjustments :: ViewportClass self => Signal self (Adjustment -> Adjustment -> IO ()) +viewportSetScrollAdjustments = Signal (connect_OBJECT_OBJECT__NONE "set-scroll-adjustments") hunk ./tools/hierarchyGen/hierarchy.list 171 + GtkIMContextSimple hunk ./tools/hierarchyGen/hierarchy.list 345 + +# For Tooltip + GtkTooltip[_^I_][_^I_][_$_] |
From: Andy S. <And...@co...> - 2010-03-24 02:59:26
|
Tue Mar 23 22:58:44 EDT 2010 Andy Stewart <laz...@gm...> * Update all `Multine` modules to Gtk+ 2.18.3 Ignore-this: 2d79d84d819e356c3bc3339a1f067ab hunk ./ApiUpdateTodoList.txt 290 -*** TODO TextBuffer.chs.pp +*** DONE TextBuffer.chs.pp hunk ./ApiUpdateTodoList.txt 292 -*** TODO TextMark.chs -*** TODO TextTag.chs.pp -*** TODO TextTagTable.chs +*** DONE TextMark.chs +*** DONE TextTag.chs.pp +*** DONE TextTagTable.chs hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 226 - -- widgetGetClipboard, + widgetGetClipboard, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 2125 --- [_$_] --- widgetGetClipboard :: WidgetClass self => self --- -> Atom -- ^ @selection@ - a {GdkAtom, FIXME: struct type} which --- -- identifies the clipboard to use. @GDK_SELECTION_CLIPBOARD@ --- -- gives the default clipboard. Another common value is --- -- @GDK_SELECTION_PRIMARY@, which gives the primary X --- -- selection. --- -> IO Clipboard -- ^ returns the appropriate clipboard object. If no --- -- clipboard already exists, a new one will be created. Once a --- -- clipboard object has been created, it is persistent for all --- -- time. --- widgetGetClipboard self selection = --- makeNewGObject mkClipboard $ --- with selection $ \selectionPtr -> --- {# call gtk_widget_get_clipboard #} --- (toWidget self) --- (castPtr selectionPtr) -- need write Stroable isntance for GdkAtom +widgetGetClipboard :: WidgetClass self => self + -> Atom -- ^ @selection@ - a {GdkAtom, FIXME: struct type} which + -- identifies the clipboard to use. @GDK_SELECTION_CLIPBOARD@ + -- gives the default clipboard. Another common value is + -- @GDK_SELECTION_PRIMARY@, which gives the primary X + -- selection. + -> IO Clipboard -- ^ returns the appropriate clipboard object. If no + -- clipboard already exists, a new one will be created. Once a + -- clipboard object has been created, it is persistent for all + -- time. +widgetGetClipboard self (Atom selection) = + makeNewGObject mkClipboard $ + with selection $ \selectionPtr -> + {# call gtk_widget_get_clipboard #} + (toWidget self) + selection hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 27 +-- hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 55 + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 63 +-- hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 75 + TextBufferDeserialize, + +-- * Enums [_$_] + TextBufferTargetInfo(..), hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 125 - textBufferHasSelection, + textBufferGetHasSelection, hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 147 +#if GTK_CHECK_VERSION(2,10,0) + textBufferDeserialize, + textBufferDeserializeGetCanCreateTags, + textBufferDeserializeSetCanCreateTags, + textBufferGetCopyTargetList, + textBufferGetPasteTargetList, + textBufferGetDeserializeFormats, + textBufferGetSerializeFormats, + textBufferRegisterDeserializeFormat, + textBufferRegisterDeserializeTagset, + textBufferRegisterSerializeFormat, + textBufferRegisterSerializeTagset, + textBufferSerialize, + textBufferUnregisterDeserializeFormat, + textBufferUnregisterSerializeFormat, +#endif hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 165 +#if GTK_CHECK_VERSION(2,8,0) + textBufferCopyTargetList, + textBufferCursorPosition, + textBufferHasSelection, + textBufferPasteTargetList, +#endif + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 227 +import System.Glib.GList hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 231 -import System.Glib.GObject (constructNewGObject, +import System.Glib.GError (GErrorDomain, GErrorClass(..), propagateGError) +import System.Glib.GObject (DestroyNotify, constructNewGObject, hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 239 +import Graphics.UI.Gtk.General.DNDTypes (Atom(..), mkTargetList) +{#import Graphics.UI.Gtk.General.Selection#} (TargetList) hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 244 +-------------------- +-- Types +type TextBufferDeserialize = TextBuffer -> TextIter -> Int -> Int -> Bool -> Bool + +{#pointer TextBufferDeserializeFunc#} + +foreign import ccall "wrapper" mkTextBufferDeserializeFunc :: + (Ptr TextBuffer -> Ptr TextBuffer -> Ptr TextIter -> {#type guint#} -> {#type glong#} -> {#type gboolean#} -> Ptr () -> IO {#type gboolean#}) + -> IO TextBufferDeserializeFunc + +type TextBufferSerialize = TextBuffer -> TextIter -> TextIter -> Int -> String + +{#pointer TextBufferSerializeFunc#} + +foreign import ccall "wrapper" mkTextBufferSerializeFunc :: + (Ptr TextBuffer -> Ptr TextBuffer -> Ptr TextIter -> Ptr TextIter -> {#type glong#} -> Ptr () -> IO CString) + -> IO TextBufferSerializeFunc + +-------------------- +-- Enums +{#enum GtkTextBufferTargetInfo as TextBufferTargetInfo {underscoreToCase} deriving (Bounded,Eq,Show)#} + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 888 -textBufferHasSelection :: TextBufferClass self => self -> IO Bool -textBufferHasSelection self = +textBufferGetHasSelection :: TextBufferClass self => self -> IO Bool +textBufferGetHasSelection self = hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 891 - {# call unsafe text_buffer_get_selection_bounds #} + {# call gtk_text_buffer_get_has_selection #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 893 - (TextIter nullForeignPtr) - (TextIter nullForeignPtr) hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 960 - {# call gtk_text_buffer_backspace #} + {# call text_buffer_backspace #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 982 - {# call gtk_text_buffer_insert_child_anchor #} + {# call text_buffer_insert_child_anchor #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 996 - {# call gtk_text_buffer_create_child_anchor #} + {# call text_buffer_create_child_anchor #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1015 - {# call gtk_text_buffer_select_range #} + {# call text_buffer_select_range #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1028 - {# call gtk_text_buffer_get_iter_at_child_anchor #} + {# call text_buffer_get_iter_at_child_anchor #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1058 - {# call gtk_text_buffer_paste_clipboard #} + {# call text_buffer_paste_clipboard #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1073 - {# call gtk_text_buffer_paste_clipboard #} + {# call text_buffer_paste_clipboard #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1084 - {# call gtk_text_buffer_copy_clipboard #} + {# call text_buffer_copy_clipboard #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1095 - {# call gtk_text_buffer_cut_clipboard #} + {# call text_buffer_cut_clipboard #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1118 +#if GTK_CHECK_VERSION(2,10,0) +-- | This function deserializes rich text in format format and inserts it at iter. +-- [_$_] +-- formats to be used must be registered using 'textBufferRegisterDeserializeFormat' or +-- 'textBufferRegisterDeserializeTagset' beforehand. +textBufferDeserialize :: (TextBufferClass registerBuf, TextBufferClass contentBuf) => [_$_] + registerBuf -> contentBuf [_$_] + -> Atom + -> TextIter [_$_] + -> String + -> Int + -> IO Bool +textBufferDeserialize regBuf conBuf (Atom format) iter dat length = [_$_] + liftM toBool $ + withUTFString dat $ \datPtr -> + propagateGError $ \gerrorPtr -> + {#call text_buffer_deserialize#} [_$_] + (toTextBuffer regBuf) + (toTextBuffer conBuf) + format + iter + (castPtr datPtr) + (fromIntegral length) + gerrorPtr + +-- | This functions returns the value set with +-- 'textBufferDeserializeSetCanCreateTags' +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferDeserializeGetCanCreateTags :: TextBufferClass self => self + -> Atom -- ^ @format@ - representing a registered rich text format + -> IO Bool -- ^ returns whether deserializing this format may create tags +textBufferDeserializeGetCanCreateTags self (Atom format) = + liftM toBool $ + {# call text_buffer_deserialize_get_can_create_tags #} + (toTextBuffer self) + format + [_$_] +-- | Use this function to allow a rich text deserialization function to create +-- new tags in the receiving buffer. Note that using this function is almost +-- always a bad idea, because the rich text functions you register should know +-- how to map the rich text format they handler to your text buffers set of +-- tags. +-- +-- The ability of creating new (arbitrary!) tags in the receiving buffer is +-- meant for special rich text formats like the internal one that is registered +-- using 'textBufferRegisterDeserializeTagset', because that format is +-- essentially a dump of the internal structure of the source buffer, including +-- its tag names. +-- +-- You should allow creation of tags only if you know what you are doing, +-- e.g. if you defined a tagset name for your application suite's text buffers +-- and you know that it's fine to receive new tags from these buffers, because +-- you know that your application can handle the newly created tags. +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferDeserializeSetCanCreateTags :: TextBufferClass self => self + -> Atom -- ^ @format@ - representing a registered rich text format + -> Bool -- ^ @canCreateTags@ - whether deserializing this format may + -- create tags + -> IO () +textBufferDeserializeSetCanCreateTags self (Atom format) canCreateTags = + {# call text_buffer_deserialize_set_can_create_tags #} + (toTextBuffer self) + format + (fromBool canCreateTags) + +-- | This function returns the list of targets this text buffer can provide +-- for copying and as DND source. The targets in the list are added with @info@ +-- values from the 'TextBufferTargetInfo' enum, using +-- 'targetListAddRichTextTargets' and 'targetListAddTextTargets'. +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferGetCopyTargetList :: TextBufferClass self => self + -> IO TargetList -- ^ returns the 'TagetList' +textBufferGetCopyTargetList self = do + tlPtr <- {# call text_buffer_get_copy_target_list #} + (toTextBuffer self) + mkTargetList tlPtr [_$_] + +-- | This function returns the rich text deserialize formats registered with +-- @buffer@ using 'textBufferRegisterDeserializeFormat' or +-- 'textBufferRegisterDeserializeTagset' +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferGetDeserializeFormats :: TextBufferClass self => self + -> IO ([Atom], Int) -- ^ @(atomList, nFormats)@ returns an array of 'Atom' [_$_] + -- representing the registered formats. + -- @nFormats@ - return location for the number of + -- formats +textBufferGetDeserializeFormats self = + alloca $ \nFormatsPtr -> do + atomPtr <- {# call text_buffer_get_deserialize_formats #} + (toTextBuffer self) + nFormatsPtr + peek nFormatsPtr >>= \nFormats -> do + atomList <- liftM (map Atom) (peekArray 0 atomPtr) + return (atomList, fromIntegral nFormats) + +-- | This function returns the rich text serialize formats registered with +-- @buffer@ using 'textBufferRegisterSerializeFormat' or +-- 'textBufferRegisterSerializeTagset' +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferGetSerializeFormats :: TextBufferClass self => self + -> IO ([Atom], Int)-- ^ @(atomList, nFormats)@ returns an array of 'Atom' [_$_] + -- representing the registered formats. + -- @nFormats@ - return location for the number of + -- formats +textBufferGetSerializeFormats self = + alloca $ \nFormatsPtr -> do + atomPtr <- {# call text_buffer_get_serialize_formats #} + (toTextBuffer self) + nFormatsPtr + peek nFormatsPtr >>= \nFormats -> do + atomList <- liftM (map Atom) (peekArray 0 atomPtr) + return (atomList, fromIntegral nFormats) + +-- | This function registers a rich text deserialization @function@ along with +-- its @mimeType@ with the passed @buffer@. +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferRegisterDeserializeFormat :: TextBufferClass self => self + -> String -- ^ @mimeType@ - the format's mime-type + -> TextBufferDeserialize -- ^ @function@ - the deserialize + -- function to register + -> DestroyNotify -- ^ @userDataDestroy@ - a function to + -- call when @userData@ is no longer + -- needed + -> IO Atom -- ^ returns the 'Atom' that corresponds to the newly + -- registered format's mime-type. +textBufferRegisterDeserializeFormat self mimeType function notify = + withUTFString mimeType $ \mimeTypePtr -> do + func <- mkTextBufferDeserializeFunc $ \_ cBuffer iterPtr dat length tags _ -> do + iter <- mkTextIterCopy iterPtr + buffer <- makeNewGObject mkTextBuffer (return cBuffer) + return (fromBool (function buffer iter (fromIntegral dat) (fromIntegral length) (toBool tags))) + atomPtr <- {# call gtk_text_buffer_register_deserialize_format #} + (toTextBuffer self) + mimeTypePtr + func + nullPtr + notify + return $ Atom atomPtr + +-- | This function registers Gtk+'s internal rich text serialization format +-- with the passed @buffer@. See 'textBufferRegisterSerializeTagset' for +-- details. +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferRegisterDeserializeTagset :: TextBufferClass self => self + -> String -- ^ @tagsetName@ - an optional tagset name + -> IO Atom -- ^ returns the 'Atom' that + -- corresponds to the newly registered format's mime-type. +textBufferRegisterDeserializeTagset self tagsetName = + withUTFString tagsetName $ \tagsetNamePtr -> do + atomPtr <- {# call gtk_text_buffer_register_deserialize_tagset #} + (toTextBuffer self) + tagsetNamePtr + return $ Atom atomPtr + +-- | This function registers a rich text serialization @function@ along with +-- its @mimeType@ with the passed @buffer@. +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferRegisterSerializeFormat :: TextBufferClass self => self + -> String -- ^ @mimeType@ - the format's mime-type + -> TextBufferSerialize -- ^ @function@ - the serialize function to + -- register + -> DestroyNotify -- ^ @userDataDestroy@ - a function to call + -- when @userData@ is no longer needed + -> IO Atom -- ^ returns the 'Atom' that corresponds to the newly + -- registered format's mime-type. +textBufferRegisterSerializeFormat self mimeType function notify = + withUTFString mimeType $ \mimeTypePtr -> do + func <- mkTextBufferSerializeFunc $ \_ cBuffer start end length _ -> do + startIter <- mkTextIterCopy start + endIter <- mkTextIterCopy end + buffer <- makeNewGObject mkTextBuffer (return cBuffer) + newCString $ function buffer startIter endIter (fromIntegral length) + atomPtr <- {# call gtk_text_buffer_register_serialize_format #} + (toTextBuffer self) + mimeTypePtr + func + nullPtr + notify + return $ Atom atomPtr + +-- | This function registers Gtk+'s internal rich text serialization format +-- with the passed @buffer@. The internal format does not comply to any +-- standard rich text format and only works between 'TextBuffer' instances. It +-- is capable of serializing all of a text buffer's tags and embedded pixbufs. +-- +-- This function is just a wrapper around +-- 'textBufferRegisterSerializeFormat'. The mime type used for registering is +-- \"application\/x-gtk-text-buffer-rich-text\", or +-- \"application\/x-gtk-text-buffer-rich-text;format=@tagsetName@\" if a +-- @tagsetName@ was passed. +-- +-- The @tagsetName@ can be used to restrict the transfer of rich text to +-- buffers with compatible sets of tags, in order to avoid unknown tags from +-- being pasted. [_$_] +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferRegisterSerializeTagset :: TextBufferClass self => self + -> String -- ^ @tagsetName@ - an optional tagset name + -> IO Atom -- ^ returns the 'Atom' that corresponds to the newly registered format's mime-type. +textBufferRegisterSerializeTagset self tagsetName = + withUTFString tagsetName $ \tagsetNamePtr -> do + atomPtr <- {# call gtk_text_buffer_register_serialize_tagset #} + (toTextBuffer self) + tagsetNamePtr + return $ Atom atomPtr + +-- | This function serializes the portion of text between @start@ and @end@ in +-- the rich text format represented by @format@. +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferSerialize :: (TextBufferClass self, TextBufferClass contentBuffer) => self + -> contentBuffer -- ^ @contentBuffer@ - the 'TextBuffer' to serialize + -> Atom -- ^ @format@ - the rich text format to use for serializing + -> TextIter -- ^ @start@ - start of block of text to serialize + -> TextIter -- ^ @end@ - end of block of test to serialize + -> [Int] -- ^ @length@ - return location for the length of the + -- serialized data + -> IO String -- ^ returns the serialized data, encoded as @format@ +textBufferSerialize self contentBuffer (Atom format) start end length = [_$_] + withArray (map fromIntegral length) $ \lengthPtr -> do + cstring <- {# call gtk_text_buffer_serialize #} + (toTextBuffer self) + (toTextBuffer contentBuffer) + format + start + end + lengthPtr + peekCString $ castPtr cstring + +-- | This function unregisters a rich text format that was previously +-- registered using 'textBufferRegisterDeserializeFormat' or +-- 'textBufferRegisterDeserializeTagset'. +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferUnregisterDeserializeFormat :: TextBufferClass self => self + -> Atom -- ^ @format@ - a 'Atom' representing a + -- registered rich text format. + -> IO () +textBufferUnregisterDeserializeFormat self (Atom format) = + {# call gtk_text_buffer_unregister_deserialize_format #} + (toTextBuffer self) + format + +-- | This function unregisters a rich text format that was previously +-- registered using 'textBufferRegisterSerializeFormat' or +-- 'textBufferRegisterSerializeTagset' +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferUnregisterSerializeFormat :: TextBufferClass self => self + -> Atom -- ^ @format@ - a 'Atom' representing a + -- registered rich text format. + -> IO () +textBufferUnregisterSerializeFormat self (Atom format) = + {# call gtk_text_buffer_unregister_serialize_format #} + (toTextBuffer self) + format + +#endif [_$_] + +-- | This function returns the list of targets this text buffer supports for +-- pasting and as DND destination. The targets in the list are added with +-- @info@ values from the 'TextBufferTargetInfo' enum, using +-- 'targetListAddRichTextTargets' and 'targetListAddTextTargets'. +-- +-- * Available since Gtk+ version 2.10 +-- +textBufferGetPasteTargetList :: TextBufferClass self => self + -> IO TargetList -- ^ returns the 'TargetList' +textBufferGetPasteTargetList self = do + tlPtr <- {# call text_buffer_get_paste_target_list #} + (toTextBuffer self) + mkTargetList tlPtr + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1414 +#if GTK_CHECK_VERSION(2,10,0) +-- | The list of targets this buffer supports for clipboard copying and as DND source. +-- [_$_] +-- Since 2.10 +textBufferCopyTargetList :: TextBufferClass self => ReadAttr self TargetList +textBufferCopyTargetList = readAttr textBufferGetCopyTargetList + +-- | The position of the insert mark (as offset from the beginning of the buffer). It is useful for +-- getting notified when the cursor moves. +-- [_$_] +-- Allowed values: >= 0 +-- [_$_] +-- Default value: 0 +-- [_$_] +-- Since 2.10 +textBufferCursorPosition :: TextBufferClass self => ReadAttr self Int +textBufferCursorPosition = readAttrFromIntProperty "cursor-position" + +-- | Whether the buffer has some text currently selected. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.10 +textBufferHasSelection :: TextBufferClass self => ReadAttr self Bool +textBufferHasSelection = readAttrFromBoolProperty "has-selection" + +-- | The list of targets this buffer supports for clipboard pasting and as DND destination. +-- [_$_] +-- Since 2.10 +textBufferPasteTargetList :: TextBufferClass self => ReadAttr self TargetList +textBufferPasteTargetList = readAttr textBufferGetPasteTargetList +#endif + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1452 - {# call pure unsafe gtk_text_tag_table_get_type #} + {# call pure unsafe text_tag_table_get_type #} hunk ./gtk/Graphics/UI/Gtk/Multiline/TextIter.chs.pp 31 +-- The following functions just for implementation, don't bind them: +-- gtk_text_iter_free +-- hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 8 --- Copyright (C) 2002-2005 Axel Simon +-- Copyright (C) 2002-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 56 +-- hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 84 + textMarkName, + textMarkLeftGravity, hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTag.chs.pp 142 +#if GTK_CHECK_VERSION(2,12,0) + textTagAccumulativeMargin, +#endif hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTag.chs.pp 743 +-- | Whether the margins accumulate or override each other. +-- [_$_] +-- When set to 'True' the margins of this tag are added to the margins of any other non-accumulative +-- margins present. When set to 'False' the margins override one another (the default). +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.12 +textTagAccumulativeMargin :: TextTagClass self => Attr self Bool +textTagAccumulativeMargin = newAttrFromBoolProperty "accumulative-margin" + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTagTable.chs 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTagTable.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTagTable.chs 36 +-- hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 8 --- Copyright (C) 2002-2005 Axel Simon +-- Copyright (C) 2002-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 34 + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 48 +-- hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 56 --- | --- | hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 170 + selectAll, hunk ./gtk/Graphics/UI/Gtk/Multiline/TextView.chs.pp 1220 +selectAll :: TextBufferClass self => Signal self (Bool -> IO ()) +selectAll = Signal (connect_BOOL__NONE "select-all") + |
From: Andy S. <And...@co...> - 2010-03-23 09:26:08
|
Tue Mar 23 05:13:30 EDT 2010 Andy Stewart <laz...@gm...> * Update all `Layout` modules to Gtk+ 2.18.3 Ignore-this: 36c78aae320c3a4b3125e8a07dc6199 hunk ./ApiUpdateTodoList.txt 235 -*** TODO Alignment.chs.pp -*** TODO AspectFrame.chs -*** TODO Expander.chs.pp -*** TODO Fixed.chs -*** TODO HBox.chs -*** TODO HButtonBox.chs -*** TODO HPaned.chs -*** TODO Layout.chs +*** DONE Alignment.chs.pp +*** DONE AspectFrame.chs +*** DONE Expander.chs.pp +*** DONE Fixed.chs +*** DONE HBox.chs +*** DONE HButtonBox.chs +*** DONE HPaned.chs +*** DONE Layout.chs hunk ./ApiUpdateTodoList.txt 244 -*** TODO Table.chs -*** TODO VBox.chs -*** TODO VButtonBox.chs -*** TODO VPaned.chs +*** DONE Table.chs +*** DONE VBox.chs +*** DONE VButtonBox.chs +*** DONE VPaned.chs hunk ./gtk/Graphics/UI/Gtk/Layout/Alignment.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Layout/Alignment.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/Alignment.chs.pp 45 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/AspectFrame.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Layout/AspectFrame.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/AspectFrame.chs 38 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp 43 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp 88 + expanderActivate, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp 95 +#endif hunk ./gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp 325 +expanderActivate :: ExpanderClass self => Signal self (IO ()) +expanderActivate = Signal (connect_NONE__NONE "activate") hunk ./gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp 328 +-------------------- +-- Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp 337 +#endif hunk ./gtk/Graphics/UI/Gtk/Layout/Fixed.chs 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2009 Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Layout/Fixed.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/Fixed.chs 66 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/HBox.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Layout/HBox.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/HBox.chs 39 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/HButtonBox.chs 8 --- Copyright (C) 2004-2005 Matthew Walton +-- Copyright (C) 2004-2009 Matthew Walton hunk ./gtk/Graphics/UI/Gtk/Layout/HButtonBox.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/HButtonBox.chs 55 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/HPaned.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Layout/HPaned.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/HPaned.chs 36 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/Layout.chs 78 + adjustments, + +-- * Deprecated hunk ./gtk/Graphics/UI/Gtk/Layout/Layout.chs 285 +adjustments :: LayoutClass self => Signal self (Adjustment -> Adjustment -> IO ()) +adjustments = Signal (connect_OBJECT_OBJECT__NONE "set-scroll-adjustments") hunk ./gtk/Graphics/UI/Gtk/Layout/Layout.chs 288 +-------------------- +-- Deprecated hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 26 --- gtk_notebook_set_window_creation_hook hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 43 + hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 57 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 71 + NotebookWindowCreation, hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 123 + hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 130 + notebookSetWindowCreationHook, hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 166 + changeCurrentPage, + createWindow, + notebookMoveFocusOut, + reorderTab, + selectPage, hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 183 -import Control.Monad (liftM) +import Control.Monad (liftM, unless) hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 190 +import System.Glib.GError hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 203 +-------------------- +-- Types. +-- | A function used by 'Notebook' when a detachable tab is dropped in the root window, it's used to +-- create a window containing a notebook where the tab will be attached. This function will also be +-- responsible of moving/resizing the window and adding the necessary properties to the notebook (i.e.: +-- group-id) +type NotebookWindowCreation = Widget -> Int -> Int -> Notebook + +{#pointer NotebookWindowCreationFunc#} + +foreign import ccall "wrapper" mkNotebookWindowCreationFunc :: + (Ptr Notebook -> Ptr Widget -> {#type glong#} -> {#type glong#} -> Ptr () -> IO (Ptr Notebook)) + -> IO NotebookWindowCreationFunc + hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 996 +-- | Installs a global function used to create a window when a detached tab is dropped in an empty area. +-- [_$_] +-- Since 2.10 +notebookSetWindowCreationHook :: [_$_] + Maybe NotebookWindowCreation + -> DestroyNotify [_$_] + -> IO () +notebookSetWindowCreationHook func destroy = do + funcPtr <- case func of + Just fc -> mkNotebookWindowCreationFunc $ \_ widgetPtr x y _ -> do + widget <- makeNewObject mkWidget (return widgetPtr) + return (unsafeForeignPtrToPtr $ unNotebook (fc widget (fromIntegral x) (fromIntegral y))) + Nothing -> return nullFunPtr + {#call notebook_set_window_creation_hook#} funcPtr nullPtr destroy + unless (funcPtr == nullFunPtr) $ freeHaskellFunPtr funcPtr + hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1260 +changeCurrentPage :: NotebookClass self => Signal self (Int -> IO Bool) +changeCurrentPage = Signal (connect_INT__BOOL "change-current-page") + [_$_] +-- | The 'createWindow' signal is emitted when a detachable tab is dropped on the root window. +-- [_$_] +-- A handler for this signal can create a window containing a notebook where the tab will be +-- attached. It is also responsible for moving/ resizing the window and adding the necessary properties +-- to the notebook (e.g. the 'groupId' ). +-- [_$_] +-- The default handler uses the global window creation hook, if one has been set with +-- 'notebookSetWindowCreationHook'. +createWindow :: NotebookClass self => Signal self (Widget -> Int -> Int -> IO Notebook) +createWindow = Signal (connect_OBJECT_INT_INT__OBJECTPTR "create-window") + +-- | Emitted signal when move focus out. +notebookMoveFocusOut :: NotebookClass self => Signal self (DirectionType -> IO ()) +notebookMoveFocusOut = Signal (connect_ENUM__NONE "move-focus-out") + [_$_] +-- | Emitted signal when switch page. hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1284 +-- | Emitted signal when reorder tab. +reorderTab :: NotebookClass self => Signal self (DirectionType -> IO ()) +reorderTab = Signal (connect_ENUM__NONE "reorder-tab") + +-- | Emitted signal when select page. +selectPage :: NotebookClass self => Signal self (Bool -> IO Bool) +selectPage = Signal (connect_BOOL__BOOL "select-page") + [_$_] + hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1332 + +-- | Signal helper functions. +connect_OBJECT_INT_INT__OBJECTPTR :: + (GObjectClass a', GObjectClass obj) => SignalName -> + ConnectAfter -> obj -> [_$_] + (a' -> Int -> Int -> IO Notebook) -> + IO (ConnectId obj) +connect_OBJECT_INT_INT__OBJECTPTR signal after obj user = + connectGeneric signal after obj action + where action :: Ptr GObject -> Ptr GObject -> Int -> Int -> IO (Ptr Notebook) + action _ obj1 x y = + failOnGError $ + makeNewGObject mkGObject (return obj1) >>= \obj1' -> + user (unsafeCastGObject obj1') x y >>= notebookToNotebookPtr + +-- | Internal helper function for convert. +notebookToNotebookPtr :: NotebookClass self => self -> IO (Ptr Notebook) +notebookToNotebookPtr notebook = return $ unsafeForeignPtrToPtr (unNotebook (toNotebook notebook)) hunk ./gtk/Graphics/UI/Gtk/Layout/Table.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Layout/Table.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/Table.chs 51 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/VBox.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Layout/VBox.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/VBox.chs 30 --- [_$_] +-- hunk ./gtk/Graphics/UI/Gtk/Layout/VBox.chs 39 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/VButtonBox.chs 8 --- Copyright (C) 2004-2005 Matthew Walton +-- Copyright (C) 2004-2009 Matthew Walton hunk ./gtk/Graphics/UI/Gtk/Layout/VButtonBox.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/VButtonBox.chs 55 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/VPaned.chs 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Layout/VPaned.chs 28 + hunk ./gtk/Graphics/UI/Gtk/Layout/VPaned.chs 30 --- [_$_] +-- hunk ./gtk/Graphics/UI/Gtk/Layout/VPaned.chs 36 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/VPaned.chs 58 - hunk ./tools/hierarchyGen/hierarchy.list 287 - +[_^I_][_^I_][_$_] |