コード例 #1
0
ファイル: BooleanEditorCell.cs プロジェクト: thbin/TraceLab
        public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state)
        {
            Gtk.ShadowType sh = (bool)Value ? Gtk.ShadowType.In : Gtk.ShadowType.Out;
            int            s  = indicatorSize - 1;

            if (s > bounds.Height)
            {
                s = bounds.Height;
            }
            if (s > bounds.Width)
            {
                s = bounds.Width;
            }
            Gtk.Style.PaintCheck(Container.Style, window, state, sh, bounds, Container, "checkbutton", bounds.X + indicatorSpacing - 1, bounds.Y + (bounds.Height - s) / 2, s, s);
        }
コード例 #2
0
        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);

            if (IsControl)
            {
                Shapes.RenderCursor(g, X + cx, Y + cy + (option * y));
            }

            Text.ShadowedText(g, "Arrange", X + x, Y + (1 * y));
            Text.ShadowedText(g, "Exchange", X + x, Y + (2 * y));
            Text.ShadowedText(g, "Clear", X + x, Y + (3 * y));
            Text.ShadowedText(g, "Trash", X + x, Y + (4 * y));
        }
コード例 #3
0
        public override void Render(Gdk.Drawable window, Cairo.Context ctx, Gdk.Rectangle bounds, Gtk.StateType state)
        {
            var values = Enum.GetValues(Property.PropertyType);

            if (values.Length < MaxCheckCount)
            {
                if (style == null)
                {
                    InitializeStyle(Container);
                }

                var container = (Widget)Container;
                using (var layout = new Pango.Layout(container.PangoContext)) {
                    layout.Width           = -1;
                    layout.FontDescription = FontService.SansFont.CopyModified(Ide.Gui.Styles.FontScale11);

                    ulong value = Convert.ToUInt64(Value);
                    int   dy    = 2;
                    foreach (var val in values)
                    {
                        ulong          uintVal = Convert.ToUInt64(val);
                        Gtk.ShadowType sh      = (value & uintVal) != 0 ? Gtk.ShadowType.In : Gtk.ShadowType.Out;
                        if (value == 0 && uintVal == 0)
                        {
                            sh = Gtk.ShadowType.In;
                        }
                        int s = indicatorSize - 1;
                        Gtk.Style.PaintCheck(style, window, state, sh, bounds, Container, "checkbutton", bounds.X + indicatorSpacing - 1, bounds.Y + dy, s, s);

                        layout.SetText(val.ToString());
                        int tw, th;
                        layout.GetPixelSize(out tw, out th);
                        ctx.Save();
                        ctx.SetSourceColor(container.Style.Text(state).ToCairoColor());
                        ctx.MoveTo(bounds.X + indicatorSize + indicatorSpacing, dy + bounds.Y + ((indicatorSize - th) / 2));
                        Pango.CairoHelper.ShowLayout(ctx, layout);
                        ctx.Restore();

                        dy += indicatorSize + CheckSpacing;
                    }
                }
            }
            else
            {
                base.Render(window, ctx, bounds, state);
                return;
            }
        }
コード例 #4
0
        protected override void DrawContents(Gdk.Drawable d)
        {
            Gdk.GC        gc = new Gdk.GC(d);
            Cairo.Context g  = Gdk.CairoHelper.Create(d);

            g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;


            Character c = Globals.Party[2];

            if (c != null)
            {
                d.DrawPixbuf(gc, Graphics.GetProfileSmall(c.Name), 0, 0,
                             X + xpic, Y + ypic,
                             Graphics.PROFILE_WIDTH_SMALL, Graphics.PROFILE_HEIGHT_SMALL,
                             Gdk.RgbDither.None, 0, 0);

                Graphics.ShadowedText(g, c.Name, X + x1, Y + y0);
                Graphics.ShadowedText(g, "Level:", X + x2, Y + y1);

                string lvl = c.Level.ToString();
                te = g.TextExtents(lvl);
                Graphics.ShadowedText(g, lvl, X + x3 - te.Width, Y + y1);

                string temp = "Exp:";
                te = g.TextExtents(temp);
                Graphics.ShadowedText(g, temp, X + x4 - te.Width, Y + y0);

                temp = "For level up:";
                te   = g.TextExtents(temp);
                Graphics.ShadowedText(g, temp, X + x4 - te.Width, Y + y1);

                string exp = c.Exp.ToString() + "p";
                te = g.TextExtents(exp);
                Graphics.ShadowedText(g, exp, X + x5 - te.Width, Y + y0);

                string expNext = c.ToNextLevel.ToString() + "p";
                te = g.TextExtents(expNext);
                Graphics.ShadowedText(g, expNext, X + x5 - te.Width, Y + y1);
            }


            ((IDisposable)g.Target).Dispose();
            ((IDisposable)g).Dispose();
        }
