⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gemhashviewcellimg.c.svn-base

📁 一款Linux手机上应用的文件管理器 系统要求就安装Gtk+2.0
💻 SVN-BASE
字号:
/*	libgemwidget - Gtk+ Embedded Widget library * *	Authors: YE Nan <nan.ye@orange-ftgourp.com>  *	 *	This software and associated documentation files (the "Software")  *	are copyright (C) 2005 LiPS Linux Phone Standards Forum [FranceTelecom]  *	All Rights Reserved.  * *	A copyright license is hereby granted for redistribution and use of  *	the Software in source and binary forms, with or without modification,  *	provided that the following conditions are met:  *	- Redistributions of source code must retain the above copyright notice,  *	this copyright license and the following disclaimer.  *  - Redistributions in binary form must reproduce the above copyright  * 	notice, this copyright license and the following disclaimer in the  *	documentation and/or other materials provided with the distribution.  *	- Neither the name of LiPS  nor the names of its Members may be used  *	to endorse or promote products derived from the Software without  *	specific prior written permission.  * *	A patent license for any Necessary Claims owned by Members of LiPS Forum  *	to make, have made, use, import, offer to sell, lease and sell or otherwise  *	distribute any implementation compliant with the any specification adopted  *	by the LiPS Forumcan be obtained from the respective Members on reasonable  *	and non-discriminatory terms and conditions and under reciprocity, as  *	regulated in more detail in the Internal Policy of the LiPS Forum.  * *	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER, ITS MEMBERS AND CONTRIBUTORS  *	"AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,  *	THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE  *	AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER,  *	ITS MEMBERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  *	PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;  *	OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  *	WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)  *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE  *	POSSIBILITY OF SUCH DAMAGE.  */#include <stdio.h>#include <stdlib.h>#include <gtk/gtk.h>#include "gemhashviewcell.h"#include "gemhashviewcellimg.h"#include "gemresource.h"#include "gemenv.h"static void											gem_hash_view_cell_image_class_init		(GemHashViewCellImageClass	*klass);static void											gem_hash_view_cell_image_init					(GemHashViewCellImage				*view);static void											gem_hash_view_cell_image_finalize			(GObject									*object);static void											gem_hash_view_cell_image_set_value		(GemHashViewCell						*cell,																																			 const gchar							*val);static G_CONST_RETURN	gchar *		gem_hash_view_cell_image_get_value		(GemHashViewCell						*cell);static GemHashViewCellStdClass * parent_class = NULL;GTypegem_hash_view_cell_image_get_type (void){	static GType cell_type = 0;  if (!cell_type)	{		static const GTypeInfo cell_info =		{			sizeof (GemHashViewCellImageClass),			NULL,		/* base_init */			NULL,		/* base_finalize */			(GClassInitFunc) gem_hash_view_cell_image_class_init,			NULL,		/* class_finalize */			NULL,		/* class_data */			sizeof (GemHashViewCellImage),			0,			/* n_preallocs */			(GInstanceInitFunc) gem_hash_view_cell_image_init,			NULL,		};		cell_type = g_type_register_static(GEM_TYPE_HASH_VIEW_CELL_STD,																			 "GemHashViewCellImage",																			 &cell_info,																			 0);	}	return cell_type;}static voidgem_hash_view_cell_image_class_init (GemHashViewCellImageClass	*klass){	GObjectClass *object_class = G_OBJECT_CLASS(klass);	GemHashViewCellClass *cell_class = GEM_HASH_VIEW_CELL_CLASS(klass);  parent_class = g_type_class_peek_parent(klass);	object_class->finalize = gem_hash_view_cell_image_finalize;	cell_class->set_value = gem_hash_view_cell_image_set_value;	cell_class->get_value = gem_hash_view_cell_image_get_value;	return;}static voidgem_hash_view_cell_image_finalize (GObject *object){  G_OBJECT_CLASS(parent_class)->finalize(object);    return;}static gboolean gem_hash_view_cell_image_entry_focus_out_cb (GtkWidget					*widget,																						 GdkEventFocus			*event,																						 gpointer						 user_data){	GemHashViewCellStd *cell_std = GEM_HASH_VIEW_CELL_STD(user_data);	GemHashViewCellImage *cell_image = GEM_HASH_VIEW_CELL_IMAGE(user_data);		if (cell_image->image)	{		GdkPixbuf * pixbuf = NULL;		gchar * picpath = NULL;				picpath = g_build_filename(gem_env_get_resource_path(),															 "pixmaps",															 gtk_entry_get_text(GTK_ENTRY(cell_std->entry)),															 NULL);															 		if (gem_resource_load_pic(picpath,															GEM_PIC_LARGE) == TRUE)		{			pixbuf = gem_resource_find_pic(picpath,																		 GEM_PIC_LARGE);		}				gtk_image_set_from_pixbuf(GTK_IMAGE(cell_image->image),															pixbuf);				g_free(picpath);	}		return FALSE;	}static voidgem_hash_view_cell_image_init (GemHashViewCellImage * cell){	cell->image = NULL;		g_signal_connect(G_OBJECT(GEM_HASH_VIEW_CELL_STD(cell)->entry), 									 "focus-out-event",									 G_CALLBACK(gem_hash_view_cell_image_entry_focus_out_cb),									 (gpointer)cell);	return;}/** * gem_hash_view_cell_image_new: *  * @label:		label text of #GemHashViewCellImage cell *  * Creates a new #GemHashViewCellImage widget. **/GtkWidget *gem_hash_view_cell_image_new (const gchar * label){  GtkWidget * widget = NULL;    widget = gtk_widget_new(GEM_TYPE_HASH_VIEW_CELL_IMAGE,  												NULL);	if (label)	{		GemHashViewCellStd * cell = GEM_HASH_VIEW_CELL_STD(widget);				gtk_label_set_markup(GTK_LABEL(cell->label),												 label);	}  												  return widget; }static voidgem_hash_view_cell_image_set_value (GemHashViewCell	*cell,																		const gchar		*val){	GemHashViewCellStd * cell_std = GEM_HASH_VIEW_CELL_STD(cell);	GemHashViewCellImage * cell_image = GEM_HASH_VIEW_CELL_IMAGE(cell);		g_print("%s(): entering, [%s]\n",					__FUNCTION__,					val);						gtk_entry_set_text(GTK_ENTRY(cell_std->entry), val);		if (cell_image->image)	{		GdkPixbuf * pixbuf = NULL;		gchar * picpath = NULL;				picpath = g_build_filename(gem_env_get_resource_path(),															 "pixmaps",															 gtk_entry_get_text(GTK_ENTRY(cell_std->entry)),															 NULL);															 		if (gem_resource_load_pic(picpath,															GEM_PIC_LARGE) == TRUE)		{			pixbuf = gem_resource_find_pic(picpath,																		 GEM_PIC_LARGE);		}				gtk_image_set_from_pixbuf(GTK_IMAGE(cell_image->image),															pixbuf);				g_free(picpath);	}		return;}static G_CONST_RETURN	gchar *gem_hash_view_cell_image_get_value (GemHashViewCell * cell){	GemHashViewCellStd * cell_std = GEM_HASH_VIEW_CELL_STD(cell);	const gchar * value = NULL;		value = gtk_entry_get_text(GTK_ENTRY(cell_std->entry));		return value;}/** * gem_hash_view_cell_image_set_buddy: *  * @cell:			a #GemHashViewCellImage instance * @buddy:		a #GtkImage widget *  * Sets the buddy of the cell. The buddy #GtkImage widget will be * updated when the content of cell is changed. *  * Return value:	Original buddy #GtkImage widget of the cell. **/GtkImage	*				gem_hash_view_cell_image_set_buddy (GemHashViewCellImage		*cell,																		GtkImage								*buddy){	GtkImage * old_image = NULL;		g_return_val_if_fail(GTK_IS_IMAGE(buddy), NULL);		if (cell->image)	{		old_image = GTK_IMAGE(cell->image);	}		cell->image = GTK_WIDGET(buddy);		return old_image;}/** * gem_hash_view_cell_image_get_buddy: *  * @cell:			a #GemHashViewCellImage instance *  * Retrieves current buddy of the cell.  *  * Return value:	Current buddy #GtkImage widget of the cell. **/GtkImage *gem_hash_view_cell_image_get_buddy (GemHashViewCellImage		*cell){	return GTK_IMAGE(cell->image);}/*vi:ts=2:nowrap:ai:expandtab */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -