📄 gemhashviewcell.c.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 <glib.h>#include <gtk/gtk.h>#include "gemhashviewcell.h"typedef struct _GemHashViewCellPriv GemHashViewCellPriv;struct _GemHashViewCellPriv{ gboolean editable; gboolean visible;};#define GEM_HASH_VIEW_CELL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \ GEM_TYPE_HASH_VIEW_CELL, \ GemHashViewCellPriv));static void gem_hash_view_cell_class_init (GemHashViewCellClass *klass);static void gem_hash_view_cell_init (GemHashViewCell *cell);static void gem_hash_view_cell_finailze (GObject *object);static GtkViewportClass * parent_class = NULL;GTypegem_hash_view_cell_get_type (void){ static GType cell_type = 0; if (!cell_type) { static const GTypeInfo cell_info = { sizeof (GemHashViewCellClass), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc) gem_hash_view_cell_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (GemHashViewCell), 0, /* n_preallocs */ (GInstanceInitFunc) gem_hash_view_cell_init, NULL, }; cell_type = g_type_register_static(GTK_TYPE_VIEWPORT, "GemHashViewCell", &cell_info, 0); } return cell_type;}static voidgem_hash_view_cell_class_init (GemHashViewCellClass * klass){ GObjectClass *object_class = G_OBJECT_CLASS(klass); parent_class = g_type_class_peek_parent (klass); g_type_class_add_private(klass, sizeof(GemHashViewCellPriv)); object_class->finalize = gem_hash_view_cell_finailze; return;}static voidgem_hash_view_cell_finailze (GObject *object){ G_OBJECT_CLASS(parent_class)->finalize(object); return;}static voidgem_hash_view_cell_init (GemHashViewCell * cell){ GemHashViewCellPriv * priv = GEM_HASH_VIEW_CELL_GET_PRIVATE(cell); priv->editable = TRUE; priv->visible = TRUE; if (TRUE) { GdkColor color; gdk_color_parse("white", &color); gtk_widget_modify_bg(GTK_WIDGET(cell), GTK_STATE_NORMAL, &color); } gtk_viewport_set_shadow_type(GTK_VIEWPORT(cell), GTK_SHADOW_NONE); return;}GtkWidget *gem_hash_view_cell_new (void){ return gtk_widget_new(GEM_TYPE_HASH_VIEW_CELL, NULL);}G_CONST_RETURN gchar *gem_hash_view_cell_get_value (GemHashViewCell * cell){ GemHashViewCellClass * klass = GEM_HASH_VIEW_CELL_GET_CLASS(cell); if (klass->get_value) { return klass->get_value(cell); } return NULL;}voidgem_hash_view_cell_set_value (GemHashViewCell *cell, const gchar *val){ GemHashViewCellClass *klass = GEM_HASH_VIEW_CELL_GET_CLASS(cell); if (klass->set_value) { klass->set_value(cell, val); } return;}gbooleangem_hash_view_cell_get_visible (GemHashViewCell * cell){ GemHashViewCellPriv * priv = GEM_HASH_VIEW_CELL_GET_PRIVATE(cell); return priv->visible; }voidgem_hash_view_cell_set_visible (GemHashViewCell *cell, gboolean visible){ GemHashViewCellPriv *priv = GEM_HASH_VIEW_CELL_GET_PRIVATE(cell); priv->visible = visible; return;} gboolean gem_hash_view_cell_get_editable (GemHashViewCell * cell){ GemHashViewCellClass * klass = GEM_HASH_VIEW_CELL_GET_CLASS(cell); GemHashViewCellPriv * priv = GEM_HASH_VIEW_CELL_GET_PRIVATE(cell); if (klass->get_editable) { return klass->get_editable(cell); } return priv->editable;}voidgem_hash_view_cell_set_editable (GemHashViewCell *cell, gboolean editable){ GemHashViewCellClass * klass = GEM_HASH_VIEW_CELL_GET_CLASS(cell); GemHashViewCellPriv * priv = GEM_HASH_VIEW_CELL_GET_PRIVATE(cell); if (klass->set_editable) { klass->set_editable(cell, editable); } priv->editable = editable; return;}voidgem_hash_view_cell_set_focus (GemHashViewCell * cell){ GemHashViewCellClass * klass = GEM_HASH_VIEW_CELL_GET_CLASS(cell); if (klass->set_focus) { klass->set_focus(cell); } return;} /*vi:ts=2:nowrap:ai:expandtab */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -