gtk-sharp [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4] Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. Gtk.Container Gtk.CellLayout Gtk.Scrollable A widget which displays a list of icons in a grid provides an alternative view on a list model. It displays the model as a grid of icons with labels. Like , it allows to select one or multiple items (depending on the selection mode, see ). In addition to selection with the arrow keys, supports rubberband selection, which is controlled by dragging the pointer. using System; using System.IO; using Gtk; public class DemoIconView : Window { const int COL_PATH = 0; const int COL_DISPLAY_NAME = 1; const int COL_PIXBUF = 2; const int COL_IS_DIRECTORY = 3; DirectoryInfo parent = new DirectoryInfo ("/"); Gdk.Pixbuf dirIcon, fileIcon; ListStore store; ToolButton upButton; static void Main () { Application.Init (); new DemoIconView (); Application.Run (); } public DemoIconView () : base ("Gtk.IconView demo") { SetDefaultSize (650, 400); DeleteEvent += new DeleteEventHandler (OnWinDelete); VBox vbox = new VBox (false, 0); Add (vbox); Toolbar toolbar = new Toolbar (); vbox.PackStart (toolbar, false, false, 0); upButton = new ToolButton (Stock.GoUp); upButton.IsImportant = true; upButton.Sensitive = false; toolbar.Insert (upButton, -1); ToolButton homeButton = new ToolButton (Stock.Home); homeButton.IsImportant = true; toolbar.Insert (homeButton, -1); fileIcon = GetIcon ("gnome-fs-regular"); dirIcon = GetIcon ("gnome-fs-directory"); ScrolledWindow sw = new ScrolledWindow (); sw.ShadowType = ShadowType.EtchedIn; sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); vbox.PackStart (sw, true, true, 0); // Create the store and fill it with the contents of '/' store = CreateStore (); FillStore (); IconView iconView = new IconView (store); iconView.SelectionMode = SelectionMode.Multiple; upButton.Clicked += OnUpClicked; homeButton.Clicked += OnHomeClicked; iconView.TextColumn = COL_DISPLAY_NAME; iconView.PixbufColumn = COL_PIXBUF; iconView.ItemActivated += new ItemActivatedHandler (OnItemActivated); sw.Add (iconView); iconView.GrabFocus (); ShowAll (); } Gdk.Pixbuf GetIcon (string name) { return Gtk.IconTheme.Default.LoadIcon (name, 48, (IconLookupFlags) 0); } ListStore CreateStore () { // path, name, pixbuf, is_dir ListStore store = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf), typeof (bool)); // Set sort column and function store.DefaultSortFunc = SortFunc; store.SetSortColumnId (COL_DISPLAY_NAME, SortType.Ascending); return store; } void FillStore () { // first clear the store store.Clear (); // Now go through the directory and extract all the file information if (!parent.Exists) return; foreach (DirectoryInfo di in parent.GetDirectories ()) { if (!di.Name.StartsWith (".")) store.AppendValues (di.FullName, di.Name, dirIcon, true); } foreach (FileInfo file in parent.GetFiles ()) { if (!file.Name.StartsWith (".")) store.AppendValues (file.FullName, file.Name, fileIcon, false); } } int SortFunc (TreeModel model, TreeIter a, TreeIter b) { // sorts folders before files bool a_is_dir = (bool) model.GetValue (a, COL_IS_DIRECTORY); bool b_is_dir = (bool) model.GetValue (b, COL_IS_DIRECTORY); string a_name = (string) model.GetValue (a, COL_DISPLAY_NAME); string b_name = (string) model.GetValue (b, COL_DISPLAY_NAME); if (!a_is_dir && b_is_dir) return 1; else if (a_is_dir && !b_is_dir) return -1; else return String.Compare (a_name, b_name); } void OnHomeClicked (object sender, EventArgs a) { parent = new DirectoryInfo (Environment.GetFolderPath (Environment.SpecialFolder.Personal)); FillStore (); upButton.Sensitive = true; } void OnItemActivated (object sender, ItemActivatedArgs a) { TreeIter iter; store.GetIter (out iter, a.Path); string path = (string) store.GetValue (iter, COL_PATH); bool isDir = (bool) store.GetValue (iter, COL_IS_DIRECTORY); if (!isDir) return; // Replace parent with path and re-fill the model parent = new DirectoryInfo (path); FillStore (); // Sensitize the up button upButton.Sensitive = true; } void OnUpClicked (object sender, EventArgs a) { parent = parent.Parent; FillStore (); upButton.Sensitive = (parent.FullName == "/" ? false : true); } void OnWinDelete (object sender, DeleteEventArgs a) { Application.Quit (); a.RetVal = true; } } Constructor Default constructor Constructor To be added. To be added. To be added. Constructor a Create a new IconView with a model. Constructor a Internal constructor This is not typically used by C# code. Event GLib.Signal("activate-cursor-item") Gtk.ActivateCursorItemHandler To be added To be added Method System.Void a of the view. an attribute name on . the model column index to bind to . Binds a model column to an Attribute of a Cell Renderer. Event GLib.Signal("select-all") System.EventHandler Emitted when SelectAll () is called. Event GLib.Signal("unselect-all") System.EventHandler Emitted when UnselectAll () is called. Property Gtk.CellArea To be added. To be added. To be added. Property GLib.Property("cell-area") Gtk.CellArea To be added. To be added. To be added. Property Gtk.CellRenderer[] To be added. To be added. To be added. Method System.Void Clears attribute bindings and removes all renderers. Method System.Void a of the view. Clears attribute bindings for a cell renderer. Property GLib.Property("columns") System.Int32 The columns property contains the number of the columns in which the items should be displayed. a If it is -1, the number of columns will be chosen automatically to fill the available area. Property GLib.Property("column-spacing") System.Int32 Space which is inserted between grid column. a Default value is 6. Method System.Void To be added. To be added. To be added. To be added. To be added. To be added. Method Cairo.Surface To be added. To be added. To be added. To be added. Method System.Void an array of items supported. drop actions supported by the view. Enables the view as a Drop destination. Method System.Void buttons allowed to start drag. an array of items supported. drag actions supported from the view. Enables the view as a Drag source. Method System.Boolean The cursor path. The currently focused cell. Gets the path and cell of the current cursor location. if the cursor is set. The will be if the cursor is not currently set. The will be if no cell has focus. Method System.Boolean x coordinate of position. y coordinate of position. returns a for the item. returns a . Determines the destination item at a position. if there is an item at the position. Method System.Void returns a for the highlighted item, or . returns the relative drop information for the highlighted item. Gets Drag information for the currently highlighted item. Method System.Boolean x position in widget coordinates. y position in widget coordinates. returns a representing the item at the position. returns a representing the cell at the position. Obtains the item and cell at a given position. if there is an item at the position. Extends on by additionally returning a cell renderer at the specified position. Method System.Int32 To be added. To be added. To be added. To be added. Method System.Int32 To be added. To be added. To be added. To be added. Method Gtk.TreePath a a To be added a To be added Method System.Boolean To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. Method System.Boolean The first visible item. The last visible item. Gets the visible range of items in the view. if the start and end paths were set. There may be invisible paths between the start and end paths. Property GLib.GType GType Property. a Returns the native value for . Property GLib.Property("hadjustment") Gtk.Adjustment To be added. To be added. To be added. Property GLib.Property("hscroll-policy") Gtk.ScrollablePolicy To be added. To be added. To be added. Event GLib.Signal("item-activated") Gtk.ItemActivatedHandler Emitted when an item is activated. Property GLib.Property("item-orientation") Gtk.Orientation To be added. To be added. To be added. Property GLib.Property("item-padding") System.Int32 To be added. To be added. To be added. Property GLib.Property("item-width") System.Int32 The width used for each item. a Property GLib.Property("margin") System.Int32 Space which is inserted at the edges of the icon view. a Default value is 6. Property GLib.Property("markup-column") System.Int32 Contains the number of the model column containing markup information to be displayed. a The markup column must be of type . If this property and the TextColumn property are both set to column numbers, it overrides the text column. If both are set to -1, no texts are displayed. Property GLib.Property("model") Gtk.TreeModel The model for the icon view. a Event GLib.Signal("move-cursor") Gtk.MoveCursorHandler To be added Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideActivateCursorItem", Type=typeof(Gtk.IconView)) System.Boolean Default handler for the event. a Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideAllSelected", Type=typeof(Gtk.IconView)) System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideAllUnselected", Type=typeof(Gtk.IconView)) System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideItemActivated", Type=typeof(Gtk.IconView)) System.Void a Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideMoveCursor", Type=typeof(Gtk.IconView)) System.Boolean a a Default handler for the event. a Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideSelectCursorItem", Type=typeof(Gtk.IconView)) System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideSelectionChanged", Type=typeof(Gtk.IconView)) System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideToggleCursorItem", Type=typeof(Gtk.IconView)) System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void a to add to the view. indicates if the should expand to available space. Packs a renderer at the end of a cell. Method System.Void a to add to the view. indicates if the should expand to available space. Packs a renderer to the beginning of the cell. Method System.Boolean a Returns if the icon pointed to by is currently selected. a If does not point to a valid location, is returned. Property GLib.Property("pixbuf-column") System.Int32 Contains the number of the model column containing the pixbufs which are displayed a The pixbuf column must be of type . Setting this property to -1 turns off the display of pixbufs. Method System.Void a of the view. desired index within the list of renderers. Moves a renderer to a position in the list of renderers. Property GLib.Property("reorderable") System.Boolean Indicates whether the list can be reordered via Drag and Drop. to allow reordering. Property GLib.Property("row-spacing") System.Int32 Space which is inserted between grid rows. a Default value is 6. Method System.Void a of the item to be made visible by scrolling. Scrolls the view to make an item visible. The minimum amount of scrolling will be done to make the item visible. To control the item's final position within the visible part of the widget, use the other overload of this method. Method System.Void a of the item to be made visible by scrolling. a value between 0.0 and 1.0. a value between 0.0 and 1.0. Scrolls the view to make an item visible. Using row_align of 0.5 and col_align of 0.5 will try to center the item in the visible part of the widget. Method System.Void Selects all the icons. The IconView must has its selection mode set to . Event GLib.Signal("select-cursor-item") System.EventHandler To be added Method System.Void a Calls a function for each selected icon. Note that the model or selection cannot be modified from within this function. Property Gtk.TreePath[] Creates a list of paths of all selected items. a Event GLib.Signal("selection-changed") System.EventHandler Emitted when the current selection changes. To be added Property GLib.Property("selection-mode") Gtk.SelectionMode Specifies the selection mode of icon view. a If the mode is , rubberband selection is enabled, for the other modes, only keyboard selection is possible. Method System.Void a Selects the row at . Method System.Void System.ParamArray a of the view. an array of name/value pairs. Set the attributes of a given Cell Renderer. Method System.Void a of the view. a , or to remove an existing delegate. Sets the Cell Data delegate for a renderer. The Cell data func is an alternative to binding attributes to model columns. The delegate is invoked any time the cell is renderer and it should set up all the appropriate renderer information. Method System.Void the item to select. the cell to focus, or . indicates if the cell should be placed in edit mode. Selects an item and sets keyboard focus to a cell. Normally followed by a call to . Method System.Void The item to highlight, or . Indicates where to drop relative to the item. Sets up drag feedback for an item. Method System.Void To be added. To be added. To be added. To be added. To be added. Method System.Void To be added. To be added. To be added. To be added. Property GLib.Property("spacing") System.Int32 Space which is inserted between cells of an item. a To be added Property GLib.Property("text-column") System.Int32 Contains the number of the model column containing the texts which are displayed. a The text column must be of type . If this property and the MarkupColumn property are both set to -1, no text is displayed. Event GLib.Signal("toggle-cursor-item") System.EventHandler To be added Property GLib.Property("tooltip-column") System.Int32 To be added. To be added. To be added. Method System.Void Unselects all the icons. Method System.Void a Unselects the row at . Method System.Void Unsets the view as a Drag destination. Reverses the effects of . Method System.Void Unsets the view as a drag source. Reverses the effects of . Property GLib.Property("vadjustment") Gtk.Adjustment To be added. To be added. To be added. Property GLib.Property("vscroll-policy") Gtk.ScrollablePolicy To be added. To be added. To be added.