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 some control over nested image size in the button.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_button.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- ewl_button.c 22 Feb 2006 03:51:01 -0000 1.28
+++ ewl_button.c 22 Feb 2006 04:53:30 -0000 1.29
@@ -228,30 +228,35 @@
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);
DCHECK_TYPE("b", b, EWL_BUTTON_TYPE);
+ /* FIXME: Is this necessary?
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), EWL_CONTAINER(b->body));
+ if (!b->image_object) {
+ Ewl_Container *redir;
- 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);
+ /*
+ * 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),
EWL_CONTAINER(b->body));
+ b->image_object = ewl_image_new();
+ ewl_container_child_prepend(EWL_CONTAINER(b), b->image_object);
+ ewl_widget_internal_set(b->image_object, TRUE);
+ ewl_widget_show(b->image_object);
+
+ ewl_container_redirect_set(EWL_CONTAINER(b), redir);
+ }
+
+ ewl_image_file_set(EWL_IMAGE(b->image_object), file, key);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -279,6 +284,27 @@
}
/**
+ * @param b: The button to set the image size on
+ * @return Returns no value.
+ * @brief Set the size of the image inside the button.
+ */
+void
+ewl_button_image_scale_to(Ewl_Button *b, int width, int height)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("b", b);
+ DCHECK_TYPE("b", b, EWL_BUTTON_TYPE);
+
+ if (!b->image_object)
+ ewl_button_image_set(b, "", NULL);
+
+ ewl_image_proportional_set(EWL_IMAGE(b->image_object), TRUE);
+ ewl_image_scale_to(EWL_IMAGE(b->image_object), width, height);
+
+ 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.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_button.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- ewl_button.h 20 Feb 2006 15:20:24 -0000 1.12
+++ ewl_button.h 22 Feb 2006 04:53:30 -0000 1.13
@@ -52,6 +52,7 @@
void ewl_button_image_set(Ewl_Button *b, const char *file, const
char *key);
const char *ewl_button_image_get(Ewl_Button *b);
+void ewl_button_image_scale_to(Ewl_Button *b, int width, int
height);
unsigned int ewl_button_alignment_get(Ewl_Button *b);
void ewl_button_alignment_set(Ewl_Button *b, unsigned int align);
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs