AccelLabel

Description The GtkAccelLabel widget is a subclass of GtkLabel that also displays an accelerator key on the right of the label text, e.g. 'Ctl+S'. It is commonly used in menus to show the keyboard short-cuts for commands. The accelerator key to display is not set explicitly. Instead, the GtkAccelLabel displays the accelerators which have been added to a particular widget. This widget is set by calling gtk_accel_label_set_accel_widget(). For example, a GtkMenuItem widget may have an accelerator added to emit the "activate" signal when the 'Ctl+S' key combination is pressed. A GtkAccelLabel is created and added to the GtkMenuItem, and gtk_accel_label_set_accel_widget() is called with the GtkMenuItem as the second argument. The GtkAccelLabel will now display 'Ctl+S' after its label. Note that creating a GtkMenuItem with gtk_menu_item_new_with_label() (or one of the similar functions for GtkCheckMenuItem and GtkRadioMenuItem) automatically adds a GtkAccelLabel to the GtkMenuItem and calls gtk_accel_label_set_accel_widget() to set it up for you. A GtkAccelLabel will only display accelerators which have GTK_ACCEL_VISIBLE set (see GtkAccelFlags). A GtkAccelLabel can display multiple accelerators and even signal names, though it is almost always used to display just one accelerator key.

Constructors

this
this(GtkAccelLabel* gtkAccelLabel)

Sets our main struct and passes it to the parent class

this
this(string string)

Creates a new GtkAccelLabel.

Members

Functions

getAccelLabelStruct
GtkAccelLabel* getAccelLabelStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getAccelWidget
Widget getAccelWidget()

Fetches the widget monitored by this accelerator label. See gtk_accel_label_set_accel_widget().

getAccelWidth
uint getAccelWidth()

Returns the width needed to display the accelerator key(s). This is used by menus to align all of the GtkMenuItem widgets, and shouldn't be needed by applications.

getStruct
void* getStruct()

the main Gtk struct as a void*

refetch
int refetch()

Recreates the string representing the accelerator keys. This should not be needed since the string is automatically updated whenever accelerators are added or removed from the associated widget.

setAccelClosure
void setAccelClosure(Closure accelClosure)

Sets the closure to be monitored by this accelerator label. The closure must be connected to an accelerator group; see gtk_accel_group_connect().

setAccelWidget
void setAccelWidget(Widget accelWidget)

Sets the widget to be monitored by this accelerator label.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

gtkAccelLabel
GtkAccelLabel* gtkAccelLabel;

the main Gtk struct

Inherited Members

From Label

gtkLabel
GtkLabel* gtkLabel;

the main Gtk struct

getLabelStruct
GtkLabel* getLabelStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
connectedSignals
int[string] connectedSignals;
onActivateCurrentLinkListeners
void delegate(Label)[] onActivateCurrentLinkListeners;
Undocumented in source.
addOnActivateCurrentLink
void addOnActivateCurrentLink(void delegate(Label) dlg, ConnectFlags connectFlags)

A keybinding signal which gets emitted when the user activates a link in the label. Applications may also emit the signal with g_signal_emit_by_name() 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

callBackActivateCurrentLink
void callBackActivateCurrentLink(GtkLabel* labelStruct, Label _label)
Undocumented in source. Be warned that the author may not have intended to support it.
onActivateLinkListeners
bool delegate(string, Label)[] onActivateLinkListeners;
Undocumented in source.
addOnActivateLink
void addOnActivateLink(bool delegate(string, Label) dlg, ConnectFlags connectFlags)

The signal which gets emitted to activate a URI. Applications may connect to it to override the default behaviour, which is to call gtk_show_uri(). TRUE if the link has been activated Since 2.18

callBackActivateLink
gboolean callBackActivateLink(GtkLabel* labelStruct, gchar* uri, Label _label)
Undocumented in source. Be warned that the author may not have intended to support it.
onCopyClipboardListeners
void delegate(Label)[] onCopyClipboardListeners;
Undocumented in source.
addOnCopyClipboard
void addOnCopyClipboard(void delegate(Label) dlg, ConnectFlags connectFlags)

The ::copy-clipboard signal is a keybinding signal which gets emitted to copy the selection to the clipboard. The default binding for this signal is Ctrl-c.

callBackCopyClipboard
void callBackCopyClipboard(GtkLabel* labelStruct, Label _label)
Undocumented in source. Be warned that the author may not have intended to support it.
onMoveCursorListeners
void delegate(GtkMovementStep, gint, gboolean, Label)[] onMoveCursorListeners;
Undocumented in source.
addOnMoveCursor
void addOnMoveCursor(void delegate(GtkMovementStep, gint, gboolean, Label) dlg, ConnectFlags connectFlags)

The ::move-cursor 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 g_signal_emit_by_name() 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. Arrow keys move by individual characters/lines Ctrl-arrow key combinations move by words/paragraphs Home/End keys move to the ends of the buffer TRUE if the move should extend the selection

callBackMoveCursor
void callBackMoveCursor(GtkLabel* entryStruct, GtkMovementStep step, gint count, gboolean extendSelection, Label _label)
Undocumented in source. Be warned that the author may not have intended to support it.
onPopulatePopupListeners
void delegate(GtkMenu*, Label)[] onPopulatePopupListeners;
Undocumented in source.
addOnPopulatePopup
void addOnPopulatePopup(void delegate(GtkMenu*, Label) dlg, ConnectFlags connectFlags)

The ::populate-popup 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.

callBackPopulatePopup
void callBackPopulatePopup(GtkLabel* labelStruct, GtkMenu* menu, Label _label)
Undocumented in source. Be warned that the author may not have intended to support it.
setText
void setText(string str)

Sets the text within the GtkLabel widget. It overwrites any text that was there before. This will also clear any previously set mnemonic accelerators.

setAttributes
void setAttributes(PgAttributeList attrs)

Sets a PangoAttrList; the attributes in the list are applied to the label text. Note The attributes set with this function will be applied and merged with any other attributes previously effected by way of the "use-underline" or "use-markup" properties. While it is not recommended to mix markup strings with manually set attributes, if you must; know that the attributes will be applied to the label after the markup string is parsed.

setMarkup
void setMarkup(string str)

Parses str which is marked up with the Pango text markup language, setting the label's text and attribute list based on the parse results. If the str is external data, you may need to escape it with g_markup_escape_text() or

setMarkupWithMnemonic
void setMarkupWithMnemonic(string str)

Parses str which is marked up with the Pango text markup language, setting the label's text and attribute list based on the parse results. If characters in str are preceded by an underscore, they are underlined indicating that they represent a keyboard accelerator called a mnemonic. The mnemonic key can be used to activate another widget, chosen automatically, or explicitly using gtk_label_set_mnemonic_widget().

setPattern
void setPattern(string pattern)

The pattern of underlines you want under the existing text within the GtkLabel widget. For example if the current text of the label says "FooBarBaz" passing a pattern of "___ ___" will underline "Foo" and "Baz" but not "Bar".

setJustify
void setJustify(GtkJustification jtype)

Sets the alignment of the lines in the text of the label relative to each other. GTK_JUSTIFY_LEFT is the default value when the widget is first created with gtk_label_new(). If you instead want to set the alignment of the label as a whole, use gtk_misc_set_alignment() instead. gtk_label_set_justify() has no effect on labels containing only a single line.

setEllipsize
void setEllipsize(PangoEllipsizeMode mode)

Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there is not enough space to render the entire string. Since 2.6

setWidthChars
void setWidthChars(int nChars)

Sets the desired width in characters of label to n_chars. Since 2.6

setMaxWidthChars
void setMaxWidthChars(int nChars)

Sets the desired maximum width in characters of label to n_chars. Since 2.6

get
void get(string str)

Warning gtk_label_get is deprecated and should not be used in newly-written code. Use gtk_label_get_text() instead. Gets the current string of text within the GtkLabel and writes it to the given str argument. It does not make a copy of this string so you must not write to it.

parseUline
uint parseUline(string string)

