contentLister/inc/gtkDistListWnd.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _GtkDistListWnd
struct  distListWnd_selectionItem_t

Defines

#define DIST_LIST_WND_WIDTH   666
#define DIST_LIST_WND_HEIGHT_SMALL   (CLIENT_AREA - LISTER_BOX_BORDER - TITLE_MIN_HEIGHT - LIST_ITEM_SPACING - LISTER_ITEM_HEIGHT - LIST_ITEM_SPACING - LIST_ITEM_SPACING)
#define DIST_LIST_WND_HEIGHT_BIG   (CLIENT_AREA - LISTER_BOX_BORDER - LIST_ITEM_SPACING)
#define DIST_LIST_WND_V_SPACING   15

Typedefs

typedef struct _GtkDistListWnd GtkDistListWnd

Functions

void create_dist_list_wnd (GtkWidget *parent)
void dist_list_wnd_clear (void)
erGtkSelectionGroupdist_list_wnd_add_list (const gchar *display_as, const gchar *title, const gchar *instruction, const gchar **item_tbl)
void dist_list_wnd_goto_page (gint page)
void dist_list_wnd_page_forward (guint offset)
void dist_list_wnd_page_back (guint offset)
gboolean dist_list_wnd_is_visible (void)


Define Documentation

#define DIST_LIST_WND_HEIGHT_BIG   (CLIENT_AREA - LISTER_BOX_BORDER - LIST_ITEM_SPACING)

Definition at line 34 of file gtkDistListWnd.h.

#define DIST_LIST_WND_HEIGHT_SMALL   (CLIENT_AREA - LISTER_BOX_BORDER - TITLE_MIN_HEIGHT - LIST_ITEM_SPACING - LISTER_ITEM_HEIGHT - LIST_ITEM_SPACING - LIST_ITEM_SPACING)

Definition at line 33 of file gtkDistListWnd.h.

#define DIST_LIST_WND_V_SPACING   15

Definition at line 37 of file gtkDistListWnd.h.

#define DIST_LIST_WND_WIDTH   666

Definition at line 31 of file gtkDistListWnd.h.


Typedef Documentation


Function Documentation

void create_dist_list_wnd ( GtkWidget *  parent  ) 

Create an empty distribution list window

Parameters:
parent - gtk event box on which to append the distribution list window
Returns:
--

Definition at line 69 of file gtkDistListWnd.c.

00070 {
00071     CL_LOGPRINTF("entry");
00072 
00073     g_parent_widget = parent;
00074     dist_list_wnd_create_notebook();
00075 }

Here is the call graph for this function:

erGtkSelectionGroup* dist_list_wnd_add_list ( const gchar *  display_as,
const gchar *  title,
const gchar *  instruction,
const gchar **  item_tbl 
)

Append a selection list to the distribution list window

Parameters:
display_as - specifies how to display the item list
title - text to appear in title bar
instruction - text to appear above list of items
item_tbl - array of items to be displayed
Returns:
erGtkSelectionGroup object for this list

Definition at line 88 of file gtkDistListWnd.c.

00092 {
00093     CL_LOGPRINTF("entry: title [%s]", title);
00094 
00095     GtkWidget*    list          = NULL;
00096     GtkWidget*    master_list   = NULL;
00097     GtkWidget*    lastpage_vbox = g_lastpage_vbox;
00098     guint         list_height   = 0;
00099     guint         list_items    = 0;
00100     guint         next_item     = 0;
00101     guint         available_height;
00102 
00103     // determine display_as for selection list
00104     erGtkSelectionList_displayAs_e list_display_as;
00105     if (strcmp(display_as, "radiobutton") == 0)
00106     {
00107         list_display_as = esl_RadioButton;
00108     }
00109     else if (strcmp(display_as, "textbutton") == 0)
00110     {
00111         list_display_as = esl_TextButton;
00112     }
00113     else
00114     {
00115         list_display_as = esl_Checklist;
00116     }
00117 
00118     // calculate space available for selection list
00119     if (lastpage_vbox == NULL)
00120     {
00121         available_height = DIST_LIST_WND_HEIGHT_SMALL;
00122     }
00123     else
00124     {
00125         if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(g_notebook)) <= 1)
00126         {
00127             available_height = DIST_LIST_WND_HEIGHT_SMALL;
00128         }
00129         else
00130         {
00131             available_height = DIST_LIST_WND_HEIGHT_BIG;
00132         }
00133         available_height = available_height - g_lastpage_height - DIST_LIST_WND_V_SPACING;
00134     }
00135 
00136     // create selection list
00137     list = ergtk_selection_list_new( list_display_as,
00138                                      title,
00139                                      instruction,
00140                                      item_tbl,
00141                                      available_height,
00142                                      &list_items,
00143                                      &list_height );
00144     if (list == NULL)
00145     {
00146         // list cannot start on current page
00147         lastpage_vbox    = NULL;
00148         available_height = DIST_LIST_WND_HEIGHT_BIG;
00149         list = ergtk_selection_list_new( list_display_as,
00150                                          title,
00151                                          instruction,
00152                                          item_tbl,
00153                                          available_height,
00154                                          &list_items,
00155                                          &list_height );
00156     }
00157 
00158     // add list to notebook, continue on next pages when needed
00159     master_list = list;
00160     while (list)
00161     {
00162         g_signal_connect(G_OBJECT(list), "selection-update", G_CALLBACK(on_selection_update), NULL);
00163         
00164         // add selection list to notebook
00165         if (lastpage_vbox == NULL)
00166         {
00167             dist_list_wnd_notebook_append_page();
00168             lastpage_vbox = g_lastpage_vbox;
00169 
00170             g_lastpage_height += list_height;
00171         }
00172         else
00173         {
00174             g_lastpage_height += DIST_LIST_WND_V_SPACING + list_height;
00175         }
00176         gtk_box_pack_start(GTK_BOX(lastpage_vbox), list, FALSE, FALSE, 0);
00177         next_item += list_items;
00178 
00179         // create additional selection list, if needed
00180         if (item_tbl[next_item] == NULL)
00181         {
00182             // all items done, no continuation list needed
00183             list = NULL;
00184         }
00185         else
00186         {
00187             // item(s) left, start continuation list on new page
00188             lastpage_vbox    = NULL;
00189             available_height = DIST_LIST_WND_HEIGHT_BIG;
00190             
00191             list = ergtk_selection_list_new_from_master( ERGTK_SELECTION_LIST(master_list),
00192                                                          next_item,
00193                                                          available_height,
00194                                                          &list_items,
00195                                                          &list_height );
00196         }
00197     }
00198 
00199     return ERGTK_SELECTION_GROUP(master_list);
00200 }

Here is the call graph for this function:

void dist_list_wnd_clear ( void   ) 

Clear the distribution window, i.e. remove all selection lists from it

Parameters:
-- 
Returns:
--

Definition at line 77 of file gtkDistListWnd.c.

00078 {
00079     CL_LOGPRINTF("entry: g_notebook [%p]", g_notebook);
00080 
00081     if (g_notebook)
00082     {
00083         gtk_widget_destroy(g_notebook);
00084         dist_list_wnd_create_notebook();
00085     }
00086 }

Here is the call graph for this function:

void dist_list_wnd_goto_page ( gint  page  ) 

Show specified page of distribution list window

Parameters:
page - pagenumber (1 ..) to display
Returns:
--

Definition at line 308 of file gtkDistListWnd.c.

00309 {
00310     gint old_page;
00311 
00312     if (g_notebook)
00313     {
00314         old_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(g_notebook));
00315         new_page--;  // notebook counts 0 ..
00316 
00317         if (new_page != old_page)
00318         {
00319             gtk_notebook_set_current_page(GTK_NOTEBOOK(g_notebook), new_page);
00320         }
00321         else
00322         {
00323             dist_list_wnd_update_pagebar();
00324         }
00325     }
00326 }

Here is the call graph for this function:

gboolean dist_list_wnd_is_visible ( void   ) 

Tell whether distribution list window is visible

Parameters:
-- 
Returns:
TRUE/FALSE - window visible / not visible

Definition at line 253 of file gtkDistListWnd.c.

00254 {
00255     if (g_parent_widget  &&  GTK_WIDGET_VISIBLE(g_parent_widget))
00256     {
00257         return TRUE;
00258     }
00259     else
00260     {
00261         return FALSE;
00262     }
00263 }

void dist_list_wnd_page_back ( guint  offset  ) 

Definition at line 228 of file gtkDistListWnd.c.

00229 {
00230     gint first_page = 0;
00231     gint old_page;
00232     gint new_page;
00233 
00234     if (g_notebook)
00235     {
00236         old_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(g_notebook));
00237         if (old_page > first_page)
00238         {
00239             new_page = old_page - offset;
00240             if (new_page < first_page)
00241             {
00242                 new_page = first_page;
00243             }
00244             gtk_notebook_set_current_page(GTK_NOTEBOOK(g_notebook), new_page);
00245         }
00246         else
00247         {
00248             erbusy_off();
00249         }
00250     }
00251 }

Here is the call graph for this function:

void dist_list_wnd_page_forward ( guint  offset  ) 

Goto next page / previous page

Parameters:
-- 
Returns:
--

Definition at line 202 of file gtkDistListWnd.c.

00203 {
00204     gint last_page;
00205     gint old_page;
00206     gint new_page;
00207 
00208     if (g_notebook)
00209     {
00210         last_page = gtk_notebook_get_n_pages(GTK_NOTEBOOK(g_notebook)) - 1;
00211         old_page  = gtk_notebook_get_current_page(GTK_NOTEBOOK(g_notebook));
00212         if (old_page < last_page)
00213         {
00214             new_page = old_page + offset;
00215             if (new_page > last_page)
00216             {
00217                 new_page = last_page;
00218             }
00219             gtk_notebook_set_current_page(GTK_NOTEBOOK(g_notebook), new_page);
00220         }
00221         else
00222         {
00223             erbusy_off();
00224         }
00225     }
00226 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:12:52 2008 by  doxygen 1.5.6