Enlightenment CVS committal Author : handyande Project : e17 Module : proto
Dir : e17/proto/etk/src/lib Modified Files: etk_menu_item.c etk_menu_item.h Log Message: Add stock wrappers for the menu_item =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu_item.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- etk_menu_item.c 7 Apr 2006 15:36:11 -0000 1.11 +++ etk_menu_item.c 18 May 2006 18:51:17 -0000 1.12 @@ -2,6 +2,7 @@ #include "etk_menu_item.h" #include <stdlib.h> #include <string.h> +#include "etk_image.h" #include "etk_menu_shell.h" #include "etk_signal.h" #include "etk_signal_callback.h" @@ -120,6 +121,21 @@ } /** + * @brief Creates a new menu item with a label and an icon defined by a stock id + * @param stock_id the stock id corresponding to a label and an icon + * @return Returns the new menu item widget + * @see Etk_Stock + */ +Etk_Widget *etk_menu_item_new_from_stock(Etk_Stock_Id stock_id) +{ + Etk_Widget *menu_item; + + menu_item = etk_menu_item_new(); + etk_menu_item_set_from_stock(ETK_MENU_ITEM(menu_item), stock_id); + + return menu_item; +} +/** * @brief Sets the label of the menu item * @param menu_item a menu item * @param label the label to set @@ -215,6 +231,30 @@ if (!menu_item) return; etk_signal_emit(_etk_menu_item_signals[ETK_MENU_ITEM_ACTIVATED_SIGNAL], ETK_OBJECT(menu_item), NULL); +} + +/** + * @brief Sets the label and the image of the menu item from the stock id + * @param menu_item a menu item + * @param stock_id the stock id to use + */ +void etk_menu_item_set_from_stock(Etk_Menu_Item *menu_item, Etk_Stock_Id stock_id) +{ + Etk_Widget *image; + char *label; + + if (!menu_item) + return; + + if (ETK_IS_MENU_ITEM_IMAGE(menu_item)) + { + image = etk_image_new_from_stock(stock_id, ETK_STOCK_SMALL); + etk_widget_show(image); + etk_widget_visibility_locked_set(image, ETK_TRUE); + etk_menu_item_image_set(ETK_MENU_ITEM_IMAGE(menu_item), ETK_IMAGE(image)); + } + label = etk_stock_label_get(stock_id); + etk_menu_item_label_set(menu_item, label); } /************************** =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu_item.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- etk_menu_item.h 14 May 2006 21:29:22 -0000 1.7 +++ etk_menu_item.h 18 May 2006 18:51:17 -0000 1.8 @@ -4,6 +4,7 @@ #include "etk_container.h" #include "etk_types.h" +#include "etk_stock.h" /** * @defgroup Etk_Menu_Item Etk_Menu_Item @@ -123,6 +124,7 @@ Etk_Type *etk_menu_item_type_get(); Etk_Widget *etk_menu_item_new(); Etk_Widget *etk_menu_item_new_with_label(const char *label); +Etk_Widget *etk_menu_item_new_from_stock(Etk_Stock_Id stock_id); void etk_menu_item_label_set(Etk_Menu_Item *menu_item, const char *label); const char *etk_menu_item_label_get(Etk_Menu_Item *menu_item); @@ -131,6 +133,8 @@ void etk_menu_item_select(Etk_Menu_Item *menu_item); void etk_menu_item_deselect(Etk_Menu_Item *menu_item); void etk_menu_item_activate(Etk_Menu_Item *menu_item); + +void etk_menu_item_set_from_stock(Etk_Menu_Item *menu_item, Etk_Stock_Id stock_id); /* Etk_Menu_Item_Separator */ Etk_Type *etk_menu_item_separator_type_get(); ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs