本文整理汇总了C#中Gdk类的典型用法代码示例。如果您正苦于以下问题:C# Gdk类的具体用法?C# Gdk怎么用?C# Gdk使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Gdk类属于命名空间,在下文中一共展示了Gdk类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
label = AddinCatalog.GetString ("Types");
icon = Context.GetIcon ("md-db-tables");
BaseNode node = (BaseNode) dataObject;
}
示例2: OnExposeEvent
protected override bool OnExposeEvent(Gdk.EventExpose ev)
{
base.OnExposeEvent(ev);
using(Cairo.Context cr = Gdk.CairoHelper.Create(ev.Window))
{
if(bgTile == null)
{
cr.Rectangle(ev.Area.X, ev.Area.Y, ev.Area.Width, ev.Area.Height);
cr.Color = new Cairo.Color(2, 114, 43);
cr.Fill();
}
else
{
int pw = bgTile.Width;
int ph = bgTile.Height;
int xStart = ev.Area.Left / pw;
int xEnd = ev.Area.Right / pw + (ev.Area.Right % pw != 0 ? 1 : 0);
int yStart = ev.Area.Top / ph;
int yEnd = ev.Area.Bottom / ph + (ev.Area.Bottom % ph != 0 ? 1 : 0);
for(int x = xStart; x < xEnd; x++)
for(int y = yStart; y < yEnd; y++)
ev.Window.DrawPixbuf(Style.BaseGC(Gtk.StateType.Normal), bgTile, 0, 0, x * pw, y * ph, pw, ph, Gdk.RgbDither.Normal, 0, 0);
}
root.RootExpose(cr, new Rectangle(ev.Area.X, ev.Area.Y, ev.Area.Width, ev.Area.Height));
}
return true;
}
示例3: ColorGetHex
/// <summary>
/// This returns the hexadecimal value of an GDK color.
/// </summary>
/// <param name="color">
/// The color to convert to a hex string.
/// </param>
public static string ColorGetHex(Gdk.Color color)
{
return String.Format ("#{0:x2}{1:x2}{2:x2}",
(byte)(color.Red >> 8),
(byte)(color.Green >> 8),
(byte)(color.Blue >> 8));
}
示例4: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
var compilationUnit = (AssemblyLoader)dataObject;
label = Path.GetFileNameWithoutExtension (compilationUnit.FileName);
icon = Context.GetIcon (Stock.Reference);
}
示例5: BuildNode
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
{
UnknownSolutionItem entry = (UnknownSolutionItem) dataObject;
if (entry.UnloadedEntry) {
icon = Context.GetIcon (MonoDevelop.Ide.Gui.Stock.Project);
Gdk.Pixbuf gicon = Context.GetComposedIcon (icon, "fade");
if (gicon == null) {
gicon = ImageService.MakeTransparent (icon, 0.5);
Context.CacheComposedIcon (icon, "fade", gicon);
}
icon = gicon;
label = GettextCatalog.GetString ("<span foreground='grey'>{0} <span size='small'>(Unavailable)</span></span>", GLib.Markup.EscapeText (entry.Name));
}
else if (entry.LoadError.Length > 0) {
icon = Context.GetIcon (Gtk.Stock.DialogError);
label = GettextCatalog.GetString ("{0} <span foreground='red' size='small'>(Load failed)</span>", GLib.Markup.EscapeText (entry.Name));
} else {
icon = Context.GetIcon (MonoDevelop.Ide.Gui.Stock.Project);
Gdk.Pixbuf gicon = Context.GetComposedIcon (icon, "fade");
if (gicon == null) {
gicon = ImageService.MakeTransparent (icon, 0.5);
Context.CacheComposedIcon (icon, "fade", gicon);
}
icon = gicon;
label = GLib.Markup.EscapeText (entry.Name);
}
}
示例6: PostProcessKeyEvent
public static void PostProcessKeyEvent (ICompletionWidget widget, Gdk.Key key, Gdk.ModifierType modifier)
{
// Called after the key has been processed by the editor
if (methods.Count == 0)
return;
for (int n=0; n<methods.Count; n++) {
// If the cursor is outside of any of the methods parameter list, discard the
// information window for that method.
MethodData md = methods [n];
int pos = md.MethodProvider.GetCurrentParameterIndex (widget, md.CompletionContext);
if (pos == -1) {
methods.RemoveAt (n);
n--;
}
}
// If the user enters more parameters than the current overload has,
// look for another overload with more parameters.
UpdateOverload (widget);
// Refresh.
UpdateWindow (widget);
}
示例7: OnExposeEvent
protected override bool OnExposeEvent(Gdk.EventExpose evnt)
{
base.OnExposeEvent (evnt);
using (var g = Gdk.CairoHelper.Create (evnt.Window)) {
UseStandardLineDrawing (g);
DrawVerticalReferenceLines (g, evnt.Area, XSize, XTranslation);
DrawHorizontalReferenceLines (g, evnt.Area, YSize);
DrawRightsideHorisontalNumbers (g, evnt.Area, SecondaryYSize);
DrawTitle (g, ChartName);
int i;
for (i = 0; i < Lines.Count; i++) {
DrawLineInfo (g, Lines [i], i);
}
for (int j = 0; j < secondaryLines.Count; j++) {
DrawLineInfo (g, secondaryLines [j], i);
i++;
}
TransformForLineDrawing (g, evnt.Area);
DrawLines (g, evnt.Area, Lines, XSize, YSize);
DrawLines (g, evnt.Area, secondaryLines, XSize, SecondaryYSize);
}
return true;
}
示例8: StartEditing
public override CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
if (Changed != null)
Changed (this, new FlagArgs () { Path = path });
this.StopEditing (true);
return null;
}
示例9: OnExposeEvent
protected override bool OnExposeEvent(Gdk.EventExpose args)
{
Cairo.Context cr = Gdk.CairoHelper.Create(GdkWindow);
var wrapper = new GraphicsContextWrapper(cr, Allocation.Width, Allocation.Height);
_control.Render(wrapper);
// int width, height;
// width = Allocation.Width;
// height = Allocation.Height;
//
// cr.SetSourceRGB(0.7, 0.2, 0.0);
// cr.Rectangle(0, 0, width, height);
// //cr.Clip();
// cr.Fill();
// cr.LineWidth = 9;
// cr.SetSourceRGB(0.7, 0.2, 0.0);
//
// cr.Translate(width/2, height/2);
// cr.Arc(0, 0, (width < height ? width : height) / 2 - 10, 0, 2*Math.PI);
// cr.StrokePreserve();
//
// cr.SetSourceRGB(0.3, 0.4, 0.6);
// cr.Fill();
((IDisposable) cr.GetTarget()).Dispose();
((IDisposable) cr).Dispose();
return true;
}
示例10: CursorTracker
CursorTracker (Gdk.Display display)
{
Enabled = true;
this.display = display;
resolution_senders = new List<object> ();
ResetTimer ();
}
示例11: Face
public Face (uint id, Gdk.Rectangle r) : base (id) {
rect = r;
photo_id = 0;
tag_id = 0;
tag = null;
}
示例12: ForDisplay
public static CursorTracker ForDisplay (Gdk.Display display)
{
if (!trackers.ContainsKey (display))
trackers [display] = new CursorTracker (display);
return trackers [display];
}
示例13: FillValues
private void FillValues (Gdk.Pixbuf src)
{
values = new int [256, 3];
if (src.BitsPerSample != 8)
throw new System.Exception ("Invalid bits per sample");
unsafe {
byte * srcb = (byte *)src.Pixels;
byte * pixels = srcb;
bool alpha = src.HasAlpha;
int rowstride = src.Rowstride;
int width = src.Width;
int height = src.Height;
// FIXME array bounds checks slow this down a lot
// so we use a pointer. It is sad but I want fastness
fixed (int * v = &values [0,0]) {
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
v [*(srcb++) * 3 + 0]++;
v [*(srcb++) * 3 + 1]++;
v [*(srcb++) * 3 + 2]++;
if (alpha)
srcb++;
}
srcb = ((byte *) pixels) + j * rowstride;
}
}
}
}
示例14: PaletteToString
/// <summary> PaletteToString Method </summary>
public static string PaletteToString(Gdk.Color[] colors)
{
int n_colors = colors.Length;
IntPtr raw_ret = gtk_color_selection_palette_to_string(colors, n_colors);
string ret = GLib.Marshaller.PtrToStringGFree (raw_ret);
return ret;
}
示例15: KeyPress
}// Parser
public override bool KeyPress (Gdk.Key key, char keyChar, Gdk.ModifierType modifier)
{
int line, column;
Editor.GetLineColumnFromPosition (Editor.CursorPosition, out line, out column);
string lineText = Editor.GetLineText (line);
// smart formatting strategy
if (TextEditorProperties.IndentStyle == IndentStyle.Smart) {
if (key == Gdk.Key.Return) {
if (lineText.TrimEnd ().EndsWith ("{")) {
Editor.InsertText (Editor.CursorPosition,
"\n" + TextEditorProperties.IndentString + GetIndent (Editor, line));
return false;
}
} else if (key == Gdk.Key.braceright && AllWhiteSpace (lineText)
&& lineText.StartsWith (TextEditorProperties.IndentString)) {
if (lineText.Length > 0)
lineText = lineText.Substring (TextEditorProperties.IndentString.Length);
Editor.ReplaceLine (line, lineText + "}");
return false;
}
}
return base.KeyPress (key, keyChar, modifier);
}