Enlightenment CVS committal
Author : moom
Project : e17
Module : libs/etk
Dir : e17/libs/etk/src/bin
Modified Files:
etk_combobox_test.c etk_embed_test.c etk_slider_test.c
Removed Files:
etk_spin_button_test.c
Log Message:
* [Embed] Change API of etk_embed_new()
Add functions: etk_embed_pointer_method_set()
etk_embed_position_method_set()
Fix position of popup-windows in an embed widget
Doc++
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/bin/etk_combobox_test.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- etk_combobox_test.c 9 Mar 2007 00:49:27 -0000 1.10
+++ etk_combobox_test.c 10 Mar 2007 18:19:21 -0000 1.11
@@ -6,6 +6,13 @@
static void _active_item_changed_cb(Etk_Object *object, void *data);
+
+/**************************
+ *
+ * Creation of the test-app window
+ *
+ **************************/
+
/* Creates the window for the combobox test */
void etk_test_combobox_window_create(void *data)
{
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/bin/etk_embed_test.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- etk_embed_test.c 29 Dec 2006 22:10:12 -0000 1.9
+++ etk_embed_test.c 10 Mar 2007 18:19:21 -0000 1.10
@@ -2,17 +2,19 @@
#include <math.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
+#include <Ecore_X.h>
+#include <Ecore_X_Cursor.h>
#include <Evas.h>
#include "config.h"
-/* Test program *highly* inspired from the evas test program */
+/* Test program *highly* inspired from the Evas test program */
-#define ETK_TEST_PI (3.141592654)
-
-static Etk_Widget *_etk_test_embed_widget_new(Evas *evas);
-static void _etk_test_embed_update();
-static void _etk_test_embed_resize_cb(Ecore_Evas *ecore_evas);
-static int _etk_test_embed_animator_cb(void *data);
+static void _embed_resize_cb(Ecore_Evas *ecore_evas);
+static int _embed_animator_cb(void *data);
+static Etk_Widget *_embed_widget_new(Evas *evas);
+static void _embed_update(void);
+static void _embed_position_set(void *position_data, int *x, int *y);
+static void _embed_pointer_set(void *pointer_data, Etk_Pointer_Type
pointer_type);
static Ecore_Evas *ecore_evas = NULL;
static Evas_Object *e_logo, *backdrop;
@@ -23,6 +25,13 @@
static int win_w = 240, win_h = 320;
static unsigned int starting_time;
+
+/**************************
+ *
+ * Creation of the test-app window
+ *
+ **************************/
+
/* Creates the window for the embed widget test */
void etk_test_embed_window_create(void *data)
{
@@ -33,18 +42,18 @@
if (ecore_evas)
{
starting_time = etk_current_time_get();
- _etk_test_embed_update();
+ _embed_update();
ecore_evas_show(ecore_evas);
return;
}
ecore_evas = ecore_evas_software_x11_new(NULL, 0, 0, 0, 32, 32);
ecore_evas_title_set(ecore_evas, "Etk Embed Test");
- ecore_evas_callback_resize_set(ecore_evas, _etk_test_embed_resize_cb);
+ ecore_evas_callback_resize_set(ecore_evas, _embed_resize_cb);
ecore_evas_callback_delete_request_set(ecore_evas, ecore_evas_hide);
evas = ecore_evas_get(ecore_evas);
- /* Creates the evas objects */
+ /* Create the Evas objects */
backdrop = evas_object_image_add(evas);
evas_object_image_file_set(backdrop, PACKAGE_DATA_DIR
"/images/backdrop.png", NULL);
evas_object_show(backdrop);
@@ -70,8 +79,10 @@
panel_clip = evas_object_rectangle_add(evas);
evas_object_show(panel_clip);
- /* Creates the embed widget */
- embed = _etk_test_embed_widget_new(evas);
+ /* Create the embed widget */
+ embed = _embed_widget_new(evas);
+ etk_embed_position_method_set(ETK_EMBED(embed), _embed_position_set,
ecore_evas);
+ etk_embed_pointer_method_set(ETK_EMBED(embed), _embed_pointer_set,
ecore_evas);
embed_object = etk_embed_object_get(ETK_EMBED(embed));
evas_object_clip_set(embed_object, panel_clip);
@@ -79,31 +90,66 @@
ecore_evas_resize(ecore_evas, min_size.w + 50, min_size.h + 120);
ecore_evas_size_min_set(ecore_evas, min_size.w + 50, min_size.h + 120);
- /* Updates the position of the objects */
+ /* Update the position of the objects */
starting_time = etk_current_time_get();
- _etk_test_embed_update();
- ecore_animator_add(_etk_test_embed_animator_cb, NULL);
+ _embed_update();
+ ecore_animator_add(_embed_animator_cb, NULL);
ecore_evas_show(ecore_evas);
}
+/**************************
+ *
+ * Callbacks
+ *
+ **************************/
+
+/* Called when the window is resized */
+static void _embed_resize_cb(Ecore_Evas *ecore_evas)
+{
+ if (!ecore_evas)
+ return;
+
+ ecore_evas_geometry_get(ecore_evas, NULL, NULL, &win_w, &win_h);
+ _embed_update();
+}
+
+/* Animates the objects */
+static int _embed_animator_cb(void *data)
+{
+ _embed_update();
+ return 1;
+}
+
+/**************************
+ *
+ * Private functions
+ *
+ **************************/
+
/* Creates the new embed widget */
-static Etk_Widget *_etk_test_embed_widget_new(Evas *evas)
+static Etk_Widget *_embed_widget_new(Evas *evas)
{
Etk_Widget *embed;
Etk_Widget *table;
Etk_Widget *image;
- Etk_Widget *buttons[3];
+ Etk_Widget *combobox;
+ Etk_Widget *buttons[2];
Etk_Widget *labels[8];
Etk_Widget *entries[6];
int i;
-
+ /* Create the children of the embed widget:
+ * Here we create the same table as in the "Table" test-app */
image = etk_image_new_from_file(PACKAGE_DATA_DIR "/images/test.png", NULL);
- buttons[0] = etk_button_new_from_stock(ETK_STOCK_DOCUMENT_OPEN);
+ combobox = etk_combobox_new_default();
+ etk_combobox_item_append(ETK_COMBOBOX(combobox), "Emphasis");
+ etk_combobox_item_append(ETK_COMBOBOX(combobox), "Exhibit");
+ etk_combobox_item_append(ETK_COMBOBOX(combobox), "Entropy");
+
+ buttons[0] = etk_check_button_new();
buttons[1] = etk_check_button_new();
- buttons[2] = etk_check_button_new();
labels[0] = etk_label_new("App Name");
labels[1] = etk_label_new("Generic Info");
@@ -116,11 +162,10 @@
for (i = 0; i < 6; i++)
entries[i] = etk_entry_new();
-
table = etk_table_new(2, 10, ETK_FALSE);
etk_table_attach(ETK_TABLE(table), image, 0, 0, 0, 0, 0, 0, ETK_TABLE_NONE);
- etk_table_attach(ETK_TABLE(table), buttons[0], 1, 1, 0, 0, 0, 0,
ETK_TABLE_HEXPAND);
+ etk_table_attach(ETK_TABLE(table), combobox, 1, 1, 0, 0, 0, 0,
ETK_TABLE_HEXPAND);
for (i = 0; i < 6; i++)
{
@@ -129,34 +174,36 @@
}
etk_table_attach(ETK_TABLE(table), labels[6], 0, 0, 8, 8, 0, 0,
ETK_TABLE_HFILL);
- etk_table_attach_default(ETK_TABLE(table), buttons[1], 1, 1, 8, 8);
+ etk_table_attach_default(ETK_TABLE(table), buttons[0], 1, 1, 8, 8);
etk_table_attach(ETK_TABLE(table), labels[7], 0, 0, 9, 9, 0, 0,
ETK_TABLE_HFILL);
- etk_table_attach_default(ETK_TABLE(table), buttons[2], 1, 1, 9, 9);
+ etk_table_attach_default(ETK_TABLE(table), buttons[1], 1, 1, 9, 9);
- embed = etk_embed_new(evas, NULL, NULL);
+ /* Create the embed widget and pack the table into it */
+ embed = etk_embed_new(evas);
etk_container_add(ETK_CONTAINER(embed), table);
etk_widget_show_all(embed);
return embed;
}
-/* Updates the geometry of the objects */
-static void _etk_test_embed_update()
+/* Updates the geometry of the different Evas objects */
+static void _embed_update(void)
{
double t;
int alpha;
Etk_Size embed_size;
int y;
+ /* Calculate the current progress */
t = ETK_MAX(0.0, etk_current_time_get() - starting_time) / 1000.0;
if (t <= 2.0)
- y = win_h - (0.75 * sin((t / 2.0) * (ETK_TEST_PI / 2)) * win_h);
+ y = win_h - (0.75 * sin((t / 2.0) * (M_PI / 2)) * win_h);
else
y = 0.25 * win_h;
alpha = ETK_CLAMP((t - 1.0) / 2.0, 0.0, 1.0) * 255;
-
+ /* Update the different object according to the progress */
evas_object_move(backdrop, 0, 0);
evas_object_resize(backdrop, win_w, y);
evas_object_image_fill_set(backdrop, 0, 0, win_w, 320);
@@ -185,19 +232,39 @@
evas_object_resize(embed_object, embed_size.w, embed_size.h);
}
-/* Called when the window is resized */
-static void _etk_test_embed_resize_cb(Ecore_Evas *ecore_evas)
+/* Gets the position of the Evas where the embed object belongs, relative to
the screen */
+static void _embed_position_set(void *position_data, int *x, int *y)
{
- if (!ecore_evas)
- return;
-
- ecore_evas_geometry_get(ecore_evas, NULL, NULL, &win_w, &win_h);
- _etk_test_embed_update();
+ ecore_evas_geometry_get(position_data, x, y, NULL, NULL);
}
-/* Animates the objects */
-static int _etk_test_embed_animator_cb(void *data)
+/* Sets the pointer of the embed widget */
+static void _embed_pointer_set(void *pointer_data, Etk_Pointer_Type
pointer_type)
{
- _etk_test_embed_update();
- return 1;
+ Ecore_Evas *ee;
+ Ecore_X_Window window;
+ Ecore_X_Cursor cursor;
+ int x_pointer_type;
+
+ if (!(ee = pointer_data) || (window =
ecore_evas_software_x11_window_get(ee)) == 0)
+ return;
+
+ /* We only need to support the "text_edit" and the default cursors here
+ * since we only have entries in the embed widget */
+ switch (pointer_type)
+ {
+ case ETK_POINTER_TEXT_EDIT:
+ x_pointer_type = ECORE_X_CURSOR_XTERM;
+ break;
+ default:
+ x_pointer_type = ECORE_X_CURSOR_LEFT_PTR;
+ break;
+ }
+
+ if (pointer_type == ETK_POINTER_NONE)
+ ecore_x_window_cursor_set(window, 0);
+ else if ((cursor = ecore_x_cursor_shape_get(x_pointer_type)))
+ ecore_x_window_cursor_set(window, cursor);
+ else
+ ETK_WARNING("Unable to find the X cursor \"%d\"", pointer_type);
}
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/bin/etk_slider_test.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- etk_slider_test.c 22 Feb 2007 05:18:34 -0000 1.12
+++ etk_slider_test.c 10 Mar 2007 18:19:21 -0000 1.13
@@ -10,6 +10,13 @@
static Etk_Widget *_hslider = NULL;
static Etk_Widget *_vslider = NULL;
+
+/**************************
+ *
+ * Creation of the test-app window
+ *
+ **************************/
+
/* Creates the window for the slider test */
void etk_test_slider_window_create(void *data)
{
-------------------------------------------------------------------------
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