コード例 #5
0
        void DrawTable()
        {
            Gdk.Drawable drawable = GameDrawArea.GdkWindow;
            int          tableWidth, tableHeight, tileWidth, tileHeight;

            drawable.GetSize(out tableWidth, out tableHeight);
            tileWidth  = tableWidth / game.GameInfo.TableSize;
            tileHeight = tableHeight / game.GameInfo.TableSize;

            Font         font      = new Font("Sans", (int)(Math.Min(tileWidth, tileHeight) * 0.5), FontStyle.Regular);
            StringFormat strFormat = new StringFormat
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            };

            using (Graphics g = Gtk.DotNet.Graphics.FromDrawable(GameDrawArea.GdkWindow))
            {
                g.SmoothingMode = SmoothingMode.AntiAlias;
                g.FillRectangle(Brushes.Black, 0, 0, tableWidth, tableHeight);

                for (int y = 0; y < game.GameInfo.TableSize; y++)
                {
                    for (int x = 0; x < game.GameInfo.TableSize; x++)
                    {
                        Tile tile = game.GetTile(x, y);

                        Rectangle desRectangle = new Rectangle(x * tileWidth, y * tileHeight, tileWidth, tileHeight);
                        Rectangle srcRectangle = new Rectangle(
                            (tile.Number - 1) % game.GameInfo.TableSize * tileWidth,
                            (tile.Number - 1) / game.GameInfo.TableSize * tileHeight,
                            desRectangle.Width, desRectangle.Height);

                        if (tile.Number != game.GameInfo.TilesCount)
                        {
                            g.DrawImage(image, desRectangle.X, desRectangle.Y, srcRectangle, GraphicsUnit.Pixel);
                            g.DrawString(tile.Number.ToString(), font, Brushes.IndianRed, desRectangle, strFormat);
                        }
                        else
                        {
                            g.FillRectangle(Brushes.Gray, desRectangle);
                        }

                        g.DrawRectangle(Pens.Black, desRectangle);
                    }
                }
            }
        }
コード例 #6
0
        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            Gdk.Drawable win = args.Window;

            int width, height;

            layout.GetPixelSize(out width, out height);

//			if (DrawRightBorder)
//				arrowXPos -= 2;

            //HACK: don't ever draw insensitive, only active/prelight/normal, because insensitive generally looks really ugly
            //this *might* cause some theme issues with the state of the text/arrows rendering on top of it
            var state = /*window != null? StateType.Active
                         * : State == StateType.Insensitive? StateType.Normal : */State;

            //HACK: paint the button background as if it were bigger, but it stays clipped to the real area,
            // so we get the content but not the border. This might break with crazy themes.
            //FIXME: we can't use the style's actual internal padding because GTK# hasn't wrapped GtkBorder AFAICT
            // (default-border, inner-border, default-outside-border, etc - see http://git.gnome.org/browse/gtk+/tree/gtk/gtkbutton.c)
            const int padding = 0;

            Style.PaintBox(Style, args.Window, state, ShadowType.None, args.Area, this, "button",
                           Allocation.X - padding, Allocation.Y - padding, Allocation.Width + padding * 2, Allocation.Height + padding * 2);

            int xPos = Allocation.Left + 4;

            if (Pixbuf != null)
            {
                win.DrawPixbuf(this.Style.BaseGC(StateType.Normal), Pixbuf, 0, 0, xPos + pixbufSpacing, Allocation.Y + (Allocation.Height - Pixbuf.Height) / 2, Pixbuf.Width, Pixbuf.Height, Gdk.RgbDither.None, 0, 0);
                xPos += Pixbuf.Width + pixbufSpacing * 2;
            }
            int arrowHeight = height - 4;
            int arrowWidth  = arrowHeight + 3;
            int arrowXPos   = this.Allocation.X + this.Allocation.Width - arrowWidth;
            //constrain the text area so it doesn't get rendered under the arrows
            var textArea = new Gdk.Rectangle(xPos, Allocation.Y + ySpacing, arrowXPos - xPos - 2, Allocation.Height - ySpacing);

            Style.PaintLayout(Style, win, state, true, textArea, this, "", textArea.X, textArea.Y, layout);

            state = Sensitive ? StateType.Normal : StateType.Insensitive;

            Gtk.Style.PaintVline(this.Style, win, state, args.Area, this, "", Allocation.Y + 3, Allocation.Bottom - 4, arrowXPos - 4);
            Gtk.Style.PaintArrow(this.Style, win, state, ShadowType.None, args.Area, this, "", ArrowType.Down, true, arrowXPos, Allocation.Y, Allocation.Height / 2, Allocation.Height);
//			if (DrawRightBorder)
//				win.DrawLine (this.Style.DarkGC (StateType.Normal), Allocation.X + Allocation.Width - 1, Allocation.Y, Allocation.X + Allocation.Width - 1, Allocation.Y + Allocation.Height);
            return(false);
        }
コード例 #7
0
        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);

            int y_cursor = y_option0 + y_spacing * Option + y_displacement_cursor;

            Shapes.RenderCursor(g, X + x_cursor, Y + y_cursor);

            Text.ShadowedText(g, "Pick save file", X + x_prompt, Y + y_prompt);

            for (int option = 0; option < options; option++)
            {
                Text.ShadowedText(g, "Save " + option, X + x_options, Y + y_option0 + y_spacing * option);
            }
        }
コード例 #8
0
        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            BattleEvent e = BattleState.ActiveAbility;

            if (e != null)
            {
                g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
                g.SetFontSize(24);

                string msg = e.GetStatus();

                TextExtents te = g.TextExtents(msg);

                Text.ShadowedText(g, msg, X + (W / 2) - (te.Width / 2), Y + 32);
            }
        }
コード例 #9
0
            protected override void Render(Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
            {
                if (float.IsNaN((float)Handler.GetValueInternal(Item, Handler.ColumnIndex, Row).Val))
                {
                    return;
                }

                if (Handler.FormattingEnabled)
                {
                    Handler.Format(new GtkGridCellFormatEventArgs <Renderer>(this, Handler.Column.Widget, Item, Row));
                }

                // calling base crashes on windows
                GtkCell.gtksharp_cellrenderer_invoke_render(Gtk.CellRendererProgress.GType.Val, Handle, window.Handle, widget.Handle, ref background_area, ref cell_area, ref expose_area, flags);
                //base.Render (window, widget, background_area, cell_area, expose_area, flags);
            }
コード例 #10
0
ファイル: ImageSelector.cs プロジェクト: noah1510/dotdevelop
        public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state)
        {
            int iy = bounds.Y + (bounds.Height - imgSize) / 2;

            if (image != null)
            {
                int dy = (imgSize - image.Height) / 2;
                int dx = (imgSize - image.Width) / 2;
                window.DrawPixbuf(Container.Style.BackgroundGC(state), image, 0, 0, bounds.X + dx, iy + dy, -1, -1, Gdk.RgbDither.None, 0, 0);
            }

            window.DrawRectangle(Container.Style.DarkGC(state), false, bounds.X, iy, imgSize - 1, imgSize - 1);

            bounds.X += imgSize + spacing;
            base.Render(window, bounds, state);
        }
コード例 #11
0
        internal protected override void Draw(Gdk.Drawable drawable, Gdk.Rectangle area, long line, int x, int y)
        {
            drawable.DrawRectangle(bgGC, true, x, y, Width, Editor.LineHeight);
            LayoutWrapper layout = GetLayout(line);

            if (!Data.IsSomethingSelected && Caret.InTextEditor && line == Data.Caret.Line)
            {
                drawable.DrawRectangle(GetGC(Style.HighlightOffset), true, CalculateCaretXPos(false), y, byteWidth, Editor.LineHeight);
            }

            drawable.DrawLayout(fgGC, x, y, layout.Layout);
            if (layout.IsUncached)
            {
                layout.Dispose();
            }
        }
