(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.Windows.Forms / Gtk / TextBox.cs
blob2a7b56a4940ece254b55703a567b8cc359773e6a
1 //
2 // System.Windows.Forms.TextBox
3 //
4 // Author:
5 // stubbed out by Jackson Harper (jackson@latitudegeo.com)
6 // Dennis Hayes (dennish@raytek.com)
7 // Remco de Jong (rdj@rdj.cg.nu)
8 //
9 // (C) 2002 Ximian, Inc
12 namespace System.Windows.Forms {
14 // <summary>
15 // This is only a template. Nothing is implemented yet.
17 // </summary>
19 public class TextBox : TextBoxBase {
21 private Gtk.TextView textview;
22 private ScrollBars scrollbars;
23 private HorizontalAlignment textalign;
24 private bool wordwrap;
27 // --- Public Constructor
29 public TextBox() {
30 scrollbars = ScrollBars.None;
33 internal override Gtk.Widget CreateWidget () {
34 // needs to initialized with a textbuffer from TextBoxBase
35 // we need default adjustments, but the scrolledwindow constructor does not take null as argument
37 Gtk.ScrolledWindow window = new Gtk.ScrolledWindow (
38 new Gtk.Adjustment (0, 0, 1, .1, .1, .1),
39 new Gtk.Adjustment (0, 0, 1, .1, .1, .1));
41 window.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Never);
42 window.AddWithViewport(TextView);
43 return window;
46 // --- Public Properties
48 public override bool ReadOnly {
49 get
51 return !TextView.Editable;
53 set
55 if (value == TextView.Editable) { // only change if value is different, correct behaviour?
56 TextView.Editable = !value;
57 OnReadOnlyChanged(EventArgs.Empty);
62 [MonoTODO]
63 public bool AcceptsReturn {
65 get
67 throw new NotImplementedException ();
69 set
71 throw new NotImplementedException ();
74 [MonoTODO]
75 /* public CharacterCasing CharacterCasing {
76 get
78 throw new NotImplementedException ();
80 set
82 throw new NotImplementedException ();
85 */ [MonoTODO]
86 public char PasswordChar {
87 get
89 throw new NotImplementedException ();
91 set
93 throw new NotImplementedException ();
97 public ScrollBars ScrollBars {
98 get {
99 return scrollbars;
101 set {
102 scrollbars = value;
104 Gtk.PolicyType vpolicy = Gtk.PolicyType.Never; // correct behaviour?
105 Gtk.PolicyType hpolicy = Gtk.PolicyType.Never;
107 if (scrollbars == ScrollBars.Both) {
108 vpolicy = Gtk.PolicyType.Always;
109 hpolicy = Gtk.PolicyType.Always;
111 else if (scrollbars == ScrollBars.Horizontal) {
112 hpolicy = Gtk.PolicyType.Always;
114 else if (scrollbars == ScrollBars.Vertical) {
115 vpolicy = Gtk.PolicyType.Always;
118 ((Gtk.ScrolledWindow) Widget).SetPolicy(hpolicy, vpolicy);
122 public HorizontalAlignment TextAlign {
125 return textalign;
129 Gtk.Justification justification = Gtk.Justification.Left;
130 if (value == HorizontalAlignment.Center) {
131 justification = Gtk.Justification.Center;
133 else if (value == HorizontalAlignment.Right) {
134 justification = Gtk.Justification.Right;
137 TextView.Justification = justification;
138 textalign = value;
140 OnTextAlignChanged(EventArgs.Empty);
144 public override bool WordWrap {
147 return wordwrap;
151 Gtk.WrapMode wrapmode = Gtk.WrapMode.None;
152 wordwrap = value;
153 if (wordwrap)
154 wrapmode = Gtk.WrapMode.Word;
156 TextView.WrapMode = wrapmode;
161 // --- Public Events
163 public event EventHandler TextAlignChanged;
165 // --- Protected Properties
167 /* [MonoTODO]
168 protected override CreateParams CreateParams {
171 throw new NotImplementedException ();
174 [MonoTODO]
175 protected override ImeMode DefaultImeMode {
178 throw new NotImplementedException ();
182 // --- Protected Members
184 protected Gtk.TextView TextView {
185 get {
186 if (textview == null) {
187 textview = new Gtk.TextView(TextBuffer);
188 textview.Show();
190 return textview;
194 /* protected override bool IsInputKey(Keys keyData)
196 throw new NotImplementedException ();
198 [MonoTODO]
199 protected override void OnHandleCreated(EventArgs e)
201 throw new NotImplementedException ();
203 [MonoTODO]
204 protected override void OnMouseUp(MouseEventArgs mevent)
206 throw new NotImplementedException ();
209 protected virtual void OnTextAlignChanged(EventArgs e)
211 if (TextAlignChanged != null)
212 TextAlignChanged (this, e);
215 /* [MonoTODO]
216 protected override void WndProc(ref Message m)
218 throw new NotImplementedException ();
220 */ }