Exemplo n.º 1
0
        public PasswordWindow()
            : base(WindowType.Toplevel)
        {
            Password = null;
            Cancelled = true;

            box = new HBox(true, 3);

            label = new Label("Wachtwoord:");
            box.PackStart(label);

            TextTagTable textTagTable = new TextTagTable();
            passwordField = new TextView(new TextBuffer(new TextTagTable()));
            box.PackStart(passwordField);

            button = new Button();
            button.Label = "Ok";
            button.Clicked += delegate {
                Password = passwordField.Buffer.Text;
                Cancelled = false;
                Hide();
            };
            box.PackStart(button);

            Add(box);
            ShowAll();
        }
Exemplo n.º 2
0
        public StyleWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            SetSizeRequest(800, 800);

            var box = new VBox();
            Add(box);

            var tab = new TextTagTable();
            buf = new TextBuffer(tab);
            buf.Text = System.IO.File.ReadAllText("res/theme/gtk.css");
            var en = new TextView(buf);
            sv = new ScrolledWindow();
            sv.Add(en);
            box.PackStart(sv, true, true, 0);

            var cssProvider = new CssProvider();
            StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);

            var isDefault = true;

            var but = new Button();
            but.Label = "Save";
            but.HeightRequest = 30;
            box.PackEnd(but, false, false, 0);
            but.Clicked += (s, e) => {
                System.IO.File.WriteAllText("res/theme/gtk.css", buf.Text);
            };

            buf.Changed += (s, e) => {
                bool error = false;
                try {
                    //StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                    cssProvider.LoadFromData(buf.Text);
                    //StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);
                } catch (Exception ex) {
                    error = true;
                }
                if (error) {
                    if (!isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider, uint.MaxValue);
                        isDefault = true;
                    }

                } else {
                    if (isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue);
                        isDefault = false;
                    }
                }

            };

            ShowAll();
        }
Exemplo n.º 3
0
 static void TagChanged_cb(IntPtr inst, IntPtr tag, bool size_changed)
 {
     try {
         TextTagTable __obj = GLib.Object.GetObject(inst, false) as TextTagTable;
         __obj.OnTagChanged(GLib.Object.GetObject(tag) as Gtk.TextTag, size_changed);
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
Exemplo n.º 4
0
    protected void ConnectTextTagTable(Gtk.TextTagTable table, Monotalk.SourceView.Style [] styles)
    {
        foreach (Monotalk.SourceView.Style s in styles)
        {
            Gtk.TextTag tag = new TextTag(s.path);
            tag.Foreground = s.color;

            table.Add(tag);
        }
    }
        private void CreateTextTags(Gtk.TextBuffer tb)
        {
            table_text_tag = new Gtk.TextTagTable();

            // Tag per text block - not style
            tag          = new Gtk.TextTag("DemoTextSelection");
            tag.WrapMode = Gtk.WrapMode.Char;
            tb.TagTable.Add(tag);

            return;
        }
Exemplo n.º 6
0
		public TextVisualizerView ()
		{
			vbox = new VBox (false, 6);
			vbox.BorderWidth = 6;
			
			TextTagTable tagTable = new TextTagTable ();
			TextBuffer buffer = new TextBuffer (tagTable);
			textView = new TextView (buffer);

			scrolledWindow = new ScrolledWindow ();
			scrolledWindow.AddWithViewport (textView);
			
			vbox.PackStart (scrolledWindow, true, true, 0);
			
			vbox.ShowAll ();
		}
Exemplo n.º 7
0
        public LogWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            Current = this;
            SetSizeRequest(800, 800);
            var tab = new TextTagTable();
            buf = new TextBuffer(tab);
            var en = new TextView(buf);
            sv = new ScrolledWindow();
            sv.Add(en);
            Add(sv);

            CoreLib.OnLog += (txt) => AppendText(txt);

            ShowAll();
        }
Exemplo n.º 8
0
 public static TextTagTable BuildTagTable()
 {
     TextTagTable textTags = new TextTagTable();
     var tag = new TextTag("date");
     tag.Justification = Justification.Center;
     tag.Weight = Pango.Weight.Bold;
     textTags.Add(tag);
     tag = new TextTag("user1");
     tag.Foreground = "#FF00FF";
     textTags.Add(tag);
     tag = new TextTag("user2");
     tag.Foreground = "#9400D3";
     textTags.Add(tag);
     tag = new TextTag("user3");
     tag.Foreground = "#191970";
     textTags.Add(tag);
     tag = new TextTag("user4");
     tag.Foreground = "#7F0000";
     textTags.Add(tag);
     tag = new TextTag("user5");
     tag.Foreground = "#FF8C00";
     textTags.Add(tag);
     tag = new TextTag("user6");
     tag.Foreground = "#FFA500";
     textTags.Add(tag);
     tag = new TextTag("user7");
     tag.Foreground = "#32CD32";
     textTags.Add(tag);
     tag = new TextTag("user8");
     tag.Foreground = "#3CB371";
     textTags.Add(tag);
     tag = new TextTag("user9");
     tag.Foreground = "#007F00";
     textTags.Add(tag);
     tag = new TextTag("user10");
     tag.Foreground = "#FFFF00";
     textTags.Add(tag);
     return textTags;
 }
Exemplo n.º 9
0
 private TextTagTable CreateTextTagTable(XmlNode topLevelNode)
 {
     TextTagTable textTagTable = new TextTagTable();
        TextTag smallFontTag = new TextTag("small-font");
        smallFontTag.Scale = Pango.Scale.Small;
        textTagTable.Add(smallFontTag);
        XmlNodeList linkNodes = topLevelNode.SelectNodes("//a");
        if (linkNodes != null)
        {
     foreach(XmlNode linkNode in linkNodes)
     {
      XmlAttribute href = linkNode.Attributes["href"];
      if (href != null)
      {
       string textTagName = href.Value;
       if (textTagTable.Lookup(textTagName) != null)
        continue;
       TextTag textTag = new TextTag(textTagName);
       textTag.Underline = Pango.Underline.Single;
       textTag.Foreground = "blue";
       textTag.TextEvent +=
        new TextEventHandler(OnTextEvent);
       textTagTable.Add(textTag);
      }
     }
        }
        return textTagTable;
 }
Exemplo n.º 10
0
	public ChopBuffer (TextTagTable table) : base  (table)
	{
	}
Exemplo n.º 11
0
 public TextTagWorkaround(string name, TextTagTable table)
     : base(name)
 {
     table.Add(this);
 }
Exemplo n.º 12
0
 public Chat()
 {
     this.Build();
     textTags = QSChatMain.BuildTagTable();
 }
Exemplo n.º 13
0
		public SourceView (TextTagTable table) : base (table) 
		{
			AddTags ();
			Config.gconf.AddNotify (Config.GCONF_DIR, new GConf.NotifyEventHandler (HighlightConfigChanged));
		}
Exemplo n.º 14
0
		// Constructors

		public SqlEditorSharp() : base(false, 4) {		 
			scroll = new ScrolledWindow (
				new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), 
				new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
			scroll.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			scroll.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			scroll.ShadowType = Gtk.ShadowType.In;
			this.PackStart (scroll, true, true, 0);

			// default font famly for SQL editor
			family = "courier";

			// other default settings
			use_hi_lighting = false;

			// create text tag table
			TextTagTable textTagTable = new TextTagTable ();

			// anything else is normaltext
			normaltext_tag = new TextTag ("normaltext");
			normaltext_tag.Family = family;
			normaltext_tag.Foreground = "black";
			normaltext_tag.Style = Pango.Style.Normal;
			textTagTable.Add (normaltext_tag);
       
			// SQL Keywords - SELECT FROM WHERE, etc
			sql_tag = new TextTag ("sql");
			sql_tag.Family = family;
			sql_tag.Foreground = "blue";
			sql_tag.Style = Pango.Style.Normal;
			textTagTable.Add (sql_tag);

			// c like free comment - used within a SQL statement
			freecomment_tag = new TextTag ("freecomment");
			freecomment_tag.Family = family;
			freecomment_tag.Foreground = "darkgreen";
			freecomment_tag.Style = Pango.Style.Italic;
			textTagTable.Add (freecomment_tag);

			// c++ like line comment, but using two hyphens
			linecomment_tag = new TextTag ("linecomment");
			linecomment_tag.Family = family;
			linecomment_tag.Foreground = "darkgreen";
			linecomment_tag.Style = Pango.Style.Italic;
			textTagTable.Add (linecomment_tag);

			/* single quoted constant - WHERE COL1 = 'ABC' */
			singlequotedconstant_tag = new TextTag ("singlequotedconstant");
			singlequotedconstant_tag.Family = family;
			singlequotedconstant_tag.Foreground = "red";
			singlequotedconstant_tag.Style = Pango.Style.Normal;
			textTagTable.Add (singlequotedconstant_tag);

			// create TextBuffer and TextView
			sqlTextBuffer = new TextBuffer (textTagTable);
			sqlTextView = new TextView (sqlTextBuffer);

			// allow it to be edited
			sqlTextView.Editable = true;

			//line_last_changed = -1;
			//last_freecomment_count = -1;

			// attach OnTextChanged callback function
			// to "changed" signal so we can do something
			// when the text has changed in the buffer
			sqlTextBuffer.Changed += new EventHandler (OnTextChanged);

			// add the TextView to the ScrolledWindow
			scroll.Add (sqlTextView);					
		}