gtk-0.14.6: Binding to the Gtk+ graphical user interface library.

Maintainergtk2hs-users@lists.sourceforge.net
Stabilityprovisional
Portabilityportable (depends on GHC)
Safe HaskellNone
LanguageHaskell98

Graphics.UI.Gtk.Buttons.Button

Contents

Description

A widget that creates a signal when clicked on

Synopsis

Detail

The Button widget is generally used to attach a function to that is called when the button is pressed. The various signals and how to use them are outlined below.

The Button widget can hold any valid child widget. That is it can hold most any other standard Widget. The most commonly used child is the Label.

Class Hierarchy

| GObject
| +----Object
| +----Widget
| +----Container
| +----Bin
| +----Button
| +----ToggleButton
| +----ColorButton
| +----FontButton
| +----OptionMenu

Types

Constructors

buttonNew :: IO Button Source #

Creates a new Button widget. To add a child widget to the button, use containerAdd.

buttonNewWithLabel Source #

Arguments

:: GlibString string 
=> string

label - The text you want the Label to hold.

-> IO Button 

Creates a Button widget with a Label child containing the given text.

buttonNewWithMnemonic Source #

Arguments

:: GlibString string 
=> string

label - The text of the button, with an underscore in front of the mnemonic character

-> IO Button 

