This commit is contained in:
Aaron Bockover 2010-11-08 17:06:39 -05:00
Родитель e8cc8ac7e2
Коммит db20e13bf7
1 изменённых файлов: 11 добавлений и 31 удалений

42
README
Просмотреть файл

@ -3,44 +3,24 @@ in managed code. Maigre takes care of implementing the GtkRcStyle, GtkStyle,
and theme module entry points, leaving the theme author to only have to worry
about rendering code.
Rendering functions (draw_*) that typically are overridden in GtkStyle are
simply defined in a well-named static class (Maigre.Theme). All methods are
optional. In addition to Draw functions, this class may optionally implement
ModuleInit and ModuleExit functions.
An example:
using System;
using Gtk;
using Cairo;
namespace Maigre
public class MyTheme : Maigre.Theme
{
public static class Theme
protected override void ModuleInit ()
{
public static void ModuleInit ()
{
}
}
public static void ModuleExit ()
{
}
public static void DrawBox (Gtk.Style style, Gdk.Window window,
StateType state_type, ShadowType shadow_type, Gdk.Rectangle area,
Widget widget, string detail, int x, int y, int width, int height)
{
var cr = Gdk.CairoHelper.Create (widget.GdkWindow);
switch (detail) {
case "hscrollbar":
case "vscrollbar": cr.Color = new Cairo.Color (1, 0, 0); break;
case "slider":" cr.Color = new Cairo.Color (0, 0, 1); break;
case "trough": cr.Color = new Cairo.Color (0, 1, 0); break;
default: cr.Color = new Cairo.Color (1, 0, 1); break;
}
cr.Rectangle (x, y, width, height);
cr.Fill ();
((IDisposable)cr).Dispose ();
protected override void DrawBox ()
{
switch (Detail) {
case "button":
Cr.Rectangle (0, 0, Width, Height);
Cr.Color = new Cairo.Color (0, 0, 0);
Cr.Fill ();
break;
}
}
}