Mercurial > projects > dwt2
comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/List.d @ 51:c01d033c633a
[swt lin]
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 27 Mar 2009 19:58:06 +0100 |
parents | 7a2dd761a8b2 |
children | b397a43d66d1 |
comparison
equal
deleted
inserted
replaced
50:d5075f5226e5 | 51:c01d033c633a |
---|---|
24 import org.eclipse.swt.widgets.TypedListener; | 24 import org.eclipse.swt.widgets.TypedListener; |
25 import org.eclipse.swt.widgets.Display; | 25 import org.eclipse.swt.widgets.Display; |
26 import java.lang.all; | 26 import java.lang.all; |
27 | 27 |
28 version(Tango){ | 28 version(Tango){ |
29 import tango.text.convert.Integer; | |
30 } else { // Phobos | 29 } else { // Phobos |
31 } | 30 } |
32 | 31 |
33 /** | 32 /** |
34 * Instances of this class represent a selectable user interface | 33 * Instances of this class represent a selectable user interface |
453 char* ptr; | 452 char* ptr; |
454 GtkTreeIter iter; | 453 GtkTreeIter iter; |
455 OS.gtk_tree_model_iter_nth_child (cast(GtkTreeStore*)modelHandle, &iter, null, index); | 454 OS.gtk_tree_model_iter_nth_child (cast(GtkTreeStore*)modelHandle, &iter, null, index); |
456 OS.gtk_tree_model_get1 (cast(GtkTreeStore*)modelHandle, &iter, 0, cast(void**)&ptr ); | 455 OS.gtk_tree_model_get1 (cast(GtkTreeStore*)modelHandle, &iter, 0, cast(void**)&ptr ); |
457 if (ptr is null) return null; | 456 if (ptr is null) return null; |
458 String res = fromStringz( ptr ).dup; | 457 String res = fromStringz( ptr )._idup(); |
459 OS.g_free (ptr); | 458 OS.g_free (ptr); |
460 return res; | 459 return res; |
461 } | 460 } |
462 | 461 |
463 /** | 462 /** |
528 GtkTreeIter iter; | 527 GtkTreeIter iter; |
529 for (int index=0; index<count; index++) { | 528 for (int index=0; index<count; index++) { |
530 OS.gtk_tree_model_iter_nth_child (cast(GtkTreeStore*)modelHandle, &iter, null, index); | 529 OS.gtk_tree_model_iter_nth_child (cast(GtkTreeStore*)modelHandle, &iter, null, index); |
531 OS.gtk_tree_model_get1 (cast(GtkTreeStore*)modelHandle, &iter, 0, cast(void**)&ptr); | 530 OS.gtk_tree_model_get1 (cast(GtkTreeStore*)modelHandle, &iter, 0, cast(void**)&ptr); |
532 if (ptr !is null) { | 531 if (ptr !is null) { |
533 String res = fromStringz( ptr ).dup; | 532 String res = fromStringz( ptr )._idup(); |
534 OS.g_free (ptr); | 533 OS.g_free (ptr); |
535 result [index] = res; | 534 result [index] = res; |
536 } | 535 } |
537 } | 536 } |
538 return result; | 537 return result; |
882 * </ul> | 881 * </ul> |
883 */ | 882 */ |
884 public bool isSelected (int index) { | 883 public bool isSelected (int index) { |
885 checkWidget(); | 884 checkWidget(); |
886 auto selection = OS.gtk_tree_view_get_selection (cast(GtkTreeView*)handle); | 885 auto selection = OS.gtk_tree_view_get_selection (cast(GtkTreeView*)handle); |
887 char* buffer = toStringz(tango.text.convert.Integer.toString(index)); | 886 char* buffer = toStringz(Integer.toString(index)); |
888 auto path = OS.gtk_tree_path_new_from_string (buffer); | 887 auto path = OS.gtk_tree_path_new_from_string (buffer); |
889 bool answer = cast(bool)OS.gtk_tree_selection_path_is_selected (selection, path); | 888 bool answer = cast(bool)OS.gtk_tree_selection_path_is_selected (selection, path); |
890 OS.gtk_tree_path_free (path); | 889 OS.gtk_tree_path_free (path); |
891 return answer; | 890 return answer; |
892 } | 891 } |