コード例 #12
0
        public static Cairo.Context CreateDrawable(Gdk.Drawable drawable, bool double_buffered)
        {
            int x, y, w, h, d;

            Cairo.Surface surface;
            bool          needs_xlate;

            ((Gdk.Window)drawable).GetGeometry(out x, out y, out w, out h, out d);

            PlatformID os = Environment.OSVersion.Platform;

            needs_xlate = drawable is Gdk.Window && double_buffered;

            if (needs_xlate)
            {
                ((Gdk.Window)drawable).GetInternalPaintInfo(out drawable, out x, out y);
            }

            if (os == PlatformID.Win32Windows || os == PlatformID.Win32NT ||
                os == PlatformID.Win32S || os == PlatformID.WinCE)
            {
                Gdk.GC gcc   = new Gdk.GC(drawable);
                IntPtr windc = gdk_win32_hdc_get(drawable.Handle, gcc.Handle, 0);
                surface = new Win32Surface(windc);

                if (double_buffered)
                {
                    gdk_win32_hdc_release(drawable.Handle, gcc.Handle, 0);
                }
            }
            else
            {
                IntPtr display   = gdk_x11_drawable_get_xdisplay(drawable.Handle);
                IntPtr visual    = gdk_drawable_get_visual(drawable.Handle);
                IntPtr xvisual   = gdk_x11_visual_get_xvisual(visual);
                IntPtr xdrawable = gdk_x11_drawable_get_xid(drawable.Handle);
                surface = new XlibSurface(display, xdrawable, xvisual, w, h);
            }

            Cairo.Context ctx = new Cairo.Context(surface);

            if (needs_xlate)
            {
                ctx.Translate(-(double)x, -(double)y);
            }
            return(ctx);
        }
コード例 #13
0
ファイル: ItemMenu.cs プロジェクト: skinitimski/Reverence
        protected override void DrawContents(Gdk.Drawable d)
        {
            Cairo.Context g = Gdk.CairoHelper.Create(d);

            g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;


            int j = Math.Min(_rows + _topRow, Inventory.INVENTORY_SIZE);

            Color gray = new Color(.4, .4, .4);

            for (int i = _topRow; i < j; i++)
            {
                IItem item = Inventory.GetItem(i);
                if (item != null)
                {
                    int count = Inventory.GetCount(i);
                    te = g.TextExtents(count.ToString());
                    if (item.Type == ItemType.Battle || item.Type == ItemType.Hybrid)
                    {
                        Graphics.ShadowedText(g, item.Name,
                                              X + x1, Y + (i - _topRow + 1) * y);
                        Graphics.ShadowedText(g, count.ToString(),
                                              X + x2 - te.Width, Y + (i - _topRow + 1) * y);
                    }
                    else
                    {
                        Graphics.ShadowedText(g, gray, item.Name,
                                              X + x1, Y + (i - _topRow + 1) * y);
                        Graphics.ShadowedText(g, gray, count.ToString(),
                                              X + x2 - te.Width, Y + (i - _topRow + 1) * y);
                    }
                }
            }

            if (IsControl)
            {
                Graphics.RenderCursor(g, X + cx, Y + cy + (_option - _topRow) * y);
            }


            ((IDisposable)g.Target).Dispose();
            ((IDisposable)g).Dispose();
        }
コード例 #14
0
        internal protected override void Draw(Gdk.Drawable drawable, Gdk.Rectangle area, long line, int x, int y)
        {
            drawable.DrawRectangle(bgGC, true, x, y, Width, Editor.LineHeight);
            LayoutWrapper layout = GetLayout(line);

            if (!Data.IsSomethingSelected && !Caret.InTextEditor && line == Data.Caret.Line)
            {
                int column  = (int)(Caret.Offset % BytesInRow);
                int xOffset = charWidth * column;
                drawable.DrawRectangle(GetGC(Style.HighlightOffset), true, x + xOffset, y, charWidth, Editor.LineHeight);
            }
            drawable.DrawLayout(fgGC, x, y, layout.Layout);
            if (layout.IsUncached)
            {
                layout.Dispose();
            }
        }
コード例 #15
0
        public void Draw(Gdk.Drawable d, bool stack)
        {
            foreach (Menu m in _menus)
            {
                m.Draw(d);
            }

            _mutex.WaitOne();
            if (stack)
            {
                foreach (IController c in _controllerStack)
                {
                    c.Draw(d);
                }
            }
            _mutex.ReleaseMutex();
        }
