[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows EventHandlers.cs,1.4,1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows EventHandlers.cs,1.4,1.5 InputOnlyWidget.cs,1.6,1.7 TopLevelWindow.cs,1.3,1.4 Widget.cs,1.3,1.4 |
Date: |
Sat, 28 Sep 2002 23:27:01 -0400 |
Update of /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows
In directory subversions:/tmp/cvs-serv17109/Xsharp/XWindows
Modified Files:
EventHandlers.cs InputOnlyWidget.cs TopLevelWindow.cs
Widget.cs
Log Message:
Implement keyboard input, focus management, and widget sensitivity.
Index: EventHandlers.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/EventHandlers.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** EventHandlers.cs 28 Sep 2002 04:47:49 -0000 1.4
--- EventHandlers.cs 29 Sep 2002 03:26:59 -0000 1.5
***************
*** 225,255 ****
/// </param>
///
/// <remarks>The <paramref name="key"/> parameter indicates the X11
! /// symbol that corresponds to the key, which allows cursor constrol
/// and function keys to be easily distinguished. The <paramref name="str"/>
/// is primarily of use to text input widgets.</remarks>
! public delegate void KeyPressEventHandler(Widget widget, KeyName key,
ModifierMask modifiers, String str);
/// <summary>
- /// <para>The <see cref="T:XWindows.KeyReleaseEventHandler"/> delegate is
- /// used to process key release events.</para>
- /// </summary>
- ///
- /// <param name="widget">
- /// <para>The widget that received the event.</para>
- /// </param>
- ///
- /// <param name="key">
- /// <para>The key code.</para>
- /// </param>
- ///
- /// <param name="modifiers">
- /// <para>Other button and shift flags that were active.</para>
- /// </param>
- public delegate void KeyReleaseEventHandler(Widget widget, KeyName key,
-
ModifierMask modifiers);
-
- /// <summary>
/// <para>The <see cref="T:XWindows.CrossingEventHandler"/> delegate is
/// used to process Enter and Leave events on a widget.</para>
--- 225,243 ----
/// </param>
///
+ /// <returns>
+ /// <para>Returns <see langword="true"/> if the key has been processed
+ /// and it should not be passed further up the focus tree. Returns
+ /// <see langword="false"/> if the key should be passed further up
+ /// the focus tree.</para>
+ /// </returns>
+ ///
/// <remarks>The <paramref name="key"/> parameter indicates the X11
! /// symbol that corresponds to the key, which allows cursor control
/// and function keys to be easily distinguished. The <paramref name="str"/>
/// is primarily of use to text input widgets.</remarks>
! public delegate bool KeyPressEventHandler(Widget widget, KeyName key,
ModifierMask modifiers, String str);
/// <summary>
/// <para>The <see cref="T:XWindows.CrossingEventHandler"/> delegate is
/// used to process Enter and Leave events on a widget.</para>
***************
*** 289,292 ****
--- 277,312 ----
CrossingMode mode,
CrossingDetail detail);
+
+ /// <summary>
+ /// <para>The <see cref="T:XWindows.FocusChangeEventHandler"/> delegate is
+ /// used to process focus change events.</para>
+ /// </summary>
+ ///
+ /// <param name="widget">
+ /// <para>The widget that received the event.</para>
+ /// </param>
+ ///
+ /// <param name="other">
+ /// <para>If this is a focus in event, <paramref name="other"/> is the
+ /// previous widget within the same top-level window that had
+ /// the focus, or <see langword="null"/> if the focus is entering the
+ /// top-level window from outside.</para>
+ ///
+ /// <para>If this is a focus out event, <paramref name="other"/> is the
+ /// new widget within the same top-level window that will receive
+ /// the focus, or <see langword="null"/> if the focus is leaving the
+ /// top-level window.</para>
+ /// </param>
+ public delegate void FocusChangeEventHandler(Widget widget, Widget other);
+
+ /// <summary>
+ /// <para>The <see cref="T:XWindows.SensitivityChangedEventHandler"/>
+ /// delegate is used to process changes in input event sensitivity.</para>
+ /// </summary>
+ ///
+ /// <param name="widget">
+ /// <para>The widget whose sensitivity has changed.</para>
+ /// </param>
+ public delegate void SensitivityChangedEventHandler(Widget widget);
} // namespace XWindows
Index: InputOnlyWidget.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/InputOnlyWidget.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** InputOnlyWidget.cs 28 Sep 2002 04:47:49 -0000 1.6
--- InputOnlyWidget.cs 29 Sep 2002 03:26:59 -0000 1.7
***************
*** 37,40 ****
--- 37,41 ----
// Internal state.
private InputEventHandlers handlers;
+ private bool focusable;
/// <summary>
***************
*** 105,108 ****
--- 106,110 ----
this.width = width;
this.height = height;
+ this.focusable = true;
// Lock down the display and create the
window handle.
***************
*** 172,175 ****
--- 174,178 ----
this.width = width;
this.height = height;
+ this.focusable = true;
// Lock down the display and create the
window handle.
***************
*** 253,256 ****
--- 256,310 ----
}
+ /// <summary>
+ /// <para>Get or set the focusable state for this widget.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>Set to <see langword="true"/> if this widget can receive
+ /// the focus during TAB navigation. The default value is
+ /// <see langword="true"/>.</para>
+ /// </value>
+ ///
+ /// <remarks>
+ /// <para>This property is used during TAB navigation to determine
+ /// where to send the focus next. Widgets that are not focusable
+ /// will be ignored during TAB navigation.</para>
+ /// </remarks>
+ public bool Focusable
+ {
+ get
+ {
+ return focusable;
+ }
+ set
+ {
+ focusable = value;
+ }
+ }
+
+ /// <summary>
+ /// <para>Determine if this widget currently has the keyboard
focus.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>Returns <see langword="true"/> if this widget currently
+ /// has the keyboard focus.</para>
+ /// </value>
+ public bool Focused
+ {
+ get
+ {
+ TopLevelWindow topLevel = TopLevel;
+ if(topLevel != null)
+ {
+ return topLevel.HasFocus(this);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
// Get the input handler list.
private InputEventHandlers GetHandlers()
***************
*** 577,584 ****
/// <summary>
! /// <para>Event that is raised if a key is released when this
! /// widget has the focus.</para>
/// </summary>
! public event KeyReleaseEventHandler KeyRelease
{
add
--- 631,638 ----
/// <summary>
! /// <para>Event that is raised when the mouse pointer enters
! /// this widget.</para>
/// </summary>
! public event CrossingEventHandler Enter
{
add
***************
*** 587,591 ****
{
InputEventHandlers handlers =
GetHandlers();
! handlers.keyRelease += value;
}
}
--- 641,646 ----
{
InputEventHandlers handlers =
GetHandlers();
!
SelectInput(EventMask.EnterWindowMask);
! handlers.enter += value;
}
}
***************
*** 596,600 ****
if(handlers != null)
{
! handlers.keyRelease -=
value;
}
}
--- 651,659 ----
if(handlers != null)
{
! handlers.enter -= value;
! if(handlers.enter ==
null)
! {
!
DeselectInput(EventMask.EnterWindowMask);
! }
}
}
***************
*** 603,610 ****
/// <summary>
! /// <para>Event that is raised when the mouse pointer enters
/// this widget.</para>
/// </summary>
! public event CrossingEventHandler Enter
{
add
--- 662,669 ----
/// <summary>
! /// <para>Event that is raised when the mouse pointer leaves
/// this widget.</para>
/// </summary>
! public event CrossingEventHandler Leave
{
add
***************
*** 613,618 ****
{
InputEventHandlers handlers =
GetHandlers();
!
SelectInput(EventMask.EnterWindowMask);
! handlers.enter += value;
}
}
--- 672,677 ----
{
InputEventHandlers handlers =
GetHandlers();
!
SelectInput(EventMask.LeaveWindowMask);
! handlers.leave += value;
}
}
***************
*** 623,630 ****
if(handlers != null)
{
! handlers.enter -= value;
! if(handlers.enter ==
null)
{
!
DeselectInput(EventMask.EnterWindowMask);
}
}
--- 682,689 ----
if(handlers != null)
{
! handlers.leave -= value;
! if(handlers.leave ==
null)
{
!
DeselectInput(EventMask.LeaveWindowMask);
}
}
***************
*** 634,641 ****
/// <summary>
! /// <para>Event that is raised when the mouse pointer leaves
/// this widget.</para>
/// </summary>
! public event CrossingEventHandler Leave
{
add
--- 693,700 ----
/// <summary>
! /// <para>Event that is raised when the keyboard focus enters
/// this widget.</para>
/// </summary>
! public event FocusChangeEventHandler FocusIn
{
add
***************
*** 644,649 ****
{
InputEventHandlers handlers =
GetHandlers();
!
SelectInput(EventMask.LeaveWindowMask);
! handlers.leave += value;
}
}
--- 703,707 ----
{
InputEventHandlers handlers =
GetHandlers();
! handlers.focusIn += value;
}
}
***************
*** 654,662 ****
if(handlers != null)
{
! handlers.leave -= value;
! if(handlers.leave ==
null)
! {
!
DeselectInput(EventMask.LeaveWindowMask);
! }
}
}
--- 712,742 ----
if(handlers != null)
{
! handlers.focusIn -=
value;
! }
! }
! }
! }
!
! /// <summary>
! /// <para>Event that is raised when the keyboard focus leaves
! /// this widget.</para>
! /// </summary>
! public event FocusChangeEventHandler FocusOut
! {
! add
! {
! lock(this)
! {
! InputEventHandlers handlers =
GetHandlers();
! handlers.focusOut += value;
! }
! }
! remove
! {
! lock(this)
! {
! if(handlers != null)
! {
! handlers.focusOut -=
value;
}
}
***************
*** 664,667 ****
--- 744,772 ----
}
+ /// <summary>
+ /// <para>Request that the keyboard focus be assigned to this widget.
+ /// </para>
+ /// </summary>
+ ///
+ /// <remarks>
+ /// <para>If the top-level window has the primary focus, then this
widget
+ /// will receive a <c>FocusIn</c> event immediately. Otherwise,
+ /// this widget will receive a <c>FocusIn</c> event the next time
+ /// the top-level window obtains the primary focus.</para>
+ ///
+ /// <para>If the top-level window does not currently have the primary
+ /// focus, and its <c>DefaultFocus</c> is set to something other than
+ /// this widget, then this widget may never receive the focus as a
result
+ /// of calling this method.</para>
+ /// </remarks>
+ public void RequestFocus()
+ {
+ TopLevelWindow topLevel = TopLevel;
+ if(topLevel != null)
+ {
+ topLevel.SetFocus(this);
+ }
+ }
+
// Dispatch an event to this widget.
internal override void DispatchEvent(ref XEvent xevent)
***************
*** 676,679 ****
--- 781,826 ----
}
+ // Dispatch a key event to this widget from the top-level window.
+ internal bool DispatchKeyEvent(KeyName key, ModifierMask modifiers,
+ String str)
+ {
+ lock(this)
+ {
+ if(FullSensitive && handlers != null &&
+ handlers.keyPress != null)
+ {
+ if(handlers.keyPress(this, key,
modifiers, str))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ // Dispatch a focus in event to this widget from the top-level window.
+ internal void DispatchFocusIn(Widget oldWidget)
+ {
+ lock(this)
+ {
+ if(handlers != null && handlers.focusIn
!= null)
+ {
+ handlers.focusIn(this,
oldWidget);
+ }
+ }
+ }
+
+ // Dispatch a focus out event to this widget from the top-level window.
+ internal void DispatchFocusOut(Widget oldWidget)
+ {
+ lock(this)
+ {
+ if(handlers != null &&
handlers.focusOut != null)
+ {
+ handlers.focusOut(this,
oldWidget);
+ }
+ }
+ }
+
// Input event handling class. This is created only if the
// user selects for input events, to avoid wasting memory if
***************
*** 694,709 ****
public ButtonName lastClickButton;
public KeyPressEventHandler keyPress;
- public KeyReleaseEventHandler keyRelease;
- public IntPtr keyBuffer;
public CrossingEventHandler enter;
public CrossingEventHandler leave;
!
! ~InputEventHandlers()
! {
! if(keyBuffer != IntPtr.Zero)
! {
! Marshal.FreeHGlobal(keyBuffer);
! }
! }
// Dispatch an event to the widget that owns this handler list.
--- 841,848 ----
public ButtonName lastClickButton;
public KeyPressEventHandler keyPress;
public CrossingEventHandler enter;
public CrossingEventHandler leave;
! public FocusChangeEventHandler focusIn;
! public FocusChangeEventHandler focusOut;
// Dispatch an event to the widget that owns this handler list.
***************
*** 816,861 ****
xevent.xmotion.y,
xevent.xmotion.state);
- }
- }
- break;
-
- case EventType.KeyPress:
- {
- // Dispatch a key press
event.
- if(keyPress != null)
- {
- if(keyBuffer ==
IntPtr.Zero)
- {
-
keyBuffer = Marshal.AllocHGlobal(32);
- }
- Xlib.KeySym
keysym = 0;
- int len =
Xlib.XLookupString
- (ref
xevent.xkey, keyBuffer, 32,
- ref
keysym, IntPtr.Zero);
- if(len > 0)
- {
-
keyPress(widget, (KeyName)keysym,
-
xevent.xkey.state,
-
Marshal.PtrToStringAnsi
-
(keyBuffer, len));
- }
- else
- {
-
keyPress(widget, (KeyName)keysym,
-
xevent.xkey.state, null);
- }
- }
- }
- break;
-
- case EventType.KeyRelease:
- {
- // Dispatch a key
release event.
- if(keyRelease != null)
- {
-
keyRelease(widget, (KeyName)
-
Xlib.XLookupKeysym
-
(ref xevent.xkey, 0),
-
xevent.xkey.state);
}
}
--- 955,958 ----
Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/TopLevelWindow.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** TopLevelWindow.cs 28 Sep 2002 04:47:49 -0000 1.3
--- TopLevelWindow.cs 29 Sep 2002 03:26:59 -0000 1.4
***************
*** 24,27 ****
--- 24,28 ----
using System;
+ using System.Runtime.InteropServices;
using XWindows.Types;
using XWindows.Events;
***************
*** 36,39 ****
--- 37,44 ----
private String name;
private bool iconic;
+ private bool hasPrimaryFocus;
+ private IntPtr keyBuffer;
+ private InputOnlyWidget focusWidget;
+ private InputOnlyWidget defaultFocus;
/// <summary>
***************
*** 107,110 ****
--- 112,119 ----
this.name = ((name != null) ? name :
String.Empty);
this.iconic = false;
+ this.hasPrimaryFocus = false;
+ this.keyBuffer = IntPtr.Zero;
+ this.focusWidget = this;
+ this.defaultFocus = null;
// Set the initial WM properties.
***************
*** 124,127 ****
--- 133,140 ----
protocols[1] = dpy.wmTakeFocus;
Xlib.XSetWMProtocols(display, handle,
protocols, 2);
+
+ // Top-level widgets receive all key
and focus events.
+ SelectInput(EventMask.KeyPressMask |
+
EventMask.FocusChangeMask);
}
finally
***************
*** 131,134 ****
--- 144,160 ----
}
+ /// <summary>
+ /// <para>Destroy an instance of <see
cref="T:XWindows.TopLevelWindow"/>.
+ /// </para>
+ /// </summary>
+ ~TopLevelWindow()
+ {
+ if(keyBuffer != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(keyBuffer);
+ keyBuffer = IntPtr.Zero;
+ }
+ }
+
// Helper method to get the root window of a specified screen.
private static Widget GetRoot(Screen screen)
***************
*** 364,367 ****
--- 390,431 ----
/// <summary>
+ /// <para>Get or set the child widget that gets the keyboard focus
+ /// by default when the top-level window receives the focus.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The widget that receives the focus, or <see langword="null"/>
+ /// if there is no default focus.</para>
+ /// </value>
+ ///
+ /// <exception cref="T.XWindows.XInvalidOperationException">
+ /// <para>Raised if the widget is not a child of this top-level window.
+ /// </para>
+ /// </exception>
+ public Widget DefaultFocus
+ {
+ get
+ {
+ return defaultFocus;
+ }
+ set
+ {
+ if(value == null)
+ {
+ defaultFocus = null;
+ }
+ else
+ {
+ if(!(value is InputOnlyWidget)
||
+ value.TopLevel != this)
+ {
+ throw new
XInvalidOperationException
+
(S._("X_InvalidFocusChild"));
+ }
+ }
+ }
+ }
+
+ /// <summary>
/// <para>Event that is raised when the window's iconic state
/// changes.</para>
***************
*** 395,398 ****
--- 459,505 ----
public event ClosedEventHandler Closed;
+ // Detect that this top-level window has gained the primary focus.
+ private void PrimaryFocusIn()
+ {
+ if(!hasPrimaryFocus)
+ {
+ hasPrimaryFocus = true;
+ if(defaultFocus != null)
+ {
+ focusWidget = defaultFocus;
+
focusWidget.DispatchFocusIn(null);
+ }
+ else if(focusWidget != null)
+ {
+
focusWidget.DispatchFocusIn(null);
+ }
+ }
+ }
+
+ // Set the focus widget to a specific child.
+ internal void SetFocus(InputOnlyWidget widget)
+ {
+ if(!hasPrimaryFocus)
+ {
+ focusWidget = widget;
+ }
+ else if(focusWidget != widget)
+ {
+ InputOnlyWidget oldFocus = focusWidget;
+ focusWidget = widget;
+ oldFocus.DispatchFocusOut(widget);
+ if(focusWidget == widget)
+ {
+
widget.DispatchFocusIn(oldFocus);
+ }
+ }
+ }
+
+ // Determine if a specific child currently has the focus.
+ internal bool HasFocus(InputOnlyWidget widget)
+ {
+ return (hasPrimaryFocus && focusWidget ==
widget);
+ }
+
// Dispatch an event to this widget.
internal override void DispatchEvent(ref XEvent xevent)
***************
*** 402,405 ****
--- 509,513 ----
case EventType.ClientMessage:
{
+ // Handle messages from the
window manager.
if(xevent.xclient.message_type
== dpy.wmProtocols)
{
***************
*** 412,417 ****
if(xevent.xclient.l(0)
== (int)(dpy.wmTakeFocus))
{
! // We have
received the input focus.
}
}
}
--- 520,591 ----
if(xevent.xclient.l(0)
== (int)(dpy.wmTakeFocus))
{
! // We were
given the primary input focus.
!
PrimaryFocusIn();
! }
! }
! }
! break;
!
! case EventType.FocusIn:
! {
! // This window has received the
focus.
! PrimaryFocusIn();
! }
! break;
!
! case EventType.FocusOut:
! {
! // This window has lost the
focus.
! if(hasPrimaryFocus)
! {
! hasPrimaryFocus = false;
! if(focusWidget != null)
! {
!
focusWidget.DispatchFocusOut(null);
! }
! }
! }
! break;
!
! case EventType.KeyPress:
! {
! // Convert the event into a
symbol and a string.
! if(keyBuffer == IntPtr.Zero)
! {
! keyBuffer =
Marshal.AllocHGlobal(32);
! }
! Xlib.KeySym keysym = 0;
! int len = Xlib.XLookupString
! (ref xevent.xkey,
keyBuffer, 32,
! ref keysym,
IntPtr.Zero);
! String str;
! if(len > 0)
! {
! str =
Marshal.PtrToStringAnsi(keyBuffer, len);
! }
! else
! {
! str = null;
! }
!
! // Dispatch the event.
! Widget widget = focusWidget;
! InputOnlyWidget io;
! while(widget != null)
! {
! io = (widget as
InputOnlyWidget);
! if(io != null)
! {
!
if(io.DispatchKeyEvent
!
((KeyName)keysym, xevent.xkey.state, str))
! {
! break;
! }
! }
! if(widget == this)
! {
! break;
}
+ widget = widget.Parent;
}
}
Index: Widget.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Widget.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Widget.cs 28 Sep 2002 03:01:00 -0000 1.3
--- Widget.cs 29 Sep 2002 03:26:59 -0000 1.4
***************
*** 41,48 ****
// Internal state.
internal int x, y;
- internal bool mapped;
internal int layer;
! private CursorType cursor;
private bool autoMapChildren;
private Widget parent;
private Widget topChild;
--- 41,50 ----
// Internal state.
internal int x, y;
internal int layer;
! internal bool mapped;
private bool autoMapChildren;
+ private bool sensitive;
+ private bool ancestorSensitive;
+ private CursorType cursor;
private Widget parent;
private Widget topChild;
***************
*** 59,62 ****
--- 61,65 ----
cursor = CursorType.XC_inherit_parent;
autoMapChildren = true;
+ sensitive = true;
// Insert this widget into the widget tree
under its parent.
***************
*** 66,69 ****
--- 69,74 ----
if(parent != null)
{
+ ancestorSensitive =
+ (parent.sensitive &&
parent.ancestorSensitive);
nextBelow = parent.topChild;
if(parent.topChild != null)
***************
*** 75,78 ****
--- 80,84 ----
else
{
+ ancestorSensitive = true;
nextBelow = null;
}
***************
*** 337,340 ****
--- 343,406 ----
/// <summary>
+ /// <para>Get or set the flag that indicates if this widget
+ /// is sensitive to input events.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The value is <see langword="true"/> if the widget is
sensitive;
+ /// <see langword="false"/> otherwise.</para>
+ /// </value>
+ public bool Sensitive
+ {
+ get
+ {
+ return sensitive;
+ }
+ set
+ {
+ if(value != sensitive)
+ {
+ sensitive = value;
+ UpdateSensitivity();
+ }
+ }
+ }
+
+ /// <summary>
+ /// <para>Get the flag that indicates if all of this widget's
+ /// ancestors are sensitive to input events.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The value is <see langword="true"/> if all ancestors
+ /// are sensitive; <see langword="false"/> otherwise.</para>
+ /// </value>
+ public bool AncestorSensitive
+ {
+ get
+ {
+ return ancestorSensitive;
+ }
+ }
+
+ /// <summary>
+ /// <para>Get the flag that indicates if this widget and all of its
+ /// ancestors are sensitive to input events.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The value is <see langword="true"/> if this widget
+ /// and all of its ancestors are sensitive;
+ /// <see langword="false"/> otherwise.</para>
+ /// </value>
+ public bool FullSensitive
+ {
+ get
+ {
+ return (sensitive && ancestorSensitive);
+ }
+ }
+
+ /// <summary>
/// <para>Get the parent of this widget.</para>
/// </summary>
***************
*** 355,358 ****
--- 421,447 ----
/// <summary>
+ /// <para>Get the top-level ancestor widget.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The <see cref="T:XWindows.TopLevelWindow"/> instance that
+ /// corresponds to this widget's top-level ancestor, or
+ /// <see langword="null"/> if the ancestor is not an instance
+ /// of <see cref="T:XWindows.TopLevelWindow"/>.</para>
+ /// </value>
+ public TopLevelWindow TopLevel
+ {
+ get
+ {
+ Widget widget = this;
+ while(widget != null && !(widget is
TopLevelWindow))
+ {
+ widget = widget.parent;
+ }
+ return (TopLevelWindow)widget;
+ }
+ }
+
+ /// <summary>
/// <para>Get the next widget above this one in stacking order.</para>
/// </summary>
***************
*** 816,819 ****
--- 905,931 ----
}
+ // Update the sensitivity on this widget and all of its children.
+ private void UpdateSensitivity()
+ {
+ // Notify everyone who is interested in our
sensitivity change.
+ if(SensitivityChanged != null)
+ {
+ SensitivityChanged(this);
+ }
+
+ // Modify the ancestor sensitivity of the child
widgets.
+ Widget child = topChild;
+ bool thisAncestorSensitive = (sensitive &&
ancestorSensitive);
+ while(child != null)
+ {
+ if(child.ancestorSensitive !=
thisAncestorSensitive)
+ {
+ child.ancestorSensitive =
thisAncestorSensitive;
+ child.UpdateSensitivity();
+ }
+ child = child.nextBelow;
+ }
+ }
+
/// <summary>
/// <para>Determine if a mouse button corresponds to "Select".
***************
*** 1098,1101 ****
--- 1210,1218 ----
/// </summary>
public event MapStateEventHandler MapState;
+
+ /// <summary>
+ /// <para>Event that is raised when the widget's sensitivity
changes.</para>
+ /// </summary>
+ public event SensitivityChangedEventHandler SensitivityChanged;
} // class Widget
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows EventHandlers.cs,1.4,1.5 InputOnlyWidget.cs,1.6,1.7 TopLevelWindow.cs,1.3,1.4 Widget.cs,1.3,1.4,
Rhys Weatherley <address@hidden> <=