settings/src/gtkSettingItem.c File Reference

setup application - empty setup item containing a header label and some item information text. <File description>=""> More...

#include <gtk/gtk.h>
#include <liberdm/display.h>
#include "setupLog.h"
#include "background.h"
#include "gtkSettingItem.h"

Go to the source code of this file.

Functions

static void gtk_settingitem_class_init (GtkSettingItemClass *klass)
static void gtk_settingitem_init (GtkSettingItem *settingitem)
GtkWidget * gtk_settingitem_new (gchar *headerlabel)
GType gtk_settingitem_get_type (void)
void gtk_settingitem_set_info_text (GtkSettingItem *settingitem, gchar *infotext)
void gtk_settingitem_set_header_text (GtkSettingItem *settingitem, gchar *headertext)
void gtk_settingitem_add_details (GtkSettingItem *settingitem, GtkWidget *details)


Detailed Description

setup application - empty setup item containing a header label and some item information text. <File description>="">

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

Definition in file gtkSettingItem.c.


Function Documentation

void gtk_settingitem_add_details ( GtkSettingItem settingitem,
GtkWidget *  details 
)

Definition at line 177 of file gtkSettingItem.c.

00178 {
00179     g_return_if_fail(IS_GTK_SETTINGITEM(settingitem));
00180 
00181     if (details)
00182     {
00183         ST_LOGPRINTF("add 0x%x", (int)details);
00184         gtk_container_add(GTK_CONTAINER(settingitem->clientArea), details);
00185     }
00186 }

static void gtk_settingitem_class_init ( GtkSettingItemClass klass  )  [static]

Definition at line 86 of file gtkSettingItem.c.

00087 {
00088     // nothing needs to be done here 
00089 }

GType gtk_settingitem_get_type ( void   ) 

Definition at line 62 of file gtkSettingItem.c.

00063 {
00064     static GType settingitem_type = 0;
00065 
00066     if (!settingitem_type)
00067     {
00068         static const GTypeInfo settingitem_info = {
00069             sizeof(GtkSettingItemClass),
00070             NULL,               /* base_init */
00071             NULL,               /* base_finalize */
00072             (GClassInitFunc) gtk_settingitem_class_init,
00073             NULL,               /* class_finalize */
00074             NULL,               /* class_data */
00075             sizeof(GtkSettingItem),
00076             0,                  /* n_preallocs */
00077             (GInstanceInitFunc) gtk_settingitem_init,
00078         };
00079 
00080         settingitem_type = g_type_register_static(GTK_TYPE_EVENT_BOX, "SettingItem", &settingitem_info, 0);
00081     }
00082     return settingitem_type;
00083 }

Here is the call graph for this function:

static void gtk_settingitem_init ( GtkSettingItem settingitem  )  [static]

Definition at line 101 of file gtkSettingItem.c.

00102 {
00103     GtkWidget *vbox;
00104     GtkWidget *header_background;
00105 
00106     gtk_widget_set_name(GTK_WIDGET(settingitem), "settingitem_background");
00107     
00108     
00109     // create (not homogenous) vbox to layout the header label and the rest of the setting item
00110     vbox = gtk_vbox_new(FALSE, SETTINGITEM_ITEM_SPACING);
00111     gtk_container_add(GTK_CONTAINER(settingitem), vbox);
00112 
00113     header_background = gtk_event_box_new();
00114     gtk_widget_set_size_request(GTK_WIDGET(header_background), SETTING_TITLE_MIN_WIDTH, SETTING_TITLE_MIN_HEIGHT);
00115     gtk_widget_set_name(GTK_WIDGET(header_background), "settingitem_headerbackground");
00116     gtk_box_pack_start(GTK_BOX(vbox), header_background, FALSE, FALSE, 0);
00117 
00118     // create header label 
00119     settingitem->headerlabel = gtk_label_new("");
00120     gtk_widget_set_name(GTK_WIDGET(settingitem->headerlabel), "settingitem_header");
00121     gtk_misc_set_alignment(GTK_MISC(settingitem->headerlabel), 0.03, 0.5);
00122     gtk_label_set_ellipsize(GTK_LABEL(settingitem->headerlabel), PANGO_ELLIPSIZE_END);
00123     gtk_label_set_justify(GTK_LABEL(settingitem->headerlabel), GTK_JUSTIFY_LEFT);
00124     gtk_container_add(GTK_CONTAINER(header_background), settingitem->headerlabel);
00125 
00126     // create info label
00127     settingitem->infolabel = gtk_label_new("");
00128     gtk_widget_set_size_request(GTK_WIDGET(settingitem->infolabel), TITLE_MIN_WIDTH, -1 );
00129     gtk_widget_set_name(GTK_WIDGET(settingitem->infolabel), "settingitem_infotext");
00130     gtk_misc_set_alignment(GTK_MISC(settingitem->infolabel), 0.03, 0.5);
00131     // gtk_label_set_ellipsize(GTK_LABEL(settingitem->infolabel), PANGO_ELLIPSIZE_END);
00132     gtk_label_set_justify(GTK_LABEL(settingitem->infolabel), GTK_JUSTIFY_LEFT);
00133     gtk_label_set_single_line_mode(GTK_LABEL(settingitem->infolabel), FALSE);
00134     gtk_label_set_line_wrap(GTK_LABEL(settingitem->infolabel), TRUE);
00135     gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(settingitem->infolabel), FALSE, FALSE, 0);
00136 
00137     // create client area
00138     settingitem->clientArea = gtk_event_box_new();
00139     gtk_widget_set_name(GTK_WIDGET(settingitem->clientArea), "settingitem_clientArea_background");
00140     gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(settingitem->clientArea), TRUE, TRUE, 0);
00141 
00142     gtk_widget_show_all(vbox);
00143 
00144     // only show this widget when there is info text available
00145     gtk_widget_hide(settingitem->infolabel);
00146 }

GtkWidget* gtk_settingitem_new ( gchar *  headerlabel  ) 

Definition at line 45 of file gtkSettingItem.c.

00046 {
00047     GtkSettingItem *settingItem;
00048 
00049     settingItem = (GtkSettingItem *) g_object_new(GTK_SETTINGITEM_TYPE, NULL);
00050 
00051     // set string values and init data fields
00052 
00053     if (headerlabel)
00054     {
00055         ST_LOGPRINTF("headerlabel %s", headerlabel);
00056         gtk_label_set_text(GTK_LABEL(settingItem->headerlabel), headerlabel);
00057     }
00058     return GTK_WIDGET(settingItem);
00059 }

void gtk_settingitem_set_header_text ( GtkSettingItem settingitem,
gchar *  headertext 
)

Definition at line 164 of file gtkSettingItem.c.

00165 {
00166     g_return_if_fail(IS_GTK_SETTINGITEM(settingitem));
00167 
00168     if (headertext)
00169     {
00170         ST_LOGPRINTF("headerlabel %s", headertext);
00171         gtk_label_set_text(GTK_LABEL(settingitem->headerlabel), headertext);
00172     }
00173 }

void gtk_settingitem_set_info_text ( GtkSettingItem settingitem,
gchar *  infotext 
)

Definition at line 150 of file gtkSettingItem.c.

00151 {
00152     g_return_if_fail(IS_GTK_SETTINGITEM(settingitem));
00153 
00154     if (infotext)
00155     {
00156         ST_LOGPRINTF("infolabel %s", infotext);
00157         gtk_label_set_text(GTK_LABEL(settingitem->infolabel), infotext);
00158         gtk_widget_show(settingitem->infolabel);
00159     }
00160 }


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