2003-07-28 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 29 Jul 2003 02:49:16 +0000 (02:49 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 29 Jul 2003 02:49:16 +0000 (02:49 -0000)
* NativeWindow.cs: Remove debugigng messages.

* Control.cs: Remove debugging messages.

* Label.cs: Use the border style.

svn path=/trunk/mcs/; revision=16819

mcs/class/System.Windows.Forms/Gtk/Control.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/win32Enums.cs

index e57e842d2d5b25897adea0004d8d1492213768da..9492d97e924fededd5e2dd83859cf4bdd06f8987 100644 (file)
@@ -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 {
index 99814824e15136cec868a0a5d7677eeef0300dec..5fa4f52175552a886f2e69ac5992e2ca15279875 100644 (file)
@@ -1,5 +1,11 @@
 2003-07-28  Miguel de Icaza  <miguel@ximian.com>
 
+       * 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  <miguel@ximian.com>
index 4fe1df9a14f8b63dfd0924acfb2f145731e49a18..543a1a87ae58a8d86535d038c19898a4388d85ab 100644 (file)
@@ -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 ();
index 32127578ff288561623a7d8cb4687a0e7c9f355e..66d281ea564a287abf60cdde6d6bd629d7043e7d 100644 (file)
@@ -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
                
        }
     }
index 30e53e75d4152b0b52b2ff066a9b21b264fae8f3..0cff589d89fad0e1b70486db9a10757988c4f46a 100644 (file)
@@ -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 (
index 33780419d3280abc69dad0ea2d719ba74a866074..fdf11ac1326fcefc731f43a856e4e1d431108b64 100644 (file)
@@ -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