本文整理汇总了C#中Gtk.TextView类的典型用法代码示例。如果您正苦于以下问题:C# TextView类的具体用法?C# TextView怎么用?C# TextView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextView类属于Gtk命名空间,在下文中一共展示了TextView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UMLEditableField
public UMLEditableField(UMLEntry entry, bool resizable)
: base((CanvasGroup) entry)
{
_textwidget = new CanvasWidget ((CanvasGroup) entry);
_entry = entry;
_is_resizable = resizable;
_textview = new TextView ();
TextBuffer tb = _textview.Buffer;
tb.Text = _entry.Text;
double x = entry.TextX, y = entry.TextY;
_textwidget.W2i (ref x, ref y);
X = x + entry.X;
Y = y + entry.Y;
_textwidget.Widget = _textview;
_textwidget.Width = entry.TextWidth + 10;//FIXME?
_textwidget.Height = entry.TextHeight + 10; //FIXME?
_textview.KeyReleaseEvent += LookingEsc;
_textview.Show ();
Width = _textwidget.Width;
Height = _textwidget.Height;
//TODO: Dejar esto como estaba
//CreateUMLControlPointGroup ();
Resized += ElementResized;
_entry.Root.CanvasEvent += ClickCanvasEvent;
}
示例2: DocsTreeView
public DocsTreeView(Gtk.TextView rtv, OurParserTask r)
{
tv = rtv;
AppendColumn("Name", new Gtk.CellRendererText());
AppendColumn("Result", new Gtk.CellRendererPixbuf());
RulesHint = true;
Columns[0].SetCellDataFunc(Columns[0].CellRenderers[0],
new Gtk.TreeCellDataFunc(RenderName));
Columns[1].SetCellDataFunc(Columns[1].CellRenderers[0],
new Gtk.TreeCellDataFunc(RenderIcon));
Columns[0].Expand = true;
Gtk.TreeStore mres_store = new Gtk.TreeStore(
typeof(IParsed));
Model = mres_store;
Selection.Changed += new EventHandler(OnSelection);
Gtk.TreeIter iter = new Gtk.TreeIter();
foreach (ParsedDocument doc in r.Docs) {
iter = mres_store.AppendValues(doc);
foreach (IParsed m in doc.Results)
if (m.Result > 0)
mres_store.AppendValues(iter, m);
}
}
示例3: WorkbenchView
public WorkbenchView(WorkbenchController controller)
{
SplashWindow.Update ("Creating GUI");
XML gxml = new Glade.XML (null,
WorkbenchSingleton.GLADEFILE,
"Workbench",
null);
window = (Gtk.Window) gxml["Workbench"];
Gtk.VPaned splitter = (Gtk.VPaned) gxml["mainPane"];
editorNotebook = new EditorNotebook ();
splitter.Pack1 (editorNotebook, true, false);
ScrolledWindow sw = new ScrolledWindow ();
console = new TextView ();
console.Editable = false;
console.WrapMode = WrapMode.Word;
sw.Add (console);
Notebook bottomNotebook = new Notebook ();
bottomNotebook.AppendPage (sw, new Label ("Console"));
splitter.Pack2 (bottomNotebook, true, false);
window.Icon = icon;
this.WindowTitle = "";
gxml.Autoconnect (controller);
bottomNotebook.ShowAll ();
editorNotebook.ShowAll ();
SplashWindow.Update ("Simetron is ready!");
}
示例4: GetWidget
private Widget GetWidget (CustomAttributeCollection cac)
{
FontDescription fd = FontDescription.FromString ("Courier 10 Pitch 10");
VBox vbox = new VBox (false, 0);
ScrolledWindow sw = new ScrolledWindow ();
sw.AddWithViewport (vbox);
if ((cac != null) && (cac.Count > 0)) {
foreach (CustomAttribute ca in cac) {
TextView textview = new TextView ();
textview.Editable = false;
textview.Buffer.Text = Format (ca);
textview.ModifyFont (fd);
Expander expander = new Expander (ca.Constructor.DeclaringType.FullName);
expander.Add (textview);
vbox.Add (expander);
}
}
sw.ShowAll ();
return sw;
}
示例5: ConsoleGtk
public ConsoleGtk ()
{
Window win = new Window ("MonoLOGO");
win.DeleteEvent += new EventHandler (Window_Delete);
win.BorderWidth = 4;
win.DefaultSize = new Size (450, 300);
VBox vbox = new VBox (false, 4);
win.EmitAdd (vbox);
ScrolledWindow swin = 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));
swin.HscrollbarPolicy = Gtk.PolicyType.Automatic;
swin.VscrollbarPolicy = Gtk.PolicyType.Automatic;
swin.ShadowType = Gtk.ShadowType.In;
vbox.PackStart (swin, true, true, 0);
TextBuffer buf = new TextBuffer (new TextTagTable ());
Out = new TextWriterGtk (buf);
TextView text = new TextView (buf);
text.Editable = false;
swin.EmitAdd (text);
Entry entry = new Entry ();
entry.Activate += new EventHandler (Entry_Activate);
vbox.PackStart (entry, false, false, 0);
win.ShowAll ();
}
示例6: MultiLineTextTool
public MultiLineTextTool (IDrawingEditor editor, MultiLineTextFigure fig, ITool dt): base (editor, fig, dt) {
_textview = new Gtk.TextView ();
_textview.Buffer.Changed += new System.EventHandler (ChangedHandler);
_textview.ModifyFont (fig.PangoLayout.FontDescription.Copy ());
_textview.RightMargin = 5;
_textview.Justification = ConvertJustificaton ();
}
示例7: build_page_1
private void build_page_1()
{
TextView tv1 = new TextView ();
try
{
string rez = "Adeptus.Resources.resources";
string key = "mystring1";
string resourceType = "";
byte[] resourceData;
ResourceReader r = new ResourceReader(rez);
r.GetResourceData (key, out resourceType, out resourceData);
r.Close();
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
tv1.Buffer.Text = enc.GetString (resourceData);
}
catch (Exception exp)
{
tv1.Buffer.Text = exp.Message;
}
tv1.WrapMode = WrapMode.Word;
tv1.Editable = false;
this.AppendPage (tv1);
this.SetPageTitle (tv1, "Introduction");
this.SetPageType (tv1, AssistantPageType.Intro);
this.SetPageComplete (tv1, true);
}
示例8: ThrowMessage
////////////////////////////////////////////////////////////////////
///<summary>
///ThrowMessage receives a msg and show a window.
///Is intended to show exception messages
///</summary>
// FIXME: Draw a better interface with l10n messages
public static void ThrowMessage(string Msg, string short_msg)
{
Gtk.Window msgwindow = new Gtk.Window("Exception");
Gtk.VBox box = new Gtk.VBox(false, 0);
Gtk.ScrolledWindow scrWin = new Gtk.ScrolledWindow();
Gtk.TextView txtView = new Gtk.TextView();
Gtk.TextBuffer buffer = txtView.Buffer;
buffer.Text = "Critical exception: " + short_msg;
buffer.Text += "\r\n \r\nReport for developers : " + Msg;
Gtk.Button buttonAccept = new Button("Accept");
Gtk.Button buttonExit = new Button("Exit");
msgwindow.DeleteEvent += new DeleteEventHandler(OnDelete);
buttonExit.Clicked += new EventHandler(OnDelete);
msgwindow.DestroyEvent += new DestroyEventHandler(OnContinue);
buttonAccept.Clicked += new EventHandler(OnContinue);
msgwindow.Add(scrWin);
scrWin.Add(txtView);
box.Spacing = 20;
box.PackStart(scrWin);
box.PackStart(buttonExit);
box.PackStart(buttonAccept);
//txtView.Show();
//buttonExit.Show();
//box.Show();
msgwindow.DefaultHeight = 300;
msgwindow.DefaultWidth = 600;
msgwindow.SetPosition(WindowPosition.Center);
msgwindow.ShowAll();
msgwindow.Present();
}
示例9: AttachWidgets
private void AttachWidgets (TextView textView)
{
// This is really different from the C version, but the
// C versions seems a little pointless.
Button button = new Button ("Click Me");
button.Clicked += new EventHandler(EasterEggCB);
textView.AddChildAtAnchor (button, buttonAnchor);
button.ShowAll ();
ComboBox combo = ComboBox.NewText ();
combo.AppendText ("Option 1");
combo.AppendText ("Option 2");
combo.AppendText ("Option 3");
textView.AddChildAtAnchor (combo, menuAnchor);
HScale scale = new HScale (null);
scale.SetRange (0,100);
scale.SetSizeRequest (70, -1);
textView.AddChildAtAnchor (scale, scaleAnchor);
scale.ShowAll ();
Gtk.Image image = Gtk.Image.LoadFromResource ("floppybuddy.gif");
textView.AddChildAtAnchor (image, animationAnchor);
image.ShowAll ();
Entry entry = new Entry ();
textView.AddChildAtAnchor (entry, entryAnchor);
entry.ShowAll ();
}
示例10: DrawMargin
/* 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);
}
}
示例11: StatusLogPage
private StatusLogPage()
{
m_TextView = new TextView();
m_TextView.Editable = false;
ScrolledWindow swindow = new ScrolledWindow();
swindow.Add(m_TextView);
this.PackStart(swindow, true, true, 0);
swindow.ShowAll();
var tag = new TextTag("Error");
tag.Foreground = "darkred";
m_TextView.Buffer.TagTable.Add(tag);
tag = new TextTag("Fatal");
tag.Foreground = "darkred";
m_TextView.Buffer.TagTable.Add(tag);
tag = new TextTag("Warn");
tag.Foreground = "darkorange";
m_TextView.Buffer.TagTable.Add(tag);
tag = new TextTag("Info");
tag.Foreground = "darkgreen";
m_TextView.Buffer.TagTable.Add(tag);
tag = new TextTag("Debug");
tag.Foreground = "darkblue";
m_TextView.Buffer.TagTable.Add(tag);
m_TextView.Buffer.CreateMark("end", m_TextView.Buffer.EndIter, false);
LoggingService.AddLogger(this);
}
示例12: DemoTextView
public DemoTextView () : base ("TextView")
{
SetDefaultSize (450,450);
BorderWidth = 0;
VPaned vpaned = new VPaned ();
vpaned.BorderWidth = 5;
Add (vpaned);
// For convenience, we just use the autocreated buffer from
// the first text view; you could also create the buffer
// by itself, then later create a view widget.
view1 = new TextView ();
TextBuffer buffer = view1.Buffer;
view2 = new TextView (buffer);
ScrolledWindow sw = new ScrolledWindow ();
sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
vpaned.Add1 (sw);
sw.Add (view1);
sw = new ScrolledWindow ();
sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
vpaned.Add2 (sw);
sw.Add (view2);
CreateTags (buffer);
InsertText (buffer);
AttachWidgets (view1);
AttachWidgets (view2);
ShowAll ();
}
示例13: evalMAEK
public String evalMAEK(String input, String type, int lineNumber, ref Hashtable symbolTable, TextView consoleText)
{
//Check if the type is valid
if (!(type.Equals ("TROOF") || type.Equals ("YARN") || type.Equals ("NUMBR") || type.Equals ("NUMBAR") || type.Equals ("NOOB"))) {
consoleText.Buffer.Text += "Syntax error at line: " + lineNumber + ". " + type + " is undefinded\n";
return "UNDEFINED";
}
//Return value based on type requested
switch (type) {
case "TROOF":
{
//String literal no content
if (Regex.IsMatch (input, @"\s*^""""$")) {
return "FAIL";
} else if (Regex.IsMatch (input, @"\s*^""\.+""$")) { //string literal with content
return "WIN";
} else if (Regex.IsMatch (input, @"^\-?[0]*.?[0]+\s*")) { // IF 0
return "FAIL";
} else {
return "WIN";
}
}
case "YARN":
{
//If yarn literal already
if (Regex.IsMatch (input, @"\s*^""\.""$")) {
//Do not modify
return input;
} else {
//Add quotes and return
return "\"" + input + "\"";
}
}
case "NOOB":
{
return "NOOB";
}
case "NUMBR":
{
//consoleText.Buffer.Text += "to Numbr";
if (Regex.IsMatch (input, @"^"".*""$")) {
consoleText.Buffer.Text += "String to Numbr";
input = comp.removeQuotes (input);
int answer;
Boolean isInteger = Int32.TryParse (input, out answer);
if (isInteger) {
return answer.ToString ();
}
return "BAWAL ITO.";
}
return (input.Equals ("WIN") ? "1" : "0");
}
case "NUMBAR":
{
input = comp.removeQuotes (input);
return input;
}
}
return "UNDEFINED";
}
示例14: DialogError
public DialogError(string message, Exception e, Window parent) : base("Error", parent, DialogFlags.Modal, Stock.Ok, ResponseType.Ok)
{
HBox hbox = new HBox();
Image icon = new Image(Stock.DialogError,IconSize.Dialog);
Label label = new Label(message);
Expander exp = new Expander("Details");
ScrolledWindow sw = new ScrolledWindow();
TextView tview = new TextView();
hbox.BorderWidth = 6;
hbox.Spacing = 6;
label.SetAlignment(0f, 0.5f);
exp.BorderWidth = 6;
tview.Buffer.Text = e.Message;
tview.Buffer.Text += "\n";
tview.Buffer.Text += e.StackTrace;
sw.Add(tview);
exp.Add(sw);
hbox.PackStart(icon, false, false, 0);
hbox.PackStart(label, true, true, 0);
this.VBox.PackStart(hbox, false, false, 0);
this.VBox.PackStart(exp, true, true, 0);
this.ShowAll();
}
示例15: LogView
public LogView ()
{
buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
textEditorControl = new Gtk.TextView (buffer);
textEditorControl.Editable = false;
ShadowType = ShadowType.None;
Add (textEditorControl);
bold = new TextTag ("bold");
bold.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (bold);
errorTag = new TextTag ("error");
errorTag.Foreground = "red";
errorTag.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (errorTag);
consoleLogTag = new TextTag ("consoleLog");
consoleLogTag.Foreground = "darkgrey";
buffer.TagTable.Add (consoleLogTag);
tag = new TextTag ("0");
tag.LeftMargin = 10;
buffer.TagTable.Add (tag);
tags.Add (tag);
endMark = buffer.CreateMark ("end-mark", buffer.EndIter, false);
UpdateCustomFont (IdeApp.Preferences.CustomOutputPadFont);
IdeApp.Preferences.CustomOutputPadFontChanged += HandleCustomFontChanged;
outputDispatcher = new GLib.TimeoutHandler (outputDispatchHandler);
}