Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_calendar.c ewl_calendar.h ewl_colordialog.c ewl_colorpicker.c ewl_datepicker.c ewl_entry.c ewl_iconbox.c ewl_label.c ewl_menu_base.c ewl_row.c ewl_spectrum.c ewl_text.c Log Message: - reformat and rearrange ewl_calendar - cleanup compile warnings =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_calendar.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- ewl_calendar.c 17 Oct 2005 15:23:27 -0000 1.10 +++ ewl_calendar.c 23 Oct 2005 16:05:37 -0000 1.11 @@ -3,154 +3,182 @@ #include "ewl_macros.h" #include "ewl_private.h" -char *months[] = { "January","February","March","April","May","June","July","August","September","October","November","December" }; +static void ewl_calendar_grid_setup(Ewl_Calendar *cal); +static int ewl_calendar_leap_year_detect(unsigned int year); +static void ewl_calendar_highlight_today(struct tm *now, Ewl_Label *day, + Ewl_Calendar *cal); +static void ewl_calendar_day_select(Ewl_Widget *w, void *ev_data, + void *user_data); +static void ewl_calendar_day_pick(Ewl_Widget *w, void *ev_data, + void *user_data); +static void ewl_calendar_prev_month_cb(Ewl_Widget *w, void *ev_data, + void *user_data); +static void ewl_calendar_next_month_cb(Ewl_Widget *w, void *ev_data, + void *user_data); +static void ewl_calendar_add_day_labels(Ewl_Calendar *ib); + + +static char *months[] = {"January", "February", "March", "April", "May", + "June", "July", "August", "September", "October", + "November", "December"}; -int mdays[] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; +static int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; -static int ewl_calendar_leap_year_detect(unsigned int year) +/** + * @return Returns NULL on failure, a new Ewl_Calendar on success + * @brief Creates a new Ewl_Calendar + * + * Creates a new Ewl_Calendar object + */ +Ewl_Widget * +ewl_calendar_new(void) { - assert(year > 1581); - return(((year % 4 == 0) && (year % 100)) || (year % 400 == 0)); -} + Ewl_Calendar* ib; + DENTER_FUNCTION (DLEVEL_STABLE); -void ewl_calendar_highlight_today(struct tm* now, Ewl_Label* day, Ewl_Calendar* cal) { - /*Get the day*/ - int i = atoi(ewl_label_text_get(EWL_LABEL(day))); - if (i == now->tm_mday && now->tm_year+1900 == cal->cur_year && now->tm_mon == cal->cur_month) { - ewl_widget_color_set(EWL_WIDGET(day), 0,0,255,255); - /*printf("Doing..\n"); */ - } else { - /* printf("%d %d %d ---- %d %d %d\n", now->tm_mday, now->tm_mon, now->tm_year+1900, i, cal->cur_month, cal->cur_year);*/ + ib = NEW(Ewl_Calendar, 1); + if (!ib) { + DRETURN_PTR(NULL, DLEVEL_STABLE); } -} - -void ewl_calendar_day_select (Ewl_Widget *w, void *ev_data, void *user_data) { - struct tm* now; - time_t now_tm; - int i; - Ewl_Widget* it; + if (!ewl_calendar_init(ib)) { + ewl_widget_destroy(EWL_WIDGET(ib)); + ib = NULL; + } - - now_tm = time(NULL); - now = localtime(&now_tm); - i = atoi(ewl_label_text_get(EWL_LABEL(w))); + DRETURN_PTR(EWL_WIDGET(ib), DLEVEL_STABLE); +} - ewl_container_child_iterate_begin(EWL_CONTAINER(EWL_CALENDAR(user_data)->grid)); - - while ( (it = ewl_container_child_next(EWL_CONTAINER(EWL_CALENDAR(user_data)->grid))) != NULL ) { - ewl_widget_color_set(EWL_WIDGET(it), 255,255,255,255); - ewl_calendar_highlight_today(now, EWL_LABEL(it), EWL_CALENDAR(user_data)); - } +/** + * @param ib: The calendar widget to initialize + * @return Returns FALSE on failure, a TRUE on success + * @brief Init a new Ewl_Calendar to default values and callbacks, and set date to today + */ +int +ewl_calendar_init(Ewl_Calendar* ib) +{ + Ewl_Widget *w, *vbox, *top_hbox, *prev_button, *next_button; + struct tm *ptr; + time_t tm; - - ewl_widget_color_set(w, 255,0,0,255); - EWL_CALENDAR(user_data)->cur_day = i; + w = EWL_WIDGET(ib); -} + if (!ewl_box_init(EWL_BOX(ib))) + DRETURN_INT(FALSE, DLEVEL_STABLE); -void ewl_calendar_day_pick (Ewl_Widget *w, void *ev_data, void *user_data) { - Ewl_Event_Mouse_Down *ev = ev_data; - if (ev->clicks == 2) - ewl_callback_call(EWL_WIDGET(user_data), - EWL_CALLBACK_VALUE_CHANGED); -} + ewl_box_orientation_set(EWL_BOX(ib), EWL_ORIENTATION_HORIZONTAL); -void ewl_calendar_prev_month_cb (Ewl_Widget *w, void *ev_data, void *user_data) { - Ewl_Calendar* ib = EWL_CALENDAR(user_data); + /* Init ewl setup */ + ewl_widget_appearance_set(EWL_WIDGET(ib), "calendar"); + ewl_widget_inherit(EWL_WIDGET(w), "calendar"); + ewl_object_fill_policy_set(EWL_OBJECT(ib), EWL_FLAG_FILL_FILL); - /*printf ("Go to prev month\n"); */ - ib->cur_month -= 1; - if (ib->cur_month < 0) { ib->cur_month = 11; ib->cur_year--; } - ewl_calendar_grid_setup(ib); -} + vbox = ewl_vbox_new(); + ewl_container_child_append(EWL_CONTAINER(ib), vbox); + ewl_object_minimum_w_set(EWL_OBJECT(vbox), 150); + ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_VSHRINK); + ewl_widget_show(vbox); -void ewl_calendar_next_month_cb (Ewl_Widget *w, void *ev_data, void *user_data) { - Ewl_Calendar* ib = EWL_CALENDAR(user_data); + top_hbox = ewl_hbox_new(); + ewl_container_child_append(EWL_CONTAINER(vbox), top_hbox); + ewl_widget_show(top_hbox); - /*printf ("Go to next month\n");*/ - ib->cur_month += 1; - if (ib->cur_month > 11) { ib->cur_month = 0; ib->cur_year++; } - ewl_calendar_grid_setup(ib); -} + prev_button = ewl_button_new(); + ewl_container_child_append(EWL_CONTAINER(top_hbox), prev_button); + ewl_button_label_set(EWL_BUTTON(prev_button), "<"); + ewl_object_maximum_size_set(EWL_OBJECT(prev_button), 20,10); + ewl_callback_append(prev_button, EWL_CALLBACK_MOUSE_DOWN, ewl_calendar_prev_month_cb, ib); + ewl_widget_show(prev_button); -void ewl_calendar_add_day_labels(Ewl_Calendar* ib) { - Ewl_Widget* day_label; - - /* Add the days*/ - day_label = ewl_label_new(); - ewl_label_text_set(EWL_LABEL(day_label), "M"); - ewl_grid_add(EWL_GRID(ib->grid), day_label, 1, 1, 1, 1); - ewl_widget_show(day_label); + ib->month_label = ewl_label_new(); + ewl_container_child_append(EWL_CONTAINER(top_hbox), ib->month_label); + ewl_label_text_set(EWL_LABEL(ib->month_label), "Disp"); + ewl_object_maximum_h_set(EWL_OBJECT(ib->month_label), 10); + ewl_widget_show(ib->month_label); - day_label = ewl_label_new(); - ewl_label_text_set(EWL_LABEL(day_label), "T"); - ewl_grid_add(EWL_GRID(ib->grid), day_label, 2, 2, 1, 1); - ewl_widget_show(day_label); + next_button = ewl_button_new(); + ewl_container_child_append(EWL_CONTAINER(top_hbox), next_button); + ewl_button_label_set(EWL_BUTTON(next_button), ">"); + ewl_object_maximum_size_set(EWL_OBJECT(next_button), 20,10); + ewl_callback_append(next_button, EWL_CALLBACK_MOUSE_DOWN, ewl_calendar_next_month_cb, ib); + ewl_widget_show(next_button); - day_label = ewl_label_new(); - ewl_label_text_set(EWL_LABEL(day_label), "W"); - ewl_grid_add(EWL_GRID(ib->grid), day_label, 3, 3, 1, 1); - ewl_widget_show(day_label); + ib->grid = ewl_grid_new(7, 7); + ewl_container_child_append(EWL_CONTAINER(vbox), ib->grid); + ewl_object_fill_policy_set(EWL_OBJECT(ib->grid), EWL_FLAG_FILL_FILL); + ewl_object_minimum_h_set(EWL_OBJECT(ib->grid), 100); + ewl_widget_show(ib->grid); - day_label = ewl_label_new(); - ewl_label_text_set(EWL_LABEL(day_label), "T"); - ewl_grid_add(EWL_GRID(ib->grid), day_label, 4, 4, 1, 1); - ewl_widget_show(day_label); + /* Get the start time.. */ + tm = time(NULL); + ptr = localtime(&tm); - day_label = ewl_label_new(); - ewl_label_text_set(EWL_LABEL(day_label), "F"); - ewl_grid_add(EWL_GRID(ib->grid), day_label, 5, 5, 1, 1); - ewl_widget_show(day_label); + ib->cur_month = ptr->tm_mon; + ib->cur_day = ptr->tm_mday; + ib->cur_year = ptr->tm_year + 1900; - day_label = ewl_label_new(); - ewl_label_text_set(EWL_LABEL(day_label), "S"); - ewl_grid_add(EWL_GRID(ib->grid), day_label, 6, 6, 1, 1); - ewl_widget_show(day_label); + ewl_calendar_grid_setup(ib); - day_label = ewl_label_new(); - ewl_label_text_set(EWL_LABEL(day_label), "S"); - ewl_grid_add(EWL_GRID(ib->grid), day_label, 7, 7, 1, 1); - ewl_widget_show(day_label); + DRETURN_INT(TRUE, DLEVEL_STABLE); } /** * @param cal: The calendar to get the date frm - * @param str: a pre-initialized char* pointer to insert the date into + * @param str: a pre-initialized char * pointer to insert the date into * @return none * @brief Returns an ASCII formatted representation of the selected date * * Inserts an ASCII formatted string of the currently selected date into the char* str pointer */ -void ewl_calendar_ascii_time_get(Ewl_Calendar* cal, char* str) { +void +ewl_calendar_ascii_time_get(Ewl_Calendar *cal, char *str) +{ time_t tm; struct tm* month_start; - + tm = time(NULL); month_start = localtime(&tm); month_start->tm_mday = cal->cur_day; month_start->tm_mon = cal->cur_month; - month_start->tm_year = cal->cur_year-1900; + month_start->tm_year = cal->cur_year - 1900; mktime(month_start); - strcpy(str,asctime(month_start)); - + strcpy(str, asctime(month_start)); } -int ewl_calendar_day_get(Ewl_Calendar* c) { +/** + * @param c: The Ewl_Calendar to get the day from + * @return Returns the day currently selected in the calendar + */ +int +ewl_calendar_day_get(Ewl_Calendar *c) +{ return c->cur_day; } -int ewl_calendar_month_get(Ewl_Calendar* c) { +/** + * @param c: The Ewl_Calendar to get the month from + * @return Returns the month currently selected in the calendar + */ +int +ewl_calendar_month_get(Ewl_Calendar *c) +{ return c->cur_month; } -int ewl_calendar_year_get(Ewl_Calendar* c) { +/** + * @param c: The Ewl_Calendar to get the year from + * @return Returns the current year selected in the calendar + */ +int +ewl_calendar_year_get(Ewl_Calendar *c) +{ return c->cur_year; } - -void ewl_calendar_grid_setup(Ewl_Calendar* cal) { +static void +ewl_calendar_grid_setup(Ewl_Calendar *cal) +{ struct tm* month_start; struct tm* now; char display_top[50]; @@ -163,53 +191,44 @@ ewl_grid_reset(EWL_GRID(cal->grid), 7, 7); ewl_calendar_add_day_labels(cal); - /*Get the start time..*/ - /*tm = time(NULL); - ptr = localtime(&tm); - printf("%d\n", ptr->tm_mon);*/ - - /*Make the initial display..*/ + /* Make the initial display.. */ sprintf(display_top, "%s %d", months[cal->cur_month], cal->cur_year); ewl_label_text_set(EWL_LABEL(cal->month_label), display_top); today = cal->cur_day; - - /*Get the DOW of the first day of this month */ + /* Get the DOW of the first day of this month */ tm = time(NULL); month_start = localtime(&tm); month_start->tm_mday = 0; month_start->tm_mon = cal->cur_month; month_start->tm_year = cal->cur_year-1900; mktime(month_start); - /*printf ("First day of this month (%d), year (%d), DOW is %d\n", cal->cur_month, cal->cur_year-1900, month_start->tm_wday);*/ /* Now add the days to this month */ cur_row = 2; cur_col = month_start->tm_wday + 1; - /*printf("Col: %d\n", cur_col);*/ if (cur_col > 7) { cur_row=2; cur_col=1; } - + cur_day = 0; now_tm = time(NULL); now = localtime(&now_tm); days = mdays[cal->cur_month]; - /*If february, do leap years...*/ + /* If february, do leap years... */ if (cal->cur_month == 1) { if (ewl_calendar_leap_year_detect(cal->cur_year)) { days = 29; } else { days = 28; } - } - + while (cur_day < days) { char day[3]; - + if (cur_col > 7) { cur_row++; cur_col = 1; @@ -223,137 +242,129 @@ ewl_grid_add(EWL_GRID(cal->grid), day_label, cur_col, cur_col, cur_row, cur_row); ewl_calendar_highlight_today(now, EWL_LABEL(day_label), cal); - /*printf("Day: %d:%d, Year: %d:%d, Month: %d:%d\n",now->tm_mday,cur_day, now->tm_year+1900,cal->cur_year, now->tm_mon, cal->cur_month);*/ ewl_widget_show(day_label); cur_col++; cur_day++; - } +} +static int +ewl_calendar_leap_year_detect(unsigned int year) +{ + assert(year > 1581); + return(((year % 4 == 0) && (year % 100)) || (year % 400 == 0)); } +static void +ewl_calendar_highlight_today(struct tm *now, Ewl_Label *day, + Ewl_Calendar *cal) +{ + /* Get the day */ + int i = atoi(ewl_label_text_get(EWL_LABEL(day))); + if ((i == now->tm_mday) && ((now->tm_year + 1900) == cal->cur_year) + && (now->tm_mon == cal->cur_month)) { + ewl_widget_color_set(EWL_WIDGET(day), 0, 0, 255, 255); + } +} -/** - * @return Returns NULL on failure, a new Ewl_Calendar on success - * @brief Creates a new Ewl_Calendar - * - * Creates a new Ewl_Calendar object - */ -Ewl_Widget *ewl_calendar_new() { - Ewl_Calendar* ib; - DENTER_FUNCTION (DLEVEL_STABLE); +static void +ewl_calendar_day_select(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data) +{ + struct tm* now; + time_t now_tm; + int i; + Ewl_Widget* it; - ib = NEW(Ewl_Calendar, 1); - if (!ib) { - DRETURN_PTR(NULL, DLEVEL_STABLE); - } + now_tm = time(NULL); + now = localtime(&now_tm); + i = atoi(ewl_label_text_get(EWL_LABEL(w))); - if (!ewl_calendar_init(ib)) { - DWARNING("Failed calendar init...\n"); - FREE(ib); - ib = NULL; + ewl_container_child_iterate_begin(EWL_CONTAINER(EWL_CALENDAR(user_data)->grid)); + while ((it = ewl_container_child_next(EWL_CONTAINER(EWL_CALENDAR(user_data)->grid))) != NULL) { + ewl_widget_color_set(EWL_WIDGET(it), 255, 255, 255, 255); + ewl_calendar_highlight_today(now, EWL_LABEL(it), EWL_CALENDAR(user_data)); } - DRETURN_PTR(EWL_WIDGET(ib), DLEVEL_STABLE); + ewl_widget_color_set(w, 255, 0, 0, 255); + EWL_CALENDAR(user_data)->cur_day = i; } -/** - * @param ib: The calendar widget to initialize - * @return Returns NULL on failure, a new Ewl_IconBox on success - * @brief Init a new Ewl_Calendar to default values and callbacks, and set date to today - */ -int ewl_calendar_init(Ewl_Calendar* ib) { - Ewl_Widget *w; - Ewl_Widget *vbox; - Ewl_Widget *top_hbox; - Ewl_Widget *prev_button; - Ewl_Widget *next_button; - - - struct tm *ptr; - - time_t tm; - - - /*printf("Configuring the calendar..\n");*/ - - - - w = EWL_WIDGET(ib); - - if (!ewl_box_init(EWL_BOX(ib))) - DRETURN_INT(FALSE, DLEVEL_STABLE); - - ewl_box_orientation_set(EWL_BOX(ib), EWL_ORIENTATION_HORIZONTAL); +static void +ewl_calendar_day_pick(Ewl_Widget *w __UNUSED__, void *ev_data, + void *user_data) +{ + Ewl_Event_Mouse_Down *ev = ev_data; + if (ev->clicks == 2) + ewl_callback_call(EWL_WIDGET(user_data), + EWL_CALLBACK_VALUE_CHANGED); +} - /* Init ewl setup */ - ewl_widget_appearance_set(EWL_WIDGET(ib), "calendar"); - ewl_widget_inherit(EWL_WIDGET(w), "calendar"); +static void +ewl_calendar_prev_month_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, + void *user_data) +{ + Ewl_Calendar* ib = EWL_CALENDAR(user_data); - - ib->grid = ewl_grid_new(7,7); - ib->month_label = ewl_label_new(); - ewl_label_text_set(EWL_LABEL(ib->month_label), "Disp"); + ib->cur_month -= 1; + if (ib->cur_month < 0) { + ib->cur_month = 11; + ib->cur_year--; + } + ewl_calendar_grid_setup(ib); +} - /*printf("Getting date..");*/ - /*Get the start time..*/ - tm = time(NULL); - ptr = localtime(&tm); - /*printf("%d\n", ptr->tm_mon);*/ - ib->cur_month = ptr->tm_mon; - ib->cur_day = ptr->tm_mday; - ib->cur_year = ptr->tm_year + 1900; - /*printf("..done\n");*/ +static void +ewl_calendar_next_month_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, + void *user_data) +{ + Ewl_Calendar* ib = EWL_CALENDAR(user_data); + ib->cur_month += 1; + if (ib->cur_month > 11) { ib->cur_month = 0; ib->cur_year++; } ewl_calendar_grid_setup(ib); +} +static void +ewl_calendar_add_day_labels(Ewl_Calendar *ib) +{ + Ewl_Widget* day_label; - prev_button = ewl_button_new(); - ewl_button_label_set(EWL_BUTTON(prev_button), "<"); - next_button = ewl_button_new(); - ewl_button_label_set(EWL_BUTTON(next_button), ">"); - top_hbox = ewl_hbox_new(); - vbox = ewl_vbox_new(); - - /*printf("Showing widgets..\n"); */ - ewl_widget_show(vbox); - ewl_widget_show(top_hbox); - ewl_widget_show(ib->grid); - /*printf("Showing widgets..\n");*/ - ewl_widget_show(ib->month_label); - ewl_widget_show(next_button); - ewl_widget_show(prev_button); - /*printf("Showing widgets..\n");*/ - ewl_container_child_append(EWL_CONTAINER(vbox), top_hbox); - ewl_container_child_append(EWL_CONTAINER(top_hbox), prev_button); - /*printf("Showing widgets..\n");*/ - ewl_container_child_append(EWL_CONTAINER(top_hbox), ib->month_label); - ewl_container_child_append(EWL_CONTAINER(top_hbox), next_button); - /*printf("..done\n");*/ + /* Add the days*/ + day_label = ewl_label_new(); + ewl_label_text_set(EWL_LABEL(day_label), "M"); + ewl_grid_add(EWL_GRID(ib->grid), day_label, 1, 1, 1, 1); + ewl_widget_show(day_label); - ewl_container_child_append(EWL_CONTAINER(vbox), ib->grid); - ewl_object_maximum_size_set(EWL_OBJECT(prev_button), 20,10); - ewl_object_maximum_size_set(EWL_OBJECT(next_button), 20,10); - ewl_object_maximum_h_set(EWL_OBJECT(ib->month_label), 10); - ewl_object_minimum_w_set(EWL_OBJECT(vbox), 150); - ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_VSHRINK); - ewl_object_fill_policy_set(EWL_OBJECT(ib->grid), EWL_FLAG_FILL_FILL); - ewl_object_fill_policy_set(EWL_OBJECT(ib), EWL_FLAG_FILL_FILL); - ewl_object_minimum_h_set(EWL_OBJECT(ib->grid), 100); + day_label = ewl_label_new(); + ewl_label_text_set(EWL_LABEL(day_label), "T"); + ewl_grid_add(EWL_GRID(ib->grid), day_label, 2, 2, 1, 1); + ewl_widget_show(day_label); + day_label = ewl_label_new(); + ewl_label_text_set(EWL_LABEL(day_label), "W"); + ewl_grid_add(EWL_GRID(ib->grid), day_label, 3, 3, 1, 1); + ewl_widget_show(day_label); - - ewl_container_child_append(EWL_CONTAINER(ib), vbox); + day_label = ewl_label_new(); + ewl_label_text_set(EWL_LABEL(day_label), "T"); + ewl_grid_add(EWL_GRID(ib->grid), day_label, 4, 4, 1, 1); + ewl_widget_show(day_label); - - //Add the prev/next callbacks - ewl_callback_append(prev_button, EWL_CALLBACK_MOUSE_DOWN, ewl_calendar_prev_month_cb, ib); - ewl_callback_append(next_button, EWL_CALLBACK_MOUSE_DOWN, ewl_calendar_next_month_cb, ib); + day_label = ewl_label_new(); + ewl_label_text_set(EWL_LABEL(day_label), "F"); + ewl_grid_add(EWL_GRID(ib->grid), day_label, 5, 5, 1, 1); + ewl_widget_show(day_label); - /*printf("Setup the calendar...\n");*/ - DRETURN_INT(TRUE, DLEVEL_STABLE); + day_label = ewl_label_new(); + ewl_label_text_set(EWL_LABEL(day_label), "S"); + ewl_grid_add(EWL_GRID(ib->grid), day_label, 6, 6, 1, 1); + ewl_widget_show(day_label); + day_label = ewl_label_new(); + ewl_label_text_set(EWL_LABEL(day_label), "S"); + ewl_grid_add(EWL_GRID(ib->grid), day_label, 7, 7, 1, 1); + ewl_widget_show(day_label); } - =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_calendar.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ewl_calendar.h 9 Oct 2005 05:18:39 -0000 1.4 +++ ewl_calendar.h 23 Oct 2005 16:05:37 -0000 1.5 @@ -1,8 +1,6 @@ #ifndef __EWL_CALENDAR_H__ #define __EWL_CALENDAR_H__ - - /** * @file ewl_calendar.h * @defgroup Ewl_Calendar Calendar: The EWL Calendar Widget @@ -16,7 +14,6 @@ * @themekey /calendar/group */ - typedef struct Ewl_Calendar Ewl_Calendar; /** @@ -27,29 +24,26 @@ /** * @struct Ewl_Calendar - * Inherits from an Ewl_Container to provide layout facilities for child widgets placed inside + * Inherits from an Ewl_Box to provide a calendar widget * Layout is either free-form, or auto-arranged to a grid. */ struct Ewl_Calendar { - Ewl_Box box; /**< Inherit from Ewl_Container */ + Ewl_Box box; /**< Inherit from Ewl_Box */ int cur_day; int cur_month; int cur_year; - Ewl_Widget* grid; - Ewl_Widget* month_label; - + Ewl_Widget *grid; + Ewl_Widget *month_label; }; - Ewl_Widget *ewl_calendar_new(void); -int ewl_calendar_init(Ewl_Calendar* calendar); -void ewl_calendar_grid_setup(Ewl_Calendar* cal); -void ewl_calendar_ascii_time_get(Ewl_Calendar* cal, char* str); -int ewl_calendar_day_get(Ewl_Calendar*); -int ewl_calendar_month_get(Ewl_Calendar*); -int ewl_calendar_year_get(Ewl_Calendar*); - +int ewl_calendar_init(Ewl_Calendar *calendar); +void ewl_calendar_ascii_time_get(Ewl_Calendar *cal, char *str); +int ewl_calendar_day_get(Ewl_Calendar *c); +int ewl_calendar_month_get(Ewl_Calendar *c); +int ewl_calendar_year_get(Ewl_Calendar *c); #endif + =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_colordialog.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- ewl_colordialog.c 10 Oct 2005 15:27:10 -0000 1.14 +++ ewl_colordialog.c 23 Oct 2005 16:05:37 -0000 1.15 @@ -389,7 +389,9 @@ } void -ewl_colordialog_color_valuechanged_cb(Ewl_Widget *w, void *ev_data, void *user_data) +ewl_colordialog_color_valuechanged_cb(Ewl_Widget *w __UNUSED__, + void *ev_data __UNUSED__, + void *user_data) { Ewl_ColorDialog *cd; Ewl_Color_Set *col; @@ -431,7 +433,8 @@ } void -ewl_colordialog_button_cb(Ewl_Widget *w, void *ev_data, void *user_data) +ewl_colordialog_button_cb(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data) { Ewl_ColorDialog *cd; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_colorpicker.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ewl_colorpicker.c 3 Oct 2005 06:43:06 -0000 1.9 +++ ewl_colorpicker.c 23 Oct 2005 16:05:37 -0000 1.10 @@ -88,7 +88,7 @@ } void -ewl_colorpicker_range_change_cb(Ewl_Widget *w, void *ev, void *data) +ewl_colorpicker_range_change_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data) { Ewl_ColorPicker *cp; Ewl_Spectrum *sp; @@ -109,7 +109,7 @@ } void -ewl_colorpicker_spectrum_change_cb(Ewl_Widget *w, void *ev, void *data) +ewl_colorpicker_spectrum_change_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data) { Ewl_ColorPicker *cp; Ewl_Spectrum *sp; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_datepicker.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ewl_datepicker.c 3 Oct 2005 06:43:06 -0000 1.4 +++ ewl_datepicker.c 23 Oct 2005 16:05:37 -0000 1.5 @@ -39,14 +39,16 @@ } void -ewl_datepicker_destroy_cb (Ewl_Widget *w, void *ev_data, void *user_data) { +ewl_datepicker_destroy_cb (Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data __UNUSED__) { Ewl_DatePicker* dp = EWL_DATEPICKER(w); ewl_widget_destroy(dp->calendar_window); ewl_widget_destroy(dp->calendar); } void -ewl_datepicker_dropdown(Ewl_Widget *w, void *ev_data, void *user_data) { +ewl_datepicker_dropdown(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data __UNUSED__) { Ewl_DatePicker *dp = EWL_DATEPICKER(w); /*printf("Drop down..\n");*/ @@ -61,12 +63,14 @@ } void -ewl_datepicker_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data) { +ewl_datepicker_configure_cb(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data __UNUSED__) { ewl_datepicker_calendar_position_set(EWL_DATEPICKER(w)); } void -ewl_datepicker_value_changed_cb(Ewl_Widget *w, void *ev_data, void *user_data) { +ewl_datepicker_value_changed_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, + void *user_data) { static char date[1024]; Ewl_DatePicker* dp = EWL_DATEPICKER(user_data); ewl_widget_hide(dp->calendar_window); @@ -75,7 +79,8 @@ ewl_text_text_set(EWL_TEXT(dp), date); } -void ewl_datepicker_realize_cb(Ewl_Widget *w, void *ev_data, void *user_data) { +void ewl_datepicker_realize_cb(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data __UNUSED__) { ewl_datepicker_calendar_position_set(EWL_DATEPICKER(w)); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_entry.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- ewl_entry.c 18 Oct 2005 05:11:07 -0000 1.28 +++ ewl_entry.c 23 Oct 2005 16:05:37 -0000 1.29 @@ -196,7 +196,8 @@ * internal stuff */ void -ewl_entry_cb_configure(Ewl_Widget *w, void *ev, void *data) +ewl_entry_cb_configure(Ewl_Widget *w, void *ev __UNUSED__, + void *data __UNUSED__) { Ewl_Entry *e; unsigned int c_pos; @@ -224,7 +225,8 @@ } void -ewl_entry_cb_selected(Ewl_Widget *w, void *ev, void *data) +ewl_entry_cb_selected(Ewl_Widget *w, void *ev __UNUSED__, + void *data __UNUSED__) { Ewl_Entry *entry = EWL_ENTRY(w); @@ -233,7 +235,8 @@ } void -ewl_entry_cb_deselected(Ewl_Widget *w, void *ev, void *data) +ewl_entry_cb_deselected(Ewl_Widget *w, void *ev __UNUSED__, + void *data __UNUSED__) { Ewl_Entry *entry = EWL_ENTRY(w); @@ -242,7 +245,8 @@ } void -ewl_entry_cb_key_down(Ewl_Widget *w, void *ev, void *data) +ewl_entry_cb_key_down(Ewl_Widget *w, void *ev __UNUSED__, + void *data __UNUSED__) { Ewl_Event_Key_Down *event; Ewl_Entry *e; @@ -313,7 +317,7 @@ } void -ewl_entry_cb_mouse_down(Ewl_Widget *w, void *ev, void *data) +ewl_entry_cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__) { Ewl_Event_Mouse_Down *event; Ewl_Entry *e; @@ -338,7 +342,8 @@ } void -ewl_entry_cb_mouse_up(Ewl_Widget *w, void *ev, void *data) +ewl_entry_cb_mouse_up(Ewl_Widget *w, void *ev __UNUSED__, + void *data __UNUSED__) { Ewl_Entry *e; @@ -356,7 +361,8 @@ } void -ewl_entry_cb_mouse_move(Ewl_Widget *w, void *ev, void *data) +ewl_entry_cb_mouse_move(Ewl_Widget *w, void *ev __UNUSED__, + void *data __UNUSED__) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("w", w); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_iconbox.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -3 -r1.46 -r1.47 --- ewl_iconbox.c 23 Oct 2005 10:27:41 -0000 1.46 +++ ewl_iconbox.c 23 Oct 2005 16:05:37 -0000 1.47 @@ -431,7 +431,7 @@ } -void ewl_iconbox_label_edit_key_down(Ewl_Widget *w, void *ev_data, void* user_data) +void ewl_iconbox_label_edit_key_down(Ewl_Widget *w __UNUSED__, void *ev_data, void* user_data) { Ewl_Event_Key_Down* ev = ev_data; Ewl_IconBox* ib = EWL_ICONBOX(user_data); @@ -778,7 +778,7 @@ /*Callbacks*/ -void ewl_iconbox_destroy_cb(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_destroy_cb(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { Ewl_IconBox* ib = EWL_ICONBOX(w); @@ -805,20 +805,20 @@ } /* ----------- */ -void ewl_iconbox_arrange_cb(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_arrange_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, void *user_data) { Ewl_IconBox* ib = EWL_ICONBOX(user_data); ewl_iconbox_icon_arrange(ib); } -void ewl_iconbox_expansion_cb(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_expansion_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, void *user_data) { Ewl_IconBox* ib = EWL_ICONBOX(user_data); ewl_object_custom_size_set(EWL_OBJECT(ib->ewl_iconbox_pane_inner), 680,700); } -void ewl_iconbox_mouse_move_cb(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_mouse_move_cb(Ewl_Widget *w __UNUSED__, void *ev_data, void *user_data) { Ewl_IconBox* ib = EWL_ICONBOX(user_data); Ewl_Event_Mouse_Move *ev = ev_data; @@ -926,7 +926,7 @@ } -void ewl_iconbox_pane_mouse_down_cb(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_pane_mouse_down_cb(Ewl_Widget *w __UNUSED__, void *ev_data, void *user_data) { Ewl_IconBox* ib = EWL_ICONBOX(user_data); @@ -973,7 +973,7 @@ -void ewl_iconbox_icon_mouse_down(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_icon_mouse_down(Ewl_Widget *w __UNUSED__, void *ev_data, void *user_data) { Ewl_IconBox_Icon* ib = user_data; @@ -1015,7 +1015,7 @@ /*ewl_callback_call_with_event_data(EWL_WIDGET(ib), EWL_CALLBACK_MOUSE_DOWN, ev_data);*/ } -void ewl_iconbox_icon_mouse_up(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_icon_mouse_up(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, void *user_data) { /*Ewl_Event_Mouse_Down *ev = ev_data;*/ @@ -1025,7 +1025,7 @@ /*printf ("Button up on icon: %s\n", ewl_border_text_get(EWL_BORDER(ib)) );*/ } -void ewl_iconbox_mouse_up(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_mouse_up(Ewl_Widget *w __UNUSED__, void *ev_data, void *user_data) { Ewl_Event_Mouse_Up *ev = ev_data; Ewl_IconBox* ib = user_data; @@ -1038,7 +1038,7 @@ } } -void ewl_iconbox_icon_label_mouse_down_cb(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_icon_label_mouse_down_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, void *user_data) { Ewl_IconBox_Icon* ib = user_data; @@ -1053,7 +1053,7 @@ * @return Returns no value * @brief Initialize the icon box */ -void ewl_iconbox_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data) +void ewl_iconbox_configure_cb(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { /*printf ("Got a configure\n");*/ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_label.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ewl_label.c 17 Oct 2005 15:29:35 -0000 1.12 +++ ewl_label.c 23 Oct 2005 16:05:37 -0000 1.13 @@ -90,7 +90,7 @@ } void -ewl_label_realize_cb(Ewl_Widget *w, void *ev, void *data) +ewl_label_realize_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("w", w); @@ -101,7 +101,7 @@ } void -ewl_label_destroy_cb(Ewl_Widget *w, void *ev, void *data) +ewl_label_destroy_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) { Ewl_Label *label; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menu_base.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ewl_menu_base.c 23 Oct 2005 07:18:00 -0000 1.9 +++ ewl_menu_base.c 23 Oct 2005 16:05:37 -0000 1.10 @@ -440,7 +440,8 @@ } void -ewl_menu_base_popbox_key_down_cb(Ewl_Widget *w, void *ev_data, void *user_data) +ewl_menu_base_popbox_key_down_cb(Ewl_Widget *w __UNUSED__, void *ev_data, + void *user_data __UNUSED__) { Ewl_Event_Key_Down *ev = ev_data; DENTER_FUNCTION(DLEVEL_STABLE); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_row.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- ewl_row.c 3 Oct 2005 06:43:07 -0000 1.8 +++ ewl_row.c 23 Oct 2005 16:05:37 -0000 1.9 @@ -243,7 +243,7 @@ } void -ewl_row_header_configure_cb(Ewl_Widget * w, void *ev_data __UNUSED__, +ewl_row_header_configure_cb(Ewl_Widget * w __UNUSED__, void *ev_data __UNUSED__, void *user_data) { Ewl_Row *row; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_spectrum.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- ewl_spectrum.c 3 Oct 2005 06:43:07 -0000 1.11 +++ ewl_spectrum.c 23 Oct 2005 16:05:37 -0000 1.12 @@ -518,7 +518,8 @@ } void -ewl_spectrum_mouse_move_cb(Ewl_Widget *w, void *ev_data, void *user_data) +ewl_spectrum_mouse_move_cb(Ewl_Widget *w, void *ev_data, + void *user_data __UNUSED__) { Ewl_Spectrum *sp; Ewl_Event_Mouse_Move *ev; @@ -548,7 +549,8 @@ } void -ewl_spectrum_mouse_down_cb(Ewl_Widget *w, void *ev_data, void *user_data) +ewl_spectrum_mouse_down_cb(Ewl_Widget *w, void *ev_data, + void *user_data __UNUSED__) { Ewl_Spectrum *sp; Ewl_Event_Mouse_Down *ev; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_text.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -3 -r1.31 -r1.32 --- ewl_text.c 21 Oct 2005 21:51:11 -0000 1.31 +++ ewl_text.c 23 Oct 2005 16:05:37 -0000 1.32 @@ -1990,12 +1990,12 @@ } static void -ewl_text_trigger_cb_free(void *value, void *data) +ewl_text_trigger_cb_free(void *value, void *data __UNUSED__) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("data", data); - ewl_text_trigger_free(data); + ewl_text_trigger_free(value); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -2449,7 +2449,8 @@ } void -ewl_text_cb_configure(Ewl_Widget *w, void *ev, void *data) +ewl_text_cb_configure(Ewl_Widget *w, void *ev __UNUSED__, + void *data __UNUSED__) { Ewl_Text *t; int xx, yy, ww, hh; @@ -2484,7 +2485,7 @@ } void -ewl_text_cb_realize(Ewl_Widget *w, void *ev, void *data) +ewl_text_cb_realize(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) { Ewl_Text *t; Ewl_Embed *emb; @@ -2535,7 +2536,8 @@ } void -ewl_text_cb_unrealize(Ewl_Widget *w, void *ev, void *data) +ewl_text_cb_unrealize(Ewl_Widget *w, void *ev __UNUSED__, + void *data __UNUSED__) { Ewl_Text *t; @@ -2555,7 +2557,7 @@ } void -ewl_text_cb_show(Ewl_Widget *w, void *ev, void *data) +ewl_text_cb_show(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) { Ewl_Text *t; @@ -2569,7 +2571,7 @@ } void -ewl_text_cb_hide(Ewl_Widget *w, void *ev, void *data) +ewl_text_cb_hide(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) { Ewl_Text *t; @@ -2583,7 +2585,7 @@ } void -ewl_text_cb_destroy(Ewl_Widget *w, void *ev, void *data) +ewl_text_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) { Ewl_Text *t; @@ -2612,7 +2614,7 @@ } void -ewl_text_cb_mouse_down(Ewl_Widget *w, void *ev, void *data) +ewl_text_cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__) { Ewl_Text *t; Ewl_Event_Mouse_Down *event; @@ -2647,7 +2649,7 @@ } void -ewl_text_cb_mouse_up(Ewl_Widget *w, void *ev, void *data) +ewl_text_cb_mouse_up(Ewl_Widget *w, void *ev, void *data __UNUSED__) { Ewl_Text *t; Ewl_Event_Mouse_Up *event; @@ -2676,7 +2678,7 @@ } void -ewl_text_cb_mouse_move(Ewl_Widget *w, void *ev, void *data) +ewl_text_cb_mouse_move(Ewl_Widget *w, void *ev, void *data __UNUSED__) { Ewl_Text *t; Ewl_Event_Mouse_Move *event; @@ -2700,7 +2702,7 @@ } void -ewl_text_trigger_cb_focus_in(Ewl_Widget *w, void *ev, void *data) +ewl_text_trigger_cb_focus_in(Ewl_Widget *w __UNUSED__, void *ev, void *data) { Ewl_Text_Trigger *trigger; @@ -2714,7 +2716,7 @@ } void -ewl_text_trigger_cb_focus_out(Ewl_Widget *w, void *ev, void *data) +ewl_text_trigger_cb_focus_out(Ewl_Widget *w __UNUSED__, void *ev, void *data) { Ewl_Text_Trigger *trigger; @@ -2728,7 +2730,7 @@ } void -ewl_text_trigger_cb_mouse_up(Ewl_Widget *w, void *ev, void *data) +ewl_text_trigger_cb_mouse_up(Ewl_Widget *w __UNUSED__, void *ev, void *data) { Ewl_Text_Trigger *trigger; @@ -2742,7 +2744,7 @@ } void -ewl_text_trigger_cb_mouse_down(Ewl_Widget *w, void *ev, void *data) +ewl_text_trigger_cb_mouse_down(Ewl_Widget *w __UNUSED__, void *ev, void *data) { Ewl_Text_Trigger *trigger; @@ -4262,7 +4264,8 @@ } void -ewl_text_selection_cb_configure(Ewl_Widget *w, void *ev, void *data) +ewl_text_selection_cb_configure(Ewl_Widget *w, void *ev __UNUSED__, + void *data __UNUSED__) { Ewl_Text_Trigger *trig; @@ -4432,6 +4435,7 @@ ewl_text_textblock2_cursor_position(Ewl_Text *t, unsigned int idx) { Evas_Textblock_Cursor *cursor; + int cur_idx; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET("t", t, NULL); @@ -4439,7 +4443,8 @@ cursor = evas_object_textblock2_cursor_new(t->textblock); evas_textblock2_cursor_node_first(cursor); - while (idx >= 0) + cur_idx = idx; + while (cur_idx >= 0) { int len = 0; const char *txt; @@ -4449,9 +4454,9 @@ if (!txt) { len = evas_textblock2_cursor_node_text_length_get(cursor); - if (len > idx) + if (len > cur_idx) { - evas_textblock2_cursor_pos_set(cursor, idx); + evas_textblock2_cursor_pos_set(cursor, cur_idx); break; } } @@ -4464,7 +4469,7 @@ evas_textblock2_cursor_char_last(cursor); break; } - idx -= len; + cur_idx -= len; } DRETURN_PTR(cursor, DLEVEL_STABLE); ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs