Inheritance: XwtObject
Beispiel #1
0
        public void SetFont(object backend, Xwt.Drawing.Font font)
        {
            LayoutInfo li = (LayoutInfo)backend;

            li.Font = (NSFont)WidgetRegistry.GetBackend(font);
            UpdateInfo(li);
        }
Beispiel #2
0
        public void SetFont(object backend, Font font)
        {
            var c = (DrawingContext)backend;

            c.Font.Dispose();
            c.Font = font.ToDrawingFont();
        }
Beispiel #3
0
        public void SetFont(Font font)
        {
            this.Font = font;
            var f = (FontData)Toolkit.GetBackend(font);

            FormattedText.SetFontFamily(f.Family);
            FormattedText.SetFontSize(f.GetDeviceIndependentPixelSize());
            FormattedText.SetFontStretch(f.Stretch);
            FormattedText.SetFontStyle(f.Style);
            FormattedText.SetFontWeight(f.Weight);
        }
Beispiel #4
0
 public void SetFont(Font font)
 {
     if (!font.Equals(this.Font))
     {
         this.Font = font;
         if (formattedText != null)
         {
             ApplyFont();
         }
     }
 }
        public static void SelectFont(this Cairo.Context ctx, Font font)
        {
            Cairo.FontSlant slant;
            switch (font.Style) {
            case FontStyle.Oblique: slant = Cairo.FontSlant.Oblique; break;
            case FontStyle.Italic: slant = Cairo.FontSlant.Italic; break;
            default: slant = Cairo.FontSlant.Normal; break;
            }

            Cairo.FontWeight w = font.Weight >= FontWeight.Bold ? Cairo.FontWeight.Bold : Cairo.FontWeight.Normal;

            ctx.SelectFontFace (font.Family, slant, w);
        }
Beispiel #6
0
        /// <summary>Creates a new ListView2Item</summary>
        /// <param name="rowNumber">Number of owning row</param>
        /// <param name="colNumber">Number of owning column</param>
        /// <param name="rowTag">The item's tag</param>
        /// <param name="columns">Array of column information</param>
        /// <param name="data">The data that should be shown in this LV2I</param>
        /// <param name="font">Which font should be used</param>
        public ListView2Item(int rowNumber, int colNumber, string rowTag, ListView2.ColumnInfo[] columns, List<Object> data, Font font)
        {
            MinHeight = 16;
            HeightRequest = 16;
            MinWidth = 500;
            ExpandHorizontal = true;
            ExpandVertical = true;

            _Values = data.ToArray();
            _Cols = columns;
            _FontToDraw = font;
            Tag = rowTag;
            RowNo = rowNumber;
            ColNo = colNumber;

            QueueDraw();
        }
Beispiel #7
0
        private void UpdateScale()
        {
            if (labelFont != null) {
                labelFontScaled = Utils.ScaleFont (labelFont, FontScale);
            }

            if (tickTextFont != null) {
                tickTextFontScaled = Utils.ScaleFont (tickTextFont, FontScale);
            }
        }
Beispiel #8
0
        public override void SetFont(object backend, Font font)
        {
            var t = (TextLayoutBackend)backend;

            t.SetFont(font);
        }
Beispiel #9
0
		void SetFont(Font newFont)
		{
			selectedFont = newFont;
			previewText.Font = selectedFont;

			if (Math.Abs (spnSize.Value - selectedFont.Size) > double.Epsilon)
				spnSize.Value = selectedFont.Size;

			if (enableFontChangedEvent)
				Application.Invoke (delegate {
				EventSink.OnFontChanged ();
			});
		}
Beispiel #10
0
		public void SetFont(Font font)
		{
			if (!font.Equals(this.Font))
			{
				this.Font = font;
				if (formattedText != null)
					ApplyFont();
			}
		}
Beispiel #11
0
 public void SetFont(object backend, Xwt.Drawing.Font font)
 {
     Pango.Layout tl = (Pango.Layout)backend;
     tl.FontDescription = (Pango.FontDescription)WidgetRegistry.GetBackend(font);
 }
Beispiel #12
0
        /// <summary>
        /// Create overview!
        /// </summary>
        public void CreateOverview(VBox RequestOverview, Font CaptionFont)
        {
            // Overview clear
            RequestOverview.Clear();

            // Information
            RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestUrl + ":")
            {
                Font = CaptionFont

            }, false, false);

            // Create URL
            RequestOverview.PackStart(new LinkLabel(Url)
            {
                Uri = new Uri(Url),
                MarginLeft = 10
            }, false, false);

            // Method
            RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestMethod + ":")
            {
                Font = CaptionFont,
                MarginTop = 20
            }, false, false);

            // Create URL
            RequestOverview.PackStart(new Label(HTTP_METHOD)
            {
                MarginLeft = 10
            }, false, false);

            // Headers
            if (Headers.Count > 0)
            {
                RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestHeaders + ":")
                {
                    Font = CaptionFont,
                    MarginTop = 20
                }, false, false);
                foreach (var h in Headers)
                    RequestOverview.PackStart(new ListItem(string.Format("{0} - {1}", h.Name, h.Value)));
            }

            // Files
            if (Files.Count > 0)
            {
                RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestFiles + ":")
                {
                    Font = CaptionFont,
                    MarginTop = 20
                }, false, false);
                foreach (var h in Files)
                    RequestOverview.PackStart(new ListItem(h.FileName));
            }

            // Request
            // Request
            if (RequestTemplate != null && RequestTemplate.Length > 0)
            {
                RequestOverview.PackStart(new Label(string.Format("{0} ({1}) :", Director.Properties.Resources.RequestTemplate, RequestTemplateTypeS))
                {
                    Font = CaptionFont,
                    MarginTop = 20
                }, false, false);

                TextEntry RequestTextEntry = new TextEntry()
                {
                    Margin = 10, Sensitive = false, MultiLine = true
                };

                if (RequestTemplateType == ContentType.JSON)
                {
                    RequestTextEntry.Text = JSONFormatter.Format(RequestTemplate);

                    if (RequestTextEntry.Text == null || RequestTextEntry.Text.Trim().Length == 0)
                        RequestTextEntry.Text = RequestTemplate;
                }
                else
                {
                    RequestTextEntry.Text = RequestTemplate;
                }
                RequestOverview.PackStart(RequestTextEntry);

                Button ClipboardButtonReq = new Button(Image.FromResource(DirectorImages.COPY_ICON), "")
                {
                    WidthRequest = 30,
                    HeightRequest = 30,
                    ExpandHorizontal = false,
                    ExpandVertical = false,
                    MarginRight = 10,
                    TooltipText = Director.Properties.Resources.CopyInClipboard
                };
                ClipboardButtonReq.Clicked += delegate
                {
                    Clipboard.SetText(RequestTextEntry.Text);
                };
                RequestOverview.PackStart(ClipboardButtonReq, hpos: WidgetPlacement.End);
            }

            // Requested code
            if (ExpectedStatusCode > 0)
            {
                RequestOverview.PackStart(new Label(Director.Properties.Resources.ExpectedStatusCode + ":")
                {
                    Font = CaptionFont
                }, false, false);
                RequestOverview.PackStart(new ListItem(ExpectedStatusCode + ""));
            }

            // Request
            if (ResponseTemplate != null && ResponseTemplate.Length > 0)
            {
                RequestOverview.PackStart(new Label(string.Format("{0} ({1}): ", Director.Properties.Resources.ResponseTemplate, ResponseTemplateTypeS))
                {
                    Font = CaptionFont,
                    MarginTop = (ExpectedStatusCode > 0) ? 20 : 0
                }, false, false);

                TextEntry ResponseTextEntry = new TextEntry()
                {
                    Margin = 10, Sensitive = false, MultiLine = true
                };

                if (ResponseTemplate.Trim().StartsWith("{"))
                {
                    ResponseTextEntry.Text = JSONFormatter.Format(ResponseTemplate);
                }
                else
                {
                    ResponseTextEntry.Text = ResponseTemplate;
                }
                RequestOverview.PackStart(ResponseTextEntry);
                Button ClipboardButton = new Button(Image.FromResource(DirectorImages.COPY_ICON), "")
                {
                    WidthRequest = 30,
                    HeightRequest = 30,
                    ExpandHorizontal = false,
                    ExpandVertical = false,
                    MarginRight = 10,
                    MarginBottom = 10,
                    TooltipText = Director.Properties.Resources.CopyInClipboard
                };
                ClipboardButton.Clicked += delegate
                {
                    Clipboard.SetText(ResponseTextEntry.Text);
                };
                RequestOverview.PackStart(ClipboardButton, hpos: WidgetPlacement.End);
            }
        }
Beispiel #13
0
 internal FontFace(string name, object backend)
 {
     Name = name;
     Font = new Font(backend);
 }