コード例 #16
0
 /// <summary>
 /// Draws the Image contained in the ColumnHeader
 /// </summary>
 /// <param name="g">The Graphics used to paint the Image</param>
 /// <param name="image">The Image to be drawn</param>
 /// <param name="imageRect">A rectangle that specifies the Size and
 /// Location of the Image</param>
 /// <param name="enabled">Specifies whether the Image should be drawn
 /// in an enabled state</param>
 protected void DrawColumnHeaderImage(Gdk.Drawable dr, Gdk.Pixbuf image, Gdk.Rectangle imageRect, bool enabled)
 {
     System.Drawing.Graphics g   = Gtk.DotNet.Graphics.FromDrawable(dr);
     System.Drawing.Image    img = GraphUtil.BitmapFromPixbuf(image);
     if (enabled)
     {
         g.DrawImage(image, imageRect);
     }
     else
     {
         using (Image im = new System.Drawing.BitmapBitmap(image, imageRect.Width, imageRect.Height))
         {
             //TODO:
             //ControlPaint.DrawImageDisabled(g, im, imageRect.X, imageRect.Y, this.BackBrush.Color);
         }
     }
 }
コード例 #17
0
        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;

            MagicMenuEntry s = BattleState.Commanding.MagicMenu.Selected;

            int row = 0;

            if (s != null)
            {
                string cost = s.Spell.MPCost.ToString();
                Text.ShadowedText(g, "MP Req", X + x1, Y + y0);

                row++;

                cost = cost + "/";
                te   = g.TextExtents(cost);
                Text.ShadowedText(g, cost, X + x2 - te.Width, Y + y0 + (row * ys));

                string tot = BattleState.Commanding.MP.ToString();
                te = g.TextExtents(tot);
                Text.ShadowedText(g, tot, X + x3 - te.Width, Y + y0 + (row * ys));

                row++;

//                if (s.AddedAbility.Contains(AddedAbility.All))
//                {
//                    string msg = "All x";
//                    msg += s.AllCount.ToString();
//                    Text.ShadowedText(g, msg, X + x0, Y + y0 + (row * ys));
//                    row++;
//                }
//
//                if (s.AddedAbility.Contains(AddedAbility.QuadraMagic))
//                {
//                    string msg = "Q-Magic x";
//                    msg += s.QMagicCount.ToString();
//                    Text.ShadowedText(g, msg, X + x0, Y + y0 + (row * ys));
//                    row++;
//                }
            }
        }
コード例 #18
0
ファイル: Main.cs プロジェクト: skinitimski/Reverence
        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);

            Color c;

            int j = Math.Min(_visibleRows + _topRow, _totalRows);


            for (int b = _topRow; b < j; b++)
            {
                for (int a = 0; a < COLUMNS; a++)
                {
                    MagicMenuEntry spell = _spells[b, a];

                    if (spell != null)
                    {
                        if (AssociatedAlly.Frog && spell.Name != "Toad")
                        {
                            c = Colors.GRAY_4;
                        }
                        else
                        {
                            c = Colors.WHITE;
                        }

                        Text.ShadowedText(g, c, spell.Spell.Name,
                                          X + x1 + a * xs,
                                          Y + (b - _topRow + 1) * ys);
                    }
                }
            }


            if (IsControl)
            {
                Shapes.RenderCursor(g,
                                    X + x1 + cx + _xopt * xs,
                                    Y + cy + (_yopt - _topRow + 1) * ys);
            }


            AssociatedAlly.CurrentBattle.Screen.MagicInfo.Draw(d, g, width, height, screenChanged);
        }
コード例 #19
0
ファイル: List.cs プロジェクト: skinitimski/Reverence
        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            for (int a = 0; a <= 2; a++)
            {
                for (int b = 0; b <= 2; b++)
                {
                    if (MenuState.Party.Reserves[a, b] != null)
                    {
                        Images.RenderProfileSmall(d, X + x + b * xs, Y + y + a * ys, MenuState.Party.Reserves[a, b]);
                    }
                }
            }

            if (IsControl)
            {
                Shapes.RenderCursor(g, X + cx, Y + cy - 15);
            }
        }
コード例 #20
0
        protected override void DrawContents(Gdk.Drawable d)
        {
            Cairo.Context g = Gdk.CairoHelper.Create(d);

            g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            string exp = Game.PostBattle.Exp.ToString() + "p";

            te = g.TextExtents(exp);
            Graphics.ShadowedText(g, "EXP", X + x1, Y + ys);
            Graphics.ShadowedText(g, exp, X + x2 - te.Width, Y + ys);

            ((IDisposable)g.Target).Dispose();
            ((IDisposable)g).Dispose();
        }
コード例 #21
0
        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;

            string msg = "";

            if (BattleState.Screen.Control != null)
            {
                msg = BattleState.Screen.Control.Info;
            }

            te = g.TextExtents(msg);

            Text.ShadowedText(g, msg, X + (W / 2) - (te.Width / 2), Y + 32);
        }
コード例 #22
0
ファイル: HoardScreen.cs プロジェクト: skinitimski/Reverence
        protected override void DrawContents(Gdk.Drawable d)
        {
            Cairo.Context g = Gdk.CairoHelper.Create(d);

            g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            string gil = Globals.Gil.ToString() + "g";

            te = g.TextExtents(gil);
            Graphics.ShadowedText(g, "Gil", X + x1, Y + ys);
            Graphics.ShadowedText(g, gil, X + x2 - te.Width, Y + ys);

            ((IDisposable)g.Target).Dispose();
            ((IDisposable)g).Dispose();
        }
コード例 #23
0
        /// <summary>
        /// Draws the ColumnHeader's sort arrow
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="drawRect">A Gdk.Rectangle that specifies the location
        /// of the sort arrow</param>
        /// <param name="direction">The direction of the sort arrow</param>
        /// <param name="enabled">Specifies whether the sort arrow should be
        /// drawn in an enabled state</param>
        protected virtual void DrawSortArrow(Gdk.Drawable dr, Gdk.Rectangle drawRect, SortOrder direction, bool enabled)
        {
            System.Drawing.Graphics g = Gtk.DotNet.Graphics.FromDrawable(dr);
            if (direction != SortOrder.None)
            {
                using (Font font = new Font("Marlett", 9f))
                {
                    using (StringFormat format = new StringFormat())
                    {
                        format.Alignment     = StringAlignment.Far;
                        format.LineAlignment = StringAlignment.Center;

                        if (direction == SortOrder.Ascending)
                        {
                            if (enabled)
                            {
                                g.DrawString("t", font, SystemBrushes.ControlDarkDark, drawRect, format);
                            }
                            else
                            {
                                using (SolidBrush brush = new SolidBrush(SystemPens.GrayText.Color))
                                {
                                    g.DrawString("t", font, brush, drawRect, format);
                                }
                            }
                        }
                        else
                        {
                            if (enabled)
                            {
                                g.DrawString("u", font, SystemBrushes.ControlDarkDark, drawRect, format);
                            }
                            else
                            {
                                using (SolidBrush brush = new SolidBrush(SystemPens.GrayText.Color))
                                {
                                    g.DrawString("u", font, brush, drawRect, format);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #24
0
ファイル: GameWindow.cs プロジェクト: AndrewAran/minesweeper
        void DrawInfoBar()
        {
            Gdk.Drawable drawable     = daInfoBar.GdkWindow;
            Graphics     gfx          = Gtk.DotNet.Graphics.FromDrawable(drawable);
            Brush        brBackground = new SolidBrush(backgroundColor);
            Brush        brForeground = new SolidBrush(primaryColor);


            int width, height, widthThird;

            drawable.GetSize(out width, out height);
            widthThird = width / 3;

            Rectangle recWhole  = new Rectangle(0, 0, width, height);
            Rectangle recLeft   = new Rectangle(0, 0, widthThird, height);
            Rectangle recMiddle = new Rectangle(widthThird, 0, widthThird, height);
            Rectangle recRight  = new Rectangle(widthThird * 2, 0, widthThird, height);

            Font         f         = new Font("Sans", (int)(Math.Min(width, height) * 0.5), FontStyle.Regular);
            StringFormat strFormat = new StringFormat();

            strFormat.Alignment     = StringAlignment.Center;
            strFormat.LineAlignment = StringAlignment.Center;

            string face;

            gfx.FillRectangle(brBackground, recWhole);

            if (game.Alive)
            {
                face = ":)";
            }
            else
            {
                face = ":(";
            }

            gfx.DrawString(game.FlagsRemaining.ToString(), f, brForeground, recLeft, strFormat);
            gfx.DrawString(face, f, brForeground, recMiddle, strFormat);
            gfx.DrawString(string.Format("{0:00}:{1:00}", (game.GameTime / 60) % 60, game.GameTime % 60),
                           f, brForeground, recRight, strFormat);

            gfx.Dispose();
        }
コード例 #25
0
        public static void SetSourceDrawable(Context ctx, Gdk.Drawable d, double x, double y)
        {
            try {
                gdk_cairo_set_source_pixmap(ctx.Handle, d.Handle, x, y);
            } catch (EntryPointNotFoundException) {
                int width, height;
                d.GetSize(out width, out height);
                XlibSurface surface = new XlibSurface(GdkUtils.GetXDisplay(d.Display),
                                                      (IntPtr)GdkUtils.GetXid(d),
                                                      GdkUtils.GetXVisual(d.Visual),
                                                      width, height);

                SurfacePattern p = new SurfacePattern(surface);
                Matrix         m = new Matrix();
                m.Translate(-x, -y);
                p.Matrix   = m;
                ctx.Source = p;
            }
        }
コード例 #26
0
        public override void Draw(Gdk.Drawable d)
        {
            Cairo.Context g = Gdk.CairoHelper.Create(d);

            if (IsControl)
            {
                foreach (ICombatant a in Game.Battle.Allies)
                {
                    Graphics.RenderCursor(g, a.X - 15, a.Y);
                }
                foreach (ICombatant e in Game.Battle.EnemyList)
                {
                    Graphics.RenderCursor(g, e.X - 15, e.Y);
                }
            }

            ((IDisposable)g.Target).Dispose();
            ((IDisposable)g).Dispose();
        }
コード例 #27
0
ファイル: List.cs プロジェクト: skinitimski/Reverence
        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.Color = Colors.WHITE;
            g.SetFontSize(24);

            int j = Math.Min(rows + _topRow, _equipment.Count);

            for (int i = _topRow; i < j; i++)
            {
                Text.ShadowedText(g, _equipment [i].Item.Name,
                                  X + x, Y + (i - _topRow + 1) * y);
            }

            if (IsControl)
            {
                Shapes.RenderCursor(g, X + cx, Y + cy + (_option - _topRow) * y);
            }
        }
コード例 #28
0
ファイル: Top.cs プロジェクト: skinitimski/Reverence
        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);

            string weapon, armor, acc;


            #region Character Status

            Images.RenderProfile(d, X + xpic, Y + ypic, MenuState.Party.Selected);

            Graphics.Stats.RenderCharacterStatus(d, g, MenuState.Party.Selected, X + x_status, Y + y_status, false);

            #endregion Status

            #region Equipment

            g.Color = Colors.TEXT_TEAL;
            g.MoveTo(X + x7, Y + yi);
            g.ShowText("Wpn.");
            g.MoveTo(X + x7, Y + yj);
            g.ShowText("Arm.");
            g.MoveTo(X + x7, Y + yk);
            g.ShowText("Acc.");
            g.Color = Colors.WHITE;

            weapon = MenuState.Party.Selected.Weapon.Name;
            armor  = MenuState.Party.Selected.Armor.Name;
            acc    = MenuState.Party.Selected.Accessory == null ? String.Empty : MenuState.Party.Selected.Accessory.Name;

            Text.ShadowedText(g, weapon, X + x8, Y + yi);
            Text.ShadowedText(g, armor, X + x8, Y + yj);
            Text.ShadowedText(g, acc, X + x8, Y + yk);

            #endregion Equipment


            if (IsControl)
            {
                Shapes.RenderCursor(g, X + cx, Y + cy - 10);
            }
        }
コード例 #29
0
ファイル: Main.cs プロジェクト: skinitimski/Reverence
        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);


            for (int i = 0; i < _options.Length; i++)
            {
                Text.ShadowedText(g, _options[i].Description, X + x_options, Y + _options[i].Y);
            }

            WindowColorMenu.Draw(d, g, width, height, screenChanged);
            BattleSpeedMenu.Draw(d, g, width, height, screenChanged);

            if (IsControl)
            {
                Shapes.RenderCursor(g, X + x_cursor, Y + _options[option].Y + y_displacement_cursor);
            }
        }
コード例 #30
0
        internal protected override void Draw(Gdk.Drawable win, Gdk.Rectangle area, long line, int x, int y)
        {
            if (backgroundGC == null)
            {
                OptionsChanged();
            }

            win.DrawRectangle(backgroundGC, true, x, y, Width, Editor.LineHeight);
            win.DrawLine(separatorGC, x + Width - 1, y, x + Width - 1, y + Editor.LineHeight);

            foreach (long bookmark in Data.Bookmarks)
            {
                if (line * Editor.BytesInRow <= bookmark && bookmark < line * Editor.BytesInRow + Editor.BytesInRow)
                {
                    DrawBookmark(win, x, y);
                    return;
                }
            }
        }
コード例 #31
0
ファイル: MainWindow.cs プロジェクト: Screenary/Screenary
    public MainWindow(int m)
        : base(Gtk.WindowType.Toplevel)
    {
        Build();

        /* Instantiate client states */
        clientStates = new IClientState[7]
        {
            new StartedState(this),
            new SenderCreatedState(this),
            new ReceiverJoinedState(this),
            new ReceiverAuthenticatedState(this),
            new SenderSendingState(this),
            new ReceiverInControlState(this),
            new SenderSendingRemoteState(this)
        };

        /* Set current state to STARTED */
        currentState = clientStates[STARTED_STATE];
        currentState.refresh();

        width = 1024;
        height = 768;

        config = Config.Load();

        window = mainDrawingArea.GdkWindow;
        drawable = (Gdk.Drawable) window;

        mainDrawingArea.AddEvents(
            (int) Gdk.EventMask.ButtonPressMask |
            (int) Gdk.EventMask.ButtonReleaseMask |
            (int) Gdk.EventMask.PointerMotionMask |
            (int) Gdk.EventMask.KeyPressMask |
            (int) Gdk.EventMask.KeyReleaseMask);

        gc = new Gdk.GC(drawable);
        gc.ClipRectangle = new Gdk.Rectangle(0, 0, width, height);

        surface = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, height);
        window.InvalidateRect(new Gdk.Rectangle(0, 0, width, height), true);

        receiver = new SurfaceReceiver(window, surface);

        this.transport = null;

        pcapSource = new PcapSource(this);

        keyboard = new Keyboard();

        if (config.BroadcasterAutoconnect)
            OnUserConnect(config.BroadcasterHostname, config.BroadcasterPort);
    }
コード例 #32
0
 public SplashScreenDrawArgs(Context context, Gdk.Drawable drawable, Gdk.Rectangle allocation)
 {
     this.context = context;
     this.drawable = drawable;
     this.allocation = allocation;
     this.retval = true;
 }
コード例 #33
0
ファイル: MainWindow.cs プロジェクト: Screenary/Screenary
    /**
     * Resets the Drawing Area to blank
     */
    protected void OnCloseActionActivated(object sender, System.EventArgs e)
    {
        this.Title = "Screenary";
        window = mainDrawingArea.GdkWindow;
        drawable = (Gdk.Drawable) window;

        gc = new Gdk.GC(drawable);
        gc.ClipRectangle = new Gdk.Rectangle(0, 0, width, height);

        surface = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, height);
        window.InvalidateRect(new Gdk.Rectangle(0, 0, width, height), true);

        receiver = new SurfaceReceiver(window, surface);
    }
コード例 #34
0
ファイル: MainWindow.cs プロジェクト: marwansamaha/Screenary
    public MainWindow(int m)
        : base(Gtk.WindowType.Toplevel)
    {
        Build();

        /* Instantiate client states */
        clientStates = new IClientState[4] {
            new StartedState(this),
            new SenderCreatedState(this),
            new ReceiverJoinedState(this),
            new ReceiverAuthenticatedState(this)
        };

        /* Set current state to STARTED */
        currentState = clientStates[STARTED_STATE];

        mode = m;
        width = 1024;
        height = 768;

        config = Config.Load();

        window = mainDrawingArea.GdkWindow;
        drawable = (Gdk.Drawable) window;

        gc = new Gdk.GC(drawable);
        gc.ClipRectangle = new Gdk.Rectangle(0, 0, width, height);

        surface = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, height);
        window.InvalidateRect(new Gdk.Rectangle(0, 0, width, height), true);

        receiver = new SurfaceReceiver(window, surface);

        OutOfSessionWindow();

        this.transport = null;

        rdpSource = new RdpSource(this);
        pcapSource = new PcapSource(this);

        if (config.BroadcasterAutoconnect)
            OnUserConnect(config.BroadcasterHostname, config.BroadcasterPort);
    }