Enlightenment CVS committal
Author : moom
Project : e17
Module : libs/etk
Dir : e17/libs/etk/src/lib
Modified Files:
etk_button.c etk_button.h etk_container.c etk_entry.c
etk_label.c etk_menu.c etk_radio_button.c etk_radio_button.h
etk_toggle_button.c etk_toggle_button.h etk_widget.c
etk_widget.h
Log Message:
* [Radio button] Etk_Radio_Button now inherits from Etk_Toggle_Button
and no longer from Etk_Check_Button
* [Button] Make sure the button's label receive the same theme-signals
as the button
* Formatting
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_button.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- etk_button.c 25 Mar 2007 18:22:00 -0000 1.39
+++ etk_button.c 1 Apr 2007 19:09:31 -0000 1.40
@@ -38,12 +38,19 @@
static void _etk_button_property_set(Etk_Object *object, int property_id,
Etk_Property_Value *value);
static void _etk_button_property_get(Etk_Object *object, int property_id,
Etk_Property_Value *value);
static void _etk_button_realized_cb(Etk_Object *object, void *data);
+static void _etk_button_label_realized_cb(Etk_Object *object, void *data);
static void _etk_button_image_removed_cb(Etk_Object *object, Etk_Widget
*child, void *data);
static void _etk_button_key_down_cb(Etk_Object *object, Etk_Event_Key_Down
*event, void *data);
static void _etk_button_key_up_cb(Etk_Object *object, Etk_Event_Key_Up *event,
void *data);
static void _etk_button_mouse_down_cb(Etk_Object *object, Etk_Event_Mouse_Down
*event, void *data);
static void _etk_button_mouse_up_cb(Etk_Object *object, Etk_Event_Mouse_Up
*event, void *data);
static void _etk_button_mouse_click_cb(Etk_Object *object, Etk_Event_Mouse_Up
*event, void *data);
+static void _etk_button_entered_handler(Etk_Widget *widget);
+static void _etk_button_left_handler(Etk_Widget *widget);
+static void _etk_button_focused_handler(Etk_Widget *widget);
+static void _etk_button_unfocused_handler(Etk_Widget *widget);
+static void _etk_button_enabled_handler(Etk_Widget *widget);
+static void _etk_button_disabled_handler(Etk_Widget *widget);
static void _etk_button_pressed_handler(Etk_Button *button);
static void _etk_button_released_handler(Etk_Button *button);
static void _etk_button_clicked_handler(Etk_Button *button);
@@ -227,8 +234,7 @@
* @brief Sets the image of the button
* @param button a button
* @param image the image to set
- * @note The current image will be destroyed only if it has been set with
etk_button_new_from_stock()
- * or with etk_button_set_from_stock(). Otherwise, it will just be unpacked
and you'll still be able to use it
+ * @note If the button already has an image, the current image will just be
unpacked, it will not be destroyed
* @note The image will be automatically shown, but you can still manually
hide it with calling etk_widget_hide()
* after having called etk_button_image_set()
*/
@@ -240,15 +246,11 @@
if (button->image)
{
button->ignore_image_remove = ETK_TRUE;
- if (button->image_from_stock)
- etk_object_destroy(ETK_OBJECT(button->image));
- else
- etk_container_remove(ETK_WIDGET(button->image));
+ etk_object_destroy(ETK_OBJECT(button->image));
button->ignore_image_remove = ETK_FALSE;
}
button->image = image;
- button->image_from_stock = ETK_FALSE;
_etk_button_rebuild(button);
etk_object_notify(ETK_OBJECT(button), "image");
}
@@ -285,61 +287,6 @@
image = etk_image_new_from_stock(stock_id, button->stock_size);
etk_widget_internal_set(image, ETK_TRUE);
etk_button_image_set(ETK_BUTTON(button), ETK_IMAGE(image));
- button->image_from_stock = ETK_TRUE;
-}
-
-/**
- * @brief Sets the alignment of the child of the button
- * @param button a button
- * @param xalign the horizontal alignment (0.0 = left, 0.5 = center, 1.0 =
right, ...)
- * @param yalign the vertical alignment (0.0 = top, 0.5 = center, 1.0 =
bottom, ...)
- * @note It only has effect if the child is a label or an alignment
- */
-void etk_button_alignment_set(Etk_Button *button, float xalign, float yalign)
-{
- Etk_Widget *child;
-
- if (!button)
- return;
-
- if ((child = etk_bin_child_get(ETK_BIN(button))))
- {
- if (ETK_IS_LABEL(child))
- etk_label_alignment_set(ETK_LABEL(child), xalign, yalign);
- else if (ETK_IS_ALIGNMENT(child))
- {
- Etk_Alignment *child_alignment = ETK_ALIGNMENT(child);
- float xscale, yscale;
-
- etk_alignment_get(child_alignment, NULL, NULL, &xscale, &yscale);
- etk_alignment_set(child_alignment, xalign, yalign, xscale, yscale);
- }
- }
-
- if (button->xalign != xalign)
- {
- button->xalign = xalign;
- etk_object_notify(ETK_OBJECT(button), "xalign");
- }
- if (button->yalign != yalign)
- {
- button->yalign = yalign;
- etk_object_notify(ETK_OBJECT(button), "yalign");
- }
-}
-
-/**
- * @brief Gets the alignment of the button's child
- * @param button a button
- * @param xalign the location where to store the horizontal alignment
- * @param yalign the location where to store the vertical alignment
- */
-void etk_button_alignment_get(Etk_Button *button, float *xalign, float *yalign)
-{
- if (xalign)
- *xalign = button ? button->xalign : 0;
- if (yalign)
- *yalign = button ? button->yalign : 0;
}
/**
@@ -414,6 +361,60 @@
return button->stock_size;
}
+/**
+ * @brief Sets the alignment of the child of the button
+ * @param button a button
+ * @param xalign the horizontal alignment (0.0 = left, 0.5 = center, 1.0 =
right, ...)
+ * @param yalign the vertical alignment (0.0 = top, 0.5 = center, 1.0 =
bottom, ...)
+ * @note It only has effect if the child is a label or an alignment
+ */
+void etk_button_alignment_set(Etk_Button *button, float xalign, float yalign)
+{
+ Etk_Widget *child;
+
+ if (!button)
+ return;
+
+ if ((child = etk_bin_child_get(ETK_BIN(button))))
+ {
+ if (ETK_IS_LABEL(child))
+ etk_label_alignment_set(ETK_LABEL(child), xalign, yalign);
+ else if (ETK_IS_ALIGNMENT(child))
+ {
+ Etk_Alignment *child_alignment = ETK_ALIGNMENT(child);
+ float xscale, yscale;
+
+ etk_alignment_get(child_alignment, NULL, NULL, &xscale, &yscale);
+ etk_alignment_set(child_alignment, xalign, yalign, xscale, yscale);
+ }
+ }
+
+ if (button->xalign != xalign)
+ {
+ button->xalign = xalign;
+ etk_object_notify(ETK_OBJECT(button), "xalign");
+ }
+ if (button->yalign != yalign)
+ {
+ button->yalign = yalign;
+ etk_object_notify(ETK_OBJECT(button), "yalign");
+ }
+}
+
+/**
+ * @brief Gets the alignment of the button's child
+ * @param button a button
+ * @param xalign the location where to store the horizontal alignment
+ * @param yalign the location where to store the vertical alignment
+ */
+void etk_button_alignment_get(Etk_Button *button, float *xalign, float *yalign)
+{
+ if (xalign)
+ *xalign = button ? button->xalign : 0;
+ if (yalign)
+ *yalign = button ? button->yalign : 0;
+}
+
/**************************
*
* Etk specific functions
@@ -439,17 +440,23 @@
etk_widget_pass_mouse_events_set(button->label, ETK_TRUE);
etk_container_add(ETK_CONTAINER(button), button->label);
- button->pressed_handler = _etk_button_pressed_handler;
- button->released_handler = _etk_button_released_handler;
- button->clicked_handler = _etk_button_clicked_handler;
-
button->ignore_image_remove = ETK_FALSE;
button->is_pressed = ETK_FALSE;
- button->image_from_stock = ETK_FALSE;
button->xalign = 0.5;
button->yalign = 0.5;
+ ETK_WIDGET(button)->entered_handler = _etk_button_entered_handler;
+ ETK_WIDGET(button)->left_handler = _etk_button_left_handler;
+ ETK_WIDGET(button)->focused_handler = _etk_button_focused_handler;
+ ETK_WIDGET(button)->unfocused_handler = _etk_button_unfocused_handler;
+ ETK_WIDGET(button)->enabled_handler = _etk_button_enabled_handler;
+ ETK_WIDGET(button)->disabled_handler = _etk_button_disabled_handler;
+ button->pressed_handler = _etk_button_pressed_handler;
+ button->released_handler = _etk_button_released_handler;
+ button->clicked_handler = _etk_button_clicked_handler;
+
etk_signal_connect("realized", ETK_OBJECT(button),
ETK_CALLBACK(_etk_button_realized_cb), NULL);
+ etk_signal_connect("realized", ETK_OBJECT(button->label),
ETK_CALLBACK(_etk_button_label_realized_cb), button);
etk_signal_connect("key-down", ETK_OBJECT(button),
ETK_CALLBACK(_etk_button_key_down_cb), NULL);
etk_signal_connect("key-up", ETK_OBJECT(button),
ETK_CALLBACK(_etk_button_key_up_cb), NULL);
etk_signal_connect("mouse-down", ETK_OBJECT(button),
ETK_CALLBACK(_etk_button_mouse_down_cb), NULL);
@@ -538,7 +545,26 @@
return;
if (button->is_pressed)
- etk_widget_theme_signal_emit(ETK_WIDGET(button), "pressed", ETK_FALSE);
+ {
+ etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,pressed",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,pressed",
ETK_FALSE);
+ }
+}
+
+/* Called when the button's label is realized */
+static void _etk_button_label_realized_cb(Etk_Object *object, void *data)
+{
+ Etk_Button *button;
+
+ if (!(button = ETK_BUTTON(data)))
+ return;
+
+ if (button->is_pressed)
+ etk_widget_theme_signal_emit(button->label, "etk,state,pressed",
ETK_FALSE);
+ if (etk_widget_disabled_get(ETK_WIDGET(button)))
+ etk_widget_theme_signal_emit(button->label, "etk,state,disabled",
ETK_FALSE);
+ if (etk_widget_is_focused(ETK_WIDGET(button)))
+ etk_widget_theme_signal_emit(button->label, "etk,state,focused",
ETK_FALSE);
}
/* Called when the image is removed from the box */
@@ -630,12 +656,85 @@
etk_button_click(button);
}
+/* Default handler for the "entered" signal. We override this handler
+ * to make the button's label receives the same theme-signals as the button */
+static void _etk_button_entered_handler(Etk_Widget *widget)
+{
+ Etk_Button *button;
+
+ if (!(button = ETK_BUTTON(widget)))
+ return;
+ etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,enter",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,enter", ETK_FALSE);
+}
+
+/* Default handler for the "left" signal. We override this handler
+ * to make the button's label receives the same theme-signals as the button */
+static void _etk_button_left_handler(Etk_Widget *widget)
+{
+ Etk_Button *button;
+
+ if (!(button = ETK_BUTTON(widget)))
+ return;
+ etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,leave",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,leave", ETK_FALSE);
+}
+
+/* Default handler for the "focused" signal. We override this handler
+ * to make the button's label receives the same theme-signals as the button */
+static void _etk_button_focused_handler(Etk_Widget *widget)
+{
+ Etk_Button *button;
+
+ if (!(button = ETK_BUTTON(widget)))
+ return;
+ etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,focused",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,focused", ETK_FALSE);
+}
+
+/* Default handler for the "unfocused" signal. We override this handler
+ * to make the button's label receives the same theme-signals as the button */
+static void _etk_button_unfocused_handler(Etk_Widget *widget)
+{
+ Etk_Button *button;
+
+ if (!(button = ETK_BUTTON(widget)))
+ return;
+ etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,unfocused",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,unfocused",
ETK_FALSE);
+}
+
+/* Default handler for the "enabled" signal. We override this handler
+ * to make the button's label receives the same theme-signals as the button */
+static void _etk_button_enabled_handler(Etk_Widget *widget)
+{
+ Etk_Button *button;
+
+ if (!(button = ETK_BUTTON(widget)))
+ return;
+ etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,enabled",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,enabled", ETK_FALSE);
+}
+
+/* Default handler for the "disabled" signal. We override this handler
+ * to make the button's label receives the same theme-signals as the button */
+static void _etk_button_disabled_handler(Etk_Widget *widget)
+{
+ Etk_Button *button;
+
+ if (!(button = ETK_BUTTON(widget)))
+ return;
+ etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,disabled",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,disabled",
ETK_FALSE);
+}
+
/* Default handler for the "pressed" signal */
static void _etk_button_pressed_handler(Etk_Button *button)
{
if (!button)
return;
etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,pressed",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,pressed", ETK_FALSE);
}
/* Default handler for the "released" signal */
@@ -644,6 +743,7 @@
if (!button)
return;
etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,released",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,released",
ETK_FALSE);
}
/* Default handler for the "clicked" signal */
@@ -652,7 +752,14 @@
if (!button)
return;
etk_widget_theme_signal_emit(ETK_WIDGET(button), "etk,state,clicked",
ETK_FALSE);
+ etk_widget_theme_signal_emit(button->label, "etk,state,clicked", ETK_FALSE);
}
+
+/**************************
+ *
+ * Private functions
+ *
+ **************************/
/* Rebuilds the default layout for the button */
static void _etk_button_rebuild(Etk_Button *button)
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_button.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- etk_button.h 22 Mar 2007 19:36:51 -0000 1.16
+++ etk_button.h 1 Apr 2007 19:09:31 -0000 1.17
@@ -51,36 +51,35 @@
Etk_Bool is_pressed;
Etk_Bool ignore_image_remove;
- Etk_Bool image_from_stock;
- float xalign;
- float yalign;
Etk_Button_Style style;
Etk_Stock_Size stock_size;
+ float xalign;
+ float yalign;
};
-Etk_Type *etk_button_type_get(void);
-Etk_Widget *etk_button_new(void);
-Etk_Widget *etk_button_new_with_label(const char *label);
-Etk_Widget *etk_button_new_from_stock(Etk_Stock_Id stock_id);
-
-void etk_button_press(Etk_Button *button);
-void etk_button_release(Etk_Button *button);
-void etk_button_click(Etk_Button *button);
-
-void etk_button_label_set(Etk_Button *button, const char *label);
-const char *etk_button_label_get(Etk_Button *button);
-void etk_button_image_set(Etk_Button *button, Etk_Image *image);
-Etk_Image *etk_button_image_get(Etk_Button *button);
-void etk_button_set_from_stock(Etk_Button *button, Etk_Stock_Id
stock_id);
-
-void etk_button_alignment_set(Etk_Button *button, float xalign, float yalign);
-void etk_button_alignment_get(Etk_Button *button, float *xalign, float
*yalign);
+Etk_Type *etk_button_type_get(void);
+Etk_Widget *etk_button_new(void);
+Etk_Widget *etk_button_new_with_label(const char *label);
+Etk_Widget *etk_button_new_from_stock(Etk_Stock_Id stock_id);
+
+void etk_button_press(Etk_Button *button);
+void etk_button_release(Etk_Button *button);
+void etk_button_click(Etk_Button *button);
+
+void etk_button_label_set(Etk_Button *button, const char *label);
+const char *etk_button_label_get(Etk_Button *button);
+void etk_button_image_set(Etk_Button *button, Etk_Image *image);
+Etk_Image *etk_button_image_get(Etk_Button *button);
+void etk_button_set_from_stock(Etk_Button *button, Etk_Stock_Id
stock_id);
void etk_button_style_set(Etk_Button *button, Etk_Button_Style
style);
Etk_Button_Style etk_button_style_get(Etk_Button *button);
void etk_button_stock_size_set(Etk_Button *button, Etk_Stock_Size
size);
Etk_Stock_Size etk_button_stock_size_get(Etk_Button *button);
+
+void etk_button_alignment_set(Etk_Button *button, float xalign,
float yalign);
+void etk_button_alignment_get(Etk_Button *button, float *xalign,
float *yalign);
/** @} */
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_container.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- etk_container.c 30 Mar 2007 14:13:55 -0000 1.18
+++ etk_container.c 1 Apr 2007 19:09:31 -0000 1.19
@@ -23,7 +23,6 @@
};
static void _etk_container_constructor(Etk_Container *container);
-static void _etk_container_destructor(Etk_Container *container);
static void _etk_container_property_set(Etk_Object *object, int property_id,
Etk_Property_Value *value);
static void _etk_container_property_get(Etk_Object *object, int property_id,
Etk_Property_Value *value);
static void _etk_container_child_added_cb(Etk_Object *object, Etk_Widget
*child, void *data);
@@ -50,7 +49,7 @@
if (!container_type)
{
container_type = etk_type_new("Etk_Container", ETK_WIDGET_TYPE,
sizeof(Etk_Container),
- ETK_CONSTRUCTOR(_etk_container_constructor),
ETK_DESTRUCTOR(_etk_container_destructor));
+ ETK_CONSTRUCTOR(_etk_container_constructor), NULL);
_etk_container_signals[ETK_CONTAINER_CHILD_ADDED_SIGNAL] =
etk_signal_new("child-added",
container_type, -1, etk_marshaller_VOID__POINTER, NULL, NULL);
@@ -259,19 +258,6 @@
etk_signal_connect("child-added", ETK_OBJECT(container),
ETK_CALLBACK(_etk_container_child_added_cb), NULL);
etk_signal_connect("child-removed", ETK_OBJECT(container),
ETK_CALLBACK(_etk_container_child_removed_cb), NULL);
-}
-
-/* Destroys the container */
-static void _etk_container_destructor(Etk_Container *container)
-{
- if (!container)
- return;
-
- /* We need to do that because Etk_Widget's destructor may
- * still want to access those methods (TODO: no more need for this?) */
- container->child_add = NULL;
- container->child_remove = NULL;
- container->children_get = NULL;
}
/* Sets the property whose id is "property_id" to the value "value" */
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_entry.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- etk_entry.c 22 Mar 2007 19:36:51 -0000 1.33
+++ etk_entry.c 1 Apr 2007 19:09:31 -0000 1.34
@@ -11,8 +11,7 @@
#include "etk_signal_callback.h"
#include "etk_utils.h"
-/* TODO: parent changed! */
-/* TODO: use etk_widget_color_set() instead of evas_object_color_set(...) when
it'll be implemented... */
+/* TODO: what if the image is reparented?! */
/**
* @addtogroup Etk_Entry
@@ -297,7 +296,7 @@
etk_signal_disconnect("mouse-up", ETK_OBJECT(image),
ETK_CALLBACK(_etk_entry_image_mouse_up_cb));
- evas_object_color_set(etk_image_evas_object_get(image), 255, 255, 255,
255);
+ etk_widget_color_set(ETK_WIDGET(image), 255, 255, 255, 255);
}
}
@@ -857,7 +856,7 @@
if (!(entry = ETK_ENTRY(data)) || !(image = ETK_IMAGE(widget)))
return;
- evas_object_color_set(etk_image_evas_object_get(image),
+ etk_widget_color_set(ETK_WIDGET(image),
entry->highlight_color.r, entry->highlight_color.g,
entry->highlight_color.b, entry->highlight_color.a);
}
@@ -872,7 +871,7 @@
return;
if (!(image = ETK_IMAGE(widget)))
return;
- evas_object_color_set(etk_image_evas_object_get(image), 255, 255, 255, 255);
+ etk_widget_color_set(ETK_WIDGET(image), 255, 255, 255, 255);
}
/* Called when the mouse is pressed over the image */
@@ -883,8 +882,7 @@
if (!(entry = ETK_ENTRY(data)) || !(image = ETK_IMAGE(widget)))
return;
-
- evas_object_color_set(etk_image_evas_object_get(image), 255, 255, 255, 255);
+ etk_widget_color_set(ETK_WIDGET(image), 255, 255, 255, 255);
}
/* Called when the mouse released over the image */
@@ -896,7 +894,7 @@
if (!(entry = ETK_ENTRY(data)) || !(image = ETK_IMAGE(widget)))
return;
- evas_object_color_set(etk_image_evas_object_get(image),
+ etk_widget_color_set(ETK_WIDGET(image),
entry->highlight_color.r, entry->highlight_color.g,
entry->highlight_color.b, entry->highlight_color.a);
}
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_label.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- etk_label.c 22 Mar 2007 19:36:51 -0000 1.29
+++ etk_label.c 1 Apr 2007 19:09:31 -0000 1.30
@@ -178,8 +178,6 @@
widget->size_request = _etk_label_size_request;
widget->size_allocate = _etk_label_size_allocate;
- /* This allows the label to receive the same theme-signals as its
theme-parent */
- widget->emit_theme_parent_signals = ETK_TRUE;
etk_signal_connect("realized", ETK_OBJECT(label),
ETK_CALLBACK(_etk_label_realized_cb), NULL);
}
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_menu.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- etk_menu.c 25 Mar 2007 18:22:00 -0000 1.24
+++ etk_menu.c 1 Apr 2007 19:09:31 -0000 1.25
@@ -464,9 +464,15 @@
if (item->submenu)
{
int mx, my, mw, item_y;
+ Etk_Menu_Item *first_item;
item_y = ETK_WIDGET(item)->geometry.y;
etk_window_geometry_get(ETK_WINDOW(menu->window), &mx, &my, &mw, NULL);
+ if (ETK_MENU_SHELL(item->submenu)->items)
+ {
+ first_item =
ETK_MENU_ITEM(ETK_MENU_SHELL(item->submenu)->items->data);
+ my -= ETK_WIDGET(first_item)->geometry.y;
+ }
etk_menu_popup_at_xy(item->submenu, mx + mw, my + item_y);
}
}
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_radio_button.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etk_radio_button.c 22 Mar 2007 19:36:52 -0000 1.13
+++ etk_radio_button.c 1 Apr 2007 19:09:31 -0000 1.14
@@ -25,17 +25,17 @@
* @brief Gets the type of an Etk_Radio_Button
* @return Returns the type of an Etk_Radio_Button
*/
-Etk_Type *etk_radio_button_type_get()
+Etk_Type *etk_radio_button_type_get(void)
{
static Etk_Type *radio_button_type = NULL;
if (!radio_button_type)
{
- radio_button_type = etk_type_new("Etk_Radio_Button",
ETK_CHECK_BUTTON_TYPE, sizeof(Etk_Radio_Button),
- ETK_CONSTRUCTOR(_etk_radio_button_constructor),
ETK_DESTRUCTOR(_etk_radio_button_destructor));
+ radio_button_type = etk_type_new("Etk_Radio_Button",
ETK_TOGGLE_BUTTON_TYPE, sizeof(Etk_Radio_Button),
+ ETK_CONSTRUCTOR(_etk_radio_button_constructor),
ETK_DESTRUCTOR(_etk_radio_button_destructor));
etk_type_property_add(radio_button_type, "group",
ETK_RADIO_BUTTON_GROUP_PROPERTY,
- ETK_PROPERTY_POINTER, ETK_PROPERTY_READABLE_WRITABLE,
etk_property_value_pointer(NULL));
+ ETK_PROPERTY_POINTER, ETK_PROPERTY_READABLE_WRITABLE,
etk_property_value_pointer(NULL));
radio_button_type->property_set = _etk_radio_button_property_set;
radio_button_type->property_get = _etk_radio_button_property_get;
@@ -45,9 +45,9 @@
}
/**
- * @brief Creates a new radio button
- * @param group the group to which the radio button will be added (NULL if the
radio button should create its own group)
- * @return Returns the new radio button widget
+ * @brief Creates a new radio-button
+ * @param group the group to which the radio-button will be added (NULL if the
radio-button should create its own group)
+ * @return Returns the new radio-button widget
*/
Etk_Widget *etk_radio_button_new(Evas_List **group)
{
@@ -56,9 +56,9 @@
}
/**
- * @brief Creates a new radio button. It will use the group of another radio
button
- * @param radio_button the radio button whose group will be used by the new
radio button
- * @return Returns the new radio button widget
+ * @brief Creates a new radio-button. It will use the group of another
radio-button
+ * @param radio_button the radio-button whose group will be used by the new
radio-button
+ * @return Returns the new radio-button widget
*/
Etk_Widget *etk_radio_button_new_from_widget(Etk_Radio_Button *radio_button)
{
@@ -67,10 +67,10 @@
}
/**
- * @brief Creates a new radio button with a label
+ * @brief Creates a new radio-button with a label
* @param label the label
- * @param group the group to which the radio button will be added (NULL if the
radio button should create its own group)
- * @return Returns the new radio button widget
+ * @param group the group to which the radio-button will be added (NULL if the
radio-button should create its own group)
+ * @return Returns the new radio-button widget
*/
Etk_Widget *etk_radio_button_new_with_label(const char *label, Evas_List
**group)
{
@@ -79,10 +79,10 @@
}
/**
- * @brief Creates a new radio button with a label. It will use the group of
another radio button
+ * @brief Creates a new radio-button with a label. It will use the group of
another radio-button
* @param label the label
- * @param radio_button the radio button whose group will be used by the new
radio button
- * @return Returns the new radio button widget
+ * @param radio_button the radio-button whose group will be used by the new
radio-button
+ * @return Returns the new radio-button widget
*/
Etk_Widget *etk_radio_button_new_with_label_from_widget(const char *label,
Etk_Radio_Button *radio_button)
{
@@ -91,8 +91,8 @@
}
/**
- * @brief Sets the group of the radio button
- * @param radio_button a radio button
+ * @brief Sets the group of the radio-button
+ * @param radio_button a radio-button
* @param group the group to use
*/
void etk_radio_button_group_set(Etk_Radio_Button *radio_button, Evas_List
**group)
@@ -131,9 +131,9 @@
}
/**
- * @brief Gets the group of the radio button
- * @param radio_button a radio button
- * @return Returns the group used by the radio button
+ * @brief Gets the group of the radio-button
+ * @param radio_button a radio-button
+ * @return Returns the group used by the radio-button
*/
Evas_List **etk_radio_button_group_get(Etk_Radio_Button *radio_button)
{
@@ -148,7 +148,7 @@
*
**************************/
-/* Initializes the radio button */
+/* Initializes the radio-button */
static void _etk_radio_button_constructor(Etk_Radio_Button *radio_button)
{
if (!radio_button)
@@ -159,7 +159,7 @@
ETK_TOGGLE_BUTTON(radio_button)->active_set = _etk_radio_button_active_set;
}
-/* Destroys the radio button */
+/* Destroys the radio-button */
static void _etk_radio_button_destructor(Etk_Radio_Button *radio_button)
{
if (!radio_button || !radio_button->group)
@@ -215,7 +215,8 @@
*
**************************/
-/* Deactivates all the other radio buttons of the group when a radio button is
activated */
+/* This function is called when the radio-button is turned on: it deactivates
all
+ * the other radio-buttons of the group, and activate the given radio-button */
static void _etk_radio_button_active_set(Etk_Toggle_Button *toggle_button,
Etk_Bool active)
{
Etk_Radio_Button *radio_button;
@@ -233,7 +234,7 @@
if (toggle_button->active)
{
- /* Uncheck the previously checked button of the group */
+ /* Deactivate the current active button of the group */
for (l = *radio_button->group; l; l = l->next)
{
tb = ETK_TOGGLE_BUTTON(l->data);
@@ -260,17 +261,17 @@
* @addtogroup Etk_Radio_Button
*
* @image html widgets/radio_button.png
- * When a radio button is activated, the other radio buttons of the same group
are deactivated. This way, in a group,
- * only one radio button can be active. @n
- * Radio buttons are used when the user has to make a choice between several
options. @n
+ * When a radio-button is activated, the other radio-buttons of the same group
are deactivated. This way, in a group,
+ * only one radio-button can be active. @n
+ * Radio-buttons are used when the user has to make a choice between several
options. @n
*
- * To create several radio buttons belonging to the same group, you can first
call etk_radio_button_new_with_label() to
- * create the first radio button, and then use
etk_radio_button_new_with_label_from_widget() to create the other radio
+ * To create several radio-buttons belonging to the same group, you can first
call etk_radio_button_new_with_label() to
+ * create the first radio-button, and then use
etk_radio_button_new_with_label_from_widget() to create the other radio
* buttons of the group. For example:
* @code
* Etk_Widget *radio_buttons[3];
*
- * //Creates 3 radio buttons belonging to the same group
+ * //Creates 3 radio-buttons belonging to the same group
* radio_buttons[0] = etk_radio_button_new_with_label("Option 1");
* radio_buttons[1] = etk_radio_button_new_with_label_from_widget("Option 2",
ETK_RADIO_BUTTON(radio_buttons[0]));
* radio_buttons[2] = etk_radio_button_new_with_label_from_widget("Option 3",
ETK_RADIO_BUTTON(radio_buttons[0]));
@@ -283,11 +284,10 @@
* - Etk_Bin
* - Etk_Button
* - Etk_Toggle_Button
- * - Etk_Check_Button
- * - Etk_Radio_Button
+ * - Etk_Radio_Button
*
* \par Properties:
- * @prop_name "group": The group of the radio button
+ * @prop_name "group": The group of the radio-button
* @prop_type Pointer (Evas_List **)
* @prop_rw
* @prop_val NULL
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_radio_button.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- etk_radio_button.h 2 Jun 2006 18:46:34 -0000 1.4
+++ etk_radio_button.h 1 Apr 2007 19:09:31 -0000 1.5
@@ -3,12 +3,12 @@
#define _ETK_RADIO_BUTTON_H_
#include <Evas.h>
-#include "etk_check_button.h"
+#include "etk_toggle_button.h"
#include "etk_types.h"
/**
* @defgroup Etk_Radio_Button Etk_Radio_Button
- * @brief The Etk_Radio_Button widget is a toggle button that belongs to a
group in which only one button can be active
+ * @brief The Etk_Radio_Button widget is a toggle-button that belongs to a
group in which only one button can be active
* @{
*/
@@ -19,27 +19,29 @@
/** Checks if the object is an Etk_Radio_Button */
#define ETK_IS_RADIO_BUTTON(obj) (ETK_OBJECT_RADIO_TYPE((obj),
ETK_RADIO_BUTTON_TYPE))
+
/**
- * @brief @widget The structure of a radio button
+ * @brief @widget A toggle-button that belongs to a group in which only one
button can be active
* @structinfo
*/
struct Etk_Radio_Button
{
/* private: */
- /* Inherit from Etk_Check_Button */
- Etk_Check_Button check_button;
+ /* Inherit from Etk_Toggle_Button */
+ Etk_Toggle_Button toggle_button;
Evas_List **group;
Etk_Bool can_uncheck;
};
-Etk_Type *etk_radio_button_type_get();
-Etk_Widget *etk_radio_button_new(Evas_List **group);
-Etk_Widget *etk_radio_button_new_from_widget(Etk_Radio_Button *radio_button);
-Etk_Widget *etk_radio_button_new_with_label(const char *label, Evas_List
**group);
-Etk_Widget *etk_radio_button_new_with_label_from_widget(const char *label,
Etk_Radio_Button *radio_button);
-void etk_radio_button_group_set(Etk_Radio_Button *radio_button, Evas_List
**group);
+Etk_Type *etk_radio_button_type_get(void);
+Etk_Widget *etk_radio_button_new(Evas_List **group);
+Etk_Widget *etk_radio_button_new_from_widget(Etk_Radio_Button *radio_button);
+Etk_Widget *etk_radio_button_new_with_label(const char *label, Evas_List
**group);
+Etk_Widget *etk_radio_button_new_with_label_from_widget(const char *label,
Etk_Radio_Button *radio_button);
+
+void etk_radio_button_group_set(Etk_Radio_Button *radio_button,
Evas_List **group);
Evas_List **etk_radio_button_group_get(Etk_Radio_Button *radio_button);
/** @} */
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_toggle_button.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- etk_toggle_button.c 22 Mar 2007 19:36:52 -0000 1.17
+++ etk_toggle_button.c 1 Apr 2007 19:09:31 -0000 1.18
@@ -24,6 +24,7 @@
static void _etk_toggle_button_property_set(Etk_Object *object, int
property_id, Etk_Property_Value *value);
static void _etk_toggle_button_property_get(Etk_Object *object, int
property_id, Etk_Property_Value *value);
static void _etk_toggle_button_realized_cb(Etk_Object *object, void *data);
+static void _etk_toggle_button_label_realized_cb(Etk_Object *object, void
*data);
static void _etk_toggle_button_toggled_handler(Etk_Toggle_Button
*toggle_button);
static void _etk_toggle_button_active_set_default(Etk_Toggle_Button
*toggle_button, Etk_Bool active);
@@ -40,20 +41,20 @@
* @brief Gets the type of an Etk_Toggle_Button
* @return Returns the type of an Etk_Toggle_Button
*/
-Etk_Type *etk_toggle_button_type_get()
+Etk_Type *etk_toggle_button_type_get(void)
{
static Etk_Type *toggle_button_type = NULL;
if (!toggle_button_type)
{
toggle_button_type = etk_type_new("Etk_Toggle_Button", ETK_BUTTON_TYPE,
sizeof(Etk_Toggle_Button),
- ETK_CONSTRUCTOR(_etk_toggle_button_constructor), NULL);
+ ETK_CONSTRUCTOR(_etk_toggle_button_constructor), NULL);
_etk_toggle_button_signals[ETK_TOGGLE_BUTTON_TOGGLED_SIGNAL] =
etk_signal_new("toggled",
- toggle_button_type, ETK_MEMBER_OFFSET(Etk_Toggle_Button,
toggled_handler), etk_marshaller_VOID__VOID, NULL, NULL);
+ toggle_button_type, ETK_MEMBER_OFFSET(Etk_Toggle_Button,
toggled_handler), etk_marshaller_VOID__VOID, NULL, NULL);
etk_type_property_add(toggle_button_type, "active",
ETK_TOGGLE_BUTTON_ACTIVE_PROPERTY,
- ETK_PROPERTY_BOOL, ETK_PROPERTY_READABLE_WRITABLE,
etk_property_value_bool(ETK_FALSE));
+ ETK_PROPERTY_BOOL, ETK_PROPERTY_READABLE_WRITABLE,
etk_property_value_bool(ETK_FALSE));
toggle_button_type->property_set = _etk_toggle_button_property_set;
toggle_button_type->property_get = _etk_toggle_button_property_get;
@@ -66,9 +67,9 @@
* @brief Creates a new toggle button
* @return Returns the new toggle-button widget
*/
-Etk_Widget *etk_toggle_button_new()
+Etk_Widget *etk_toggle_button_new(void)
{
- return etk_widget_new(ETK_TOGGLE_BUTTON_TYPE, "theme-group",
"toggle_button", "focusable", ETK_TRUE, NULL);
+ return etk_widget_new(ETK_TOGGLE_BUTTON_TYPE, "theme-group",
"toggle_button","focusable", ETK_TRUE, NULL);
}
/**
@@ -79,7 +80,7 @@
Etk_Widget *etk_toggle_button_new_with_label(const char *label)
{
return etk_widget_new(ETK_TOGGLE_BUTTON_TYPE, "theme-group",
"toggle_button",
- "label", label, "focusable", ETK_TRUE, NULL);
+ "label", label, "focusable", ETK_TRUE, NULL);
}
/**
@@ -133,10 +134,11 @@
toggle_button->active_set = _etk_toggle_button_active_set_default;
etk_signal_connect("realized", ETK_OBJECT(toggle_button),
- ETK_CALLBACK(_etk_toggle_button_realized_cb), NULL);
- /* If the button is clicked, we toggle it */
+ ETK_CALLBACK(_etk_toggle_button_realized_cb), NULL);
+ etk_signal_connect("realized", ETK_OBJECT(ETK_BUTTON(toggle_button)->label),
+ ETK_CALLBACK(_etk_toggle_button_label_realized_cb), toggle_button);
etk_signal_connect_swapped("clicked", ETK_OBJECT(toggle_button),
- ETK_CALLBACK(etk_toggle_button_toggle), toggle_button);
+ ETK_CALLBACK(etk_toggle_button_toggle), toggle_button);
}
/* Sets the property whose id is "property_id" to the value "value" */
@@ -181,15 +183,30 @@
*
**************************/
-/* Called when the toggle button is realized */
+/* Called when the toggle-button is realized */
static void _etk_toggle_button_realized_cb(Etk_Object *object, void *data)
{
Etk_Toggle_Button *toggle_button;
if (!(toggle_button = ETK_TOGGLE_BUTTON(object)))
return;
+
etk_widget_theme_signal_emit(ETK_WIDGET(toggle_button),
- toggle_button->active ? "etk,state,on" : "etk,state,off", ETK_FALSE);
+ toggle_button->active ? "etk,state,on" : "etk,state,off", ETK_FALSE);
+ etk_widget_theme_signal_emit(ETK_BUTTON(toggle_button)->label,
+ toggle_button->active ? "etk,state,on" : "etk,state,off", ETK_FALSE);
+}
+
+/* Called when the toggle-button's label is realized */
+static void _etk_toggle_button_label_realized_cb(Etk_Object *object, void
*data)
+{
+ Etk_Toggle_Button *toggle_button;
+
+ if (!(toggle_button = ETK_TOGGLE_BUTTON(data)))
+ return;
+
+ etk_widget_theme_signal_emit(ETK_BUTTON(toggle_button)->label,
+ toggle_button->active ? "etk,state,on" : "etk,state,off", ETK_FALSE);
}
/* Default handler for the "toggled" signal */
@@ -197,8 +214,11 @@
{
if (!toggle_button)
return;
+
etk_widget_theme_signal_emit(ETK_WIDGET(toggle_button),
- toggle_button->active ? "etk,state,on" : "etk,state,off", ETK_FALSE);
+ toggle_button->active ? "etk,state,on" : "etk,state,off", ETK_FALSE);
+ etk_widget_theme_signal_emit(ETK_BUTTON(toggle_button)->label,
+ toggle_button->active ? "etk,state,on" : "etk,state,off", ETK_FALSE);
}
/**************************
@@ -207,7 +227,7 @@
*
**************************/
-/* Default behavior for the "active_set" function */
+/* This function is called when the toggle-button is turned on: here it just
activates it */
static void _etk_toggle_button_active_set_default(Etk_Toggle_Button
*toggle_button, Etk_Bool active)
{
if (!toggle_button || toggle_button->active == active)
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_toggle_button.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- etk_toggle_button.h 22 Mar 2007 19:36:52 -0000 1.5
+++ etk_toggle_button.h 1 Apr 2007 19:09:31 -0000 1.6
@@ -19,6 +19,7 @@
/** @brief Checks if the object is an Etk_Toggle_Button */
#define ETK_IS_TOGGLE_BUTTON(obj) (ETK_OBJECT_CHECK_TYPE((obj),
ETK_TOGGLE_BUTTON_TYPE))
+
/**
* @brief @widget A button that can be activated/deactivated
* @structinfo
@@ -34,13 +35,14 @@
Etk_Bool active;
};
-Etk_Type *etk_toggle_button_type_get();
-Etk_Widget *etk_toggle_button_new();
+
+Etk_Type *etk_toggle_button_type_get(void);
+Etk_Widget *etk_toggle_button_new(void);
Etk_Widget *etk_toggle_button_new_with_label(const char *label);
-void etk_toggle_button_toggle(Etk_Toggle_Button *toggle_button);
-void etk_toggle_button_active_set(Etk_Toggle_Button *toggle_button,
Etk_Bool active);
-Etk_Bool etk_toggle_button_active_get(Etk_Toggle_Button *toggle_button);
+void etk_toggle_button_toggle(Etk_Toggle_Button *toggle_button);
+void etk_toggle_button_active_set(Etk_Toggle_Button *toggle_button,
Etk_Bool active);
+Etk_Bool etk_toggle_button_active_get(Etk_Toggle_Button *toggle_button);
/** @} */
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_widget.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -3 -r1.111 -r1.112
--- etk_widget.c 25 Mar 2007 19:49:23 -0000 1.111
+++ etk_widget.c 1 Apr 2007 19:09:31 -0000 1.112
@@ -1335,22 +1335,12 @@
*/
void etk_widget_theme_signal_emit(Etk_Widget *widget, const char *signal_name,
Etk_Bool size_recalc)
{
- Etk_Widget *tc;
- Evas_List *l;
-
if (!widget)
return;
if (widget->theme_object)
edje_object_signal_emit(widget->theme_object, signal_name, "etk");
- for (l = widget->theme_children; l; l = l->next)
- {
- tc = ETK_WIDGET(l->data);
- if (tc->emit_theme_parent_signals)
- etk_widget_theme_signal_emit(tc, signal_name, size_recalc);
- }
-
if (size_recalc)
{
widget->need_theme_size_recalc = ETK_TRUE;
@@ -1977,7 +1967,6 @@
widget->need_redraw = ETK_FALSE;
widget->need_theme_size_recalc = ETK_FALSE;
widget->swallowed = ETK_FALSE;
- widget->emit_theme_parent_signals = ETK_FALSE;
etk_signal_connect("destroyed", ETK_OBJECT(widget),
ETK_CALLBACK(_etk_widget_destroyed_cb), NULL);
etk_signal_connect_swapped("mouse-in", ETK_OBJECT(widget),
etk_widget_enter, widget);
@@ -2467,9 +2456,10 @@
widget->inset.bottom = 0;
}
- if (widget->disabled || (widget->emit_theme_parent_signals
- && widget->theme_parent && widget->theme_parent->disabled))
+ if (widget->disabled)
etk_widget_theme_signal_emit(widget, "etk,state,disabled", ETK_FALSE);
+ if (etk_widget_is_focused(widget))
+ etk_widget_theme_signal_emit(widget, "etk,state,focused", ETK_FALSE);
}
else
{
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_widget.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- etk_widget.h 25 Mar 2007 18:22:01 -0000 1.51
+++ etk_widget.h 1 Apr 2007 19:09:31 -0000 1.52
@@ -106,7 +106,6 @@
unsigned int need_size_recalc : 1;
unsigned int need_redraw : 1;
unsigned int need_theme_size_recalc : 1;
- unsigned int emit_theme_parent_signals : 1;
};
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs