From: Miguel de Icaza Date: Tue, 29 Jul 2003 02:49:16 +0000 (-0000) Subject: 2003-07-28 Miguel de Icaza X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=901bef5c01306c1b9a58d51447a8b298584eb9c9;p=mono.git 2003-07-28 Miguel de Icaza * NativeWindow.cs: Remove debugigng messages. * Control.cs: Remove debugging messages. * Label.cs: Use the border style. svn path=/trunk/mcs/; revision=16819 --- diff --git a/mcs/class/System.Windows.Forms/Gtk/Control.cs b/mcs/class/System.Windows.Forms/Gtk/Control.cs index e57e842d2d5..9492d97e924 100644 --- a/mcs/class/System.Windows.Forms/Gtk/Control.cs +++ b/mcs/class/System.Windows.Forms/Gtk/Control.cs @@ -30,7 +30,7 @@ namespace System.Windows.Forms { bool tabStop=true; static int init_me; RightToLeft rightToLeft; - protected Gtk.VBox vbox = null; + Gtk.VBox vbox = null; public class ControlCollection : IList, ICollection, IEnumerable, ICloneable { @@ -183,13 +183,18 @@ namespace System.Windows.Forms { } - public Control (string text, int left, int top, int width, int height) + public Control (string text, int left, int top, int width, int height) : this (text, left, top, width, height); { } public Control (Control parent, string text, int left, int top, int width, int height) { - + this.parent = parent; + this.text = text; + this.left = left; + this.top = top; + this.width = width; + this.height = height; } internal Widget Widget { diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog index 99814824e15..5fa4f521755 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,5 +1,11 @@ 2003-07-28 Miguel de Icaza + * NativeWindow.cs: Remove debugigng messages. + + * Control.cs: Remove debugging messages. + + * Label.cs: Use the border style. + * win32functions.cs: Set the default to WineLib now on Linux. 2003-07-23 Miguel de Icaza diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs index 4fe1df9a14f..543a1a87ae5 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs @@ -858,10 +858,8 @@ namespace System.Windows.Forms { } set { if (parent != value) { - Console.WriteLine ("setting parent"); parent = value; - Console.WriteLine ("add ourself to the parents control"); // add ourself to the parents control if (!parent.Controls.Contains (this)) parent.Controls.Add (this); @@ -872,9 +870,7 @@ namespace System.Windows.Forms { OnParentBackColorChanged (new EventArgs ()); } - Console.WriteLine ("SetParent"); if (IsHandleCreated) { - Console.WriteLine ("Handle created"); Win32.SetParent (Handle, value.Handle); } /* @@ -1570,7 +1566,6 @@ namespace System.Windows.Forms { IEnumerator cw = childControls.GetEnumerator (); while (cw.MoveNext ()) { - Console.WriteLine ("Adding Control"); Control control = (Control) cw.Current; control.CreateControl (); control.Show (); @@ -1663,8 +1658,6 @@ namespace System.Windows.Forms { protected virtual void OnHandleCreated (EventArgs e) { - Console.WriteLine ("OnHandleCreated"); - //if (font != null) { // Win32.SendMessage (Handle, Msg.WM_SETFONT, font.ToHfont ().ToInt32 (), 0); //} @@ -2152,7 +2145,7 @@ namespace System.Windows.Forms { // are big enough to warrant recreating the HWND protected void RecreateHandle () { - statuses [ RECREATING_HANDLE ] = true; + statuses [RECREATING_HANDLE] = true; if (IsHandleCreated) { DestroyHandle (); CreateHandle (); diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs index 32127578ff2..66d281ea564 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs @@ -15,25 +15,25 @@ namespace System.Windows.Forms { using System.Drawing; public class Label : Control { - Image backgroundImage; - BorderStyle borderStyle; + Image background_image; + BorderStyle border_style; bool autoSize; Image image; - ContentAlignment imageAlign; - ImeMode defaultImeMode; - bool renderTransparent; - FlatStyle flatStyle; - int preferredHeight; - int preferredWidth; - bool tabStop; - ContentAlignment textAlign; - bool useMnemonic; + ContentAlignment image_align; + ImeMode default_ime_mode; + bool render_transparent; + FlatStyle flat_style; + int preferred_height; + int preferred_width; + bool tab_stop; + ContentAlignment text_align; + bool use_mnemonic; public Label () : base () { // Defaults in the Spec autoSize = false; - borderStyle = BorderStyle.None; + border_style = BorderStyle.None; base.TabStop = false; SubClassWndProc_ = true; @@ -52,30 +52,35 @@ namespace System.Windows.Forms { public override Image BackgroundImage { get { - return backgroundImage; + return background_image; } set { - backgroundImage = value; - // FIXME: force redraw + background_image = value; + Refresh (); } } public virtual BorderStyle BorderStyle { get { - return borderStyle; + return border_style; } set { - borderStyle = value; + if (border_style == value) + return; + + border_style = value; + RecreateHandle (); } } public FlatStyle FlatStyle { get { - return flatStyle; + return flat_style; } set { - flatStyle = value; + flat_style = value; + Refresh (); } } @@ -85,15 +90,16 @@ namespace System.Windows.Forms { } set { image = value; + Refresh (); } } public ContentAlignment ImageAlign { get { - return imageAlign; + return image_align; } set { - imageAlign = value; + image_align = value; } } @@ -105,7 +111,7 @@ namespace System.Windows.Forms { } set { //FIXME: - } + } } [MonoTODO] @@ -130,41 +136,41 @@ namespace System.Windows.Forms { public int PreferredHeight { get { - return preferredHeight; + return preferred_height; } } public int PreferredWidth { get { - return preferredWidth; + return preferred_width; } } public new bool TabStop { get { - return tabStop; + return tab_stop; } set { - tabStop = value; + tab_stop = value; } } //Compact Framework public virtual ContentAlignment TextAlign { get { - return textAlign; + return text_align; } set { - textAlign = value; + text_align = value; } } public bool UseMnemonic { get { - return useMnemonic; + return use_mnemonic; } set { - useMnemonic = value; + use_mnemonic = value; } } @@ -174,12 +180,20 @@ namespace System.Windows.Forms { createParams.ClassName = "Static"; + int bs = 0; + if (border_style == BorderStyle.FixedSingle) + bs |= (int) WindowStyles.WS_BORDER; + else if (border_style == BorderStyle.Fixed3D) + bs |= (int) WindowStyles.WS_BORDER | (int) SS_Static_Control_Types.SS_SUNKEN; + + createParams.Style = (int) ( (int)WindowStyles.WS_CHILD | (int)WindowStyles.WS_VISIBLE | (int)SS_Static_Control_Types.SS_LEFT | (int)WindowStyles.WS_CLIPCHILDREN | - (int)WindowStyles.WS_CLIPSIBLINGS ); + (int)WindowStyles.WS_CLIPSIBLINGS | + bs); return createParams; } @@ -193,17 +207,17 @@ namespace System.Windows.Forms { protected virtual bool RenderTransparent { get { - return renderTransparent; + return render_transparent; } set { //FIXME: - } + } } protected override ImeMode DefaultImeMode { get { - //FIXME: - return defaultImeMode; + //FIXME: + return default_ime_mode; } } @@ -211,16 +225,9 @@ namespace System.Windows.Forms { #region Methods - public new void Select() - { - //FIXME: - base.Select (); - } - - //Compact Framework public override string ToString() { - //FIXME: add name of lable, as well as text. would adding base.ToString work? + //FIXME: add name of lable, as well as text. would adding base.ToString work? return "Label: " + base.Text; } @@ -245,7 +252,8 @@ namespace System.Windows.Forms { //FIXME: } - protected virtual void OnAutoSizeChanged (EventArgs e) { + protected virtual void OnAutoSizeChanged (EventArgs e) + { if (AutoSizeChanged != null) AutoSizeChanged (this, e); } @@ -340,12 +348,11 @@ namespace System.Windows.Forms { protected new void UpdateBounds (int x, int y, int width, - int height, int clientWidth, - int clientHeight) - { - base.UpdateBounds (x, y, width, height, clientWidth, - clientHeight); - } + int height, int clientWidth, + int clientHeight) + { + base.UpdateBounds (x, y, width, height, clientWidth, clientHeight); + } protected override void WndProc(ref Message m) { @@ -357,7 +364,7 @@ namespace System.Windows.Forms { public event EventHandler AutoSizeChanged; public event EventHandler TextAlignChanged; -#endif +#endregion } } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs index 30e53e75d41..0cff589d89f 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs @@ -216,17 +216,19 @@ namespace System.Windows.Forms { message.WParam = wParam; message.LParam = lParam; message.Result = (IntPtr) 0; - + +#if false if (msg == Msg.WM_CREATE) Console.WriteLine ("WM_CREATE (static)"); - +#endif + if (window != null) { if (msg == Msg.WM_CREATE) { - Console.WriteLine ("WM_CREATE (static != null)"); + // Console.WriteLine ("WM_CREATE (static != null)"); } window.WndProc(ref message); } else { - Console.WriteLine ("no window, defwndproc"); + // Console.WriteLine ("no window, defwndproc"); // even though we are not managing the // window let the window get the message message.Result = Win32.DefWindowProcA ( diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Enums.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Enums.cs index 33780419d32..fdf11ac1326 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Enums.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Enums.cs @@ -312,13 +312,9 @@ namespace System.Windows.Forms{ WS_ICONIC = 0x20000000, WS_SIZEBOX = 0x00040000, WS_POPUPWINDOW = 0x80880000, - WS_OVERLAPPEDWINDOW = 0x00CF0000, - //this OR option is perferred - // public const uint WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | - // WS_CAPTION | WS_SYSMENU | WS_THICKFRAME| - // WS_MINIMIZEBOX | WS_MAXIMIZEBOX; - WS_TILEDWINDOW = 0x00CF0000, - WS_CHILDWINDOW = 0x40000000 + WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, + WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW, + WS_CHILDWINDOW = WS_CHILD } #endregion