2 // System.Windows.Forms.TextBox
5 // stubbed out by Jackson Harper (jackson@latitudegeo.com)
6 // Dennis Hayes (dennish@raytek.com)
7 // Remco de Jong (rdj@rdj.cg.nu)
9 // (C) 2002 Ximian, Inc
12 namespace System
.Windows
.Forms
{
15 // This is only a template. Nothing is implemented yet.
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
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
);
46 // --- Public Properties
48 public override bool ReadOnly
{
51 return !TextView
.Editable
;
55 if (value == TextView
.Editable
) { // only change if value is different, correct behaviour?
56 TextView
.Editable
= !value;
57 OnReadOnlyChanged(EventArgs
.Empty
);
63 public bool AcceptsReturn
{
67 throw new NotImplementedException ();
71 throw new NotImplementedException ();
75 /* public CharacterCasing CharacterCasing {
78 throw new NotImplementedException ();
82 throw new NotImplementedException ();
86 public char PasswordChar
{
89 throw new NotImplementedException ();
93 throw new NotImplementedException ();
97 public ScrollBars ScrollBars
{
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
{
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
;
140 OnTextAlignChanged(EventArgs
.Empty
);
144 public override bool WordWrap
{
151 Gtk
.WrapMode wrapmode
= Gtk
.WrapMode
.None
;
154 wrapmode
= Gtk
.WrapMode
.Word
;
156 TextView
.WrapMode
= wrapmode
;
163 public event EventHandler TextAlignChanged
;
165 // --- Protected Properties
168 protected override CreateParams CreateParams {
171 throw new NotImplementedException ();
175 protected override ImeMode DefaultImeMode {
178 throw new NotImplementedException ();
182 // --- Protected Members
184 protected Gtk
.TextView TextView
{
186 if (textview
== null) {
187 textview
= new Gtk
.TextView(TextBuffer
);
194 /* protected override bool IsInputKey(Keys keyData)
196 throw new NotImplementedException ();
199 protected override void OnHandleCreated(EventArgs e)
201 throw new NotImplementedException ();
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
);
216 protected override void WndProc(ref Message m)
218 throw new NotImplementedException ();