Example #1
0
        int Width, Height; // the desired size of the widget

        #endregion Fields

        #region Constructors

        public CodeSnippetWindow()
            : base(false, 4)
        {
            manager = new GtkSourceView.SourceLanguageManager ();
            GtkSourceView.SourceLanguage language = manager.GetLanguage ("c");

            GtkSourceView.SourceStyleSchemeManager schemeManager =
                            new GtkSourceView.SourceStyleSchemeManager ();
            GtkSourceView.SourceStyleScheme styleScheme = schemeManager.GetScheme ("oblivion");

            sourceBuf = new GtkSourceView.SourceBuffer (language);
            sourceBuf.HighlightMatchingBrackets = true;
            sourceBuf.HighlightSyntax = true;
            sourceBuf.StyleScheme = styleScheme;

            source = new GtkSourceView.SourceView (sourceBuf);
            source.BorderWidth = 3;
            source.AutoIndent = true;
            source.IndentOnTab = true;
            source.IndentWidth = 4;
            source.TabWidth = 4;
            source.ShowLineNumbers = true;
            FontDescription font_desc = FontDescription.FromString ("monospace size:small");
            source.ModifyFont(font_desc);

            scroll = new Gtk.ScrolledWindow ();
            scroll.Add (source);
            PackStart (scroll, true, true, 2);

            changed = false;
            Width = 300;
            Height = 200;
            SetSizeRequest (Width, Height);

            source.FocusInEvent += OnFocusIn;
            source.FocusOutEvent += OnFocusOut;
            source.PopulatePopup += OnPopulatePopup;
        }