_
ButtonA Gtk_Toggle_Button is like a regular button, but can be in one of two states, "active" or "inactive". Its visual aspect is modified when the state is changed.
You should consider using a Gtk_Check_Button instead, since it looks nicer and provides more visual clues that the button can be toggled.
Widget Hierarchy |
---|
Gtk_Object (see section Package Gtk.Object)
\___ Gtk_Widget (see section Package Gtk.Widget)
\___ Gtk_Container (see section Package Gtk.Container)
\___ Gtk_Bin (see section Package Gtk.Bin)
\___ Gtk_Button (see section Package Gtk.Button)
\___ Gtk_Toggle_Button (see section Package Gtk.Toggle
|
Signals |
---|
Subprograms |
---|
procedure Gtk_New (Toggle_Button : out Gtk_Toggle_Button; Label : in String := ""); | ||
Initialize a button. | ||
function Get_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_Toggle_Button.
| ||
procedure Set_Mode (Toggle_Button : access Gtk_Toggle_Button_Record; Draw_Indicator : in Boolean); | ||
Change the mode of the button. | ||
procedure Set_Active (Toggle_Button : access Gtk_Toggle_Button_Record; Is_Active : in Boolean); | ||
Change the state of the button. | ||
function Get_Active (Toggle_Button : access Gtk_Toggle_Button_Record) return Boolean; | ||
Return true if the button is in its active state, i.e is pressed.
| ||
function Is_Active (Toggle_Button : access Gtk_Toggle_Button_Record) return Boolean; | ||
Deprecated: this is the old name of Get_Active.
| ||
Signals emission | ||
procedure Toggled (Toggle_Button : access Gtk_Toggle_Button_Record); | ||
Emit the toggled signal on this widget. |
Example |
---|
-- This example creates a toggle button with a pixmap in it with Gtk.Toggle_Button, Gdk.Pixmap, Gdk.Bitmap, Gtk.Pixmap; with Gtk.Style, Gtk.Enums; procedure Toggle is Toggle : Gtk.Toggle_Button.Gtk_Toggle_Button; Style : Gtk.Style.Gtk_Style; Pixmap : Gdk.Pixmap.Gdk_Pixmap; Mask : Gdk.Bitmap.Gdk_Bitmap; PixmapWid : Gtk.Pixmap.Gtk_Pixmap; begin -- Do not specify a label Gtk.Toggle_Button.Gtk_New (Toggle); Style := Gtk.Toggle_Button.Get_Style (Toggle); Gdk.Pixmap.Create_From_Xpm (Pixmap, Gtk.Toggle_Button.Get_Window (Toggle), Mask, Gtk.Style.Get_Bg (Style, Gtk.Enums.State_Normal), "icon.xpm"); Gtk.Pixmap.Gtk_New (PixmapWid, Pixmap, Mask); -- Add the pixmap to the button Gtk.Toggle_Button.Add (Toggle, PixmapWid); end;