| 1 /* |
|
| 2 * GNT - The GLib Ncurses Toolkit |
|
| 3 * |
|
| 4 * GNT is the legal property of its developers, whose names are too numerous |
|
| 5 * to list here. Please refer to the COPYRIGHT file distributed with this |
|
| 6 * source distribution. |
|
| 7 * |
|
| 8 * This library is free software; you can redistribute it and/or modify |
|
| 9 * it under the terms of the GNU General Public License as published by |
|
| 10 * the Free Software Foundation; either version 2 of the License, or |
|
| 11 * (at your option) any later version. |
|
| 12 * |
|
| 13 * This program is distributed in the hope that it will be useful, |
|
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 * GNU General Public License for more details. |
|
| 17 * |
|
| 18 * You should have received a copy of the GNU General Public License |
|
| 19 * along with this program; if not, write to the Free Software |
|
| 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
| 21 */ |
|
| 22 |
|
| 23 #include "gnt-skel.h" |
|
| 24 |
|
| 25 enum |
|
| 26 { |
|
| 27 SIGS = 1, |
|
| 28 }; |
|
| 29 |
|
| 30 static GntWidgetClass *parent_class = NULL; |
|
| 31 static guint signals[SIGS] = { 0 }; |
|
| 32 |
|
| 33 static void |
|
| 34 gnt_skel_draw(GntWidget *widget) |
|
| 35 { |
|
| 36 GNTDEBUG; |
|
| 37 } |
|
| 38 |
|
| 39 static void |
|
| 40 gnt_skel_size_request(GntWidget *widget) |
|
| 41 { |
|
| 42 } |
|
| 43 |
|
| 44 static void |
|
| 45 gnt_skel_map(GntWidget *widget) |
|
| 46 { |
|
| 47 if (widget->priv.width == 0 || widget->priv.height == 0) |
|
| 48 gnt_widget_size_request(widget); |
|
| 49 GNTDEBUG; |
|
| 50 } |
|
| 51 |
|
| 52 static gboolean |
|
| 53 gnt_skel_key_pressed(GntWidget *widget, const char *text) |
|
| 54 { |
|
| 55 return FALSE; |
|
| 56 } |
|
| 57 |
|
| 58 static void |
|
| 59 gnt_skel_destroy(GntWidget *widget) |
|
| 60 { |
|
| 61 } |
|
| 62 |
|
| 63 static void |
|
| 64 gnt_skel_class_init(GntSkelClass *klass) |
|
| 65 { |
|
| 66 GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
| 67 |
|
| 68 parent_class = GNT_WIDGET_CLASS(klass); |
|
| 69 parent_class->destroy = gnt_skel_destroy; |
|
| 70 parent_class->draw = gnt_skel_draw; |
|
| 71 parent_class->map = gnt_skel_map; |
|
| 72 parent_class->size_request = gnt_skel_size_request; |
|
| 73 parent_class->key_pressed = gnt_skel_key_pressed; |
|
| 74 |
|
| 75 parent_class->actions = gnt_hash_table_duplicate(parent_class->actions, g_str_hash, |
|
| 76 g_str_equal, NULL, (GDestroyNotify)gnt_widget_action_free); |
|
| 77 parent_class->bindings = gnt_hash_table_duplicate(parent_class->bindings, g_str_hash, |
|
| 78 g_str_equal, NULL, (GDestroyNotify)gnt_widget_action_param_free); |
|
| 79 |
|
| 80 gnt_widget_actions_read(G_OBJECT_CLASS_TYPE(klass), klass); |
|
| 81 |
|
| 82 GNTDEBUG; |
|
| 83 } |
|
| 84 |
|
| 85 static void |
|
| 86 gnt_skel_init(GTypeInstance *instance, gpointer class) |
|
| 87 { |
|
| 88 GNTDEBUG; |
|
| 89 } |
|
| 90 |
|
| 91 /****************************************************************************** |
|
| 92 * GntSkel API |
|
| 93 *****************************************************************************/ |
|
| 94 GType |
|
| 95 gnt_skel_get_type(void) |
|
| 96 { |
|
| 97 static GType type = 0; |
|
| 98 |
|
| 99 if(type == 0) |
|
| 100 { |
|
| 101 static const GTypeInfo info = { |
|
| 102 sizeof(GntSkelClass), |
|
| 103 NULL, /* base_init */ |
|
| 104 NULL, /* base_finalize */ |
|
| 105 (GClassInitFunc)gnt_skel_class_init, |
|
| 106 NULL, /* class_finalize */ |
|
| 107 NULL, /* class_data */ |
|
| 108 sizeof(GntSkel), |
|
| 109 0, /* n_preallocs */ |
|
| 110 gnt_skel_init, /* instance_init */ |
|
| 111 }; |
|
| 112 |
|
| 113 type = g_type_register_static(GNT_TYPE_WIDGET, |
|
| 114 "GntSkel", |
|
| 115 &info, 0); |
|
| 116 } |
|
| 117 |
|
| 118 return type; |
|
| 119 } |
|
| 120 |
|
| 121 GntWidget *gnt_skel_new() |
|
| 122 { |
|
| 123 GntWidget *widget = g_object_new(GNT_TYPE_SKEL, NULL); |
|
| 124 GntSkel *skel = GNT_SKEL(widget); |
|
| 125 |
|
| 126 return widget; |
|
| 127 } |
|
| 128 |
|