Beispiel #14
0
 /// <summary>
 /// Draw a information on the ListView2Item
 /// </summary>
 /// <param name="What">What should be drawed</param>
 /// <param name="Where">Where (position by X) should be drawed</param>
 /// <param name="On">On what Drawing.Context the information should be drawed</param>
 /// <param name="MaxWidth">The limit of the picture's width</param>
 /// <param name="TextColor">The text foreground color</param>
 /// <param name="WhatFont">Which font is used to draw the onject</param>
 private void Draw(object What, double Where, Context On, double MaxWidth, Color TextColor, Font WhatFont)
 {
     if (What.GetType() != typeof (Image)
         &&
         What.GetType() != typeof (DirItem))
     {
         TextLayout tl = new TextLayout(this)
         {
             Text = What.ToString(),
             Font = WhatFont,
             Width = MaxWidth,
             Trimming = TextTrimming.WordElipsis
         };
         On.SetColor (TextColor);
         On.DrawTextLayout(tl, Where + 4, 0);
     }
     if (What is Image)
     {
         On.DrawImage(What as Image, Where + 2, 0);
     }
 }
Beispiel #15
0
 internal FontFace(string name, Font font)
 {
     Name = name;
     Font = font;
 }
Beispiel #16
0
 public Font WithSettings(Font fromFont)
 {
     return(WithSettings(fromFont.Size, fromFont.Style, fromFont.Weight, fromFont.Stretch));
 }
Beispiel #17
0
		void UpdateFaceList (Font font)
		{
			storeFace.Clear ();
			int row = -1;
			foreach (var face in font.GetAvailableFontFaces ()) {
				row = storeFace.AddRow ();
				storeFace.SetValues (row, dfaceName, face.Name, dfaceFont, face.Font, dfaceMarkup, "<span font=\"" + face.Font.WithSize (listFace.Font.Size) + "\">" + face.Name + "</span>");
			}
			if (row >= 0) {
				listFace.SelectRow (0);
			}
			listFace.QueueForReallocate ();
		}
Beispiel #18
0
		/// <summary>
		/// Shows the dialog.
		/// </summary>
		public bool Run (WindowFrame parentWindow)
		{
			var backend = Toolkit.CurrentEngine.Backend.CreateBackend<ISelectFontDialogBackend> ();
			if (backend == null)
				backend = new DefaultSelectFontDialogBackend (parentWindow);
			try {
				backend.SelectedFont = SelectedFont;
				backend.Title = Title;
				backend.PreviewText = PreviewText;
				return backend.Run ((IWindowFrameBackend)Toolkit.CurrentEngine.GetSafeBackend (parentWindow));
			} catch (Exception ex) {
				Console.WriteLine (ex);
				return false;
			} finally {
				font = backend.SelectedFont;
				backend.Dispose ();
			}
		}
Beispiel #19
0
        /// <summary>
        /// Create result vbox data item.
        /// </summary>
        public void CreateResult(VBox RequestStatus, Font CaptionFont)
        {
            // Clear
            RequestStatus.Clear();

            // Nothing to do!
            if (RequestRemoteResult == null)
            {
                RequestStatus.PackStart(new Label(Director.Properties.Resources.NoResponse)
                {
                    Font = CaptionFont
                });
                return;
            }

            // iterate
            bool first = true;
            foreach (var i in RequestRemoteResult)
            {
                if (i.Type == 1)
                {
                    RequestStatus.PackStart(new Label(i.Data)
                    {
                        Font = CaptionFont,
                        MarginTop = (first) ? 0 : 20
                    }, false, false);
                }
                else if (i.Type == 2)
                {
                    RequestStatus.PackStart(new ListItem(i.Data));
                }
                else
                {
                    TextEntry RequestTextEntry = new TextEntry()
                    {
                        Margin = 10,
                        Text = i.Data,
                        Sensitive = false,
                        MultiLine = true
                    };
                    RequestStatus.PackStart(RequestTextEntry);
                    Button ClipboardButtonReq = new Button(Image.FromResource(DirectorImages.COPY_ICON), "")
                    {
                        WidthRequest = 30,
                        HeightRequest = 30,
                        ExpandHorizontal = false,
                        ExpandVertical = false,
                        MarginRight = 10,
                        TooltipText = Director.Properties.Resources.CopyInClipboard
                    };
                    ClipboardButtonReq.Clicked += delegate
                    {
                        Clipboard.SetText(RequestTextEntry.Text);
                    };
                    RequestStatus.PackStart(ClipboardButtonReq, hpos: WidgetPlacement.End);
                }

                first = false;
            }
        }
 public void SetFont(Font font)
 {
     this.Font = font;
     var f = (FontData)Toolkit.GetBackend (font);
     FormattedText.SetFontFamily (f.Family);
     FormattedText.SetFontSize (f.GetDeviceIndependentPixelSize ());
     FormattedText.SetFontStretch (f.Stretch);
     FormattedText.SetFontStyle (f.Style);
     FormattedText.SetFontWeight (f.Weight);
 }
 public override void SetFont(object backend, Font font)
 {
     LayoutBackend la = (LayoutBackend) backend;
     la.Measured = false;
     la.Font = font;
 }
		void DisposeFont ()
		{
			if (font != null) {
				//				font.Dispsoe ();
				font = null;
			}
		}
 public void SetFont(object backend, Font font)
 {
 }
