GtkSharp Quick Reference

GtkSharp is a C# binding to GTK 3. This quick reference lists a number of fundamental classes and methods in GtkSharp, which should be adequate for writing many programs.

Unfortunately there is no official API documentation for GtkSharp. If you want to go beyond what's listed here, you could look at the GTK 3 API documentation for C or for Python, since most GTK class/method names in C# will be similar (especially to the Python-based API). Or you can look at the older Gtk# 2 documentation, since many GTK 2 classes and methods also exist in GTK 3.

All properties and methods below are public unless otherwise specified.

== Index ==

Cairo
Color | Context | Gradient | ImageSurface | LinearGradient | Pattern | PointD | RadialGradient | Rectangle | Surface | TextExtents
Gdk
CairoHelper | Event | EventButton | EventKey | EventMask | EventMotion | EventScroll | Key | Pixbuf | Rectangle | RGBA
GLib
Timeout | TimeoutHandler
Gtk
Align | Application | Box | Button | Calendar | CellRendererText | CheckButton | ColorChooserDialog | ComboBoxText | Container | Dialog | DrawingArea | Entry | FileChooserDialog | Fixed | Grid | Image | ITreeModel | Label | ListStore | Menu | MenuBar | MenuItem | MessageDialog | Orientation | RadioButton | ResponseType | Scale | ScrolledWindow | Separator | SeparatorToolItem | SpinButton | Stock | TextBuffer | TextIter | TextView | Toolbar | ToggleButton | ToggleToolButton | ToolButton | ToolItem | TreeIter | TreePath | TreeSelection | TreeView | TreeViewColumn | Widget | Window

== Gtk class hierarchy ==

Widget
  Button
    ToggleButton
      CheckButton
        RadioButton
  Calendar
  Container
    Box
    ComboBoxText
    Grid
    ScrolledWindow
    Toolbar
    ToolItem
      SeparatorToolItem
      ToolButton
        ToggleToolButton
    Window
      Dialog
        ColorChooserDialog
        FileChooserDialog
        MessageDialog
  DrawingArea
  Entry
    SpinButton
  Image
  Label
  MenuBar
  MenuItem
  Scale
  Separator
  TextView
  TreeView

== Cairo namespace ==

Cairo is a library for drawing 2-dimensional graphics. GTK integrates closely with Cairo, and most GTK applications use Cairo for visual output.

Cairo.Color

A color, with red, blue, green, and alpha components, each in the range from 0.0 to 1.0. Alpha represents transparency; a color with alpha = 1.0 is opaque, and a color with alpha = 0.0 is completely transparent.

There's also a Color class in the Gdk namespace, so you will probably want to choose this one explicitly:

using Color = Cairo.Color;
Color(double r, double g, double b);
Create a color with red, green, and blue components.
Color(double r, double g, double b, double a);
Create a color with red, green, blue, and alpha components.

Cairo.Context : IDisposable

A Context is used for drawing graphics. Typically you will use a Context object to draw on a window in the OnDrawn handler of a Widget subclass.

Be aware that methods such as Arc(), LineTo() and Rectangle() do not draw - they merely add a geometric shape to the current path. After you call these methods, you must call either Stroke() or Fill() to draw to the output surface.

