Updated README
This commit is contained in:
Родитель
e8cc8ac7e2
Коммит
db20e13bf7
42
README
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче