[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms BoundsSpecified
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms BoundsSpecified.cs,1.1,1.2 Control.cs,1.1,1.2 Form.cs,1.1,1.2 |
Date: |
Wed, 11 Jun 2003 06:37:30 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms
In directory subversions:/tmp/cvs-serv21569/System.Windows.Forms
Modified Files:
BoundsSpecified.cs Control.cs Form.cs
Log Message:
Process user-initiated move and resize events from the window manager;
implement "SetBoundsCore" and window invalidation.
Index: BoundsSpecified.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/BoundsSpecified.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** BoundsSpecified.cs 11 Jun 2003 07:07:19 -0000 1.1
--- BoundsSpecified.cs 11 Jun 2003 10:37:27 -0000 1.2
***************
*** 23,28 ****
{
- #if !CONFIG_COMPACT_FORMS
-
[Flags]
public enum BoundsSpecified
--- 23,26 ----
***************
*** 38,43 ****
}; // enum BoundsSpecified
-
- #endif // !CONFIG_COMPACT_FORMS
}; // namespace System.Windows.Forms
--- 36,39 ----
Index: Control.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Control.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Control.cs 11 Jun 2003 07:07:19 -0000 1.1
--- Control.cs 11 Jun 2003 10:37:27 -0000 1.2
***************
*** 344,348 ****
}
}
- [TODO]
public Rectangle Bounds
{
--- 344,347 ----
***************
*** 353,365 ****
set
{
! // TODO
! top = value.X;
! left = value.Y;
! width = value.Width;
! height = value.Height;
! if(toolkitWindow != null)
! {
! toolkitWindow.MoveResize(top,
left, width, height);
! }
}
}
--- 352,357 ----
set
{
! SetBoundsCore(top, left, width, height,
!
BoundsSpecified.All);
}
}
***************
*** 420,423 ****
--- 412,416 ----
get
{
+ CreateControl();
int leftAdjust = 0;
int topAdjust = 0;
***************
*** 435,452 ****
set
{
! int leftAdjust = 0;
! int topAdjust = 0;
! int rightAdjust = 0;
! int bottomAdjust = 0;
! if(toolkitWindow != null)
! {
!
toolkitWindow.GetClientAreaAdjust
! (ref leftAdjust, ref
topAdjust,
! ref rightAdjust, ref
bottomAdjust);
! }
! Bounds = new Rectangle
! (left, top,
! value.Width + leftAdjust +
rightAdjust,
! value.Height + topAdjust +
bottomAdjust);
}
}
--- 428,432 ----
set
{
! SetClientSizeCore(value.Width,
value.Height);
}
}
***************
*** 712,716 ****
{
font = value;
- InvalidateAll();
OnFontChanged(EventArgs.Empty);
}
--- 692,695 ----
***************
*** 772,776 ****
set
{
! Bounds = new Rectangle(left, top,
width, value);
}
}
--- 751,756 ----
set
{
! SetBoundsCore(left, top, width, value,
!
BoundsSpecified.Height);
}
}
***************
*** 825,829 ****
set
{
! Bounds = new Rectangle(value, top,
width, height);
}
}
--- 805,810 ----
set
{
! SetBoundsCore(value, top, width, height,
!
BoundsSpecified.X);
}
}
***************
*** 836,840 ****
set
{
! Bounds = new Rectangle(value.X,
value.Y, width, height);
}
}
--- 817,822 ----
set
{
! SetBoundsCore(value.X, value.Y, width,
height,
!
BoundsSpecified.Location);
}
}
***************
*** 966,980 ****
}
}
- [TODO]
protected bool ResizeRedraw
{
get
{
! // TODO
! return false;
}
set
{
! // TODO
}
}
--- 948,960 ----
}
}
protected bool ResizeRedraw
{
get
{
! return
GetStyle(ControlStyles.ResizeRedraw);
}
set
{
! SetStyle(ControlStyles.ResizeRedraw,
value);
}
}
***************
*** 1012,1031 ****
}
}
- [TODO]
protected virtual bool ShowFocusCues
{
get
{
! // TODO
! return true;
}
}
- [TODO]
protected virtual bool ShowKeyboardCues
{
get
{
! // TODO
! return true;
}
}
--- 992,1021 ----
}
}
protected virtual bool ShowFocusCues
{
get
{
! if(parent != null)
! {
! return parent.ShowFocusCues;
! }
! else
! {
! return true;
! }
}
}
protected virtual bool ShowKeyboardCues
{
get
{
! if(parent != null)
! {
! return parent.ShowKeyboardCues;
! }
! else
! {
! return true;
! }
}
}
***************
*** 1051,1056 ****
set
{
! Bounds = new Rectangle
! (left, top, value.Width,
value.Height);
}
}
--- 1041,1046 ----
set
{
! SetBoundsCore(left, top, value.Width,
value.Height,
!
BoundsSpecified.Size);
}
}
***************
*** 1119,1123 ****
set
{
! Bounds = new Rectangle(left, value,
width, height);
}
}
--- 1109,1114 ----
set
{
! SetBoundsCore(left, value, width,
height,
!
BoundsSpecified.Y);
}
}
***************
*** 1166,1170 ****
set
{
! Bounds = new Rectangle(left, top,
value, height);
}
}
--- 1157,1162 ----
set
{
! SetBoundsCore(left, top, value, height,
!
BoundsSpecified.Width);
}
}
***************
*** 1539,1560 ****
// Invalidate a region of the control and queue up a repaint request.
- [TODO]
public void Invalidate()
{
! // TODO
}
[TODO]
public void Invalidate(bool invalidateChildren)
{
// TODO
}
- [TODO]
public void Invalidate(Rectangle rc)
{
! // TODO
}
[TODO]
public void Invalidate(Rectangle rc, bool invalidateChildren)
{
// TODO
}
--- 1531,1558 ----
// Invalidate a region of the control and queue up a repaint request.
public void Invalidate()
{
! if(toolkitWindow != null && Visible)
! {
! toolkitWindow.Invalidate();
! }
}
[TODO]
public void Invalidate(bool invalidateChildren)
{
+ Invalidate();
// TODO
}
public void Invalidate(Rectangle rc)
{
! if(toolkitWindow != null && Visible)
! {
! toolkitWindow.Invalidate(rc.X, rc.Y,
rc.Width, rc.Height);
! }
}
[TODO]
public void Invalidate(Rectangle rc, bool invalidateChildren)
{
+ Invalidate(rc);
// TODO
}
***************
*** 1570,1580 ****
}
- // Invalidate this control and all of its children.
- [TODO]
- private void InvalidateAll()
- {
- // TODO
- }
-
// Invoke a delegate on the thread that owns the low-level control.
[TODO]
--- 1568,1571 ----
***************
*** 1969,2034 ****
}
- #if !CONFIG_COMPACT_FORMS
-
// Set the bounds of the control.
public void SetBounds(int x, int y, int width, int height)
{
! Bounds = new Rectangle(x, y, width, height);
}
public void SetBounds(int x, int y, int width, int height,
BoundsSpecified specified)
{
! if((specified & BoundsSpecified.All) ==
! BoundsSpecified.All)
{
! Bounds = new Rectangle(x, y, width,
height);
}
! else if((specified & BoundsSpecified.All) ==
!
BoundsSpecified.Location)
{
! Location = new Point(x, y);
}
! else if((specified & BoundsSpecified.All) ==
! BoundsSpecified.Size)
{
! Size = new Size(width, height);
}
! else
{
! if((specified & BoundsSpecified.X) != 0)
! {
! Left = x;
! }
! if((specified & BoundsSpecified.Y) != 0)
! {
! Top = y;
! }
! if((specified & BoundsSpecified.Width)
!= 0)
! {
! Width = width;
! }
! if((specified & BoundsSpecified.Height)
!= 0)
{
! Height = height;
}
}
- }
! // Inner core of "SetBounds".
! [TODO]
! protected virtual void SetBoundsCore
! (int x, int y, int width, int height,
! BoundsSpecified specified)
! {
! // TODO
! }
! #endif
// Inner core of setting the client size.
- [TODO]
protected virtual void SetClientSizeCore(int x, int y)
{
! // TODO
}
--- 1960,2033 ----
}
// Set the bounds of the control.
public void SetBounds(int x, int y, int width, int height)
{
! SetBoundsCore(x, y, width, height,
BoundsSpecified.All);
}
public void SetBounds(int x, int y, int width, int height,
BoundsSpecified specified)
{
! SetBoundsCore(x, y, width, height, specified);
! }
!
! // Inner core of "SetBounds".
! [TODO]
! protected virtual void SetBoundsCore
! (int x, int y, int width, int height,
! BoundsSpecified specified)
! {
! // Set unspecified components to the right
values.
! if((specified & BoundsSpecified.X) == 0)
{
! x = this.left;
}
! if((specified & BoundsSpecified.Y) == 0)
{
! y = this.top;
}
! if((specified & BoundsSpecified.Width) == 0)
{
! width = this.width;
}
! if((specified & BoundsSpecified.Height) == 0)
{
! height = this.height;
! }
!
! // Move and resize the toolkit version of the
control.
! if(toolkitWindow != null)
! {
! if(x != this.left || y != this.top ||
! width != this.width || height !=
this.height)
{
! toolkitWindow.MoveResize(x, y,
width, height);
}
}
! // Update the bounds and emit the necessary
events.
! UpdateBounds(x, y, width, height);
! // TODO: layout the child controls, apply
docking rules, etc
! }
// Inner core of setting the client size.
protected virtual void SetClientSizeCore(int x, int y)
{
! CreateControl();
! int leftAdjust = 0;
! int topAdjust = 0;
! int rightAdjust = 0;
! int bottomAdjust = 0;
! if(toolkitWindow != null)
! {
! toolkitWindow.GetClientAreaAdjust
! (ref leftAdjust, ref topAdjust,
! ref rightAdjust, ref
bottomAdjust);
! }
! SetBoundsCore
! (left, top,
! x + leftAdjust + rightAdjust,
! y + topAdjust + bottomAdjust,
! BoundsSpecified.Size);
}
***************
*** 2084,2102 ****
// Update the bounds of the control.
- [TODO]
protected void UpdateBounds()
{
! // TODO
}
- [TODO]
protected void UpdateBounds(int x, int y, int width, int height)
{
! // TODO
}
- [TODO]
protected void UpdateBounds(int x, int y, int width, int height,
int
clientWidth, int clientHeight)
{
! // TODO
}
--- 2083,2115 ----
// Update the bounds of the control.
protected void UpdateBounds()
{
! UpdateBounds(left, top, width, height);
}
protected void UpdateBounds(int x, int y, int width, int height)
{
! bool moved;
! bool resized;
! moved = (x != this.left || y != this.top);
! resized = (width != this.width || height !=
this.height);
! this.left = x;
! this.top = y;
! this.width = width;
! this.height = height;
! if(moved)
! {
! OnMove(EventArgs.Empty);
! }
! if(resized)
! {
! OnResize(EventArgs.Empty);
! }
}
protected void UpdateBounds(int x, int y, int width, int height,
int
clientWidth, int clientHeight)
{
! // Ignore the client size information: we
assume that
! // the client area remains fixed relative to
the bounds.
! UpdateBounds(x, y, width, height);
}
***************
*** 2118,2140 ****
// Default window procedure for this control class.
- [TODO]
protected virtual void DefWndProc(ref Message msg)
{
! // TODO
}
// Pre-process a message before it is dispatched by the event loop.
- [TODO]
public virtual bool PreProcessMessage(ref Message msg)
{
! // TODO
return false;
}
// Process a message.
- [TODO]
public virtual void WndProc(ref Message m)
{
! // TODO
}
--- 2131,2150 ----
// Default window procedure for this control class.
protected virtual void DefWndProc(ref Message msg)
{
! // Window procedures are not used in this
implementation.
}
// Pre-process a message before it is dispatched by the event loop.
public virtual bool PreProcessMessage(ref Message msg)
{
! // Window procedures are not used in this
implementation.
return false;
}
// Process a message.
public virtual void WndProc(ref Message m)
{
! // Window procedures are not used in this
implementation.
}
***************
*** 3437,3440 ****
--- 3447,3457 ----
protected virtual void OnResize(EventArgs e)
{
+ // Force a repaint if "ResizeRedraw" is set.
+ if(GetStyle(ControlStyles.ResizeRedraw))
+ {
+ Invalidate();
+ }
+
+ // Invoke the event handler.
EventHandler handler;
handler =
(EventHandler)(GetHandler(EventId.Resize));
***************
*** 3965,4034 ****
}; // class ControlCollectionEnumerator
- // Toolkit expose event, which calls "OnPaint".
- private void ToolkitExpose(Graphics graphics)
- {
- }
-
- // Toolkit key down event, which calls "OnKeyDown".
- private void ToolkitKeyDown(ToolkitKeys keyData)
- {
- }
-
- // Toolkit key up event, which calls "OnKeyUp".
- private void ToolkitKeyUp(ToolkitKeys keyData)
- {
- OnKeyUp(new KeyEventArgs((Keys)keyData));
- }
-
- // Toolkit key character event, which calls "OnKeyPress".
- private void ToolkitKeyChar(char charCode)
- {
- }
-
- // Toolkit mouse down event.
- private void ToolkitMouseDown
- (ToolkitMouseButtons buttons, ToolkitKeys
modifiers,
- int clicks, int x, int y, int delta)
- {
- OnMouseDown(new MouseEventArgs
- ((MouseButtons)buttons, clicks, x, y,
delta));
- }
-
- // Toolkit mouse up event.
- private void ToolkitMouseUp
- (ToolkitMouseButtons buttons, ToolkitKeys
modifiers,
- int clicks, int x, int y, int delta)
- {
- OnMouseUp(new MouseEventArgs
- ((MouseButtons)buttons, clicks, x, y,
delta));
- }
-
- // Toolkit mouse move event.
- private void ToolkitMouseMove
- (ToolkitMouseButtons buttons, ToolkitKeys
modifiers,
- int clicks, int x, int y, int delta)
- {
- OnMouseMove(new MouseEventArgs
- ((MouseButtons)buttons, clicks, x, y,
delta));
- }
-
- // Toolkit mouse hover event.
- private void ToolkitMouseHover
- (ToolkitMouseButtons buttons, ToolkitKeys
modifiers,
- int clicks, int x, int y, int delta)
- {
- OnMouseHover(new MouseEventArgs
- ((MouseButtons)buttons, clicks, x, y,
delta));
- }
-
- // Toolkit mouse wheel event.
- private void ToolkitMouseWheel
- (ToolkitMouseButtons buttons, ToolkitKeys
modifiers,
- int clicks, int x, int y, int delta)
- {
- OnMouseWheel(new MouseEventArgs
- ((MouseButtons)buttons, clicks, x, y,
delta));
- }
-
// Toolkit event that is emitted for an expose on this window.
void IToolkitEventSink.ToolkitExpose(Graphics graphics)
--- 3982,3985 ----
***************
*** 4125,4128 ****
--- 4076,4099 ----
OnMouseWheel(new MouseEventArgs
((MouseButtons)buttons, clicks, x, y,
delta));
+ }
+
+ // Toolkit event that is emitted when the window is moved by
+ // external means (e.g. the user dragging the window).
+ void IToolkitEventSink.ToolkitExternalMove(int x, int y)
+ {
+ if(x != left || y != top)
+ {
+ Location = new Point(x, y);
+ }
+ }
+
+ // Toolkit event that is emitted when the window is resized by
+ // external means (e.g. the user resizing the window).
+ void IToolkitEventSink.ToolkitExternalResize(int width, int height)
+ {
+ if(width != this.width || height != this.height)
+ {
+ Size = new Size(width, height);
+ }
}
Index: Form.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Form.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Form.cs 11 Jun 2003 07:07:19 -0000 1.1
--- Form.cs 11 Jun 2003 10:37:28 -0000 1.2
***************
*** 54,57 ****
--- 54,66 ----
}
+ // Determine if this is a top-level control which cannot have parents.
+ internal override bool IsTopLevel
+ {
+ get
+ {
+ return true;
+ }
+ }
+
}; // class Form
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms BoundsSpecified.cs,1.1,1.2 Control.cs,1.1,1.2 Form.cs,1.1,1.2,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/samples FormsHello.cs,NONE,1.1 dummy.cs,NONE,1.1 XHello.cs,1.4,1.5 ilrun.sh.in,1.3,1.4 samples.build,1.5,1.6
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp InputOutputWidget.cs,1.2,1.3
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/samples FormsHello.cs,NONE,1.1 dummy.cs,NONE,1.1 XHello.cs,1.4,1.5 ilrun.sh.in,1.3,1.4 samples.build,1.5,1.6
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp InputOutputWidget.cs,1.2,1.3
- Index(es):