Beispiel #24
0
 public void SetFont(object backend, Xwt.Drawing.Font font)
 {
 }
Beispiel #25
0
        public override void SetFont(object backend, Xwt.Drawing.Font font)
        {
            var tl = (PangoBackend)backend;

            tl.Layout.FontDescription = (Pango.FontDescription)ApplicationContext.Toolkit.GetSafeBackend(font);
        }
Beispiel #26
0
 private void Init()
 {
     textFont_ = Font.FromName ("Tahoma 10");
 }
Beispiel #27
0
 /// <summary>
 /// Get a Font exactly the same as the passed in one, except for scale factor.
 /// </summary>
 /// <param name="initial">The font to scale.</param>
 /// <param name="scale">Scale by this factor.</param>
 /// <returns>The scaled font.</returns>
 public static Font ScaleFont(Font initial, double scale)
 {
     Font scaled = initial.WithScaledSize (scale);
     return scaled;
 }
 public void SetFont(object backend, Font font)
 {
     var c = (DrawingContext) backend;
     c.Font.Dispose();
     c.Font = font.ToDrawingFont ();
 }
 public void SetFont(object backend, Font font)
 {
     ((TextLayoutContext)backend).Font = font.ToDrawingFont();
 }
Beispiel #30
0
 private void Init()
 {
     textFont_ = Font.SystemSansSerifFont.WithSize (10);
 }
        public override void SetFont(object backend, Xwt.Drawing.Font font)
        {
            var tl = (GdiTextLayoutBackend)backend;

            tl.Font = font;
        }
Beispiel #32
0
        public override void SetFont(object backend, Xwt.Drawing.Font font)
        {
            LayoutInfo li = (LayoutInfo)backend;

            li.Font = (NSFont)Toolkit.GetBackend(font);
        }
Beispiel #33
0
		public Font WithSettings (Font fromFont)
		{
			return WithSettings (fromFont.Size, fromFont.Style, fromFont.Weight, fromFont.Stretch);
		}
Beispiel #34
0
		internal FontFace (string name, Font font)
		{
			Name = name;
			Font = font;
		}
Beispiel #35
0
		internal FontFace (string name, object backend)
		{
			Name = name;
			Font = new Font (backend);
		}
Beispiel #36
0
 internal void InitForToolkit(Toolkit tk)
 {
     if (ToolkitEngine == null || ToolkitEngine != tk) {
         // If this is a re-initialization we dispose the previous state
         if (handler != null) {
             Dispose ();
             GC.ReRegisterForFinalize (this);
         }
         ToolkitEngine = tk;
         handler = ToolkitEngine.TextLayoutBackendHandler;
         Backend = handler.Create ();
         Setup ();
         font = (Font)tk.ValidateObject (font);
         if (font != null)
             handler.SetFont (Backend, font);
         if (text != null)
             handler.SetText (Backend, text);
         if (width != -1)
             handler.SetWidth (Backend, width);
         if (height != -1)
             handler.SetHeight (Backend, height);
         if (attributes != null && attributes.Count > 0)
             foreach (var attr in attributes)
                 handler.AddAttribute (Backend, attr);
     }
 }
Beispiel #37
0
 public override void SetFont(object backend, Font font)
 {
     ((TextLayoutContext) backend).Font = font.ToDrawingFont();
 }
Beispiel #38
0
 public abstract void SetFont(object backend, Font font);
 public override void SetFont(object backend, Font font)
 {
 }
 public override void SetFont(object backend, Font font)
 {
     var t = (TextLayoutBackend)backend;
     t.SetFont (font);
 }
Beispiel #41
0
        public override void SetFont(object backend, Xwt.Drawing.Font font)
        {
            LayoutInfo li = (LayoutInfo)backend;

            li.Font = ((FontData)ApplicationContext.Toolkit.GetSafeBackend(font)).Font;
        }
Beispiel #42
0
 public static Font FromName(string name, double size)
 {
     Font f = new Font ();
     f.Backend = handler.CreateFromName (name, size);
     return f;
 }
Beispiel #43
0
 public static SD.Font ToGdi(this Font value)
 {
     return((SD.Font)value.GetBackend());
 }