Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_calendar.c ewl_datepicker.c ewl_datepicker.h 


Log Message:
- datepicker: use ewl_poup
- calendar: some minor improvemnts

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_calendar.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ewl_calendar.c      6 Sep 2006 15:16:11 -0000       1.20
+++ ewl_calendar.c      16 Nov 2006 19:13:46 -0000      1.21
@@ -77,8 +77,6 @@
 
        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);
 
        top_hbox = ewl_hbox_new();
@@ -87,27 +85,32 @@
 
        prev_button = ewl_button_new();
        ewl_container_child_append(EWL_CONTAINER(top_hbox), prev_button);
+       ewl_object_fill_policy_set(EWL_OBJECT(prev_button), EWL_FLAG_FILL_NONE);
+       ewl_object_alignment_set(EWL_OBJECT(prev_button), EWL_FLAG_ALIGN_LEFT);
        ewl_button_image_set(EWL_BUTTON(prev_button), 
                                
ewl_icon_theme_icon_path_get(EWL_ICON_GO_PREVIOUS, 
                                                                
EWL_ICON_SIZE_SMALL), 
                                EWL_ICON_GO_PREVIOUS);
-       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);
 
        ib->month_label = ewl_label_new();
+       ewl_object_fill_policy_set(EWL_OBJECT(ib->month_label), 
+                                               EWL_FLAG_FILL_FILL);
+       ewl_object_alignment_set(EWL_OBJECT(ib->month_label), 
+                                               EWL_FLAG_ALIGN_CENTER);
        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);
 
        next_button = ewl_button_new();
+       ewl_object_fill_policy_set(EWL_OBJECT(next_button), EWL_FLAG_FILL_NONE);
+       ewl_object_alignment_set(EWL_OBJECT(next_button), EWL_FLAG_ALIGN_RIGHT);
        ewl_container_child_append(EWL_CONTAINER(top_hbox), next_button);       
        ewl_button_image_set(EWL_BUTTON(next_button), 
                                ewl_icon_theme_icon_path_get(EWL_ICON_GO_NEXT, 
                                                        EWL_ICON_SIZE_SMALL), 
                                EWL_ICON_GO_NEXT);
-       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);
@@ -116,7 +119,6 @@
        ewl_grid_dimensions_set(EWL_GRID(ib->grid), 7, 7);
        ewl_container_child_append(EWL_CONTAINER(vbox), EWL_WIDGET(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);
 
        /* Get the start time.. */
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_datepicker.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ewl_datepicker.c    2 Oct 2006 05:19:24 -0000       1.15
+++ ewl_datepicker.c    16 Nov 2006 19:13:46 -0000      1.16
@@ -3,7 +3,6 @@
 #include "ewl_debug.h"
 #include "ewl_macros.h"
 
-static void ewl_datepicker_calendar_position_set(Ewl_Datepicker *dp);
 static void ewl_datepicker_cb_dropdown(Ewl_Widget *w, void *ev_data, 
                                                        void *user_data); 
 
@@ -45,20 +44,27 @@
        if (!ewl_text_init(EWL_TEXT(dp)))
                DRETURN_INT(FALSE, DLEVEL_STABLE);
 
-       ewl_text_text_set(EWL_TEXT(dp), "Date Test");
-
-       /* Init ewl setup */
        ewl_widget_appearance_set(EWL_WIDGET(dp), EWL_DATEPICKER_TYPE);
        ewl_widget_inherit(EWL_WIDGET(dp), EWL_DATEPICKER_TYPE);
+       ewl_object_fill_policy_set(EWL_OBJECT(dp), EWL_FLAG_FILL_HFILL |
+                                                       EWL_FLAG_FILL_NONE);
 
-       dp->calendar_window = ewl_window_new();
-       ewl_object_custom_size_set(EWL_OBJECT(dp->calendar_window), 159, 170);
+       dp->calendar_window = ewl_popup_new();
+       ewl_widget_appearance_set(dp->calendar_window, EWL_DATEPICKER_TYPE"/"
+                                                       EWL_POPUP_TYPE);
        ewl_object_fill_policy_set(EWL_OBJECT(dp->calendar_window), 
-                                               EWL_FLAG_FILL_FILL);
-       ewl_widget_layer_top_set(dp->calendar_window, TRUE);
-       ewl_window_borderless_set(EWL_WINDOW(dp->calendar_window));
+                                               EWL_FLAG_FILL_NONE);
+       ewl_popup_type_set(EWL_POPUP(dp->calendar_window), 
+                                       EWL_POPUP_TYPE_MENU_VERTICAL);
+       ewl_popup_follow_set(EWL_POPUP(dp->calendar_window), EWL_WIDGET(dp));
+       ewl_window_keyboard_grab_set(EWL_WINDOW(dp->calendar_window), TRUE);
+       ewl_window_pointer_grab_set(EWL_WINDOW(dp->calendar_window), TRUE);
+       ewl_callback_append(dp->calendar_window, EWL_CALLBACK_MOUSE_DOWN,
+                               ewl_datepicker_cb_window_mouse_down, dp);
 
        dp->calendar = ewl_calendar_new();
