Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Label


Detailed Description

The Etk_Label widget is a simple widget that can display text.

label.png
You can use html-like tags to format the text of the label. For example, "<b>Text</b>" makes Text bold.
Here is the list of the supported tags:
  • "<left>Text</left>": Align left
  • "<right>Text</right>": Align right
  • "<center>Text</center>": Align center
  • "<b>Text</b>": Bold
  • "<b>Text</b>": Italic
  • "<bi>Text</bi>": Bold-Italic
  • "<color=#rrggbbaa>Text</>": Set the color of the text
  • "<font_size=16>Text</>": Set the size of the text
  • "<title>Text</title>": Style for titles
  • "<subtitle>Text</subtitle>": Style for subtitles
  • "<glow>Text</glow>": Make the the text glow
  • "<description>Text</description>": Style for descriptions
  • "<br>": End of line
  • "<tab>": Add a tab

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Label
Properties:
  • "label": The text of the label widget
    • Type: String (char *)
    • Access: Read/Write
    • Default Value: NULL
  • "xalign": The horizontal alignment of the text of the label, from 0.0 (left-aligned) to 1.0 (right-aligned)
    • Type: Float
    • Access: Read/Write
    • Default Value: 0.0
  • "yalign": The vertical alignment of the text of the label, from 0.0 (top-aligned) to 1.0 (bottom-aligned)
    • Type: Float
    • Access: Read/Write
    • Default Value: 0.5


Data Structures

struct  Etk_Label
 [Widget] A simple widget that can display text More...

Defines

#define ETK_LABEL_TYPE   (etk_label_type_get())
#define ETK_LABEL(obj)   (ETK_OBJECT_CAST((obj), ETK_LABEL_TYPE, Etk_Label))
#define ETK_IS_LABEL(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_LABEL_TYPE))

Functions

Etk_Widget * etk_label_new (const char *text)
 Creates a new label.
void etk_label_set (Etk_Label *label, const char *text)
 Sets the text of the label.
const char * etk_label_get (Etk_Label *label)
 Gets the text of the label.
void etk_label_alignment_set (Etk_Label *label, float xalign, float yalign)
 Sets the alignment of the label.
void etk_label_alignment_get (Etk_Label *label, float *xalign, float *yalign)
 Gets the alignment of the label.


Define Documentation

#define ETK_LABEL_TYPE   (etk_label_type_get())

Gets the type of a label

Referenced by etk_label_new().

#define ETK_LABEL ( obj   )     (ETK_OBJECT_CAST((obj), ETK_LABEL_TYPE, Etk_Label))

Casts the object to an Etk_Label

Referenced by etk_button_alignment_set(), etk_button_label_get(), etk_button_label_set(), etk_combobox_active_item_set(), etk_combobox_entry_item_field_get(), etk_combobox_entry_item_fields_get_valist(), etk_combobox_fields_set_valist(), etk_combobox_item_field_get(), etk_combobox_item_fields_get_valist(), etk_message_dialog_text_get(), etk_message_dialog_text_set(), and etk_tooltips_pop_up().

#define ETK_IS_LABEL ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_LABEL_TYPE))

Check if the object is an Etk_Label

Referenced by etk_button_alignment_set().


Function Documentation

Etk_Widget * etk_label_new ( const char *  text  ) 

Creates a new label.

Parameters:
text the text to set to the label
Returns:
Returns the new label widget

References ETK_LABEL_TYPE, and etk_widget_new().

Referenced by etk_combobox_build(), etk_combobox_entry_item_field_set(), etk_combobox_entry_item_fields_set_valist(), etk_combobox_item_field_set(), etk_combobox_item_fields_set_valist(), etk_tooltips_init(), and etk_tooltips_pop_up().

void etk_label_set ( Etk_Label *  label,
const char *  text 
)

Sets the text of the label.

Parameters:
label a label
text the text to set

References ETK_WIDGET, etk_widget_size_recalc_queue(), etk_widget_theme_part_text_set(), and text.

Referenced by etk_button_label_set(), etk_combobox_active_item_set(), etk_combobox_fields_set_valist(), etk_message_dialog_text_set(), and etk_tooltips_pop_up().

const char * etk_label_get ( Etk_Label *  label  ) 

Gets the text of the label.

Parameters:
label a label
Returns:
Returns the text of the label

References text.

Referenced by etk_button_label_get(), etk_combobox_active_item_set(), etk_combobox_entry_item_field_get(), etk_combobox_entry_item_fields_get_valist(), etk_combobox_item_field_get(), etk_combobox_item_fields_get_valist(), and etk_message_dialog_text_get().

void etk_label_alignment_set ( Etk_Label *  label,
float  xalign,
float  yalign 
)

Sets the alignment of the label.

Parameters:
label a label
xalign the horizontal alignment (0.0 = left, 0.5 = center, 1.0 = right, ...)
yalign the vertical alignment (0.0 = top, 0.5 = center, 1.0 = bottom, ...)

References ETK_CLAMP, ETK_OBJECT, etk_object_notify(), ETK_WIDGET, etk_widget_redraw_queue(), xalign, and yalign.

Referenced by etk_button_alignment_set().

void etk_label_alignment_get ( Etk_Label *  label,
float *  xalign,
float *  yalign 
)

Gets the alignment of the label.

Parameters:
label a label
xalign the location to store the horizontal alignment
yalign the location to store the vertical alignment

References xalign, and yalign.