Warning gtk_label_parse_uline is deprecated and should not be used in newly-written code. Use gtk_label_set_use_underline() instead. Parses the given string for underscores and converts the next character to an underlined character. The last character that was underlined will have its lower-cased accelerator keyval returned (i.e. "_File" would return the keyval for "f". This is probably only used within the GTK+ library itself for menu items and such.

setLineWrap
void setLineWrap(int wrap)

Toggles line wrapping within the GtkLabel widget. TRUE makes it break lines if text exceeds the widget's size. FALSE lets the text get cut off by the edge of the widget if it exceeds the widget size. Note that setting line wrapping to TRUE does not make the label wrap at its parent container's width, because GTK+ widgets conceptually can't make their requisition depend on the parent container's size. For a label that wraps at a specific position, set the label's width using gtk_widget_set_size_request().

setLineWrapMode
void setLineWrapMode(PangoWrapMode wrapMode)

If line wrapping is on (see gtk_label_set_line_wrap()) this controls how the line wrapping is done. The default is PANGO_WRAP_WORD which means wrap on word boundaries. Since 2.10

getLayoutOffsets
void getLayoutOffsets(int x, int y)

Obtains the coordinates where the label will draw the PangoLayout representing the text in the label; useful to convert mouse events into coordinates inside the PangoLayout, e.g. to take some action if some part of the label is clicked. Of course you will need to create a GtkEventBox to receive the events, and pack the label inside it, since labels are a GTK_NO_WINDOW widget. Remember when using the PangoLayout functions you need to convert to and from pixels using PANGO_PIXELS() or PANGO_SCALE.

getMnemonicKeyval
uint getMnemonicKeyval()

If the label has been set so that it has an mnemonic key this function returns the keyval used for the mnemonic accelerator. If there is no mnemonic set up it returns GDK_VoidSymbol.

getSelectable
int getSelectable()

Gets the value set by gtk_label_set_selectable().

getText
string getText()

Fetches the text from a label widget, as displayed on the screen. This does not include any embedded underlines indicating mnemonics or Pango markup. (See gtk_label_get_label())

selectRegion
void selectRegion(int startOffset, int endOffset)

Selects a range of characters in the label, if the label is selectable. See gtk_label_set_selectable(). If the label is not selectable, this function has no effect. If start_offset or end_offset are -1, then the end of the label will be substituted.

setMnemonicWidget
void setMnemonicWidget(Widget widget)

If the label has been set so that it has an mnemonic key (using i.e. gtk_label_set_markup_with_mnemonic(), gtk_label_set_text_with_mnemonic(), gtk_label_new_with_mnemonic() or the "use_underline" property) the label can be associated with a widget that is the target of the mnemonic. When the label is inside a widget (like a GtkButton or a GtkNotebook tab) it is automatically associated with the correct widget, but sometimes (i.e. when the target is a GtkEntry next to the label) you need to set it explicitly using this function. The target widget will be accelerated by emitting the GtkWidget::mnemonic-activate signal on it. The default handler for this signal will activate the widget if there are no mnemonic collisions and toggle focus between the colliding widgets otherwise.

setSelectable
void setSelectable(int setting)

Selectable labels allow the user to select text from the label, for copy-and-paste.

setTextWithMnemonic
void setTextWithMnemonic(string str)

Sets the label's text from the string str. If characters in str are preceded by an underscore, they are underlined indicating that they represent a keyboard accelerator called a mnemonic. The mnemonic key can be used to activate another widget, chosen automatically, or explicitly using gtk_label_set_mnemonic_widget().

getAttributes
PgAttributeList getAttributes()

Gets the attribute list that was set on the label using gtk_label_set_attributes(), if any. This function does not reflect attributes that come from the labels markup (see gtk_label_set_markup()). If you want to get the effective attributes for the label, use pango_layout_get_attribute (gtk_label_get_layout (label)).

getJustify
GtkJustification getJustify()

Returns the justification of the label. See gtk_label_set_justify().

getEllipsize
PangoEllipsizeMode getEllipsize()

Returns the ellipsizing position of the label. See gtk_label_set_ellipsize(). Since 2.6

getWidthChars
int getWidthChars()

Retrieves the desired width of label, in characters. See gtk_label_set_width_chars(). Since 2.6

getMaxWidthChars
int getMaxWidthChars()

Retrieves the desired maximum width of label, in characters. See gtk_label_set_width_chars(). Since 2.6

getLabel
string getLabel()

Fetches the text from a label widget including any embedded underlines indicating mnemonics and Pango markup. (See gtk_label_get_text()).

getLayout
PgLayout getLayout()

Gets the PangoLayout used to display the label. The layout is useful to e.g. convert text positions to pixel positions, in combination with gtk_label_get_layout_offsets(). The returned layout is owned by the label so need not be freed by the caller.

getLineWrap
int getLineWrap()

Returns whether lines in the label are automatically wrapped. See gtk_label_set_line_wrap().

getLineWrapMode
PangoWrapMode getLineWrapMode()

Returns line wrap mode used by the label. See gtk_label_set_line_wrap_mode(). Since 2.10

getMnemonicWidget
Widget getMnemonicWidget()

Retrieves the target of the mnemonic (keyboard shortcut) of this label. See gtk_label_set_mnemonic_widget().

getSelectionBounds
int getSelectionBounds(int start, int end)

Gets the selected range of characters in the label, returning TRUE if there's a selection.

getUseMarkup
int getUseMarkup()

Returns whether the label's text is interpreted as marked up with the Pango text markup language. See gtk_label_set_use_markup().

getUseUnderline
int getUseUnderline()

Returns whether an embedded underline in the label indicates a mnemonic. See gtk_label_set_use_underline().

getSingleLineMode
int getSingleLineMode()

Returns whether the label is in single line mode. Since 2.6

getAngle
double getAngle()

Gets the angle of rotation for the label. See gtk_label_set_angle(). Since 2.6

setLabel
void setLabel(string str)

Sets the text of the label. The label is interpreted as including embedded underlines and/or Pango markup depending on the values of the "use-underline"" and "use-markup" properties.

setUseMarkup
void setUseMarkup(int setting)

Sets whether the text of the label contains markup in Pango's text markup language. See gtk_label_set_markup().

setUseUnderline
void setUseUnderline(int setting)

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

setSingleLineMode
void setSingleLineMode(int singleLineMode)

Sets whether the label is in single line mode. Since 2.6

setAngle
void setAngle(double angle)

Sets the angle of rotation for the label. An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom. The angle setting for the label is ignored if the label is selectable, wrapped, or ellipsized. Since 2.6

getCurrentUri
string getCurrentUri()

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 "activate-link" handler or for use in a "query-tooltip" handler. Since 2.18

setTrackVisitedLinks
void setTrackVisitedLinks(int trackLinks)

Sets whether the label should keep track of clicked links (and use a different color for them). Since 2.18

getTrackVisitedLinks
int getTrackVisitedLinks()

Returns whether the label is currently keeping track of clicked links. Since 2.18

Meta