+       ewl_object_fill_policy_set(EWL_OBJECT(dp->calendar), 
+                                                       EWL_FLAG_FILL_NONE);
        ewl_container_child_append(EWL_CONTAINER(dp->calendar_window), 
                                                        dp->calendar);
        ewl_callback_append(EWL_WIDGET(dp->calendar), 
@@ -66,12 +72,8 @@
                                ewl_datepicker_cb_value_changed, dp);
        ewl_widget_show(dp->calendar);
 
-       ewl_datepicker_calendar_position_set(dp);
-
        ewl_callback_prepend(EWL_WIDGET(dp), EWL_CALLBACK_DESTROY, 
                                ewl_datepicker_cb_destroy, dp);
-       ewl_callback_append(EWL_WIDGET(dp), EWL_CALLBACK_CONFIGURE,
-                                   ewl_datepicker_cb_configure, NULL);
        ewl_callback_append(EWL_WIDGET(dp), EWL_CALLBACK_MOUSE_DOWN, 
                                ewl_datepicker_cb_dropdown, NULL);
        
@@ -100,28 +102,6 @@
 
        dp = EWL_DATEPICKER(w);
        ewl_widget_destroy(dp->calendar_window);
-       ewl_widget_destroy(dp->calendar);
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @param ev: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief The configure callback
- */
-void
-ewl_datepicker_cb_configure(Ewl_Widget *w, void *ev __UNUSED__, 
-                                       void *user_data __UNUSED__) 
-{
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR("w", w);
-       DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
-
-       ewl_datepicker_calendar_position_set(EWL_DATEPICKER(w));
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -156,44 +136,22 @@
 
 /**
  * @internal
- * @param w: The widget to work with
+ * @param w: the calendar window
  * @param ev: UNUSED
- * @param user_data: UNUSED
+ * @param user_data: The datepicker
  * @return Returns no value
- * @brief Realize callback
+ * @brief Callback to hide the calendar window
  */
 void
-ewl_datepicker_cb_realize(Ewl_Widget *w, void *ev __UNUSED__, 
-                                               void *user_data __UNUSED__) 
+ewl_datepicker_cb_window_mouse_down(Ewl_Widget *w, void *ev __UNUSED__,
+                                                       void *user_data) 
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
 
-       ewl_datepicker_calendar_position_set(EWL_DATEPICKER(w));
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-static void
-ewl_datepicker_calendar_position_set(Ewl_Datepicker *dp) 
-{
-       int x, y;
-       int sx, sy;
-       Ewl_Embed *emb;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR("dp", dp);
-       DCHECK_TYPE("dp", dp, EWL_DATEPICKER_TYPE);
-
-       /* Get the position of the parent */
-       emb = ewl_embed_widget_find(EWL_WIDGET(dp));
-       if (emb) {
-               ewl_embed_window_position_get(EWL_EMBED(emb), &x, &y);
-               ewl_object_current_size_get(EWL_OBJECT(dp), &sx, &sy);
-               ewl_window_move(EWL_WINDOW(dp->calendar_window), x + (sx / 4), 
-                                                               y + sy + 3);
-       }
+       if (w == ewl_embed_focused_widget_get(EWL_EMBED(w)))
+               ewl_widget_hide(w);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -211,7 +169,6 @@
        dp = EWL_DATEPICKER(w);
        ewl_widget_show(dp->calendar_window);
        ewl_window_raise(EWL_WINDOW(dp->calendar_window));
-       ewl_datepicker_calendar_position_set(dp);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_datepicker.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_datepicker.h    30 Sep 2006 18:41:01 -0000      1.9
+++ ewl_datepicker.h    16 Nov 2006 19:13:46 -0000      1.10
@@ -49,9 +49,9 @@
  * Internally used callbacks, override at your risk
  */
 void ewl_datepicker_cb_destroy(Ewl_Widget *w, void *ev, void *user_data);
-void ewl_datepicker_cb_configure(Ewl_Widget *w, void *ev, void *user_data);
 void ewl_datepicker_cb_value_changed(Ewl_Widget *w, void *ev, void *user_data);
-void ewl_datepicker_cb_realize(Ewl_Widget *w, void *ev, void *user_data);
+void ewl_datepicker_cb_window_mouse_down(Ewl_Widget *w, void *ev, 
+                                                       void *user_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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to