Context (Surface surface);
Create a Cairo context that will draw on the given Surface. When you are finished with the context, you should call Dispose() to free it.
void Arc (double xc, double yc, double radius, double angle1, double angle2);
Add an arc from angle1 to angle2 to the current path, centered at (xc, yc). To draw a circle, pass angle1 = 0.0 and angle2 = 2 * Math.PI.
If there is already a current point, Cairo will add an initial line segment that connects the current point to the beginning of the arc.
void ClosePath ();
Close the current path, returning to its starting point.
void Fill ();
Fill in the current path with the current color.
void FillPreserve ();
Fill in the current path with the current color, and preserve the path.
void LineTo (double x, double y);
void LineTo (PointD p);
Add a line from the current point to the given point. (If there is not yet a current point because the path is empty, LineTo behaves like MoveTo.)
double LineWidth { set; get; }
Set or get the width of the stroke.
void MoveTo (double x, double y);
void MoveTo (PointD p);
Begin a new path at the given point.
void Paint();
Paint the current source everywhere. Typically you will use this method for drawing an image that you have selected as a source surface.
void Rectangle (double x, double y, double width, double height);
void Rectangle (Rectangle rectangle);
Add a rectangle to the current path.
void Scale (double sx, double sy);
Add a scaling transformation to the context's transformation matrix.
void SelectFontFace (string family, FontSlant slant, FontWeight weight);
Select a font to use for drawing text.
void SetFontSize (double scale);
Set the font size to use for drawing text.
void SetSource(Pattern source);
Set a pattern (such as a gradient) to be used as a drawing source.
void SetSourceColor(Color color);
Set a solid color as a drawing source.
void SetSourceRGB (double r, double g, double b);
Set a solid color as a drawing source, defined by the given red, green, and blue components.
void SetSourceSurface (Surface source, int x, int y);
Set the given Surface as a source for drawing at the position (x, y) in the destination. Typically you will make a following call to Paint() to perform the actual drawing operation.
void ShowText (string text);
Draw text. The current position (the "reference point" or "origin") is at the left side of the text to be drawn, along the baseline, so the text will appear above and to the right of the current position.
void Stroke ();
Draw the current path without filling it, and reset the path.
void StrokePreserve ();
Draw the current path without filling it, and preserve the path.
TextExtents TextExtents (string text);
Get a TextExtents object with information about the size of the given text in the currently selected font.
void Translate (double tx, double ty);
Add a translation to the context's transformation matrix.

Cairo.Gradient : Pattern

A gradient is a pattern in which points smoothly transition from one color to another.

Status AddColorStop (double offset, Color c);
Add a color stop to a gradient pattern. offset is a value in the range 0.0 … 1.0.

Cairo.ImageSurface : Surface

An ImageSurface is a Cairo surface that holds pixel data in memory. You can draw onto an ImageSurface, and then later use the ImageSurface as a source for other drawing operations.

ImageSurface(string filename);
Create an ImageSurface with an image read from the given file in PNG format.
ImageSurface (Format format, int width, int height);
Create an ImageSurface with the given width and height. Typically Format will be either Format.Rgb24, meaning 24-bit color with 8 bits for each color channel (red, green, blue), or Format.Argb32, which is similar but also includes an 8-bit alpha (transparency) channel.
IntPtr DataPtr { get; }
Return a pointer to the underlying image data. The number of bytes of data will be (Height * Stride).
Before accessing the data, you should call Flush() to ask Cairo to write any pending changes to it. After modifying it, you should call MarkDirty().
To read or write this data in C#, you can call System.Runtime.InteropServices.Marshal() to copy it to or from a C# array.
int Height { get; }
The height of the image in pixels.
int Stride { get; }
The number of bytes per row of image data.
int Width { get; }
The width of the image in pixels.
void WriteToPng(string filename);
Write an ImageSurface to the given file in PNG format.

Cairo.LinearGradient : Gradient

A gradient that extends along a line.

LinearGradient(double x0, double y0, double x1, double y1);
Construct a LinearGradient along a line through the points (x0, y0) and (x1, y1). You will want to call AddColorStop() to add at least two color stops to the gradient before displaying it. When you are finished with the gradient, you should call Dispose() to free it.

Cairo.Pattern : IDisposable

A Pattern is a source for drawing, such as a solid color or a gradient.

Cairo.PointD

A PointD represents an (x, y) point. (The "D" stands for "double".)

PointD (double x, double y);
Construct a point from its x and y components.
double X { get; set; }
double Y { get; set; }
Retrieve the components of a PointD.

Cairo.RadialGradient : Gradient

A gradient that extends from one circle to another.

RadialGradient (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
Construct a RadialGradient, given the centers of two circles and their radii. You will want to call AddColorStop() to add at least two color stops to the gradient before displaying it. When you are finished with the gradient, you should call Dispose() to free it.

Cairo.Rectangle

A Rectangle represents a rectangle on the (x,y) plane. Note that this class (Cairo.Rectangle) is distinct from Gdk.Rectangle, which appears below.

Rectangle (double x, double y, double width, double height);
Construct a Rectangle.
double Height { get; }
double Width { get; }
double X { get; }
double Y { get; }
Retrive the components of a Rectangle.

Cairo.Surface

An abstract base class for any kind of surface on which Cairo can draw, such as an ImageSurface.

void Flush();
Flush any pending drawing to the surface. You should make this call before accessing a surface's underlying pixel data.
void MarkDirty();
Notifies Cairo that you have modified a surface's underlying pixel data.

Cairo.TextExtents

A TextExtents structure represents layout information about a particular piece of text. Be aware that the values in this structure are sizes in screen pixels, independent of any coordinate transformation in the graphics context.

double Height { get; }
The height of the text.
double Width { get; }
The width of the text.
double XBearing { get; }
The horizontal distance from the origin (i.e. the point specified by MoveTo before a call to ShowText) to the leftmost part of the text glyphs.
double YBearing { get; }
The vertical distance from the origin to the topmost part of the text glyphs. Typically this will be negative.
In the image below, the red dot is the origin, and blue line represents the bearing. YBearing is negative, and XBearing is slightly negative:

Here is how to draw a string s centered at the point (x, y):

TextExtents te = context.TextExtents(s);
context.MoveTo(x - (te.Width / 2 + te.XBearing),
               y - (te.Height / 2 + te.YBearing));
context.ShowText(s);

== Gdk namespace ==

GDK is a low-level library that sits underneath GTK.

Gdk.CairoHelper

This class contains a few static utility methods for working with Cairo.

There's also a CairoHelper class in the Gtk namespace, so you will probably want to choose this one explicitly:

using CairoHelper = Gdk.CairoHelper;
static void SetSourcePixbuf(Cairo.Context context, Pixbuf pixbuf, double x, double y);
Select a Pixbuf to use for drawing to a Cairo context at position (x, y). Typically you will follow this with a call to context.Paint() to draw the image.
static void SetSourceRgba(Cairo.Context context, RGBA color);
Set the color to be used for drawing to the given Cairo context.
static Cairo.Surface SurfaceCreateFromPixbuf(Pixbuf pixbuf, int scale, Gdk.Window for_window);
Create a Cairo surface from a Pixbuf. Typically you will pass scale = 1 and for_window = null.

Gdk.Event

An input event.

Gdk.EventButton : Event

An event that occurs when a mouse button has been pressed or released.

uint Button { get; }
The button that was pressed or released. Normally 1 is the left mouse button, 2 is the middle button, and 3 is the right button.
ModifierType State { get; }
A value indicating which modifier key(s) (e.g. Control, Shift) were held down as the mouse button was pressed. ModifierType is an enumeration including values ControlMask and ShiftMask.
EventType Type { get; }
One of the following values indicating the type of click:
Note that if the user double-clicks the mouse, you will receive one ButtonPress event for each click, and also a TwoButtonPress event.
double X { get; }
double Y { get; }
The X and Y coordinates of a button press, relative to the window.

Gdk.EventKey : Event

An event that occurs when a key has been pressed or released. This event will be delivered to the widget that currently has the input focus. The top-level window has focus by default. If the user clicks in a control such a Gtk.Entry, that control will receive the focus so that the user can type there.

Key Key { get; }
The key that the user pressed or released.

Gdk.EventMask

An enumeration with one value for each possible event type, including

Gdk.EventMotion : Event

An event that occurs when the user has moved the mouse.

double X { get; }
double Y { get; }
The X and Y coordinates of the mouse pointer, relative to the window.

Gdk.EventScroll : Event

An event that occurs when the user has rotated the scroll wheel.

ScrollDirection Direction { get; }
The direction in which the wheel was scrolled. ScrollDirection is an enumeration including values Up and Down.
double X { get; }
double Y { get; }
The X and Y coordinates of the mouse pointer, relative to the window.

Gdk.Key

An enumeration with one value for each key that can be typed. Some useful values include

See the full list of values here.

There is another class named Key in the GTK namespace, so you will probably want to specify this one explicitly:

using Key = Gdk.Key;

Gdk.Pixbuf

A Pixbuf holds an image in memory.

A Cairo.ImageSurface can also hold an image, however this class provides a wider set of functionality, such as flipping or resizing images, and support for additional file formats beyond PNG.

To draw a Pixbuf in Cairo, you can call CairoHelper.SurfaceCreateFromPixbuf() to convert the Pixbuf to a Cairo surface, which you can draw by calling SetSourceSurface() and then Paint(). Alternatively, you can call CairoHelper.SetSourcePixbuf() to set the Pixbuf as a source, then call Paint() to draw the source image.

Pixbuf (string filename);
Read a Pixbuf from a file in PNG or JPEG format. Throws an exception if the file is not found.
Pixbuf Flip (bool horizontal);
Flip an image horizontally or vertically.
int Height { get; }
The height of the image in pixels.
bool Save (string filename, string type);
Save the image to a file. type can be "jpeg" or "png". Return true if the save succeeded.
Pixbuf ScaleSimple (int dest_width, int dest_height, InterpType interp_type)
Resize an image to a new width and height, returning a new PixBuf. InterpType is an interpolation type, and can be e.g. InterpType.Bilinear for a reasonable balance between quality and speed, or InterpType.Hyper which produces a higher-quality image but is slower.
int Width { get; }
The width of the image in pixels.

Gdk.Rectangle

A Rectangle represents a rectangle on the (x,y) plane. Note that this class (Gdk.Rectangle) is distinct from Cairo.Rectangle, which appears above.

Rectangle (int x, int y, int width, int height);
Construct a Rectangle.
int Height, Width;
int X, Y;
Retrieve the components of a Rectangle.

Gdk.RBGA

An RGBA represents a color.

RGBA();
Construct a color whose components are all initially 0.
double Red, Green, Blue, Alpha;
The color components, each ranging from 0.0 to 1.0.
bool Parse(string spec);
Create a color from a string, which can be either be a standard X11 color name such as "red" or a hexadecimal value in the form “#rrggbb”, e.g. "#6f889f".

== GLib namespace ==

GLib is a low-level library that sits underneath GDK and GTK.

GLib.Timeout

A class that lets you register a timeout handler.

There is another class named Timeout in the System.Threading namespace, so you may need to specify this one explicitly:

using Timeout = GLib.Timeout;
static uint Add (uint interval, TimeoutHandler handler);
Request that the given TimeoutHandler be called at regular intervals of interval milliseconds.

Glib.TimeoutHandler

delegate bool TimeoutHandler ();
Return true if calls to this TimeoutHandler should continue, or false to cancel the calls.

== Gtk namespace ==

Gtk.Align

An enumeration used to specify how a widget is aligned inside extra space that is allocated for it. Values include Start (i.e. at the left or top), End (i.e. at the right or bottom), and Center.

Gtk.Application

A GTK application.

static void Init ();
Initialize GTK. Call this before calling any other GTK methods in your application.
static void Run ();
Run the application's main loop.
static void Quit ();
Quit the application.

Gtk.Box : Container

A container that arranges child widgets into a single row or column.

You can add child widgets to a Box by calling the Add or PackStart methods. Add(w) is equivalent to PackStart(w, false, false, 0).

Box(Orientation orientation, int spacing);
Create a Box. Orientation is an enumeration with values Horizontal and Vertical. spacing is the number of pixels to place by default between children in the box.
void PackStart (Widget child, bool expand, bool fill, uint padding);
Add a child widget to a Box.
If expand is true, the child will receive any extra space that is available. If more than one child sets this option, then the extra space will be evenly divided among them.
If fill is true, the child will occupy any extra space it is given. If it is false, the extra space will just be used as padding. (If expand is false, then fill has no effect.)
padding is the size (in pixels) of extra space to place between this widget and its neighbors in the box.

Gtk.Button : Widget

A pushbutton.

Button (string label);
Construct a Button with the given label.
event EventHandler Clicked;
Called when the user has clicked this button.
string Label { get; set; }
The label that the button displays.

Gtk.Calendar : Widget

A widget that displays a calendar and lets the user select a date.

Calendar();
Create a Calendar.
event EventHandler DaySelected;
Called when the user has selected a day.

Gtk.CellRendererText

A renderer that can display a column of data in a TreeView in textual format.

CellRendererText();
Create a CellRendererText.

Gtk.CheckButton : ToggleButton

A button that toggles a check mark.

The Active property (inherited from ToggleButton) indicates whether the button is currently checked.

CheckButton(string label);
Create a CheckButton that displays the given label.

Gtk.ColorChooserDialog : Dialog

A ColorChooserDialog lets the user select a color.

ColorChooserDialog(string title, Window parent);
Create a ColorChooserDialog.
Gdk.RGBA Rgba { get; set; }
The currently selected color.

Gtk.ComboBoxText : Container

A ComboBoxText is a drop-down menu that lets the user select one of a series of text items.

ComboBoxText();
Create a ComboBoxText with no items.
public int Active { get; set; }
Get or set the index of the currently selected item. If no item is selected, this property has the value -1.
void AppendText(string text);
Append an item with the given text.
event EventHandler Changed;
An event that fires when the user has selected a new item.

Gtk.Container : Widget, IEnumerable

An abstract base class for any widget that can contain other widgets.

void Add (Widget widget);
Add the given widget to this Container.
Widget[] Children { get; }
Return an array of all children of this Container. (If you want to iterate over the children, there is no need to access this property; Container implements IEnumerable, so you can iterate over a Container directly.)

Gtk.Dialog : Window

A dialog box.

After you add child widgets to a dialog, you must call the dialog's ShowAll() method if you want the children to be visible.

Dialog (string title, Window parent, DialogFlags flags, params object[] button_data);
Create a dialog box.
flags will typically be DialogFlags.Modal to create a modal dialog.
button_data indicates a set of buttons to display at the bottom of the dialog. Each such button is represented by a pair of values: a button text string (e.g. "Add") followed by a value to be returned if that button is selected (typically a response code such as ResponseType.Ok or ResponseType.Cancel). For example:
Dialog d = new Dialog("My Dialog", this, DialogFlags.Modal,
                      "OK", ResponseType.Ok, "Cancel", ResponseType.Cancel);
Box ContentArea { get; }
A box that holds widgets in the main area of the dialog.
int Run ();
Run a dialog, returning when the user has chosen a response button. Typically the return value will be a response code such as ResponseType.Ok or ResponseType.Cancel, cast to an int.
After a dialog returns, you must call Destroy() to destroy it - otherwise it will remain visible on the screen.

Gtk.DrawingArea : Widget

A DrawingArea is a canvas where the program can draw graphics with Cairo. To draw on a DrawingArea, override the OnDrawn method and use the provided Cairo context to draw.

DrawingArea ();
Create a DrawingArea.

Gtk.Entry : Widget

An Entry is a box where the user can enter a single line of text.

Entry ();
Create an Entry.
protected virtual void OnTextInserted(string new_text, ref int position);
Called when the user wants to insert text into the Entry, e.g. when the user has typed a key. To allow the text to be entered, call the same method in the superclass:
base.OnTextInserted(new_text, ref position);
string Text { get; set; }
Get or set the text in an Entry.

Gtk.FileChooserDialog : Dialog

A standard dialog box that prompts the user to select a file to be opened or created.

FileChooserDialog (string title, Window parent, FileChooserAction action, params object[] button_data)
Create a FileChooserDialog.
A typical call to this constructor might look like this:
new FileChooserDialog(
    "Open...", this, FileChooserAction.Open,
    "Cancel", ResponseType.Cancel, "Open", ResponseType.Ok);
string Filename { get; }
The filename that the user chose.

Gtk.Fixed : Container

A Fixed is a container that holds child widgets at arbitrary positions that may overlap. You may add a child to a Fixed by calling Add(), which will add it at position (0, 0), or by calling Put() to add it at a specified position.

Fixed();
Create a new Fixed.
void Move(Widget widget, int x, int y);
Move an existing widget in the container to a new position.
void Put(Widget widget, int x, int y);
Add a widget at the position (x, y).

Gtk.Grid : Container

A Grid is a container that holds widgets arranged in rows and columns. Each widget may occupy one or more rows and columns in the grid. Rows and columns are indexed starting from 0.

void Grid ();
Create a Grid.
void Attach(Widget child, int left, int top, int width, int height);
Add a widget to the grid. left and top are the column and row indices of the upper-left corner of the widget in the grid. width and height are the number of colums and rows that the widget will occupy.
uint ColumnSpacing { get; set; }
The amount of space in pixels to place between adjacent columns in the grid.
uint RowSpacing { get; set; }
The amount of space in pixels to place between adjacent rows in the grid.

Gtk.Image : Widget

A widget that displays an image.

Image(string filename);
Create an Image widget that will display an image loaded from the given file in PNG or JPEG format.
Image(string stock_id, IconSize size);
Create an Image widget that will display a stock icon. stock_id should be one of the names defined in the Stock class. size will typically be IconSize.SmallToolbar if you are creating an icon to display in a toolbar button.

Gtk.ITreeModel

An interface implemented by classes that hold data to be displayed in a TreeView. One such class is a ListStore.

Gtk.Label : Widget

A widget that displays a text label, which is often a fixed string.

Label (string str);
Create a Label that will display the given string.

Gtk.ListStore : TreeModel

A ListStore holds data that can be displayed in a TreeView.

ListStore (params Type[] types);
Create a ListStore whose columns will hold the given types of data. For example:
        ListStore store = new ListStore(typeof(bool), typeof(string), typeof(int));
TreeIter Append ();
Append a new row to a ListStore, and return a TreeIter that points to it.
void Clear();
Remove all rows from a ListStore.
void SetValues (TreeIter iter, params object[] values);
Set the column values for a given row in a ListStore.

Gtk.Menu

A top-level menu or a submenu.

Menu ();
Create an empty Menu.
void Append (MenuItem child);
Add an item to this Menu.

Gtk.MenuBar : Widget

The menu bar that typically appears at the top of a window.

MenuBar ();
Create an empty MenuBar.
void Append (MenuItem child);
Add an item that holds a top-level menu.

Gtk.MenuItem : Widget

A MenuItem is an item that appears in a menu. It may itself contain a submenu of child MenuItem objects.

MenuItem (string label);
Create a MenuItem with the given label.
event EventHandler Activated;
An event that a MenuItem fires when the user selects it.
Menu Submenu { get; set; }
A submenu contained in this MenuItem.

Gtk.MessageDialog : Dialog

A simple dialog box that displays a message, plus optional secondary text and one or more buttons.

MessageDialog(Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt,
string format, params object[] args);
Create a MessageDialog.
flags will typically be DialogFlags.Modal.
type is a MessageType, which is an enumeration including values Info, Warning, Question, and Error. The dialog may display an icon that depends on the message type.
bt is a ButtonsType, which is an enumeration including values Ok, YesNo and OkCancel. This value determines the button(s) that will be shown in the dialog.
format is a C# format string that may include format items with optional formatting codes; for example, it could be "name: {0}, score: {1:f2}". These items will be replaced with the string representations of any folllowing arguments.
string SecondaryText { get; set; }
Secondary text to be displayed in the dialog.

Gtk.Orientation

An enumeration with values Horizontal and Vertical.

Gtk.RadioButton : CheckButton

A button that appears in a group. When one radio button in a group is selected, the others are automatically deselected.

RadioButton(string label);
Create a RadioButton with the given label. It will be the first button in its group.
RadioButton(RadioButton other, string label);
Create a RadioButton that will be in the same group as the button other.

Gtk.ResponseType

An enumeration of values that may be returned by a GtkDialog, including Cancel and Ok.

Gtk.Scale : Widget

A horizontal or vertical slider that lets the user select a number in a given range.

Scale(Orientation orientation, double min, double max, double step);
Create a Scale. Orientation is an enumeration with values Horizontal and Vertical. The slider will let the user select any value between min and max. If the user selects the slider and presses an arrow key, the number will jump by step.
double Value { get; set; }
Get or set the value represented by the current slider position.
event EventHandler ValueChanged;
An event that fires when the slider position has changed.

Gtk.ScrolledWindow : Container

A widget that can display a scrolling view of its contents, showing scrollbars when necessary.

ScrolledWindow();
Create a ScrolledWindow.

Gtk.Separator : Widget

A horizontal or vertical separator line, useful for visually separating groups of controls e.g. in dialog boxes.

Separator(Orientation orientation);
Create a Separator with the given orientation.

Gtk.SeparatorToolItem : ToolItem

A SeparatorToolItem displays a separator line in a toolbar.

SeparatorToolItem();
Create a SeparatorToolItem.

Gtk.SpinButton : Entry

A spin button lets the user enter a number either by typing it into a text box, or by using buttons to adjust it.

SpinButton(double min, double max, double step);
Create a SpinButton that will let the user enter a value between min and max. If the user presses one of the buttons beside the text box, the number will increase or decrease by step.
double Value { get; set; }
Get or set the current value.
event EventHandler ValueChanged;
An event that fires when the current value has changed.

Gtk.Stock

A class with string fields naming particular built-in icons. For example, Gtk.Stock.Delete is the name of this icon, represeting a deletion action:

The exact appearance of this and other stock icons will depend on your operating system and icon theme.

Here is a complete list of the fields in this class.

Gtk.TextBuffer

A TextBuffer holds the text in a TextView.

event EventHandler Changed;
An event that fires when text in the buffer has changed.
void Delete(ref TextIter start, ref TextIter end);
Delete all text between the given positions, which will be updated to the position where the text was deleted.
bool GetSelectionBounds(out TextIter start, out TextIter end);
If text is currently selected in the buffer, returns true and sets start and end to the beginning and end of the selected range.
string GetText(TextIter start, TextIter end, bool include_hidden_chars);
Return the text between the positions start and end. include_hidden_chars specifies whether invisible text will be returned; in most simple uses of a TextBuffer, there will be no such text, so this value does not matter.
bool HasSelection { get; }
True if any text in the buffer is currently selected.
void Insert(ref TextIter iter, string text);
Insert text at the given position, which will be updated to the end of the inserted text.
string Text { get; set; }
The text as a string.

Gtk.TextIter

A TextIter represents a position in a TextBuffer.

bool BackwardVisibleWordStart();
Move an iterator backward to the previous visible word start. If the iterator is already at the start of a word, it will move backward to the previous word start before that.
TextBuffer Buffer { get; }
Return the TextBuffer that this iterator is associated with.

Gtk.TextView : Widget

A TextView is a multiline text editor widget.

TextView();
Create a TextView.
TextBuffer Buffer { get; set; }
The buffer that holds the text in this TextView.
bool Monospace { get; set; }
True if the TextView should use a fixed-width font.
event EventHandler MoveCursor;
An event that fires each time the cursor moves.

Gtk.ToggleButton : Button

A ToggleButton is like a Button, but remains pressed in after the user clicks it. If the user then clicks it again, it will return to its original unpressed state.

ToggleButton(string label);
Create a ToggleButton with the given label.
bool Active { get; set; }
True if the button is currently active (i.e. pressed in).

Gtk.ToggleToolButton : ToolButton

A ToggleToolButton is like a ToolButton, but can be in one of two visible states: either it is pressed in or it is not. By default, its state toggles when the user clicks it.

ToggleToolButton();
Create a ToggleToolButton. Unlike the ToolButton constructor, this constructor does not take a Widget argument, but you may add a widget to the button by setting the IconWidget property.
bool Active { get; set; }
True if the button is currently pressed in. Be aware that setting this property may trigger the Clicked event.

Gtk.Toolbar : Container

A Toolbar displays a set of buttons in a single row or column.

Toolbar();
Create a Toolbar.
Orientation Orientation { get; set; }
Get or set the toolbar's orientation, which can be Orientation.Horizontal or Orientation.Vertical.
ToolbarStyle Style { get; set; }
Get or set the toolbar's style, which can be e.g. ToolbarStyle.Icons to display only icons, ToolbarStyle.Text to display only text, or ToolbarStyle.Both to display both.

Gtk.ToolButton : ToolItem

A toolbar button.

ToolButton(Widget icon_widget, string label);
Create a ToolButton that will display the given widget (typically an Image) and optionally display a string label.
event EventHandler Clicked;
An event that occurs when the button is clicked.
Widget IconWidget { get; set; }
Get or set the widget that will display the image in this ToolButton.

Gtk.ToolItem : Container

An abstract base class for items that can appear in a toolbar, such as ToolButton and SeparatorToolItem widgets.

Gtk.TreeIter

A TreeIter is a pointer to a particular node in a TreeModel, such as a row in a ListStore.

Gtk.TreePath

A list of integers representing the path from the root to a particular node in a TreeModel. If the model is a ListStore, this will just be a single integer representing a row index.

int[] Indices { get; }
The indices in the path. (If the model is a ListStore, this will be an array of length 1.)

Gtk.TreeSelection

A TreeSelection manages row selection in a TreeView.

event EventHandler Changed;
An event that fires when the selection has changed.
TreePath[] GetSelectedRows();
Return an array of TreePath objects, one for each row that is currently selected.
SelectionMode Mode { get; set; }
Possible values include SelectionMode.Single, indicating that only one row may be selected at a time, or SelectionMode.Multiple, allowing multiple selection.

Gtk.TreeView : Widget

A TreeView displays a list or tree of data in columns.

TreeView(ITreeModel model);
Create a TreeView that will display data from the given model.
int AppendColumn (TreeViewColumn column);
Append a column to the TreeView.
event RowActivatedHandler RowActivated;
An event that fires when the user has double-clicked a row, or selected the row and pressed Enter. RowActivatedHandler is a delegate type:
delegate void RowActivatedHandler(object o, RowActivatedArgs args);
RowActivatedArgs has fields Path (a TreePath) and Column (a TreeViewColumn).
TreeSelection Selection { get; }
The TreeSelection object for this TreeView.

Gtk.TreeViewColumn

A column to be displayed in a TreeView.

TreeViewColumn (string title, CellRenderer cell, params object[] attrs);
Create a TreeViewColumn, including a CellRenderer and one or more attributes. Typically you will specify an attribute indicating the index of the model column containing the data that the CellRenderer should display. For example:
        TreeViewColumn col = new TreeViewColumn("name", new CellRendererText(), "text", 0);
int SortColumnId { get; set; }
The id of the column by which the view should be sorted if this column is selected for sorting. Setting this property makes the column header clickable.
bool SortIndicator { get; set; }
True if this column is currently displaying a sort indicator arrow.
SortType SortOrder { get; set; }
The sort order indicated by the sort indicator arrow. SortType is an enum with values Ascending and Descending.
Note that setting this property does not actually sort the model; that happens only when the user clicks on the column header.

Gtk.Widget

A widget is a visual element such as a button, check box, scrollbar, or text area. (In Windows programming these are called controls, but "widget" is the usual Unix term.) A top-level window also counts as a widget.

void AddEvents (int events);
Ask to receive the given event type(s). The events should be cast from a Gdk.EventMask, which is an enumeration with one value for each possible event type. For example:
AddEvents((int) (EventMask.ButtonPressMask |
                 EventMask.ButtonReleaseMask |
                 EventMask.PointerMotionMask));
Gdk.Rectangle Allocation { get; set; }
The Allocation property is a Gdk.Rectangle representing the widget's current size and position within its parent widget.
If this is a top-level widget, i.e. a Window, then Allocation.X and Allocation.Y will be 0, and Allocation.Width and Allocation.Height will be the size of the client area of the window.
bool CanFocus { set; get; }
Set this property to true to allow the widget to receive the focus, which will allow it to receive keyboard input.
void GrabFocus();
Set the focus to this widget so that it can receive keyboard input.
Align Halign { get; set; }
The widget's horizontal alignment in any extra space that it is given.
event KeyPressEventHandler KeyPressEvent;
Called when the user has pressed a key. KeyPressEventHandler is a delegate type:
delegate void KeyPressEventHandler(object o, KeyPressEventArgs args);
KeyPressEventArgs has a field Event of type EventKey.
(If you are subclassing a GTK class, it may be more convenient to override the OnKeyPressEvent method rather than adding a handler for this event.)
int Margin { get; set; }
The number of blank pixels to display around this widget on all sides.
protected virtual bool OnButtonPressEvent (EventButton e);
protected virtual bool OnButtonReleaseEvent (EventButton e);
Called when the user has pressed or released a mouse button. Return true to indicate that the event has been handled.
protected virtual bool OnDrawn (Cairo.Context c);
Runs when it is time for a widget to repaint itself.
Typically the event handler will use the provided Cairo context to draw graphics.
Return true to indicate that the event has been handled.
protected virtual bool OnKeyPressEvent (EventKey e);
Called when the user has pressed a key. Return true to indicate that the event has been handled.
protected virtual bool OnKeyReleaseEvent (EventKey e);
Called when the user has released a key. Return true to indicate that the event has been handled.
protected virtual bool OnMotionNotifyEvent (EventMotion e);
Called when the user has moved the mouse. Return true to indicate that the event has been handled.
protected virtual void OnSizeAllocated (Gdk.Rectangle allocation);
Called when this widget's size has changed. If this widget is a Window, this handler will be called when the user has resized the window.
void QueueDraw ();
Ask for this widget to be redrawn. This will cause the system to call the OnDrawn handler in the near future.
bool Sensitive { get; set; }
If true, the widget is available. If false, the widget is grayed out and the user cannot interact with it.
void SetSizeRequest(int width, int height);
Set a minimum size for this widget.
void ShowAll ();
Show this widget and any widgets it contains.
string TooltipText { get; set; }
Get or set the text of a tooltip that will be displayed when the mouse moves over this widget.
Align Valign { get; set; }
The widget's vertical alignment in any extra space that it is given.

Gtk.Window : Container

A window that appears on the user's desktop.

There's also a Window class in the Gdk namespace, so you will probably want to choose this one explicitly:

using Window = Gtk.Window;

A Window can directly contain only a single widget. To hold more widgets, add a container widget such as a Box and place the child widgets in that container.

Window (string title);
Construct a window with the given title. The window will not initially be visible; you must call ShowAll() to make it appear.
void Destroy ();
Destroy a window.
protected virtual bool OnDeleteEvent(Gdk.Event event);
Called when the user has clicked a window's close button. Typically you will exit the application in reponse to this notification.
void Resize (int width, int height);
Set a window's width and height in pixels.
string Title { get; set; }
The window's title.