summaryrefslogtreecommitdiff
path: root/iup/src/gtk/iupgtk_list.c
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2010-06-15 00:59:57 -0700
committerPixel <pixel@nobis-crew.org>2010-06-15 00:59:57 -0700
commiteed0eb6a476d54ce19aeff137984aa981d9e3976 (patch)
tree807891636efd2f87dcbd261e971216269973ae07 /iup/src/gtk/iupgtk_list.c
parentccc8261e4d48de89da4ddfe7b55e378ae0cd6f47 (diff)
Upgrading to iup 3.1
Diffstat (limited to 'iup/src/gtk/iupgtk_list.c')
-rwxr-xr-xiup/src/gtk/iupgtk_list.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/iup/src/gtk/iupgtk_list.c b/iup/src/gtk/iupgtk_list.c
index 80f6cce..48fa88e 100755
--- a/iup/src/gtk/iupgtk_list.c
+++ b/iup/src/gtk/iupgtk_list.c
@@ -113,6 +113,8 @@ void iupdrvListInsertItem(Ihandle* ih, int pos, const char* value)
GtkTreeIter iter;
gtk_list_store_insert(GTK_LIST_STORE(model), &iter, pos);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, iupgtkStrConvertToUTF8(value), -1);
+
+ iupListUpdateOldValue(ih, pos, 0);
}
void iupdrvListRemoveItem(Ihandle* ih, int pos)
@@ -127,14 +129,24 @@ void iupdrvListRemoveItem(Ihandle* ih, int pos)
int curpos = gtk_combo_box_get_active((GtkComboBox*)ih->handle);
if (pos == curpos)
{
- if (curpos > 0) curpos--;
- else curpos++;
+ if (curpos > 0)
+ curpos--;
+ else
+ {
+ curpos=1;
+ if (iupdrvListGetCount(ih)==1)
+ curpos = -1; /* remove the selection */
+ }
+ g_signal_handlers_block_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkListComboBoxChanged), ih);
gtk_combo_box_set_active((GtkComboBox*)ih->handle, curpos);
+ g_signal_handlers_unblock_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkListComboBoxChanged), ih);
}
}
gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
+
+ iupListUpdateOldValue(ih, pos, 1);
}
}
@@ -177,7 +189,7 @@ static int gtkListSetStandardFontAttrib(Ihandle* ih, const char* value)
static char* gtkListGetIdValueAttrib(Ihandle* ih, const char* name_id)
{
int pos = iupListGetPos(ih, name_id);
- if (pos != -1)
+ if (pos >= 0)
{
GtkTreeIter iter;
GtkTreeModel* model = gtkListGetModel(ih);
@@ -349,7 +361,7 @@ static int gtkListSetValueAttrib(Ihandle* ih, const char* value)
GtkTreeModel *model = gtkListGetModel(ih);
g_signal_handlers_block_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkListComboBoxChanged), ih);
if (iupStrToInt(value, &pos)==1 &&
- (pos>0 && pos<gtk_tree_model_iter_n_children(model, NULL)))
+ (pos>0 && pos<=gtk_tree_model_iter_n_children(model, NULL)))
{
gtk_combo_box_set_active((GtkComboBox*)ih->handle, pos-1); /* IUP starts at 1 */
iupAttribSetInt(ih, "_IUPLIST_OLDVALUE", pos);
@@ -788,9 +800,10 @@ static int gtkListSetNCAttrib(Ihandle* ih, const char* value)
{
GtkEntry* entry = (GtkEntry*)iupAttribGet(ih, "_IUPGTK_ENTRY");
gtk_entry_set_max_length(entry, ih->data->nc);
+ return 0;
}
-
- return 0;
+ else
+ return 1; /* store until not mapped, when mapped will be set again */
}
static int gtkListSetClipboardAttrib(Ihandle *ih, const char *value)
@@ -1364,9 +1377,9 @@ static int gtkListMapMethod(Ihandle* ih)
if (!ih->data->has_editbox && ih->data->is_multiple)
{
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
-#if GTK_CHECK_VERSION(2, 10, 0)
+ #if GTK_CHECK_VERSION(2, 10, 0)
gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(ih->handle), TRUE);
-#endif
+ #endif
}
else
gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);