gi-gtk-3.0.43: Gtk bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.Style

Contents

- Exported types
- Methods
  - applyDefaultBackground
  - copy
  - detach
  - getStyleProperty
  - hasContext
  - lookupColor
  - lookupIconSet
  - new
  - renderIcon
  - setBackground
- Properties
  - context
- Signals
  - realize
  - unrealize

Description

A `Style` object encapsulates the information that provides the look and feel for a widget.

    In GTK+ 3.0, GtkStyle has been deprecated and replaced by
    t'GI.Gtk.Objects.StyleContext.StyleContext'.

Each `Widget` has an associated `Style` object that is used when rendering that widget. Also, a `Style` holds information for the five possible widget states though not every widget supports all five states; see `StateType`.

Usually the `Style` for a widget is the same as the default style that is set by GTK+ and modified the theme engine.

Usually applications should not need to use or modify the `Style` of their widgets.

Synopsis

- newtype Style = Style (ManagedPtr Style)
- class (GObject o, IsDescendantOf Style o) => IsStyle o
- toStyle :: (MonadIO m, IsStyle o) => o -> m Style
- styleApplyDefaultBackground :: (HasCallStack, MonadIO m, IsStyle a, IsWindow b) => a -> Context -> b -> StateType -> Int32 -> Int32 -> Int32 -> Int32 -> m ()
- styleCopy :: (HasCallStack, MonadIO m, IsStyle a) => a -> m Style
- styleDetach :: (HasCallStack, MonadIO m, IsStyle a) => a -> m ()
- styleGetStyleProperty :: (HasCallStack, MonadIO m, IsStyle a) => a -> GType -> Text -> m GValue
- styleHasContext :: (HasCallStack, MonadIO m, IsStyle a) => a -> m Bool
- styleLookupColor :: (HasCallStack, MonadIO m, IsStyle a) => a -> Text -> m (Bool, Color)
- styleLookupIconSet :: (HasCallStack, MonadIO m, IsStyle a) => a -> Text -> m IconSet
- styleNew :: (HasCallStack, MonadIO m) => m Style
- styleRenderIcon :: (HasCallStack, MonadIO m, IsStyle a, IsWidget b) => a -> IconSource -> TextDirection -> StateType -> Int32 -> Maybe b -> Maybe Text -> m Pixbuf
- styleSetBackground :: (HasCallStack, MonadIO m, IsStyle a, IsWindow b) => a -> b -> StateType -> m ()
- constructStyleContext :: (IsStyle o, MonadIO m, IsStyleContext a) => a -> m (GValueConstruct o)
- getStyleContext :: (MonadIO m, IsStyle o) => o -> m (Maybe StyleContext)
- type StyleRealizeCallback = IO ()
- afterStyleRealize :: (IsStyle a, MonadIO m) => a -> ((?self :: a) => StyleRealizeCallback) -> m SignalHandlerId
- onStyleRealize :: (IsStyle a, MonadIO m) => a -> ((?self :: a) => StyleRealizeCallback) -> m SignalHandlerId
- type StyleUnrealizeCallback = IO ()
- afterStyleUnrealize :: (IsStyle a, MonadIO m) => a -> ((?self :: a) => StyleUnrealizeCallback) -> m SignalHandlerId
- onStyleUnrealize :: (IsStyle a, MonadIO m) => a -> ((?self :: a) => StyleUnrealizeCallback) -> m SignalHandlerId

# Exported types

newtype Style Source #

Memory-managed wrapper type.

Constructors

Style (ManagedPtr Style) |

#### Instances

Instances details

Eq Style Source # |
Instance details Defined in GI.Gtk.Objects.Style Methods (==) :: Style -> Style -> Bool Source # (/=) :: Style -> Style -> Bool Source #
GObject Style Source # |
Instance details Defined in GI.Gtk.Objects.Style
ManagedPtrNewtype Style Source # |
Instance details Defined in GI.Gtk.Objects.Style Methods toManagedPtr :: Style -> ManagedPtr Style Source #
TypedObject Style Source # |
Instance details Defined in GI.Gtk.Objects.Style Methods glibType :: IO GType Source #
HasParentTypes Style Source # |
Instance details Defined in GI.Gtk.Objects.Style
IsGValue (Maybe Style) Source # | Convert `Style` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.Style Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Style -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Style) Source #
type ParentTypes Style Source # |
Instance details Defined in GI.Gtk.Objects.Style type ParentTypes Style = '[Object]

class (GObject o, IsDescendantOf Style o) => IsStyle o Source #

Type class for types which can be safely cast to `Style`, for instance with `toStyle`.

#### Instances

Instances details

(GObject o, IsDescendantOf Style o) => IsStyle o Source # |
Instance details Defined in GI.Gtk.Objects.Style

toStyle :: (MonadIO m, IsStyle o) => o -> m Style Source #

Cast to `Style`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

applyDefaultBackground, bindProperty, bindPropertyFull, copy, detach, forceFloating, freezeNotify, getv, hasContext, isFloating, lookupColor, lookupIconSet, notify, notifyByPspec, ref, refSink, renderIcon, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getData, getProperty, getQdata, getStyleProperty.

#### Setters

setBackground, setData, setDataFull, setProperty.

## applyDefaultBackground

styleApplyDefaultBackground :: (HasCallStack, MonadIO m, IsStyle a, IsWindow b) => a -> Context -> b -> StateType -> Int32 -> Int32 -> Int32 -> Int32 -> m () Source #

Deprecated: (Since version 3.0)Use `StyleContext` instead

No description available in the introspection data.

## copy

styleCopy Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyle a) |
=> a | `style`: a `Style`
-> m Style | Returns: a copy of `style`

Deprecated: (Since version 3.0)Use `StyleContext` instead

Creates a copy of the passed in `Style` object.

## detach

styleDetach Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyle a) |
=> a | `style`: a `Style`
-> m () |

Deprecated: (Since version 3.0)Use `StyleContext` instead

Detaches a style from a window. If the style is not attached to any windows anymore, it is unrealized. See `gtk_style_attach()`.

## getStyleProperty

styleGetStyleProperty Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyle a) |
=> a | `style`: a `Style`
-> GType | `widgetType`: the `GType` of a descendant of `Widget`
-> Text | `propertyName`: the name of the style property to get
-> m GValue |

Queries the value of a style property corresponding to a widget class is in the given style.

Since: 2.16

## hasContext

styleHasContext Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyle a) |
=> a | `style`: a `Style`
-> m Bool | Returns: `True` if `style` has a `StyleContext`

Returns whether `style` has an associated `StyleContext`.

Since: 3.0

## lookupColor

styleLookupColor Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyle a) |
=> a | `style`: a `Style`
-> Text | `colorName`: the name of the logical color to look up
-> m (Bool, Color) | Returns: `True` if the mapping was found.

Deprecated: (Since version 3.0)Use `styleContextLookupColor` instead

Looks up `colorName` in the style’s logical color mappings, filling in `color` and returning `True` if found, otherwise returning `False`. Do not cache the found mapping, because it depends on the `Style` and might change when a theme switch occurs.

Since: 2.10

## lookupIconSet

styleLookupIconSet Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyle a) |
=> a | `style`: a `Style`
-> Text | `stockId`: an icon name
-> m IconSet | Returns: icon set of `stockId`

Deprecated: (Since version 3.0)Use `styleContextLookupIconSet` instead

Looks up `stockId` in the icon factories associated with `style` and the default icon factory, returning an icon set if found, otherwise `Nothing`.

## new

styleNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Style | Returns: a new `Style`.

Deprecated: (Since version 3.0)Use `StyleContext`

Creates a new `Style`.

## renderIcon

styleRenderIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyle a, IsWidget b) |
=> a | `style`: a `Style`
-> IconSource | `source`: the `IconSource` specifying the icon to render
-> TextDirection | `direction`: a text direction
-> StateType | `state`: a state
-> Int32 | `size`: the size to render the icon at (t`IconSize`). A size of `(GtkIconSize)-1` means render at the size of the source and don’t scale.
-> Maybe b | `widget`: the widget
-> Maybe Text | `detail`: a style detail
-> m Pixbuf | Returns: a newly-created `Pixbuf` containing the rendered icon

Deprecated: (Since version 3.0)Use `renderIconPixbuf` instead

Renders the icon specified by `source` at the given `size` according to the given parameters and returns the result in a pixbuf.

## setBackground

styleSetBackground Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyle a, IsWindow b) |
=> a | `style`: a `Style`
-> b | `window`: a `Window`
-> StateType | `stateType`: a state
-> m () |

Deprecated: (Since version 3.0)Use `styleContextSetBackground` instead

Sets the background of `window` to the background color or pixmap specified by `style` for the given state.

# Properties

## context

No description available in the introspection data.

constructStyleContext :: (IsStyle o, MonadIO m, IsStyleContext a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`context`” property. This is rarely needed directly, but it is used by `new`.

getStyleContext :: (MonadIO m, IsStyle o) => o -> m (Maybe StyleContext) Source #

Get the value of the “`context`” property. When overloading is enabled, this is equivalent to

    get style #context

# Signals

## realize

type StyleRealizeCallback = IO () Source #

Emitted when the style has been initialized for a particular visual. Connecting to this signal is probably seldom useful since most of the time applications and widgets only deal with styles that have been already realized.

Since: 2.4

afterStyleRealize :: (IsStyle a, MonadIO m) => a -> ((?self :: a) => StyleRealizeCallback) -> m SignalHandlerId Source #

Connect a signal handler for the realize signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after style #realize callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onStyleRealize :: (IsStyle a, MonadIO m) => a -> ((?self :: a) => StyleRealizeCallback) -> m SignalHandlerId Source #

Connect a signal handler for the realize signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on style #realize callback

## unrealize

type StyleUnrealizeCallback = IO () Source #

Emitted when the aspects of the style specific to a particular visual is being cleaned up. A connection to this signal can be useful if a widget wants to cache objects as object data on `Style`. This signal provides a convenient place to free such cached objects.

Since: 2.4

afterStyleUnrealize :: (IsStyle a, MonadIO m) => a -> ((?self :: a) => StyleUnrealizeCallback) -> m SignalHandlerId Source #

Connect a signal handler for the unrealize signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after style #unrealize callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onStyleUnrealize :: (IsStyle a, MonadIO m) => a -> ((?self :: a) => StyleUnrealizeCallback) -> m SignalHandlerId Source #

Connect a signal handler for the unrealize signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on style #unrealize callback