| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 |
- //
- // System.Windows.Forms.TextBoxBase
- //
- // Author:
- // stubbed out by Jackson Harper ([email protected])
- // Dennis Hayes ([email protected])
- // Remco de Jong ([email protected])
- //
- // (C) 2002 Ximian, Inc
- //
- using System.Drawing;
- namespace System.Windows.Forms {
- // <summary>
- // This is only a template. Nothing is implemented yet.
- //
- // </summary>
- public class TextBoxBase : Control {
- private int maxlength = 0;
- private Gtk.TextTagTable tagtable;
- private Gtk.TextBuffer textbuffer = null;
- //
- // --- Public Properties
- //
- public TextBoxBase () {
- }
- protected Gtk.TextBuffer TextBuffer {
- get {
- if (textbuffer == null) {
- tagtable = new Gtk.TextTagTable ();
- textbuffer = new Gtk.TextBuffer (tagtable);
- // attach events
- textbuffer.ModifiedChanged += new EventHandler (modified_changed_cb);
- }
-
- return textbuffer;
- }
- }
- protected override void OnTextChanged(EventArgs e)
- {
- TextBuffer.SetText(Text, Text.Length);
- }
- [MonoTODO]
- public bool AcceptsTab {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- public virtual bool AutoSize {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- /* [MonoTODO]
- public override Color BackColor {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- public override Color ForeColor {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- public override Image BackgroundImage {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- public BorderStyle BorderStyle {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- */ [MonoTODO]
- public bool CanUndo {
- get
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- public bool HideSelection {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- public string[] Lines {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- Clear ();
- foreach (String s in value) {
- AppendText (s + "\n");
- }
- }
- }
- [MonoTODO]
- public virtual int MaxLength {
- get
- {
- return maxlength;
- }
- set
- {
- maxlength = value;
- }
- }
- public bool Modified {
- get
- {
- return TextBuffer.Modified;
- }
- set
- {
- if (TextBuffer.Modified != value) { // only call if it has really been changed since this will trigger an event, is this correct behavior?
- TextBuffer.Modified = value;
- }
- }
- }
- [MonoTODO]
- public virtual bool Multiline {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- public int PreferredHeight {
- get
- {
- throw new NotImplementedException ();
- }
- }
- public virtual bool ReadOnly {
- // needs to be overwritten by child classes
- get { return false; }
- set {}
- }
- [MonoTODO]
- public virtual string SelectedText {
- get
- {
- String selection = "";
- Gtk.TextIter start;
- Gtk.TextIter end;
-
- if (TextBuffer.GetSelectionBounds(ref start, ref end))
- selection = TextBuffer.GetText(start, end, true);
-
- return selection;
- }
- set
- {
- // paste text over selection
- }
- }
- [MonoTODO]
- public virtual int SelectionLength {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- public int SelectionStart {
- get
- {
- throw new NotImplementedException ();
- }
- set
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- public virtual int TextLength {
- get
- {
- return Text.Length;
- }
- }
- [MonoTODO]
- public virtual bool WordWrap {
- get
- {
- return false;
- }
- set
- {
- }
- }
-
- // --- Public Methods
-
- public void AppendText(string text)
- {
- Text += text;
- }
- public void Clear()
- {
- TextBuffer.SetText("", 0);
- }
- [MonoTODO]
- public void ClearUndo()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public void Copy()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public void Cut()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public void Paste()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public void ScrollToCaret()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public void Select(int start, int length)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public void SelectAll()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public override string ToString()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public void Undo()
- {
- throw new NotImplementedException ();
- }
-
- // --- Internal Events (Gtk)
- internal protected void modified_changed_cb (object o, EventArgs args)
- {
- OnModifiedChanged (EventArgs.Empty);
- }
- // --- Public Events
-
- [MonoTODO]
- public event EventHandler AcceptsTabChanged;
- [MonoTODO]
- public event EventHandler AutoSizeChanged;
- [MonoTODO]
- public event EventHandler BorderStyleChanged;
- [MonoTODO]
- //public override event EventHandler Click;
- [MonoTODO]
- public event EventHandler HideSelectionChanged;
- public event EventHandler ModifiedChanged;
- [MonoTODO]
- public event EventHandler MultilineChanged;
- public event EventHandler ReadOnlyChanged;
- // --- Protected Properties
- /*
- [MonoTODO]
- protected override CreateParams CreateParams {
- get
- {
- throw new NotImplementedException ();
- }
- }
- [MonoTODO]
- protected override Size DefaultSize {
- get
- {
- throw new NotImplementedException ();
- }
- }
-
- // --- Protected Methods
-
- [MonoTODO]
- protected override void CreateHandle()
- {
- throw new NotImplementedException ();
- }
- */
- [MonoTODO]
- /* protected override bool IsInputKey(Keys keyData)
- {
- throw new NotImplementedException ();
- }
- */ [MonoTODO]
- protected virtual void OnAcceptsTabChanged(EventArgs e)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- protected virtual void OnAutoSizeChanged(EventArgs e)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- protected virtual void OnBorderStyleChanged(EventArgs e)
- {
- throw new NotImplementedException ();
- }
- /*
- [MonoTODO]
- protected override void OnFontChanged(EventArgs e)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- protected override void OnHandleCreated(EventArgs e)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- protected override void OnHandleDestroyed(EventArgs e)
- {
- throw new NotImplementedException ();
- }
- */
- [MonoTODO]
- protected virtual void OnHideSelectionChanged(EventArgs e)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- protected virtual void OnModifiedChanged(EventArgs e)
- {
- if (ModifiedChanged != null)
- ModifiedChanged (this, e);
- }
- [MonoTODO]
- protected virtual void OnMultilineChanged(EventArgs e)
- {
- throw new NotImplementedException ();
- }
- protected virtual void OnReadOnlyChanged(EventArgs e)
- {
- if (ReadOnlyChanged != null)
- ReadOnlyChanged (this, e);
- }
- /* [MonoTODO]
- protected override bool ProcessDialogKey(Keys keyData)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- protected override void WndProc(ref Message m)
- {
- throw new NotImplementedException ();
- }
- */ }
- }
|