src/func-list.h File Reference

Header for frame menu items constructors and utilities. More...

#include <gtk/gtk.h>
#include "constants.h"
Include dependency graph for func-list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  func_list_t
 A list of (display name, function) couples used to populate a menu. More...

Functions

void func_list_add_new_func (GList **list, const char *name, void(*func)(GtkMenuItem *, gpointer))
 Adds a function menu item to a func_list_t list.
void func_list_add_new_submenu (GList **, const char *, GList *)
 Adds a submenu menu item to a func_list_t list.
void func_list_add_new_separator (GList **)
void func_list_t_free (func_list_t *)
 Frees a func_list_t struct.
GtkWidget * func_list_t_setup_submenu (func_list_t *, struct __frame_t *)

Detailed Description

Header for frame menu items constructors and utilities.

Author:
Steve Dodier <sidnioulz@gmail.com>

This header file contains the func_list_t structure that represents a frame menu item, as well as constructors for this struct.

Definition in file func-list.h.


Function Documentation

void func_list_add_new_func ( GList **  list,
const char *  name,
void(*)(GtkMenuItem *, gpointer)  func 
)

Adds a function menu item to a func_list_t list.

This function adds a menu item of type FUNCTION to a list of menu items, and updates the pointer to the list passed as a parameter.

Parameters:
[out] list a pointer to the list where to add the menu item
[in] name the display name (must be unique in the list) of the menu item
[in] func the function to call when this menu item is clicked

Definition at line 32 of file func-list.c.

00033 {
00034     func_list_t *f = g_malloc (sizeof (func_list_t));
00035 
00036     f->type = FUNCTION;
00037     f->name = g_strdup (name);
00038     f->data.func = func;
00039 
00040     *list = g_list_prepend (*list, f);
00041 }

void func_list_add_new_separator ( GList **   ) 

Definition at line 58 of file func-list.c.

00059 {
00060     func_list_t *f = g_malloc (sizeof (func_list_t));
00061 
00062     f->type = SEPARATOR;
00063     f->name = NULL;
00064 
00065     *list = g_list_prepend (*list, f);
00066 }

void func_list_add_new_submenu ( GList **  list,
const char *  name,
GList *  children 
)

Adds a submenu menu item to a func_list_t list.

Adds a separator to a func_list_t list.

This function adds a menu item of type SUBMENU to a list of menu items, and updates the pointer to the list passed as a parameter.

Parameters:
[out] list a pointer to the list where to add the menu item
[in] name the display name (must be unique in the list) of the menu item
[in] children the list of menu items in the submenu of the newly created one

This function adds a menu item of type SEPARATOR to a list of menu items, and updates the pointer to the list passed as a parameter.

Parameters:
[out] list a pointer to the list where to add the separator

Definition at line 45 of file func-list.c.

00046 {
00047     func_list_t *f = g_malloc (sizeof (func_list_t));
00048 
00049     f->type = SUBMENU;
00050     f->name = g_strdup (name);
00051     f->data.children = children;
00052 
00053     *list = g_list_prepend (*list, f);
00054 }

void func_list_t_free ( func_list_t fn  ) 

Frees a func_list_t struct.

This function frees the data in a func_list_t struct, and the struct itself.

Parameters:
[out] fn the func_list_t struct to free

Definition at line 70 of file func-list.c.

00071 {
00072     if (fn) {
00073         g_free (fn->name);
00074         if (fn->type == SUBMENU)
00075             g_list_free (fn->data.children);
00076     }
00077     g_free (fn);
00078 }

GtkWidget* func_list_t_setup_submenu ( func_list_t ,
struct __frame_t *   
)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Tue Jan 12 00:48:45 2010 for ENSIBSynema by  doxygen 1.6.1