public SqlDefinitionPad()
            : base("SQL Definition", "md-mono-query-view")
        {
            frame = new Gtk.Frame ();
            sw = new Gtk.ScrolledWindow ();
            frame.Add (sw);
            SourceLanguagesManager lm = new SourceLanguagesManager ();
            textBuffer = new SourceBuffer(lm.GetLanguageFromMimeType("text/x-sql"));
            textBuffer.Highlight = true;
            textView = new SourceView (textBuffer);
            textView.ShowLineNumbers = false;
            textView.ShowMargin = false;
            textView.TabsWidth = 2;
            textView.Editable = false;
            sw.Add (textView);
            frame.ShowAll ();

            service.SqlDefinitionPad = this;
        }
Example #2
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;
        }