/[dotgnu-pnet]/pnetlib/System.Windows.Forms/Control.cs
ViewVC logotype

Diff of /pnetlib/System.Windows.Forms/Control.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.82 by t3rmin4t0r, Thu Dec 23 07:22:01 2004 UTC revision 1.83 by Rich333, Thu Dec 30 07:31:17 2004 UTC
# Line 66  public class Control : IWin32Window, IDi Line 66  public class Control : IWin32Window, IDi
66          private Control[] children;          private Control[] children;
67          private int numChildren;          private int numChildren;
68          private BindingContext bindingContext;          private BindingContext bindingContext;
69          private bool enabled;          private ControlFlags flags;
70          internal bool visible;          internal bool visible;
         private bool allowDrop;  
         private bool causesValidation;  
71          internal Color backColor;          internal Color backColor;
72          internal Color foreColor;          internal Color foreColor;
73          private Font font;          private Font font;
74          private Image backgroundImage;          private Image backgroundImage;
         private bool layoutInitSuspended;  
75          private int prevParentWidth, prevParentHeight;          private int prevParentWidth, prevParentHeight;
76          private byte anchorStyles;          private byte anchorStyles;
77          private byte dockStyle;          private byte dockStyle;
78          private byte imeMode;          private byte imeMode;
79          private byte rightToLeft;          private byte rightToLeft;
80          private int tabIndex;          private int tabIndex;
         private bool tabStop;  
         private bool disposed;  
         private bool performingLayout;  
81          private int layoutSuspended;          private int layoutSuspended;
82          private Object tag;          private Object tag;
83          private CreateParams currentParams;          private CreateParams currentParams;
# Line 100  public class Control : IWin32Window, IDi Line 94  public class Control : IWin32Window, IDi
94          // The thread that was used to create the control.          // The thread that was used to create the control.
95          private Thread createThread;          private Thread createThread;
96          private Cursor cursor;          private Cursor cursor;
         private bool notifyClick = false;  
         private bool notifyDoubleClick = false;  
         private bool validationCancelled = false;  
