contentLister/inc/lister.h File Reference

lister - eReader content Lister page creation More...

#include "erMdsContent.h"
#include "gtkContentListItem.h"

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

Go to the source code of this file.

Classes

struct  lsLister_t

Defines

#define LIST_ITEM_SPACING   20
#define NO_FOCUSSED_ITEM   (-1)
#define MAX_ITEMS_ON_ONE_PAGE   6
#define LS_MAX_TITLE_SIZE   256
#define LS_MAX_SUBTITLE_SIZE   256
#define LS_MAX_DESCRIPTION_SIZE   512
#define LISTER_BOX_BORDER   51
#define TITLE_MIN_HEIGHT   54
#define TITLE_MIN_WIDTH   666
#define LISTER_ITEM_HEIGHT   115
#define CURSOR_X   (LISTER_BOX_BORDER - HBOX_TEXT_THUMB_SPACING)
#define CURSOR_START_Y   (LISTER_BOX_BORDER + TITLE_MIN_HEIGHT + LIST_ITEM_SPACING)
#define CURSOR_STEP   (LIST_ITEM_SPACING + LISTER_ITEM_HEIGHT)
#define KEYBOARD_TOP   680
#define METADATA_CLIENTAREA_HEIGHT   (KEYBOARD_TOP - LISTER_BOX_BORDER - TITLE_MIN_HEIGHT - LIST_ITEM_PADDING - LISTER_ITEM_HEIGHT - LISTER_BOX_BORDER - 30)

Functions

lsLister_tlsInit (GtkWidget *topLevelWindow, gpointer data)
GtkWidget * lsGetListerItem (lsLister_t *lister, int index)
void lsUpdatePage (lsLister_t *lister, clDisplayItem_t *items, int count, int focus, gchar *category, const gchar *location)


Detailed Description

lister - eReader content Lister page creation

<File description>=""> The eReader content Lister page contains a predefined number of gtkContentListItems. Which are created and updated with the following API

Definition in file lister.h.


Define Documentation

#define CURSOR_START_Y   (LISTER_BOX_BORDER + TITLE_MIN_HEIGHT + LIST_ITEM_SPACING)

Definition at line 62 of file lister.h.

#define CURSOR_STEP   (LIST_ITEM_SPACING + LISTER_ITEM_HEIGHT)

Definition at line 63 of file lister.h.

#define CURSOR_X   (LISTER_BOX_BORDER - HBOX_TEXT_THUMB_SPACING)

Definition at line 61 of file lister.h.

#define KEYBOARD_TOP   680

Definition at line 66 of file lister.h.

#define LIST_ITEM_SPACING   20

Definition at line 43 of file lister.h.

#define LISTER_BOX_BORDER   51

Definition at line 56 of file lister.h.

#define LISTER_ITEM_HEIGHT   115

Definition at line 59 of file lister.h.

#define LS_MAX_DESCRIPTION_SIZE   512

Definition at line 54 of file lister.h.

#define LS_MAX_SUBTITLE_SIZE   256

Definition at line 53 of file lister.h.

#define LS_MAX_TITLE_SIZE   256

Definition at line 52 of file lister.h.

#define MAX_ITEMS_ON_ONE_PAGE   6

Definition at line 49 of file lister.h.

#define METADATA_CLIENTAREA_HEIGHT   (KEYBOARD_TOP - LISTER_BOX_BORDER - TITLE_MIN_HEIGHT - LIST_ITEM_PADDING - LISTER_ITEM_HEIGHT - LISTER_BOX_BORDER - 30)

Definition at line 67 of file lister.h.

#define NO_FOCUSSED_ITEM   (-1)

Definition at line 46 of file lister.h.

#define TITLE_MIN_HEIGHT   54

Definition at line 57 of file lister.h.

#define TITLE_MIN_WIDTH   666

Definition at line 58 of file lister.h.


Function Documentation

GtkWidget* lsGetListerItem ( lsLister_t lister,
int  index 
)

Return the specified lister item

Parameters:
lister reference to the lister page
index sequence number of lister item on this page (0 ..)
Returns:
lister item or NULL

Definition at line 143 of file lister.c.

00144 {
00145     g_assert(lister != NULL);
00146     g_assert(index >= 0  &&  index < MAX_ITEMS_ON_ONE_PAGE);
00147 
00148     return lister->listItems[index];
00149 }

lsLister_t* lsInit ( GtkWidget *  topLevelWindow,
gpointer  data 
)

Init Lister page, by creating a predefined number of gtkContentListItems and assigning "control" callback routines

Parameters:
topLevelWindow reference to the top level window
data value that needs to be passed in lister item callback routines
Returns:
lister containing the gtkContentListItems and header

Definition at line 71 of file lister.c.

00072 {
00073     GtkWidget *alignment;
00074     GtkWidget *listVBox;
00075     GtkWidget *listItem;
00076     GtkWidget *titleBackground;
00077     GtkWidget *titleContainer;
00078 
00079     int     index;
00080 
00081     // object hierarchy:
00082     //     topLevelWidget
00083     //       |-- listVBox
00084     //             |
00085     listVBox = gtk_vbox_new(FALSE, LIST_ITEM_SPACING);
00086     gtk_container_add(GTK_CONTAINER(topLevelWidget), listVBox);
00087     gtk_widget_show(listVBox);
00088     //             |
00089     //             |-- alignment
00090     //             |     |-- titleBackground
00091     //             |           |
00092     alignment = gtk_alignment_new(0, 0, 0, 0);
00093     gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, LISTER_BOX_BORDER, 0);
00094     gtk_box_pack_start(GTK_BOX(listVBox), alignment, FALSE, FALSE, 0);
00095     gtk_widget_show(alignment);
00096     //
00097     titleBackground = gtk_event_box_new();
00098     gtk_widget_set_size_request(GTK_WIDGET(titleBackground), TITLE_MIN_WIDTH, TITLE_MIN_HEIGHT);
00099     gtk_widget_set_name(GTK_WIDGET(titleBackground), "title_background");
00100     gtk_container_add(GTK_CONTAINER(alignment), titleBackground);
00101     g_signal_connect(G_OBJECT(titleBackground), "expose-event", G_CALLBACK(ls_lister_expose_event), NULL);
00102     gtk_widget_show(titleBackground);
00103     //             |           |
00104     //             |           |-- titleContainer (GtkHBox)
00105     //             |                 |-- g_lister.titleItem (GtkLabel)
00106     //             |                 |-- g_lister.titleLocation (GtkLabel)
00107     //             |
00108     titleContainer = gtk_hbox_new(FALSE, 10);
00109     gtk_widget_set_size_request(GTK_WIDGET(titleContainer), TITLE_MIN_WIDTH, TITLE_MIN_HEIGHT);    
00110     gtk_container_add(GTK_CONTAINER(titleBackground), titleContainer);
00111     gtk_widget_show(titleContainer);
00112     //
00113     g_lister.titleItem = gtk_label_new("");
00114     gtk_misc_set_alignment(GTK_MISC(g_lister.titleItem), 0, 0.5);
00115     gtk_widget_set_name(GTK_WIDGET(g_lister.titleItem), "title_item");
00116     gtk_box_pack_start (GTK_BOX (titleContainer), g_lister.titleItem, FALSE, FALSE, 10);
00117     gtk_widget_show(g_lister.titleItem);
00118     //
00119     g_lister.titleLocation = gtk_label_new("");
00120     gtk_misc_set_alignment(GTK_MISC(g_lister.titleLocation), 1.0, 0.5);
00121     gtk_label_set_ellipsize(GTK_LABEL(g_lister.titleLocation), PANGO_ELLIPSIZE_START);
00122     gtk_widget_set_name(GTK_WIDGET(g_lister.titleLocation), "title_location");
00123     gtk_box_pack_start (GTK_BOX (titleContainer), g_lister.titleLocation, TRUE, TRUE, 10);
00124     gtk_widget_show(g_lister.titleLocation);
00125     //             |
00126     //             |-- g_lister.listItems[0] (GtkContentListItem)
00127     //             |--   ...
00128     //             |-- g_lister.listItems[..] (GtkContentListItem)
00129     //
00130     for (index = 0; index < MAX_ITEMS_ON_ONE_PAGE; index++)
00131     {
00132         listItem = gtk_content_list_item_new(index);
00133         gtk_content_list_item_show_cursor(GTK_CONTENT_LIST_ITEM(listItem), FALSE);
00134         gtk_box_pack_start(GTK_BOX(listVBox), listItem, FALSE, FALSE, 0);
00135         g_signal_connect(G_OBJECT(listItem), "button_press_event", G_CALLBACK(ls_listItem_press_event), data);
00136 
00137         g_lister.listItems[index] = listItem;
00138     }
00139 
00140     return &g_lister;
00141 }

Here is the call graph for this function:

void lsUpdatePage ( lsLister_t lister,
clDisplayItem_t items,
int  count,
int  focus,
gchar *  category,
const gchar *  location 
)

Update the items of the lister widget

<note> the max itemcount/page is the fixed value "MAX_ITEMS_ON_ONE_PAGE" so when more items are available, only the first MAX_ITEMS_ON_ONE_PAGE will be shown

Parameters:
lister reference to the lister page
items array page items, containing the data that needs to be displayed
count number of items in the array
focus item that should get the focus
category category name - used as the header fro the lster page
location current location information - where are we
Returns:
-

Definition at line 152 of file lister.c.

00154 {
00155     int       index = 0;
00156     GtkWidget *listerItem;
00157     char      *location;
00158     char      str[MAX_INT_LEN];
00159 
00160     //update the title
00161     if (title)
00162     {
00163         CL_LISTERPRINTF("set title %s", title);
00164         gtk_label_set_text(GTK_LABEL(lister->titleItem), title);
00165     }
00166     else
00167     {
00168         gtk_label_set_text(GTK_LABEL(lister->titleItem), "");
00169     }
00170     
00171     if (path)
00172     {
00173         // update the location information
00174         gtk_label_set_text(GTK_LABEL(lister->titleLocation), path);
00175     }
00176     else
00177     {
00178         gtk_label_set_text(GTK_LABEL(lister->titleLocation), "");
00179     }
00180 
00181 
00182     // update and display used lister items, hide the others
00183     for (index = 0 ; index < MAX_ITEMS_ON_ONE_PAGE ; index++)
00184     {
00185         listerItem = lister->listItems[index];
00186 
00187         if (index < count)
00188         {
00189             // update and display used lister items   
00190             CL_LISTERPRINTF("update and display listerItem %p - index %d", listerItem, index);
00191             gtk_content_list_item_set_title(GTK_CONTENT_LIST_ITEM(listerItem), items[index].szTitle);
00192             gtk_content_list_item_set_subtitle(GTK_CONTENT_LIST_ITEM(listerItem), items[index].szSubTitle);
00193             gtk_content_list_item_set_description(GTK_CONTENT_LIST_ITEM(listerItem), items[index].szDescription);
00194 
00195             str[0] = '\0';
00196             if (ERCL_INVALID_SIZE != items[index].size)
00197             {
00198                 if (items[index].fit == mdsFitStorage)
00199                 {
00200                     formatFree(items[index].size, str, MAX_INT_LEN);
00201                 }
00202                 else
00203                 {
00204                     formatSize(items[index].size, str, MAX_INT_LEN);
00205                 }
00206             }
00207             gtk_content_list_item_set_information(GTK_CONTENT_LIST_ITEM(listerItem), str);
00208 
00209             // set icon
00210             if (ctrl_location_is_outbox(path))
00211             {
00212                 CL_LISTERPRINTF("clIconOutboxItem");
00213                 gtk_content_list_item_set_icon_thumb(GTK_CONTENT_LIST_ITEM(listerItem), clOutboxIcon);
00214             }
00215             else if (items[index].iconID == clIconUrlDefined)
00216             {
00217                 CL_LISTERPRINTF("clIconUrlDefined");
00218                 gtk_content_list_item_set_thumb(GTK_CONTENT_LIST_ITEM(listerItem), items[index].clIconURL);
00219             }
00220             else if (   (items[index].iconID == clUnknownIcon)
00221                      && ((location = pm_getIcon(items[index].szFileExt)) != NULL) )
00222             {
00223                 CL_LISTERPRINTF("known extension => location");
00224                 gtk_content_list_item_set_thumb(GTK_CONTENT_LIST_ITEM(listerItem), location);
00225             }
00226             else
00227             {
00228                 gtk_content_list_item_set_icon_thumb(GTK_CONTENT_LIST_ITEM(listerItem), items[index].iconID);
00229             }
00230 
00231             // set cursor
00232             if (index == focus)
00233             {
00234                 CL_LISTERPRINTF("focus widget %d", focus);
00235                 //temp do update here until history story becomes clear in future releases
00236                 gtk_content_list_item_show_cursor(GTK_CONTENT_LIST_ITEM(listerItem), TRUE);
00237             }
00238             else
00239             {
00240                 gtk_content_list_item_show_cursor(GTK_CONTENT_LIST_ITEM(listerItem), FALSE);
00241             }
00242 
00243             gtk_widget_show(listerItem);
00244         }
00245         else
00246         {
00247             CL_LISTERPRINTF("hide and clear listerItem %p - index %d", listerItem, index);
00248             gtk_content_list_item_set_title(GTK_CONTENT_LIST_ITEM(listerItem), "");
00249             gtk_content_list_item_set_subtitle(GTK_CONTENT_LIST_ITEM(listerItem), "");
00250             gtk_content_list_item_set_description(GTK_CONTENT_LIST_ITEM(listerItem), "");
00251             gtk_content_list_item_set_information(GTK_CONTENT_LIST_ITEM(listerItem), "");        
00252             gtk_content_list_item_hide_thumb(GTK_CONTENT_LIST_ITEM(listerItem));
00253 
00254             gtk_widget_hide(listerItem);
00255         }
00256     }
00257 
00258     CL_SCREENPRINTF("");
00259     display_update_increase_level(LISTER_EXPOSE_LEVEL);
00260 }

Here is the call graph for this function:


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