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] 2.12.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. 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; } } Gtk.Container Gtk.CellLayout Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. a Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Boolean Default handler for the event. a a a Override this method in a subclass to provide a default handler for the event. Method System.Boolean Default handler for the event. a Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Unselects all the icons. Method System.Void Calls a function for each selected icon. a Note that the model or selection cannot be modified from within this function. Method System.Void Unselects the row at . a Method System.Void Selects all the icons. The IconView must has its selection mode set to . Method System.Boolean Returns if the icon pointed to by is currently selected. a a If does not point to a valid location, is returned. Method Gtk.TreePath To be added a a a To be added Method System.Void Activates the item determined by . a Method System.Void Selects the row at . a Constructor Protected Constructor. a Chain to this constructor if you have manually registered a native value for your subclass. System.Obsolete Constructor Internal constructor a This is not typically used by C# code. Constructor Default constructor Constructor Create a new IconView with a model. a Property GLib.GType GType Property. a Returns the native value for . Property 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. GLib.Property("selection-mode") Property 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. GLib.Property("columns") Property System.Int32 Space which is inserted at the edges of the icon view. a Default value is 6. GLib.Property("margin") Property Gtk.Orientation How the text and icon of each item are positioned relative to each other. a Default value is GLib.Property("orientation") Property System.Int32 The width used for each item. a GLib.Property("item-width") Property 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. GLib.Property("text-column") Property System.Int32 Space which is inserted between cells of an item. a To be added GLib.Property("spacing") Property 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. GLib.Property("pixbuf-column") Property System.Int32 Space which is inserted between grid rows. a Default value is 6. GLib.Property("row-spacing") Property System.Int32 Space which is inserted between grid column. a Default value is 6. GLib.Property("column-spacing") Property 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. GLib.Property("markup-column") Property Gtk.TreeModel The model for the icon view. a GLib.Property("model") Property Gtk.TreePath[] Creates a list of paths of all selected items. a Event System.EventHandler Emitted when the current selection changes. To be added GLib.Signal("selection-changed") Event System.EventHandler Emitted when UnselectAll () is called. GLib.Signal("unselect_all") Event Gtk.ItemActivatedHandler Emitted when an item is activated. GLib.Signal("item_activated") Event System.EventHandler Emitted when SelectAll () is called. GLib.Signal("select_all") Event System.EventHandler To be added GLib.Signal("toggle_cursor_item") Event Gtk.MoveCursorHandler To be added GLib.Signal("move_cursor") Event Gtk.ActivateCursorItemHandler To be added To be added GLib.Signal("activate_cursor_item") Event System.EventHandler To be added GLib.Signal("select_cursor_item") 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 Gdk.Pixmap a to an item in the view. Creates a pixmap representation of an item. a representation of the item at . Method System.Void Unsets the view as a Drag destination. Reverses the effects of . 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. 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.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.Void The item to highlight, or . Indicates where to drop relative to the item. Sets up drag feedback for an item. Method System.Void Unsets the view as a drag source. Reverses the effects of . 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 . Property GLib.Property("reorderable") System.Boolean Indicates whether the list can be reordered via Drag and Drop. to allow reordering. 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.Void an array of items supported. drop actions supported by the view. Enables the view as a Drop destination. 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.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 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 a of the view. Clears attribute bindings for a cell renderer. Method System.Void Clears attribute bindings and removes all renderers. 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. 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 of the view. desired index within the list of renderers. Moves a renderer to a position in the list of renderers. 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.Void System.ParamArray a of the view. an array of name/value pairs. Set the attributes of a given Cell Renderer. Property Gtk.CellRenderer[] To be added. To be added. To be added. Method System.Void To be added. To be added. To be added. To be added. To be added. 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.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("tooltip-column") System.Int32 To be added. To be added. To be added.