本文整理汇总了C#中Gdk类的典型用法代码示例。如果您正苦于以下问题:C# Gdk类的具体用法?C# Gdk怎么用?C# Gdk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gdk类属于命名空间,在下文中一共展示了Gdk类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:TypesNodeBuilder.cs
示例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;
}
开发者ID:sciaopin,项目名称:bang-sharp,代码行数:29,代码来源:GameBoardWidget.cs
示例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));
}
开发者ID:nolith,项目名称:tasque,代码行数:13,代码来源:Utilities.cs
示例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);
}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:7,代码来源:AssemblyNodeBuilder.cs
示例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);
}
}
开发者ID:fedorw,项目名称:monodevelop,代码行数:28,代码来源:UnknownEntryNodeBuilder.cs
示例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);
}
开发者ID:Shanto,项目名称:monodevelop,代码行数:25,代码来源:ParameterInformationWindowManager.cs
示例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;
}
开发者ID:haved,项目名称:MyPrograms,代码行数:27,代码来源:HDoubleChart.cs
示例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;
}
开发者ID:chergert,项目名称:adroit,代码行数:7,代码来源:CellRendererFlag.cs
示例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;
}
开发者ID:pascalfr,项目名称:MPfm,代码行数:30,代码来源:OutputMeter.cs
示例10: CursorTracker
CursorTracker (Gdk.Display display)
{
Enabled = true;
this.display = display;
resolution_senders = new List<object> ();
ResetTimer ();
}
开发者ID:Aurora-and-Equinox,项目名称:docky,代码行数:7,代码来源:CursorTracker.cs
示例11: Face
public Face (uint id, Gdk.Rectangle r) : base (id) {
rect = r;
photo_id = 0;
tag_id = 0;
tag = null;
}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:7,代码来源:FaceStore.cs
示例12: ForDisplay
public static CursorTracker ForDisplay (Gdk.Display display)
{
if (!trackers.ContainsKey (display))
trackers [display] = new CursorTracker (display);
return trackers [display];
}
开发者ID:Aurora-and-Equinox,项目名称:docky,代码行数:7,代码来源:CursorTracker.cs
示例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;
}
}
}
}
开发者ID:mono,项目名称:f-spot,代码行数:33,代码来源:Histogram.cs
示例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;
}
开发者ID:Gravecorp,项目名称:gtk-sharp,代码行数:8,代码来源:ColorSelection.cs
示例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);
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:27,代码来源:ValaTextEditorExtension.cs
示例16: Render
protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
{
base.Render (window, widget, background_area, cell_area, expose_area, flags);
if (PackageSourceViewModel == null)
return;
using (var layout = new Pango.Layout (widget.PangoContext)) {
layout.Alignment = Pango.Alignment.Left;
layout.SetMarkup (GetPackageSourceNameMarkup ());
int packageSourceNameWidth = GetLayoutWidth (layout);
StateType state = GetState (widget, flags);
layout.SetMarkup (GetPackageSourceDescriptionMarkup ());
window.DrawLayout (widget.Style.TextGC (state), cell_area.X + textSpacing, cell_area.Y + textTopSpacing, layout);
if (!PackageSourceViewModel.IsValid) {
using (var ctx = Gdk.CairoHelper.Create (window)) {
ctx.DrawImage (widget, warningImage, cell_area.X + textSpacing + packageSourceNameWidth + imageSpacing, cell_area.Y + textTopSpacing);
}
layout.SetMarkup (GetPackageSourceErrorMarkup ());
int packageSourceErrorTextX = cell_area.X + textSpacing + packageSourceNameWidth + (int)warningImage.Width + (2 * imageSpacing);
window.DrawLayout (widget.Style.TextGC (state), packageSourceErrorTextX, cell_area.Y + textTopSpacing, layout);
}
}
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:28,代码来源:PackageSourceCellRenderer.cs
示例17: ProcessKeyEvent
// Called when a key is pressed in the editor.
// Returns false if the key press has to continue normal processing.
public static bool ProcessKeyEvent (ICompletionWidget widget, Gdk.Key key, Gdk.ModifierType modifier)
{
if (methods.Count == 0)
return false;
MethodData cmd = methods [methods.Count - 1];
if (key == Gdk.Key.Down) {
if (cmd.MethodProvider.OverloadCount <= 1)
return false;
if (cmd.CurrentOverload < cmd.MethodProvider.OverloadCount - 1)
cmd.CurrentOverload ++;
else
cmd.CurrentOverload = 0;
UpdateWindow (widget);
return true;
}
else if (key == Gdk.Key.Up) {
if (cmd.MethodProvider.OverloadCount <= 1)
return false;
if (cmd.CurrentOverload > 0)
cmd.CurrentOverload --;
else
cmd.CurrentOverload = cmd.MethodProvider.OverloadCount - 1;
UpdateWindow (widget);
return true;
}
else if (key == Gdk.Key.Escape) {
HideWindow (widget);
return true;
}
return false;
}
开发者ID:Shanto,项目名称:monodevelop,代码行数:35,代码来源:ParameterInformationWindowManager.cs
示例18: DrawContents
protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
{
g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
g.SetFontSize(24);
TextExtents te;
Text.ShadowedText(g, "Time", X + x1, Y + y1);
Text.ShadowedText(g, "Gil", X + x1, Y + y2);
g.SelectFontFace("Courier New", FontSlant.Normal, FontWeight.Bold);
long s, m, h;
s = GameClock.Seconds;
m = GameClock.Minutes;
h = GameClock.Hours;
string time = String.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s);
te = g.TextExtents(time);
Text.ShadowedText(g, time, X + x2 - te.Width, Y + y1);
te = g.TextExtents(Gil);
Text.ShadowedText(g, Gil, X + x2 - te.Width, Y + y2);
}
开发者ID:skinitimski,项目名称:Reverence,代码行数:25,代码来源:Time.cs
示例19: Render
public override void Render (ImageSurface src, ImageSurface dest, Gdk.Rectangle[] rois)
{
if (op == null)
op = new UnaryPixelOps.PosterizePixel (Data.Red, Data.Green, Data.Blue);
op.Apply (dest, src, rois);
}
开发者ID:msiyer,项目名称:Pinta,代码行数:7,代码来源:PosterizeEffect.cs
示例20: InsertCompletionText
public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, Gdk.Key closeChar, char keyChar, Gdk.ModifierType modifier)
{
// insert add/remove event handler code after +=/-=
editor.Replace (initialOffset, editor.Caret.Offset - initialOffset, this.DisplayText + (AddSemicolon ? ";" : ""));
// Search opening bracket of member
int pos = callingMember != null ? editor.Document.LocationToOffset (callingMember.BodyRegion.BeginLine, callingMember.BodyRegion.BeginColumn) : initialOffset;
while (pos < editor.Document.TextLength && editor.Document.GetCharAt (pos) != '{') {
pos++;
}
// Search closing bracket of member
pos = editor.Document.GetMatchingBracketOffset (pos) + 1;
pos = Math.Max (0, Math.Min (pos, editor.Document.TextLength - 1));
// Insert new event handler after closing bracket
var line = callingMember != null ? editor.Document.GetLine (callingMember.Region.BeginLine) : editor.Document.GetLineByOffset (initialOffset);
string indent = line.GetIndentation (editor.Document);
StringBuilder sb = new StringBuilder ();
sb.Append (editor.EolMarker);
sb.Append (editor.EolMarker);
sb.Append (indent);
if (callingMember != null && callingMember.IsStatic)
sb.Append ("static ");
sb.Append ("void ");
int pos2 = sb.Length;
sb.Append (this.DisplayText);
sb.Append (' ');
sb.Append (this.parameterList);
sb.Append (editor.EolMarker);
sb.Append (indent);
sb.Append ("{");
sb.Append (editor.EolMarker);
sb.Append (indent);
sb.Append (editor.Options.IndentationString);
int cursorPos = pos + sb.Length;
sb.Append (editor.EolMarker);
sb.Append (indent);
sb.Append ("}");
editor.Insert (pos, sb.ToString ());
editor.Caret.Offset = cursorPos;
// start text link mode after insert
List<TextLink> links = new List<TextLink> ();
TextLink link = new TextLink ("name");
link.AddLink (new TextSegment (0, this.DisplayText.Length));
link.AddLink (new TextSegment (pos - initialOffset + pos2, this.DisplayText.Length));
links.Add (link);
var tle = new TextLinkEditMode (editor.Parent, initialOffset, links);
tle.TextLinkMode = TextLinkMode.EditIdentifier;
tle.SetCaretPosition = true;
tle.SelectPrimaryLink = true;
tle.OldMode = editor.CurrentMode;
tle.StartMode ();
editor.CurrentMode = tle;
}
开发者ID:segaman,项目名称:monodevelop,代码行数:60,代码来源:EventCreationCompletionData.cs
注:本文中的Gdk类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论