/* Private methods */

	public void DrawMargin (TextView textView) {

    	/* Get char count info  */
    	int[,] info;
    	GetCharCountDrawInfo(textView, out info);

    	/* Set margin and window */
    	int marginWidth = (this.marginSpace * 2) + (this.marginDigitCount * this.marginCharWidth);
    	textView.SetBorderWindowSize(TextWindowType.Right, marginWidth);
    	Gdk.Window window = textView.GetWindow(TextWindowType.Right);
    	window.Clear();

    	/* Draw line */
    	window.DrawLine(this.lineGC, 0, 0, 0, textView.Allocation.Height);

    	/* Draw text */
    	int infoCount = info.GetLength(0);
    	for (int i = 0 ; i < infoCount ; i++) {
    		int charCount = info[i, 0];
    		int y = info[i, 1];

    		this.textLayout.SetText(charCount.ToString());
    		int textLayoutWidth, textLayoutHeight;
    		this.textLayout.GetPixelSize(out textLayoutWidth, out textLayoutHeight);
    		window.DrawLayout(this.textGC, this.marginSpace, y - textLayoutHeight/2, this.textLayout);
		}
    }
示例#2
0
		// Looks at all tags covering the position (x, y) in the text view,
		// and if one of them is a link, change the cursor to the "hands" cursor
		// typically used by web browsers.
		void SetCursorIfAppropriate (TextView view, int x, int y)
		{
			bool hovering = false;
			TextIter iter = view.GetIterAtLocation (x, y);

			foreach (TextTag tag in iter.Tags) {
				hovering = true;
				break;
			}

			if (hovering != hoveringOverLink) {
				Gdk.Window window = view.GetWindow (Gtk.TextWindowType.Text);

				hoveringOverLink = hovering;
				if (hoveringOverLink)
					window.Cursor = handCursor;
				else
					window.Cursor = regularCursor;
			}
		}