pcshareMgr/inc/view.h File Reference

view - GUI of the downloadManager application More...

#include <liberdm/display.h>

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

Go to the source code of this file.

Defines

#define VIEW_TEXT_SPACING   10
#define VIEW_MAX_INF0_STRING_SIZE   128
#define VIEW_MAX_PROGRESS_STRING_SIZE   128
#define VIEW_MAX_DOTS   5
#define HBOX_TEXT_BORDER   6
#define VBOX_SPACING   4
#define TEXT_BG_WIDTH   708
#define TEXT_BG_HEIGHT   56
#define INFO_TEXT_WIDTH   600
#define ERROR_BG_WIDTH   708
#define ERROR_BG_HEIGHT   115
#define ERRORICON_BG_WIDTH   91
#define ERRORICON_BG_HEIGHT   115
#define ERRORICON_IMG_WIDTH   69
#define ERRORICON_IMG_HEIGHT   93
#define ERRORCONFIRM_HEIGHT   23
#define ERRORTEXT_HEIGHT   (ERROR_BG_HEIGHT - ERRORCONFIRM_HEIGHT - 2*HBOX_TEXT_BORDER)
#define ERRORTEXT_WIDTH   (ERROR_BG_WIDTH - ERRORICON_BG_WIDTH - 3*HBOX_TEXT_BORDER)
#define ERRORCONFIRM_WIDTH   (ERRORTEXT_WIDTH - ERRORICON_BG_WIDTH - HBOX_TEXT_BORDER)
#define TEXT_BORDER_LEFT   ((SCREEN_WIDTH - TEXT_BG_WIDTH)/2)
#define TEXT_BORDER_RIGHT   (SCREEN_WIDTH - TEXT_BG_WIDTH - TEXT_BORDER_LEFT)
#define TEXT_BORDER_TOP   840
#define TEXT_BORDER_BOTTOM   0

Typedefs

typedef void on_error_confirmed_t (void)

Functions

void viewInit (GtkWidget *topLevelWindow)
void viewSetText (void)
void viewShowInfo (char *info)
void viewHideInfo (void)
void viewShowProgress (void)
void viewHideProgress (void)
void viewShowError (const char *msg)
void viewHideError (void)
void view_callback_on_error_confirmed (on_error_confirmed_t *callback)


Detailed Description

view - GUI of the downloadManager application

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

<File description>="">

Definition in file view.h.


Define Documentation

#define ERROR_BG_HEIGHT   115

Definition at line 55 of file view.h.

#define ERROR_BG_WIDTH   708

Definition at line 54 of file view.h.

#define ERRORCONFIRM_HEIGHT   23

Definition at line 63 of file view.h.

#define ERRORCONFIRM_WIDTH   (ERRORTEXT_WIDTH - ERRORICON_BG_WIDTH - HBOX_TEXT_BORDER)

Definition at line 66 of file view.h.

#define ERRORICON_BG_HEIGHT   115

Definition at line 58 of file view.h.

#define ERRORICON_BG_WIDTH   91

Definition at line 57 of file view.h.

#define ERRORICON_IMG_HEIGHT   93

Definition at line 61 of file view.h.

#define ERRORICON_IMG_WIDTH   69

Definition at line 60 of file view.h.

#define ERRORTEXT_HEIGHT   (ERROR_BG_HEIGHT - ERRORCONFIRM_HEIGHT - 2*HBOX_TEXT_BORDER)

Definition at line 64 of file view.h.

#define ERRORTEXT_WIDTH   (ERROR_BG_WIDTH - ERRORICON_BG_WIDTH - 3*HBOX_TEXT_BORDER)

Definition at line 65 of file view.h.

#define HBOX_TEXT_BORDER   6

Definition at line 42 of file view.h.

#define INFO_TEXT_WIDTH   600

Definition at line 51 of file view.h.

#define TEXT_BG_HEIGHT   56

Definition at line 49 of file view.h.

#define TEXT_BG_WIDTH   708

Definition at line 48 of file view.h.

#define TEXT_BORDER_BOTTOM   0

Definition at line 73 of file view.h.

#define TEXT_BORDER_LEFT   ((SCREEN_WIDTH - TEXT_BG_WIDTH)/2)

Definition at line 70 of file view.h.

#define TEXT_BORDER_RIGHT   (SCREEN_WIDTH - TEXT_BG_WIDTH - TEXT_BORDER_LEFT)

Definition at line 71 of file view.h.

#define TEXT_BORDER_TOP   840

Definition at line 72 of file view.h.

#define VBOX_SPACING   4

Definition at line 45 of file view.h.

#define VIEW_MAX_DOTS   5

Definition at line 39 of file view.h.

#define VIEW_MAX_INF0_STRING_SIZE   128

Definition at line 37 of file view.h.

#define VIEW_MAX_PROGRESS_STRING_SIZE   128

Definition at line 38 of file view.h.

#define VIEW_TEXT_SPACING   10

Definition at line 36 of file view.h.


Typedef Documentation

typedef void on_error_confirmed_t(void)