97          private IToolkitWindowBuffer buffer;          private IToolkitWindowBuffer buffer;
98          private ControlBindingsCollection controlBindingsCollection;          private ControlBindingsCollection controlBindingsCollection;
99          private Timer hoverTimer;          private Timer hoverTimer;
100            
101    
102            // Miscellaneous flags for controls.
103            [Flags]
104            private enum ControlFlags
105            {
106                    None                = 0x0000,
107                    Enabled             = 0x0001,
108                    TabStop             = 0x0002,
109                    AllowDrop           = 0x0004,
110                    CausesValidation    = 0x0008,
111                    Disposed            = 0x0010,
112                    LayoutInitSuspended = 0x0020,
113                    PerformingLayout    = 0x0040,
114                    NotifyClick         = 0x0080,
115                    NotifyDoubleClick   = 0x0100,
116                    ValidationCancelled = 0x0200,
117                    NeedReparent        = 0x0400,
118                    Default             = (Enabled | CausesValidation | TabStop)
119    
120            }; // enum ControlFlags
121    
122          //          //
123          // Implentation of classes and variables for Invoke/BeginInvoke/EndInvoke          // Implentation of classes and variables for Invoke/BeginInvoke/EndInvoke
124          //          //
# Line 203  public class Control : IWin32Window, IDi Line 215  public class Control : IWin32Window, IDi
215          public Control()          public Control()
216                          {                          {
217                                  this.name = String.Empty;                                  this.name = String.Empty;
218                                  this.enabled = true;                                  this.flags = ControlFlags.Default;
219                                  this.visible = true;                                  this.visible = true;
                                 this.layoutInitSuspended = false;  
220                                  this.anchorStyles =                                  this.anchorStyles =
221                                          (byte)(AnchorStyles.Top | AnchorStyles.Left);                                          (byte)(AnchorStyles.Top | AnchorStyles.Left);
                                 this.causesValidation = true;  
222                                  this.imeMode = (byte)DefaultImeMode;                                  this.imeMode = (byte)DefaultImeMode;
223                                  this.rightToLeft = (byte)(RightToLeft.Inherit);                                  this.rightToLeft = (byte)(RightToLeft.Inherit);
224                                  this.tabIndex = -1;                                  this.tabIndex = -1;
                                 this.tabStop = true;  
225                                  borderStyle = BorderStyle.None;                                  borderStyle = BorderStyle.None;
226                                  // Create the currentParams                                  // Create the currentParams
227                                  currentParams = new CreateParams();                                  currentParams = new CreateParams();
# Line 487  public class Control : IWin32Window, IDi Line 496  public class Control : IWin32Window, IDi
496                          {                          {
497                                  get                                  get
498                                  {                                  {
499                                          return allowDrop;                                          return GetControlFlag(ControlFlags.AllowDrop);
500                                  }                                  }
501                                  set                                  set
502                                  {                                  {
503                                          allowDrop = value;                                          SetControlFlag(ControlFlags.AllowDrop, value);
504                                  }                                  }
505                          }                          }
506  #if CONFIG_COMPONENT_MODEL  #if CONFIG_COMPONENT_MODEL
# Line 676  public class Control : IWin32Window, IDi Line 685  public class Control : IWin32Window, IDi
685                          {                          {
686                                  get                                  get
687                                  {                                  {
688                                          return causesValidation;                                          return GetControlFlag(ControlFlags.CausesValidation);
689                                  }                                  }
690                                  set                                  set
691                                  {                                  {
692                                          if(causesValidation != value)                                          if(GetControlFlag(ControlFlags.CausesValidation) != value)
693                                          {                                          {
694                                                  causesValidation = value;                                                  SetControlFlag(ControlFlags.CausesValidation, value);
695                                                  OnCausesValidationChanged(EventArgs.Empty);                                                  OnCausesValidationChanged(EventArgs.Empty);
696                                          }                                          }
697                                  }                                  }
# Line 860  public class Control : IWin32Window, IDi Line 869  public class Control : IWin32Window, IDi
869                                          cp.Height = height;                                          cp.Height = height;
870                                          cp.ClassStyle = Win32Constants.CS_DBLCLKS;                                          cp.ClassStyle = Win32Constants.CS_DBLCLKS;
871                                          cp.Style = Win32Constants.WS_CLIPCHILDREN;                                          cp.Style = Win32Constants.WS_CLIPCHILDREN;
872                                          if (GetStyle(ControlStyles.ContainerControl))                                          if(GetStyle(ControlStyles.ContainerControl))
873                                          {                                          {
874                                                  cp.ExStyle = Win32Constants.WS_EX_CONTROLPARENT;                                                  cp.ExStyle = Win32Constants.WS_EX_CONTROLPARENT;
875                                          }                                          }
# Line 869  public class Control : IWin32Window, IDi Line 878  public class Control : IWin32Window, IDi
878                                                  cp.Style |= Win32Constants.WS_CHILD |                                                  cp.Style |= Win32Constants.WS_CHILD |
879                                                          Win32Constants.WS_CLIPSIBLINGS;                                                          Win32Constants.WS_CLIPSIBLINGS;
880                                          }                                          }
881                                          if(tabStop)                                          if(GetControlFlag(ControlFlags.TabStop))
882                                          {                                          {
883                                                  cp.Style |= Win32Constants.WS_TABSTOP;                                                  cp.Style |= Win32Constants.WS_TABSTOP;
884                                          }                                          }
# Line 1066  public class Control : IWin32Window, IDi Line 1075  public class Control : IWin32Window, IDi
1075                          {                          {
1076                                  get                                  get
1077                                  {                                  {
1078                                          if(!enabled)                                          if(!GetControlFlag(ControlFlags.Enabled))
1079                                          {                                          {
1080                                                  // There is no point going further up the tree.                                                  // There is no point going further up the tree.
1081                                                  return false;                                                  return false;
# Line 1082  public class Control : IWin32Window, IDi Line 1091  public class Control : IWin32Window, IDi
1091                                  }                                  }
1092                                  set                                  set
1093                                  {                                  {
1094                                          if(enabled != value)                                          if(GetControlFlag(ControlFlags.Enabled) != value)
1095                                          {                                          {
1096                                                  enabled = value;                                                  SetControlFlag(ControlFlags.Enabled, value);
1097                                                  OnEnabledChanged(EventArgs.Empty);                                                  OnEnabledChanged(EventArgs.Empty);
1098                                          }                                          }
1099                                  }                                  }
# Line 1294  public class Control : IWin32Window, IDi Line 1303  public class Control : IWin32Window, IDi
1303                          {                          {
1304                                  get                                  get
1305                                  {                                  {
1306                                          return disposed;                                          return GetControlFlag(ControlFlags.Disposed);
1307                                  }                                  }
1308                          }                          }
1309  #if CONFIG_COMPONENT_MODEL  #if CONFIG_COMPONENT_MODEL
# Line 1687  public class Control : IWin32Window, IDi Line 1696  public class Control : IWin32Window, IDi
1696                          {                          {
1697                                  get                                  get
1698                                  {                                  {
1699                                          return tabStop;                                          return GetControlFlag(ControlFlags.TabStop);
1700                                  }                                  }
1701                                  set                                  set
1702                                  {                                  {
1703                                          if(tabStop != value)                                          if(GetControlFlag(ControlFlags.TabStop) != value)
1704                                          {                                          {
1705                                                  tabStop = value;                                                  SetControlFlag(ControlFlags.TabStop, value);
1706                                                  OnTabStopChanged(EventArgs.Empty);                                                  OnTabStopChanged(EventArgs.Empty);
1707                                          }                                          }
1708                                  }                                  }
# Line 1947  public class Control : IWin32Window, IDi Line 1956  public class Control : IWin32Window, IDi
1956          public void CreateControl()          public void CreateControl()
1957                          {                          {
1958                                  // Only create if needed                                  // Only create if needed
1959                                  if (toolkitWindow != null)                                  if(toolkitWindow != null) { return; }
1960                                          return;  
1961                                  // Cannot create the control if it has been disposed.                                  // Cannot create the control if it has been disposed.
1962                                  if(disposed)                                  if(GetControlFlag(ControlFlags.Disposed))
1963                                  {                                  {
1964                                          throw new ObjectDisposedException                                          throw new ObjectDisposedException
1965                                                  ("control", S._("SWF_ControlDisposed"));                                                  ("control", S._("SWF_ControlDisposed"));
# Line 1965  public class Control : IWin32Window, IDi Line 1974  public class Control : IWin32Window, IDi
1974                                          control = control.parent;                                          control = control.parent;
1975                                  }                                  }
1976                                  control.CreateControlInner();                                  control.CreateControlInner();
1977    
1978                                  // If one of the parents of this control is not visible then the control                                  // If one of the parents of this control is not visible then the control
1979                                  // will not be created. We must ensure that the control is created, even if                                  // will not be created. We must ensure that the control is created, even if
1980                                  // its parent isnt.                                  // its parent isnt.
1981                                  CreateHandle();                                  if(toolkitWindow == null)
1982                                    {
1983                                            CreateHandle();
1984                                    }
1985                          }                          }
1986          private void CreateControlInner()          private void CreateControlInner()
1987                          {                          {
# Line 1978  public class Control : IWin32Window, IDi Line 1991  public class Control : IWin32Window, IDi
1991                                  // Create the child controls.                                  // Create the child controls.
1992                                  for(int posn = (numChildren - 1); posn >= 0; --posn)                                  for(int posn = (numChildren - 1); posn >= 0; --posn)
1993                                  {                                  {
1994                                            // Get the current child.
1995                                          Control child = children[posn];                                          Control child = children[posn];
1996    
1997                                          // We only need to create a control if its visible.                                          // We only need to create a control if its visible.
1998                                          if (child.visible)                                          if(child.visible)
1999                                            {
2000                                                    // Update the windowing system z-order.
2001                                                    if(child.toolkitWindow != null)
2002                                                    {
2003                                                            child.toolkitWindow.Raise();
2004                                                    }
2005    
2006                                                    // Create the child control.
2007                                                  child.CreateControlInner();                                                  child.CreateControlInner();
2008                                            }
2009                                  }                                  }
2010    
2011                                  // Map the control to the screen if it is visible.                                  // Map the control to the screen if it is visible.
# Line 2016  public class Control : IWin32Window, IDi Line 2040  public class Control : IWin32Window, IDi
2040          protected virtual void CreateHandle()          protected virtual void CreateHandle()
2041                          {                          {
2042                                  // Cannot create the control if it has been disposed.                                  // Cannot create the control if it has been disposed.
2043                                  if(disposed)                                  if(GetControlFlag(ControlFlags.Disposed))
2044                                  {                                  {
2045                                          throw new ObjectDisposedException                                          throw new ObjectDisposedException
2046                                                  ("control", S._("SWF_ControlDisposed"));                                                  ("control", S._("SWF_ControlDisposed"));
# Line 2026  public class Control : IWin32Window, IDi Line 2050  public class Control : IWin32Window, IDi
2050                                  // already exists from some previous incarnation.                                  // already exists from some previous incarnation.
2051                                  if(toolkitWindow != null)                                  if(toolkitWindow != null)
2052                                  {                                  {
2053                                          if(parent != null && toolkitWindow.Parent != parent.toolkitWindow)                                          if(parent != null &&
2054                                               toolkitWindow.Parent != parent.toolkitWindow)
2055                                          {                                          {
2056                                                  Reparent(parent);                                                  Reparent(parent);
2057                                          }                                          }
# Line 2037  public class Control : IWin32Window, IDi Line 2062  public class Control : IWin32Window, IDi
2062                                  if(parent != null)                                  if(parent != null)
2063                                  {                                  {
2064                                          toolkitWindow = CreateToolkitWindow(parent.toolkitWindow);                                          toolkitWindow = CreateToolkitWindow(parent.toolkitWindow);
2065                                          // Initialize layout for calculating the anchor.  
2066                                          InitLayout();                                          // Mark this control as requiring a reparent, if needed.
2067                                            if(parent.toolkitWindow == null)
2068                                            {
2069                                                    SetControlFlag(ControlFlags.NeedReparent, true);
2070                                            }
2071                                  }                                  }
2072                                  else                                  else
2073                                  {                                  {
# Line 2061  public class Control : IWin32Window, IDi Line 2090  public class Control : IWin32Window, IDi
2090    
2091                                  createThread = Thread.CurrentThread;                                  createThread = Thread.CurrentThread;
2092    
2093                                    // Reparent the children which require it.
2094                                    for(int i = 0; i < numChildren; ++i)
2095                                    {
2096                                            if(children[i].GetControlFlag(ControlFlags.NeedReparent))
2097                                            {
2098                                                    children[i].Reparent(this);
2099                                            }
2100                                    }
2101    
2102                                  // Notify subclasses that the handle has been created.                                  // Notify subclasses that the handle has been created.
2103                                  OnHandleCreated(EventArgs.Empty);                                  OnHandleCreated(EventArgs.Empty);
2104                          }                          }
# Line 2159  public class Control : IWin32Window, IDi Line 2197  public class Control : IWin32Window, IDi
2197          protected virtual void Dispose(bool disposing)          protected virtual void Dispose(bool disposing)
2198  #endif  #endif
2199                          {                          {
2200                                  if (buffer != null)                                  if(buffer != null)
2201                                  {                                  {
2202                                          buffer.Dispose();                                          buffer.Dispose();
2203                                          buffer = null;                                          buffer = null;
2204                                  }                                  }
2205                                  DestroyHandle();                                  DestroyHandle();
2206                                  disposed = true;                                  SetControlFlag(ControlFlags.Disposed, true);
2207                          }                          }
2208    
2209          // Find the form that this control is a member of.          // Find the form that this control is a member of.
# Line 2251  public class Control : IWin32Window, IDi Line 2289  public class Control : IWin32Window, IDi
2289                                  return (IContainerControl)current;                                  return (IContainerControl)current;
2290                          }                          }
2291    
2292            // Get a control flag.
2293            private bool GetControlFlag(ControlFlags mask)
2294                            {
2295                                    return ((flags & mask) == mask);
2296                            }
2297    
2298          // Get the next or previous control in the tab order.          // Get the next or previous control in the tab order.
2299          public Control GetNextControl(Control ctl, bool forward)          public Control GetNextControl(Control ctl, bool forward)
2300                          {                          {
# Line 2404  public class Control : IWin32Window, IDi Line 2448  public class Control : IWin32Window, IDi
2448                                          }                                          }
2449                                          else                                          else
2450                                          {                                          {
2451                                                  layoutInitSuspended = true;                                                  SetControlFlag(ControlFlags.LayoutInitSuspended, true);
2452                                          }                                          }
2453                                  }                                  }
2454                          }                          }
# Line 2610  public class Control : IWin32Window, IDi Line 2654  public class Control : IWin32Window, IDi
2654                                  }                                  }
2655    
2656                                  // Mark this control as currently being laid out.                                  // Mark this control as currently being laid out.
2657                                  performingLayout = true;                                  SetControlFlag(ControlFlags.PerformingLayout, true);
2658                                  ++layoutSuspended;                                  ++layoutSuspended;
2659    
2660                                  // Lay out this control.  We use a try block to make                                  // Lay out this control.  We use a try block to make
# Line 2625  public class Control : IWin32Window, IDi Line 2669  public class Control : IWin32Window, IDi
2669                                  {                                  {
2670                                          // We are finished laying out this control.                                          // We are finished laying out this control.
2671                                          --layoutSuspended;                                          --layoutSuspended;
2672                                          performingLayout = false;                                          SetControlFlag(ControlFlags.PerformingLayout, false);
2673                                  }                                  }
2674                          }                          }
2675    
# Line 3064  public class Control : IWin32Window, IDi Line 3108  public class Control : IWin32Window, IDi
3108                          {                          {
3109                                  if(layoutSuspended <= 0 || (--layoutSuspended) == 0)                                  if(layoutSuspended <= 0 || (--layoutSuspended) == 0)
3110                                  {                                  {
3111                                          if(layoutInitSuspended)                                          if(GetControlFlag(ControlFlags.LayoutInitSuspended))
3112                                          {                                          {
3113                                                  InitLayout();                                                  InitLayout();
3114                                                  layoutInitSuspended = false;                                                  SetControlFlag(ControlFlags.LayoutInitSuspended, false);
3115                                          }                                          }
3116                                          if(performLayout && !performingLayout)                                          if(performLayout &&
3117                                               !GetControlFlag(ControlFlags.PerformingLayout))
3118                                          {                                          {
3119                                                  PerformLayout();                                                  PerformLayout();
3120                                          }                                          }
# Line 3358  public class Control : IWin32Window, IDi Line 3403  public class Control : IWin32Window, IDi
3403                                  SetBoundsCore(left, top, client.Width, client.Height, BoundsSpecified.Size);                                  SetBoundsCore(left, top, client.Width, client.Height, BoundsSpecified.Size);
3404                          }                          }
3405    
3406            // Set a control flag.
3407            private void SetControlFlag(ControlFlags mask, bool value)
3408                            {
3409                                    if(value)
3410                                    {
3411                                            flags |= mask;
3412                                    }
3413                                    else
3414                                    {
3415                                            flags &= ~mask;
3416                                    }
3417                            }
3418    
3419          // Set a style bit.          // Set a style bit.
3420  #if CONFIG_COMPONENT_MODEL  #if CONFIG_COMPONENT_MODEL
3421          [EditorBrowsable(EditorBrowsableState.Advanced)]          [EditorBrowsable(EditorBrowsableState.Advanced)]
# Line 5008  public class Control : IWin32Window, IDi Line 5066  public class Control : IWin32Window, IDi
5066          protected virtual void OnParentEnabledChanged(EventArgs e)          protected virtual void OnParentEnabledChanged(EventArgs e)
5067                          {                          {
5068                                  bool parentEnabled = parent.Enabled;                                  bool parentEnabled = parent.Enabled;
5069                                    bool enabled = GetControlFlag(ControlFlags.Enabled);
5070                                  if((!parentEnabled && enabled) != (parentEnabled && enabled))                                  if((!parentEnabled && enabled) != (parentEnabled && enabled))
5071                                  {                                  {
5072                                          OnEnabledChanged(e);                                          OnEnabledChanged(e);
# Line 5249  public class Control : IWin32Window, IDi Line 5308  public class Control : IWin32Window, IDi
5308                                  if(toolkitWindow != null)                                  if(toolkitWindow != null)
5309                                  {                                  {
5310                                          toolkitWindow.IsMapped = visible;                                          toolkitWindow.IsMapped = visible;
5311    
5312                                          // May as well release the double buffer resource if its being used.                                          // May as well release the double buffer resource if its being used.
5313                                          if (!visible && buffer != null)                                          if(!visible && buffer != null)
5314                                          {                                          {
5315                                                  buffer.Dispose();                                                  buffer.Dispose();
5316                                                  buffer = null;                                                  buffer = null;
5317                                          }                                          }
5318                                  }                                  }
5319                                  else if(visible && !disposed && (parent == null || parent.IsHandleCreated) )                                  else if(visible && !GetControlFlag(ControlFlags.Disposed) &&
5320                                            (parent == null || parent.IsHandleCreated))
5321                                  {                                  {
5322                                          // Create the toolkit window for the first time.                                          // Create the toolkit window for the first time.
5323                                          // This will also map the toolkit window to the screen.                                          // This will also map the toolkit window to the screen.
5324                                          CreateControl();                                          CreateControl();
5325    
5326                                          // Force PerformLayout to be called on all the children in the heirarchy.                                          // Force PerformLayout to be called on all the children in the heirarchy.
5327                                          ForceLayout();                                          ForceLayout();
5328                                  }                                  }
# Line 5293  public class Control : IWin32Window, IDi Line 5355  public class Control : IWin32Window, IDi
5355          // Move a child to below another.  Does not update "children".          // Move a child to below another.  Does not update "children".
5356          private static void MoveToBelow(Control after, Control child)          private static void MoveToBelow(Control after, Control child)
5357                          {                          {
5358                                  if(after.toolkitWindow != null &&                                  if(after.toolkitWindow != null && child.toolkitWindow != null)
                                         child.toolkitWindow != null)  
5359                                  {                                  {
5360                                          child.toolkitWindow.MoveToBelow(after.toolkitWindow);                                          child.toolkitWindow.MoveToBelow(after.toolkitWindow);
5361                                  }                                  }
# Line 5303  public class Control : IWin32Window, IDi Line 5364  public class Control : IWin32Window, IDi
5364          // Move a child to above another.  Does not update "children".          // Move a child to above another.  Does not update "children".
5365          private static void MoveToAbove(Control before, Control child)          private static void MoveToAbove(Control before, Control child)
5366                          {                          {
5367                                  if(before.toolkitWindow != null &&                                  if(before.toolkitWindow != null && child.toolkitWindow != null)
                                         child.toolkitWindow != null)  
5368                                  {                                  {
5369                                          child.toolkitWindow.MoveToAbove(before.toolkitWindow);                                          child.toolkitWindow.MoveToAbove(before.toolkitWindow);
5370                                  }                                  }
# Line 5325  public class Control : IWin32Window, IDi Line 5385  public class Control : IWin32Window, IDi
5385                                          toolkitWindow.Reparent(null, left + ToolkitDrawOrigin.X,                                          toolkitWindow.Reparent(null, left + ToolkitDrawOrigin.X,
5386                                                  top + ToolkitDrawOrigin.Y);                                                  top + ToolkitDrawOrigin.Y);
5387                                  }                                  }
5388                                  else if (newParent.toolkitWindow != null)                                  else if(newParent.toolkitWindow != null)
5389                                  {                                  {
5390                                          int xOffset = parent.ClientOrigin.X - parent.ToolkitDrawOrigin.X                                          int xOffset = parent.ClientOrigin.X - parent.ToolkitDrawOrigin.X
5391                                                  + ToolkitDrawOrigin.X;                                                  + ToolkitDrawOrigin.X;
# Line 5336  public class Control : IWin32Window, IDi Line 5396  public class Control : IWin32Window, IDi
5396                                                  top + yOffset);                                                  top + yOffset);
5397                                          toolkitWindow.Lower();                                          toolkitWindow.Lower();
5398                                  }                                  }
5399                                    else
5400                                    {
5401                                            SetControlFlag(ControlFlags.NeedReparent, true);
5402                                    }
5403                          }                          }
5404    
5405          // Collection of child controls.          // Collection of child controls.
# Line 5531  public class Control : IWin32Window, IDi Line 5595  public class Control : IWin32Window, IDi
5595                                                                          }                                                                          }
5596                                                                          value.tabIndex = lastIndex;                                                                          value.tabIndex = lastIndex;
5597                                                                  }                                                                  }
   
                                                                 // Initialize layout within the new context.  
                                                                 value.InitLayout();  
5598                                                          }                                                          }
5599                                                          finally                                                          finally
5600                                                          {                                                          {
# Line 5627  public class Control : IWin32Window, IDi Line 5688  public class Control : IWin32Window, IDi
5688    
5689                                          // Find the previous index of the control.                                          // Find the previous index of the control.
5690                                          int index = IndexOf(child);                                          int index = IndexOf(child);
5691                    
5692                                          // Move the control.                                          // Move the control.
5693                                          int posn;                                          int posn;
5694                                          if(index < newIndex)                                          if(index < newIndex)
# Line 5957  public class Control : IWin32Window, IDi Line 6018  public class Control : IWin32Window, IDi
6018                  (ToolkitMouseButtons buttons, ToolkitKeys modifiers,                  (ToolkitMouseButtons buttons, ToolkitKeys modifiers,
6019                  int clicks, int x, int y, int delta)                  int clicks, int x, int y, int delta)
6020                          {                          {
6021                                  if (!enabled)                                  if(!GetControlFlag(ControlFlags.Enabled))
6022                                  {                                  {
6023                                          return;                                          return;
6024                                  }                                  }
# Line 5976  public class Control : IWin32Window, IDi Line 6037  public class Control : IWin32Window, IDi
6037                  int clicks, int x, int y, int delta)                  int clicks, int x, int y, int delta)
6038                          {                          {
6039                                                                    
6040                                  if (GetStyle(ControlStyles.Selectable) && buttons == MouseButtons.Left)                                  if(GetStyle(ControlStyles.Selectable) && buttons == MouseButtons.Left)
6041                                  {                                  {
6042                                          Focus();                                          Focus();
6043                                  }                                  }
6044    
6045                                  // Walk up the hierarchy and see if we must focus the control                                  // Walk up the hierarchy and see if we must focus the control
6046                                  if (Enabled)                                  if(Enabled)
6047                                  {                                  {
6048                                          OnMouseDown(new MouseEventArgs                                          OnMouseDown(new MouseEventArgs
6049                                                  (buttons, clicks, x, y, delta));                                                  (buttons, clicks, x, y, delta));
6050                                  }                                  }
6051    
6052                                  // We fire the OnDoubleClick and OnClick events when the mouse button is up/                                  // We fire the OnDoubleClick and OnClick events when the mouse button is up/
6053                                  if (GetStyle(ControlStyles.StandardClick))                                  if(GetStyle(ControlStyles.StandardClick))
6054                                  {                                  {
6055                                          if (clicks == 2 && GetStyle(ControlStyles.StandardDoubleClick))                                          if(clicks == 2 && GetStyle(ControlStyles.StandardDoubleClick))
6056                                          {                                          {
6057                                                  notifyDoubleClick = true;                                                  SetControlFlag(ControlFlags.NotifyDoubleClick, true);
6058                                          }                                          }
6059                                          else                                          else
6060                                          {                                          {
6061                                                  notifyClick = true;                                                  SetControlFlag(ControlFlags.NotifyClick, true);
6062                                          }                                          }
6063                                  }                                  }
6064                          }                          }
# Line 6010  public class Control : IWin32Window, IDi Line 6073  public class Control : IWin32Window, IDi
6073                                  y += ToolkitDrawOrigin.Y - ClientOrigin.Y;                                  y += ToolkitDrawOrigin.Y - ClientOrigin.Y;
6074                                  mouseButtons = (MouseButtons)buttons;                                  mouseButtons = (MouseButtons)buttons;
6075                                  currentModifiers = (Keys)modifiers;                                  currentModifiers = (Keys)modifiers;
6076                                  if (notifyDoubleClick)                                  if(GetControlFlag(ControlFlags.NotifyDoubleClick))
6077                                  {                                  {
6078                                          OnDoubleClick(EventArgs.Empty);                                          OnDoubleClick(EventArgs.Empty);
6079                                          notifyDoubleClick = false;                                          SetControlFlag(ControlFlags.NotifyDoubleClick, false);
6080                                  }                                  }
6081                                  else if (notifyClick)                                  else if(GetControlFlag(ControlFlags.NotifyClick))
6082                                  {                                  {
6083                                          OnClick(EventArgs.Empty);                                          OnClick(EventArgs.Empty);
6084                                          notifyClick = false;                                          SetControlFlag(ControlFlags.NotifyClick, false);
6085                                  }                                  }
6086                                  OnMouseUp(new MouseEventArgs                                  OnMouseUp(new MouseEventArgs
6087                                          ((MouseButtons)buttons, clicks, x, y, delta));                                          ((MouseButtons)buttons, clicks, x, y, delta));
6088                                  // See if we need to display the context menu.                                  // See if we need to display the context menu.
6089                                  if (mouseButtons == MouseButtons.Right && contextMenu != null)                                  if(mouseButtons == MouseButtons.Right && contextMenu != null)
6090                                  {                                  {
6091                                          contextMenu.Show(this, new Point(x, y));                                          contextMenu.Show(this, new Point(x, y));
6092                                  }                                  }
# Line 6224  public class Control : IWin32Window, IDi Line 6287  public class Control : IWin32Window, IDi
6287    
6288          internal virtual void DoValidationCancel(bool cancelled)          internal virtual void DoValidationCancel(bool cancelled)
6289          {          {
6290                          this.validationCancelled = cancelled;                          SetControlFlag(ControlFlags.ValidationCancelled, cancelled);
6291          }          }
6292    
6293    

Legend:
Removed from v.1.82  
changed lines
  Added in v.1.83

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26