menustore.h

Go to the documentation of this file.
00001 #ifndef __MENUSTORE_H__
00002 #define __MENUSTORE_H__
00003 
00004 /**
00005  * File Name  : menustore.h
00006  *
00007  * Description: 
00008  */
00009 
00010 /*
00011  * This file is part of popupmenu.
00012  *
00013  * popupmenu is free software: you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation, either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * popupmenu is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00025  */
00026 
00027 /**
00028  * Copyright (C) 2008 iRex Technologies B.V.
00029  * All rights reserved.
00030  */
00031 
00032 #include <glib.h>
00033 
00034 G_BEGIN_DECLS
00035 
00036 //----------------------------------------------------------------------------
00037 // Type Declarations
00038 //----------------------------------------------------------------------------
00039 
00040 enum menu_state
00041 {
00042   MENU_STATE_NORMAL = 0,
00043   MENU_STATE_SELECTED,
00044   MENU_STATE_DISABLED,
00045   MENU_STATE_ALTERNATE
00046 };
00047 
00048 enum
00049 {
00050   TREE_COL_TYPE = 0,
00051   TREE_COL_NAME,
00052   TREE_COL_TEXT,
00053   TREE_COL_ICON,
00054   TREE_COL_STATE,
00055   TREE_COL_IMAGE_NORMAL,
00056   TREE_COL_IMAGE_ALTERNATE,
00057   TREE_COL_ITER,
00058   TREE_NUM_COLS
00059 };
00060 
00061 //----------------------------------------------------------------------------
00062 // Functions
00063 //----------------------------------------------------------------------------
00064 
00065 typedef void (*taskbar_cb_t)();
00066 void menustore_create(taskbar_cb_t cb);
00067 
00068 void menustore_set_text();
00069 
00070 const char* menustore_get_current_menu();
00071 
00072 void menustore_set_current_menu(const char* name);
00073 
00074 const char* menustore_get_current_service();
00075 
00076 
00077 /**---------------------------------------------------------------------------
00078  *
00079  * Name :  menustore_add_group
00080  *
00081  * @brief  Add a menu group to the store
00082  *
00083  * @param  iname New group name
00084  * @param  pname Parent group name it belongs to or NULL for root
00085  * @param  text Label text
00086  * @param  icon Icon name
00087  *
00088  * @return Returns TRUE on succes, FALSE otherwise
00089  *
00090  *--------------------------------------------------------------------------*/
00091 gboolean menustore_add_group(const char *iname, const char *pname, const char *text, const char *icon);
00092 
00093 /**---------------------------------------------------------------------------
00094  *
00095  * Name :  menustore_add_item
00096  *
00097  * @brief  Add a menu item to a group
00098  *
00099  * @param  iname New item name
00100  * @param  pname Parent group name it belongs to
00101  * @param  text Label text
00102  * @param  icon Icon name
00103  *
00104  * @return Returns TRUE on succes, FALSE otherwise
00105  *
00106  *--------------------------------------------------------------------------*/
00107 gboolean menustore_add_item(const char *iname, const char *pname, const char *text, const char *icon);
00108 
00109 /**---------------------------------------------------------------------------
00110  *
00111  * Name :  menustore_add_menu
00112  *
00113  * @brief  Create a new erMyThing object
00114  *
00115  * @param  iname New menu set
00116  * @param  label Label text
00117  * @param  service IPC service name
00118  * @param  group1 Name of group in 1st row
00119  * @param  group2 Name of group in 2nd row
00120  * @param  group3 Name of group in 3rd row
00121  * @param  group4 Name of group in 4th row
00122  *
00123  * @return Returns TRUE on succes, FALSE otherwise
00124  *
00125  *--------------------------------------------------------------------------*/
00126 gboolean menustore_add_menu(const char *iname, const char *label, const char *service, 
00127                             const char *group1, const char *group2,
00128                             const char *group3, const char *group4);
00129 
00130 /**---------------------------------------------------------------------------
00131  *
00132  * Name :  menustore_remove_group
00133  *
00134  * @brief  Remove menu group and everything below it
00135  *
00136  * @param  name Name of menu group
00137  *
00138  * @return Returns TRUE on succes, FALSE otherwise
00139  *
00140  *--------------------------------------------------------------------------*/
00141 gboolean menustore_remove_group(const char *name);
00142 
00143 /**---------------------------------------------------------------------------
00144  *
00145  * Name :  menustore_remove_item
00146  *
00147  * @brief  Remove a single item
00148  *
00149  * @param  iname New item name
00150  * @param  pname Parent group name it belongs to
00151  *
00152  * @return Returns TRUE on succes, FALSE otherwise
00153  *
00154  *--------------------------------------------------------------------------*/
00155 gboolean menustore_remove_item(const char *iname, const char* pname);
00156 
00157 /**---------------------------------------------------------------------------
00158  *
00159  * Name :  menustore_remove_menu
00160  *
00161  * @brief  Remove menu set
00162  *
00163  * @param  name Name of menu set
00164  *
00165  * @return Returns TRUE on succes, FALSE otherwise
00166  *
00167  *--------------------------------------------------------------------------*/
00168 gboolean menustore_remove_menu(const char *name);
00169 
00170 /**---------------------------------------------------------------------------
00171  *
00172  * Name :  menustore_set_group_state
00173  *
00174  * @brief  Set the group state
00175  *
00176  * @param  name Name of group
00177  * @param  state New state
00178  *
00179  * @return Returns TRUE on succes, FALSE otherwise
00180  *
00181  *--------------------------------------------------------------------------*/
00182 gboolean menustore_set_group_state(const char *name, const char *state);
00183 
00184 /**---------------------------------------------------------------------------
00185  *
00186  * Name :  menustore_set_group_label
00187  *
00188  * @brief  Set the group label
00189  *
00190  * @param  name Name of group
00191  * @param  state New label text
00192  *
00193  * @return Returns TRUE on succes, FALSE otherwise
00194  *
00195  *--------------------------------------------------------------------------*/
00196 gboolean menustore_set_group_label(const char *name, const char *label);
00197 
00198 /**---------------------------------------------------------------------------
00199  *
00200  * Name :  menustore_set_item_state
00201  *
00202  * @brief  Set the item state
00203  *
00204  * @param  iname New item name
00205  * @param  pname Parent group name it belongs to
00206  * @param  state New state
00207  *
00208  * @return Returns TRUE on succes, FALSE otherwise
00209  *
00210  *--------------------------------------------------------------------------*/
00211 gboolean menustore_set_item_state(const char *iname, const char *pname, const char *state);
00212 
00213 /**---------------------------------------------------------------------------
00214  *
00215  * Name :  menustore_set_item_label
00216  *
00217  * @brief  Set the item label text
00218  *
00219  * @param  iname New item name
00220  * @param  pname Parent group name it belongs to
00221  * @param  label New label text
00222  *
00223  * @return Returns TRUE on succes, FALSE otherwise
00224  *
00225  *--------------------------------------------------------------------------*/
00226 gboolean menustore_set_item_label(const char *iname, const char *pname, const char *label);
00227 
00228 
00229 gboolean menustore_popup_has_changed();
00230 
00231 void menustore_clear_popup_changed();
00232 
00233 typedef void (*tool_func_t)(const char *iname, const char *pname, const char *mname, const char *state, const char *service);
00234 gboolean menustore_activate_item_iter(gpointer user_data, tool_func_t func);
00235 
00236 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW
00237 #define MENUSTORE_NUM_TOOLS 16      // nr of tools with fullbar
00238 #define MENUSTORE_SMALL_TOOLS 5     // nr of tools with limited space
00239 
00240 gboolean menustore_toolbar_has_changed();
00241 
00242 void menustore_clear_toolbar_changed();
00243 
00244 int menustore_get_tool_limit();
00245 
00246 GdkPixbuf* menustore_get_tool_icon(int index);
00247 
00248 void menustore_activate_toolitem(int index, tool_func_t func);
00249 
00250 void menustore_activate_item(const char* pname, const char* iname, tool_func_t func);
00251 #endif
00252 
00253 typedef gpointer (*add_item_func)(const char* name,
00254                                   const char* text,
00255                                   enum menu_state state,
00256                                   GdkPixbuf* img,
00257                                   gpointer menu_data,
00258                                   gpointer user_data);
00259 typedef void (*separator_func)(gpointer user_data);
00260 void menustore_fill_menu(add_item_func item_cb,
00261                          add_item_func submenu_cb,
00262                          separator_func separator_cb,
00263                          gpointer user_data);
00264 
00265 #if (TESTING_ON)
00266 const char* testing_menustore_print();
00267 
00268 const char* testing_menustore_get_route(const char* pname, const char* iname);
00269 #endif
00270 
00271 G_END_DECLS
00272     
00273 #endif
00274 
Generated by  doxygen 1.6.2-20100208