Definition at line 97 of file view.h.


Function Documentation

void view_callback_on_error_confirmed ( on_error_confirmed_t callback  ) 

Definition at line 320 of file view.c.

00321 {
00322     DL_LOGPRINTF("entry");
00323 
00324     g_on_error_confirmed = callback;
00325 }

void viewHideError ( void   ) 

Definition at line 284 of file view.c.

00285 {
00286     DL_LOGPRINTF("entry");
00287     gtk_label_set_text(GTK_LABEL(g_error_text), "");
00288 
00289     gtk_widget_hide(g_error_background);
00290     // display update implicit because main window gets fully exposed now
00291 }

void viewHideInfo ( void   ) 

Definition at line 220 of file view.c.

00221 {
00222     DL_LOGPRINTF("entry");
00223     gtk_label_set_text(GTK_LABEL(g_info), "");
00224 
00225     display_update_request_screen_refresh(TEXT_UPDATE_LEVEL, (gpointer) WAVEFORM_TYPING);
00226 }

Here is the call graph for this function:

void viewHideProgress ( void   ) 

Definition at line 254 of file view.c.

00255 {
00256     DL_LOGPRINTF("entry");
00257     g_progressCount = 1;
00258     gtk_label_set_text(GTK_LABEL(g_progress), "");
00259     display_update_request_screen_refresh(TEXT_UPDATE_LEVEL, (gpointer) WAVEFORM_TYPING);
00260 }

Here is the call graph for this function:

void viewInit ( GtkWidget *  topLevelWindow  ) 

Definition at line 78 of file view.c.

00079 {
00080     GtkWidget *hbox;
00081     GtkWidget *alignment;
00082     GtkWidget *vbox;
00083     GtkWidget *viewbackground;
00084     GtkWidget *textbackground;
00085     GtkWidget *error_vbox;
00086     GtkWidget *widget;
00087 
00088     DL_LOGPRINTF("entry");
00089 
00090     // viewbackground
00091     widget = gtk_event_box_new();
00092     gtk_widget_set_name(widget, "downloadMgr_background");
00093     gtk_container_add(GTK_CONTAINER(topLevelWindow), widget);
00094     viewbackground = widget;
00095     //     signal handlers
00096     g_signal_connect(G_OBJECT(viewbackground), "expose-event", G_CALLBACK(view_expose_event), NULL);
00097 
00098     // alignment
00099     widget = gtk_alignment_new(0, 0, 1, 1);
00100     gtk_alignment_set_padding(GTK_ALIGNMENT(widget), TEXT_BORDER_TOP, TEXT_BORDER_BOTTOM, TEXT_BORDER_LEFT, TEXT_BORDER_RIGHT);
00101     gtk_container_add(GTK_CONTAINER(viewbackground), widget);
00102     alignment = widget;
00103     
00104     // vbox
00105     vbox = gtk_vbox_new(FALSE, VBOX_SPACING);
00106     gtk_container_add(GTK_CONTAINER(alignment), vbox);
00107 
00108     // textbackground
00109     widget = gtk_event_box_new();
00110     gtk_widget_set_name(widget, "downloadMgr_textbackground");
00111     gtk_widget_set_size_request(widget, TEXT_BG_WIDTH, TEXT_BG_HEIGHT);
00112     gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);
00113     textbackground = widget;
00114 
00115     //     hbox
00116     hbox = gtk_hbox_new(FALSE, VIEW_TEXT_SPACING);
00117     gtk_widget_set_size_request(hbox, TEXT_BG_WIDTH, TEXT_BG_HEIGHT);
00118     gtk_container_set_border_width(GTK_CONTAINER(hbox), HBOX_TEXT_BORDER);
00119     gtk_container_add(GTK_CONTAINER(textbackground), hbox);
00120 
00121     //         g_info
00122     widget = gtk_label_new("");
00123     gtk_widget_set_name(widget, "downloadMgr_info_text");
00124     gtk_widget_set_size_request(widget, INFO_TEXT_WIDTH, (-1));
00125     gtk_label_set_ellipsize(GTK_LABEL(widget), PANGO_ELLIPSIZE_END);
00126     gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5);
00127     gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
00128     g_info = widget;
00129 
00130     //         g_progress
00131     widget = gtk_label_new("");
00132     gtk_widget_set_name(widget, "downloadMgr_progress_text");
00133     gtk_label_set_ellipsize(GTK_LABEL(widget), PANGO_ELLIPSIZE_END);
00134     gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5);
00135     gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0);
00136     g_progress = widget;
00137 
00138 
00139     // g_error_background
00140     widget = gtk_event_box_new();
00141     gtk_widget_set_name(widget, "downloadMgr_error_background");
00142     gtk_widget_set_size_request(widget, ERROR_BG_WIDTH, ERROR_BG_HEIGHT);
00143     gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);
00144     g_error_background = widget;
00145     //     signal handlers
00146     g_signal_connect(G_OBJECT(g_error_background), "button-press-event", G_CALLBACK(on_error_button_pressed), NULL);
00147 
00148     //     hbox
00149     hbox = gtk_hbox_new(FALSE, VIEW_TEXT_SPACING);
00150     gtk_container_set_border_width(GTK_CONTAINER(hbox), HBOX_TEXT_BORDER);
00151     gtk_container_add(GTK_CONTAINER(g_error_background), hbox);
00152 
00153     //     alignment
00154     widget = gtk_alignment_new(0.5, 0.5, 0, 0);
00155     gtk_widget_set_size_request(widget, ERRORICON_BG_WIDTH, ERRORICON_BG_HEIGHT);
00156     gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
00157     alignment = widget;
00158     
00159     //         g_error_icon
00160     widget = gtk_event_box_new();
00161     gtk_widget_set_name(widget, "downloadMgr_error_icon");
00162     gtk_widget_set_size_request(widget, ERRORICON_IMG_WIDTH, ERRORICON_IMG_HEIGHT);
00163     gtk_container_add(GTK_CONTAINER(alignment), widget);
00164     g_error_icon = widget;
00165 
00166     //     error_vbox
00167     widget = gtk_vbox_new(FALSE, 0);
00168     gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
00169     error_vbox = widget;
00170 
00171     //         g_error_text
00172     widget = gtk_label_new("");
00173     gtk_widget_set_name(widget, "downloadMgr_error_text");
00174     gtk_widget_set_size_request(widget, ERRORTEXT_WIDTH, ERRORTEXT_HEIGHT);
00175     gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.0);
00176     gtk_label_set_single_line_mode(GTK_LABEL(widget), FALSE);
00177     gtk_label_set_line_wrap(GTK_LABEL(widget), TRUE);
00178     gtk_box_pack_start(GTK_BOX(error_vbox), widget, FALSE, FALSE, 0);
00179     g_error_text = widget;
00180 
00181     //         hbox
00182     hbox = gtk_hbox_new(FALSE, 0);
00183     gtk_container_set_border_width(GTK_CONTAINER(hbox), 0);
00184     gtk_container_add(GTK_CONTAINER(error_vbox), hbox);
00185 
00186     //         g_error_confirm
00187     widget = gtk_label_new("");
00188     gtk_widget_set_name(widget, "downloadMgr_error_confirm");
00189     gtk_widget_set_size_request(widget, ERRORCONFIRM_WIDTH, -1);
00190     gtk_misc_set_alignment(GTK_MISC(widget), 0.5, 0.5);
00191     gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
00192     g_error_confirm = widget;
00193 
00194 
00195     // show download screen, but not yet the error section
00196     gtk_widget_show_all(viewbackground);
00197     gdk_flush();
00198     gtk_widget_hide(g_error_background);
00199 }

