screen_utils.c

Go to the documentation of this file.
00001 /*
00002  * File Name: screen_utils.c
00003  */
00004 
00005 /*
00006  * This file is part of hello-world-settings.
00007  *
00008  * hello-world is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * hello-world is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 /**
00023  * Copyright (C) 2009 iRex Technologies B.V.
00024  * All rights reserved.
00025  */
00026 
00027 //----------------------------------------------------------------------------
00028 // Include Files
00029 //----------------------------------------------------------------------------
00030 
00031 #include "config.h"
00032 
00033 // system include files, between < >
00034 #include <glib.h>
00035 #include <gtk/gtk.h>
00036 #include <signal.h>
00037 #include <string.h>
00038 #include <stdlib.h>
00039 #include <sys/types.h>
00040 #include <unistd.h>
00041 
00042 // ereader include files, between < >
00043 #include <libergtk/ergtk.h>
00044 
00045 // local include files, between " "
00046 #include "log.h"
00047 #include "i18n.h"
00048 #include "screen_utils.h"
00049 
00050 
00051 //----------------------------------------------------------------------------
00052 // Type Declarations
00053 //----------------------------------------------------------------------------
00054 
00055 
00056 //----------------------------------------------------------------------------
00057 // Constants
00058 //----------------------------------------------------------------------------
00059 
00060 // screen layout
00061 #define TITLE_SEPARATOR_HEIGHT          20
00062 #define TITLE_SEPARATOR_V_SPACING       10
00063 #define ITEM_SEPARATOR_HEIGHT           10
00064 
00065 
00066 //----------------------------------------------------------------------------
00067 // Static Variables
00068 //----------------------------------------------------------------------------
00069 
00070 
00071 //============================================================================
00072 // Local Function Definitions
00073 //============================================================================
00074 
00075 // signal handlers
00076 
00077 //============================================================================
00078 // Functions Implementation
00079 //============================================================================
00080 
00081 // create main screen title
00082 GtkWidget *create_screen_title (GtkWidget **p_title)
00083 {
00084     GtkWidget   *background = NULL;     // return value
00085     GtkWidget   *widget;
00086     GtkWidget   **p_widget;
00087     GtkBox      *vbox;
00088 
00089     LOGPRINTF("entry");
00090 
00091     // object hierarchy:
00092     //     background (vbox)
00093     //       |
00094     widget = gtk_vbox_new(FALSE, 0);
00095     gtk_container_add(GTK_CONTAINER(background), widget);
00096     gtk_widget_show(widget);
00097     vbox = GTK_BOX(widget);
00098     background = widget;
00099     //       |
00100     //       |-- title (label)
00101     //       |
00102     p_widget = p_title;
00103     widget = gtk_label_new(NULL);
00104     gtk_widget_set_name(widget, "irex-hello-title");
00105     gtk_box_pack_start(vbox, widget, FALSE, FALSE, 0);
00106     gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5);
00107     if (p_widget)
00108     {
00109         g_signal_connect(widget, "destroy", G_CALLBACK(gtk_widget_destroyed), p_widget);
00110         gtk_widget_show(widget);
00111         g_assert(*p_widget == NULL);
00112         *p_widget = widget;
00113     }
00114     //       |
00115     //       |-- separator (event box)
00116     //       |
00117     widget = gtk_event_box_new();
00118     gtk_widget_set_name(widget, "irex-hello-title-separator");
00119     gtk_widget_set_size_request(widget, -1, TITLE_SEPARATOR_HEIGHT);
00120     gtk_box_pack_start(vbox, widget, FALSE, FALSE, TITLE_SEPARATOR_V_SPACING);
00121     gtk_widget_show(widget);
00122     
00123     return background;
00124 }
00125 
00126 
00127 // create separator between entry fields
00128 GtkWidget* create_separator (void)
00129 {
00130     GtkWidget   *widget = NULL;    // return value
00131 
00132     LOGPRINTF("entry");
00133 
00134     widget = gtk_event_box_new();
00135     gtk_widget_set_name(widget, "irex-hello-item-separator");
00136     gtk_widget_set_size_request(widget, -1, ITEM_SEPARATOR_HEIGHT);
00137     gtk_widget_show(widget);
00138 
00139     return widget;
00140 }
00141 
Generated by  doxygen 1.6.2-20100208