Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_button.c ewl_button.h 


Log Message:
Add button content alignment control.
Change redirection in the button when doing internal packing to improve
inheritance interactions.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_button.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_button.c        15 Feb 2006 17:40:49 -0000      1.26
+++ ewl_button.c        20 Feb 2006 15:20:24 -0000      1.27
@@ -118,6 +118,15 @@
                b->label_object = NULL;
        }
        else if (!b->label_object) {
+               Ewl_Container *redir;
+
+               /*
+                * Save the current redirection and focus on the point where our
+                * internal widgets belong.
+                */
+               redir = ewl_container_redirect_get(EWL_CONTAINER(b));
+               ewl_container_redirect_set(EWL_CONTAINER(b), b->body);
+
                b->label_object = ewl_label_new();
                ewl_label_text_set(EWL_LABEL(b->label_object), l);
                ewl_object_fill_policy_set(EWL_OBJECT(b->label_object),
@@ -125,6 +134,8 @@
                ewl_container_child_append(EWL_CONTAINER(b), b->label_object);
                ewl_widget_internal_set(b->label_object, TRUE);
                ewl_widget_show(b->label_object);
+
+               ewl_container_redirect_set(EWL_CONTAINER(b), redir);
        }
        else
                ewl_label_text_set(EWL_LABEL(b->label_object), l);
@@ -160,7 +171,7 @@
 void
 ewl_button_stock_type_set(Ewl_Button *b, Ewl_Stock_Type stock)
 {
-       char *data;
+       const char *data;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("b", b);
@@ -187,7 +198,6 @@
                theme = ewl_theme_path_get();
                ewl_button_image_set(b, theme, data);
                FREE(theme);
-               FREE(data);
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -218,6 +228,8 @@
 void
 ewl_button_image_set(Ewl_Button *b, const char *file, const char *key)
 {
+       Ewl_Container *redir;
+
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("b", b);
        DCHECK_PARAM_PTR("file", file);
@@ -226,12 +238,21 @@
        if (b->image_object)
                ewl_widget_destroy(b->image_object);
 
+       /*
+        * Save the current redirection and focus on the point where our
+        * internal widgets belong.
+        */
+       redir = ewl_container_redirect_get(EWL_CONTAINER(b));
+       ewl_container_redirect_set(EWL_CONTAINER(b), b->body);
+
        b->image_object = ewl_image_new();
        ewl_container_child_prepend(EWL_CONTAINER(b), b->image_object);
        ewl_image_file_set(EWL_IMAGE(b->image_object), file, key);
        ewl_widget_internal_set(b->image_object, TRUE);
        ewl_widget_show(b->image_object);
 
+       ewl_container_redirect_set(EWL_CONTAINER(b), redir);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -257,6 +278,41 @@
        DRETURN_PTR(file, DLEVEL_STABLE);
 }
 
+/**
+ * @param b: The button to set the content alignment
+ * @param align: The new alignment for button contents
+ * @return Returns no value.
+ * @brief Set the alignment of the contents of the button.
+ */
+void
+ewl_button_alignment_set(Ewl_Button *b, unsigned int align)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("b", b);
+       DCHECK_TYPE("b", b, EWL_BUTTON_TYPE);
+
+       ewl_object_alignment_set(EWL_OBJECT(b->body), align);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param b: The button to set the content alignment
+ * @param align: The new alignment for button contents
+ * @return Returns no value.
+ * @brief Set the alignment of the contents of the button.
+ */
+unsigned int
+ewl_button_alignment_get(Ewl_Button *b)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("b", b, 0);
+       DCHECK_TYPE_RET("b", b, EWL_BUTTON_TYPE, 0);
+
+       DRETURN_INT(ewl_object_alignment_get(EWL_OBJECT(b->body)),
+                       DLEVEL_STABLE);
+}
+
 void
 ewl_button_cb_key_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_button.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_button.h        16 Feb 2006 17:06:43 -0000      1.11
+++ ewl_button.h        20 Feb 2006 15:20:24 -0000      1.12
@@ -52,6 +52,8 @@
 
 void            ewl_button_image_set(Ewl_Button *b, const char *file, const 
char *key);
 const char     *ewl_button_image_get(Ewl_Button *b);
+unsigned int     ewl_button_alignment_get(Ewl_Button *b);
+void             ewl_button_alignment_set(Ewl_Button *b, unsigned int align);
 
 /*
  * Internal




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to