Creates a new Button containing a label. If characters in label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use '__' (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the button.

buttonNewFromStock Source #

Arguments

:: StockId

stockId - the name of the stock item

-> IO Button 

Creates a new Button containing the image and text from a stock item.

If stockId is unknown, then it will be treated as a mnemonic label (as for buttonNewWithMnemonic).

Methods

buttonPressed :: ButtonClass self => self -> IO () Source #

Emits the button pressed signal for the given Button.

buttonReleased :: ButtonClass self => self -> IO () Source #

Emits the button released signal for the given Button.

buttonClicked :: ButtonClass self => self -> IO () Source #

Emits the button clicked signal for the given Button.

This is similar to calling buttonPressed and buttonReleased in sequence.

buttonEnter :: ButtonClass self => self -> IO () Source #

Emit the cursor enters signal to the button.

buttonLeave :: ButtonClass self => self -> IO () Source #

Emit the cursor leaves signal to the button.

buttonSetRelief Source #

Arguments

:: ButtonClass self 
=> self 
-> ReliefStyle

newstyle - The ReliefStyle as described above.

-> IO () 

Sets the relief style of the edges of the given Button widget. Three styles exist, ReliefNormal, ReliefHalf, ReliefNone. The default style is, as one can guess, ReliefNormal.

buttonGetRelief Source #

Arguments

:: ButtonClass self 
=> self 
-> IO ReliefStyle

returns The current ReliefStyle

Returns the current relief style of the given Button.

buttonSetLabel :: (ButtonClass self, GlibString string) => self -> string -> IO () Source #

Sets the text of the label of the button. This text is also used to select the stock item if buttonSetUseStock is used.

This will also clear any previously set labels.

buttonGetLabel :: (ButtonClass self, GlibString string) => self -> IO string Source #

Gets the text from the label of the button, as set by buttonSetLabel. If the label text has not been set the return value will be "". This will be the case if you create an empty button with buttonNew to use as a container.

buttonSetUseStock Source #

Arguments

:: ButtonClass self 
=> self 
-> Bool

useStock - True if the button should use a stock item

-> IO () 

If true, the label set on the button is used as a stock id to select the stock item for the button.

Setting this property to True will make the button lookup its label in the table of stock items. If there is a match, the button will use the stock item instead of the label. You need to set this flag before you change the label.

buttonGetUseStock Source #

Arguments

:: ButtonClass self 
=> self 
-> IO Bool

returns True if the button label is used to select a stock item instead of being used directly as the label text.

Returns whether the button label is a stock item.

buttonSetUseUnderline Source #

Arguments

:: ButtonClass self 
=> self 
-> Bool

useUnderline - True if underlines in the text indicate mnemonics

-> IO () 

If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.

Setting this property will make the button join any underline character into the following letter and inserting this letter as a keyboard shortcut. You need to set this flag before you change the label.

buttonGetUseUnderline Source #

Arguments

:: ButtonClass self 
=> self 
-> IO Bool

returns True if an embedded underline in the button label indicates the mnemonic accelerator keys.

Returns whether an embedded underline in the button label indicates a mnemonic. See buttonSetUseUnderline.

buttonSetFocusOnClick Source #

Arguments

:: ButtonClass self 
=> self 
-> Bool

focusOnClick - whether the button grabs focus when clicked with the mouse

-> IO () 

Sets whether the button will grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don't want the keyboard focus removed from the main area of the application.

  • Available since Gtk version 2.4

buttonGetFocusOnClick Source #

Arguments

:: ButtonClass self 
=> self 
-> IO Bool

returns True if the button grabs focus when it is clicked with the mouse.

Returns whether the button grabs focus when it is clicked with the mouse. See buttonSetFocusOnClick.

  • Available since Gtk version 2.4

buttonSetAlignment Source #

Arguments

:: ButtonClass self 
=> self 
-> (Float, Float)

(xalign, yalign) - the horizontal position of the child (0.0 is left aligned, 1.0 is right aligned) and the vertical position of the child (0.0 is top aligned, 1.0 is bottom aligned)

-> IO () 

Sets the alignment of the child. This has no effect unless the child derives from Misc or Alignment.

  • Available since Gtk version 2.4

buttonGetAlignment Source #

Arguments

:: ButtonClass self 
=> self 
-> IO (Float, Float)

(xalign, yalign) - horizontal and vertical alignment

Gets the alignment of the child in the button.

  • Available since Gtk version 2.4

buttonGetImage Source #

Arguments

:: ButtonClass self 
=> self 
-> IO (Maybe Widget)

a Widget or Nothing in case there is no image

Gets the widget that is currenty set as the image of the button. This may have been explicitly set by buttonSetImage or constructed by buttonNewFromStock.

  • Available since Gtk+ version 2.6

buttonSetImage Source #

Arguments

:: (ButtonClass self, WidgetClass image) 
=> self 
-> image

a widget to set as the image for the button

-> IO () 

Set the image of the button to the given widget. Note that it depends on the "gtk-button-images" setting whether the image will be displayed or not.

  • Available since Gtk+ version 2.6

buttonSetImagePosition Source #

Arguments

:: ButtonClass self 
=> self 
-> PositionType

position - the position

-> IO () 

Sets the position of the image relative to the text inside the button.

  • Available since Gtk+ version 2.10

buttonGetImagePosition Source #

Arguments

:: ButtonClass self 
=> self 
-> IO PositionType

returns the position

Gets the position of the image relative to the text inside the button.

  • Available since Gtk+ version 2.10

buttonGetEventWindow Source #

Arguments

:: ButtonClass self 
=> self 
-> IO (Maybe DrawWindow)

returns button's event window or Nothing

Returns the button's event window if it is realized, Nothing otherwise.

  • Available since Gtk+ version 2.22

Attributes

buttonLabel :: (ButtonClass self, GlibString string) => Attr self string Source #

Text of the label widget inside the button, if the button contains a label widget.

Default value: ""

buttonUseUnderline :: ButtonClass self => Attr self Bool Source #

If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.

Default value: False

buttonUseStock :: ButtonClass self => Attr self Bool Source #

If set, the label is used to pick a stock item instead of being displayed.

Default value: False

buttonFocusOnClick :: ButtonClass self => Attr self Bool Source #

Whether the button grabs focus when it is clicked with the mouse.

Default value: True

buttonRelief :: ButtonClass self => Attr self ReliefStyle Source #

The border relief style.

Default value: ReliefNormal

buttonXalign :: ButtonClass self => Attr self Float Source #

If the child of the button is a Misc or Alignment, this property can be used to control it's horizontal alignment. 0.0 is left aligned, 1.0 is right aligned.

Allowed values: [0,1]

Default value: 0.5

buttonYalign :: ButtonClass self => Attr self Float Source #

If the child of the button is a Misc or Alignment, this property can be used to control it's vertical alignment. 0.0 is top aligned, 1.0 is bottom aligned.

Allowed values: [0,1]

Default value: 0.5

buttonImage :: (ButtonClass self, WidgetClass image) => ReadWriteAttr self (Maybe Widget) image Source #

Child widget to appear next to the button text.

  • Available since Gtk version 2.6

buttonImagePosition :: ButtonClass self => Attr self PositionType Source #

The position of the image relative to the text inside the button.

Default value: PosLeft

  • Available since Gtk+ version 2.10

Signals

buttonActivated :: ButtonClass self => Signal self (IO ()) Source #

Emitted when the button has been activated (pressed and released).

Deprecated

onButtonActivate :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The button has been depressed (but not necessarily released yet). See clicked signal.

afterButtonActivate :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The button has been depressed (but not necessarily released yet). See clicked signal.

onClicked :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The button was clicked. This is only emitted if the mouse cursor was over the button when it was released.

afterClicked :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The button was clicked. This is only emitted if the mouse cursor was over the button when it was released.

onEnter :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The cursor enters the button box.

afterEnter :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The cursor enters the button box.

onLeave :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The cursor leaves the button box.

afterLeave :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The cursor leaves the button box.

onPressed :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The button is pressed.

afterPressed :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The button is pressed.

onReleased :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The button is released.

afterReleased :: ButtonClass b => b -> IO () -> IO (ConnectId b) Source #

The button is released.