Enlightenment CVS committal

Author  : urandom
Project : e17
Module  : libs/etk

Dir     : e17/libs/etk/src/lib


Modified Files:
        etk_dialog.c etk_dialog.h 


Log Message:
 [Etk_Dialog] - added functions for getting/setting the horizontal alignment of 
the action area buttons

===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_dialog.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etk_dialog.c        6 Oct 2006 17:04:14 -0000       1.13
+++ etk_dialog.c        17 Feb 2007 17:27:08 -0000      1.14
@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "etk_box.h"
+#include "etk_alignment.h"
 #include "etk_separator.h"
 #include "etk_button.h"
 #include "etk_theme.h"
@@ -25,7 +26,8 @@
 
 enum Etk_Dialog_Property_Id
 {
-   ETK_DIALOG_HAS_SEPARATOR_PROPERTY
+   ETK_DIALOG_HAS_SEPARATOR_PROPERTY,
+   ETK_DIALOG_ACTION_AREA_ALIGN_PROPERTY
 };
 
 static void _etk_dialog_constructor(Etk_Dialog *dialog);
@@ -61,6 +63,7 @@
 
       etk_type_property_add(dialog_type, "has_separator", 
ETK_DIALOG_HAS_SEPARATOR_PROPERTY,
          ETK_PROPERTY_BOOL, ETK_PROPERTY_READABLE_WRITABLE, 
etk_property_value_bool(ETK_TRUE));
+      etk_type_property_add(dialog_type, "action_area_align", 
ETK_DIALOG_ACTION_AREA_ALIGN_PROPERTY, ETK_PROPERTY_FLOAT, 
ETK_PROPERTY_READABLE_WRITABLE,  etk_property_value_float(0.5));
 
       dialog_type->property_set = _etk_dialog_property_set;
       dialog_type->property_get = _etk_dialog_property_get;
@@ -179,6 +182,36 @@
 }
 
 /**
+ * @brief Sets the alignment of the buttons in the dialog's action area
+ * @param dialog a dialog
+ * @param align the horizontal alignment (0.0 = left, 0.5 = center, 1.0 = 
right, ...)
+ */
+void etk_dialog_action_area_alignment_set(Etk_Dialog *dialog, float align)
+{
+   float yalign, xscale, yscale;
+
+   etk_alignment_get(ETK_ALIGNMENT(dialog->action_area_alignment), NULL, 
&yalign, &xscale, &yscale);
+   etk_alignment_set(ETK_ALIGNMENT(dialog->action_area_alignment), align, 
yalign, xscale, yscale);
+
+   if (dialog->align != align)
+   {
+      dialog->align = align;
+      etk_object_notify(ETK_OBJECT(dialog), "action_area_align");
+   }
+}
+
+/**
+ * @brief Gets the alignment of the buttons in the dialog's action area
+ * @param dialog a dialog
+ * @param align the location where to store the horizontal alignment
+ */
+void etk_dialog_action_area_alignment_get(Etk_Dialog *dialog, float *align)
+{
+   if (align)
+      *align = dialog ? dialog->align : 0;
+}
+
+/**
  * @brief Adds a button created from a stock id to the dialog's action area.
  * The button will be packed at the end of the hbox of the action area
  * @param dialog a dialog
@@ -258,8 +291,13 @@
    etk_widget_internal_set(dialog->separator, ETK_TRUE);
    etk_widget_show(dialog->separator);
 
+   dialog->action_area_alignment = etk_alignment_new(0.5, 0.5, 0.0, 0.0);
+   etk_box_append(ETK_BOX(dialog->dialog_vbox), dialog->action_area_alignment, 
ETK_BOX_END, ETK_BOX_FILL, 0);
+   etk_widget_internal_set(dialog->action_area_alignment, ETK_TRUE);
+   etk_widget_show(dialog->action_area_alignment);
+
    dialog->action_area_hbox = etk_hbox_new(ETK_FALSE, 6);
-   etk_box_append(ETK_BOX(dialog->dialog_vbox), dialog->action_area_hbox, 
ETK_BOX_END, ETK_BOX_FILL, 0);
+   etk_container_add(ETK_CONTAINER(dialog->action_area_alignment), 
dialog->action_area_hbox);
    etk_widget_internal_set(dialog->action_area_hbox, ETK_TRUE);
    etk_widget_show(dialog->action_area_hbox);
 
@@ -279,6 +317,9 @@
       case ETK_DIALOG_HAS_SEPARATOR_PROPERTY:
          etk_dialog_has_separator_set(dialog, 
etk_property_value_bool_get(value));
          break;
+      case ETK_DIALOG_ACTION_AREA_ALIGN_PROPERTY:
+        etk_dialog_action_area_alignment_set(dialog, 
etk_property_value_float_get(value));
+        break;
       default:
          break;
    }
@@ -297,6 +338,9 @@
       case ETK_DIALOG_HAS_SEPARATOR_PROPERTY:
          etk_property_value_bool_set(value, 
etk_dialog_has_separator_get(dialog));
          break;
+      case ETK_DIALOG_ACTION_AREA_ALIGN_PROPERTY:
+        etk_property_value_float_set(value, dialog->align);
+        break;
       default:
          break;
    }
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_dialog.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- etk_dialog.h        6 Oct 2006 17:04:14 -0000       1.9
+++ etk_dialog.h        17 Feb 2007 17:27:08 -0000      1.10
@@ -52,10 +52,13 @@
 
    Etk_Widget *dialog_vbox;
    Etk_Widget *main_area_vbox;
+   Etk_Widget *action_area_alignment;
    Etk_Widget *action_area_hbox;
    Etk_Widget *separator;
 
    Etk_Bool has_separator;
+
+   float align;
 };
 
 Etk_Type *etk_dialog_type_get();
@@ -67,6 +70,8 @@
 
 Etk_Widget *etk_dialog_button_add(Etk_Dialog *dialog, const char *label, int 
response_id);
 Etk_Widget *etk_dialog_button_add_from_stock(Etk_Dialog *dialog, int stock_id, 
int response_id);
+void etk_dialog_action_area_alignment_set(Etk_Dialog *dialog, float align);
+void etk_dialog_action_area_alignment_get(Etk_Dialog *dialog, float *align);
 
 void     etk_dialog_has_separator_set(Etk_Dialog *dialog, Etk_Bool 
has_separator);
 Etk_Bool etk_dialog_has_separator_get(Etk_Dialog *dialog);



-------------------------------------------------------------------------
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