Here is the call graph for this function:

void viewSetText ( void   ) 

Definition at line 202 of file view.c.

00203 {
00204     gtk_label_set_text(GTK_LABEL(g_error_confirm), _("Please click here to confirm."));
00205 }

void viewShowError ( const char *  msg  ) 

Definition at line 269 of file view.c.

00270 {
00271     DL_LOGPRINTF("entry %s", (msg == NULL) ? "NULL" : msg);
00272 
00273     gtk_label_set_text(GTK_LABEL(g_error_text), msg);
00274 
00275     gtk_widget_show(g_error_background);
00276 
00277     // it's a weird world, but calling display_update_request_screen_refresh right now does not work
00278     // maybe this because it is called from the ecdcthread and objects are created in the main thread
00279     // anyway, adding a slight delay works fine and also separates the "downloading" display from the "error"
00280     g_timeout_add(1000, on_delayed_update_screen, 0);
00281 }

Here is the call graph for this function:

void viewShowInfo ( char *  info  ) 

Definition at line 209 of file view.c.

00210 {
00211     DL_LOGPRINTF("entry %s", (info == NULL) ? "NULL" : info);
00212 
00213     gtk_label_set_text(GTK_LABEL(g_info), info);
00214 
00215     gtk_widget_show(g_info);
00216     display_update_request_screen_refresh(TEXT_UPDATE_LEVEL, (gpointer) WAVEFORM_TYPING);
00217 }

Here is the call graph for this function:

void viewShowProgress ( void   ) 

Definition at line 229 of file view.c.

00230 {
00231     gchar text[10];
00232 
00233     DL_LOGPRINTF("entry %d", g_progressCount);
00234     
00235     memset(text, '+', g_progressCount);
00236     text[g_progressCount] = '\0';
00237 
00238     gtk_label_set_text(GTK_LABEL(g_progress), text);
00239     gtk_widget_show(g_progress);
00240 
00241     if (g_progressCount == VIEW_MAX_DOTS)
00242     {
00243         g_progressCount = 1;
00244     }
00245     else
00246     {
00247         g_progressCount++;
00248     }
00249 
00250     display_update_request_screen_refresh(TEXT_UPDATE_LEVEL, (gpointer) WAVEFORM_BW);
00251 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:16:50 2008 by  doxygen 1.5.6