 |
 |
 |
 |
Etk_Utils
Detailed Description
A set of utility functions and macros.
|
Defines |
#define | _(string) gettext(string) |
#define | ETK_MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2)) |
#define | ETK_MIN(v1, v2) (((v1) < (v2)) ? (v1) : (v2)) |
#define | ETK_CLAMP(value, left, right) ((value) < (left) ? (left) : ((value) > (right) ? (right) : (value))) |
#define | ETK_ROUND(a) ((a < 0.0) ? (int)(floor(a - 0.5)) : (int)(floor(a + 0.5))) |
#define | ETK_INSIDE(x, y, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy))) |
#define | ETK_WARNING(format,...) fprintf(stderr, "[Etk-Warning] (%s:%d - %s()):\n" format "\n\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) |
Functions |
Etk_Bool | etk_callback_set_null (void *data) |
| A utility function to use as a swapped callback. It sets to NULL the pointer located at the adress stored in data.
For example, if you want to set "pointer" to NULL when "button" is clicked, you can do:
etk_signal_connect_swapped(ETK_OBJECT(button), "clicked", ETK_CALLBACK(etk_callback_set_null), &pointer);.
|
unsigned int | etk_current_time_get () |
| Gets the current time, in milliseconds.
|
Define Documentation
#define _ |
( |
string |
|
) |
gettext(string) |
#define ETK_MAX |
( |
v1, |
|
|
v2 |
|
) |
(((v1) > (v2)) ? (v1) : (v2)) |
Gets the max of the two values
Referenced by etk_cache_new(), etk_cache_size_set(), etk_combobox_entry_items_height_set(), etk_combobox_items_height_set(), etk_editable_theme_set(), etk_iconbox_model_geometry_set(), etk_iconbox_model_icon_geometry_set(), etk_iconbox_model_label_geometry_set(), etk_image_size_get(), etk_shadow_border_set(), etk_spinner_digits_set(), etk_tree_col_min_width_set(), etk_tree_col_width_set(), etk_tree_rows_height_set(), etk_widget_padding_set(), and etk_widget_size_request_full().
#define ETK_MIN |
( |
v1, |
|
|
v2 |
|
) |
(((v1) < (v2)) ? (v1) : (v2)) |
#define ETK_CLAMP |
( |
value, |
|
|
left, |
|
|
right |
|
) |
((value) < (left) ? (left) : ((value) > (right) ? (right) : (value))) |
Clamps the value against the boudaries
Referenced by etk_alignment_set(), etk_combobox_column_add(), etk_combobox_entry_column_add(), etk_container_child_space_fill(), etk_editable_align_set(), etk_editable_cursor_pos_set(), etk_editable_selection_pos_set(), etk_editable_text_range_get(), etk_iconbox_model_label_geometry_set(), etk_label_alignment_set(), etk_progress_bar_fraction_set(), etk_progress_bar_pulse_step_set(), etk_range_value_set(), etk_shadow_border_color_set(), etk_shadow_shadow_color_set(), etk_shadow_shadow_set(), etk_string_insert_char(), etk_string_insert_sized(), etk_table_attach(), etk_tree_col_alignment_set(), etk_tree_col_position_set(), and etk_tree_model_image_width_set().
#define ETK_ROUND |
( |
a |
|
) |
((a < 0.0) ? (int)(floor(a - 0.5)) : (int)(floor(a + 0.5))) |
Rounds the float value to the nearest integer
#define ETK_INSIDE |
( |
x, |
|
|
y, |
|
|
xx, |
|
|
yy, |
|
|
ww, |
|
|
hh |
|
) |
(((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy))) |
Tests if the position (x, y) is inside the rectangle starting at (xx, yy) and of size (ww, hh)
Referenced by etk_tree_row_get_at_xy().
#define ETK_WARNING |
( |
format, |
|
|
... |
|
) |
fprintf(stderr, "[Etk-Warning] (%s:%d - %s()):\n" format "\n\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) |
Displays a warning in the output console
Referenced by etk_combobox_active_item_set(), etk_combobox_column_add(), etk_combobox_entry_active_item_set(), etk_combobox_entry_column_add(), etk_combobox_entry_item_insert_empty(), etk_combobox_fields_set_valist(), etk_combobox_item_insert_empty(), etk_config_init(), etk_config_load(), etk_config_save(), etk_embed_new(), etk_image_copy(), etk_init_full(), etk_object_check_cast(), etk_object_properties_get_valist(), etk_object_properties_set_valist(), etk_signal_block_by_code(), etk_signal_block_scb_by_code(), etk_signal_connect_full_by_code(), etk_signal_disconnect_all_by_code(), etk_signal_disconnect_by_code(), etk_signal_disconnect_scb_by_code(), etk_signal_emit(), etk_signal_emit_by_name(), etk_signal_unblock_scb_by_code(), etk_textblock2_iter_compare(), etk_textblock2_iter_copy(), etk_textblock2_node_format_apply(), etk_tree_col_model_add(), etk_tree_col_new(), etk_tree_mode_set(), and etk_tree_row_insert_valist().
Function Documentation
Etk_Bool etk_callback_set_null |
( |
void * |
data |
) |
|
A utility function to use as a swapped callback. It sets to NULL the pointer located at the adress stored in data.
For example, if you want to set "pointer" to NULL when "button" is clicked, you can do:
etk_signal_connect_swapped(ETK_OBJECT(button), "clicked", ETK_CALLBACK(etk_callback_set_null), &pointer);.
- Parameters:
-
| data | data stores the location of the pointer to set to NULL |
unsigned int etk_current_time_get |
( |
|
) |
|
Gets the current time, in milliseconds.
- Returns:
- Returns the current time, in milliseconds
|
 |
 |
 |
 |
|