/// <summary> Initializing constructor. </summary> /// <param name="parent"> The parent (associated top-level) shell (an override shell can't be a top-level shell. <see cref="IntPtr"/> </param> /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). Passed as reference to avoid structure copy constructor calls. <see cref="TPoint"/> </param> public XrwOverrideShell(XrwApplicationShell parent, ref TPoint assignedPosition) : base(parent.Display, parent.Screen, parent.Window) { _parent = parent; InitializeOverrideShellResources(ref assignedPosition); }
/// <summary> Initializing constructor. </summary> /// <param name="parent"> The parent (associated top-level) shell (an override shell can't be a top-level shell. <see cref="IntPtr"/> </param> /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). Passed as reference to avoid structure copy constructor calls. <see cref="TPoint"/> </param> public XrwTransientShell(XrwApplicationShell parent, ref TPoint assignedPosition) : base(parent.Display, parent.Screen, parent.Window) { _parent = parent; _assignedSize = PreferredSize(); InitializeTransientShellResources(ref assignedPosition); }
/// <summary> Initializing constructor. </summary> /// <param name="parent"> The parent (associated top-level) shell (an override shell can't be a top-level shell. <see cref="IntPtr"/> </param> /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). Passed as reference to avoid structure copy constructor calls. <see cref="TPoint"/> </param> /// <param name="fixedSize"> The fixed size, that ist to use (if set) rather than the calcualated size. Passed as reference to avoid structure copy constructor calls. <see cref="TSize"/> </param> public XrwOverrideShell(XrwApplicationShell parent, ref TPoint assignedPosition, ref TSize fixedSize) : base(parent.Display, parent.Screen, parent.Window, ref fixedSize) { _parent = parent; _assignedSize = PreferredSize(); // The assignedPosition will be carried by the underlaying window, NOT relative to the parent. InitializeOverrideShellResources(ref assignedPosition); }
/// <summary> Initializing constructor. </summary> /// <param name="parent"> The parent (associated top-level) shell (an override shell can't be a top-level shell. <see cref="IntPtr"/> </param> /// <param name="fixedSize"> The fixed size, that ist to use (if set) rather than the calcualated size. Passed as reference to avoid structure copy constructor calls. <see cref="TSize"/> </param> public XrwOverrideShell(XrwApplicationShell parent, ref TSize fixedSize) : base(parent.Display, parent.Screen, parent.Window, ref fixedSize) { _parent = parent; TPoint assignedPosition = new TPoint(0, 0); InitializeOverrideShellResources(ref assignedPosition); }
// ############################################################################### // ### C O N S T R U C T I O N A N D I N I T I A L I Z A T I O N // ############################################################################### #region Construction /// <summary> Initializing constructor. </summary> /// <param name="parent"> The parent (associated top-level) shell (an override shell can't be a top-level shell. <see cref="IntPtr"/> </param> /// <param name="message"> The message to display. <see cref="System.String"/> </param> /// <param name="title"> The title to display. <see cref="System.String"/> </param> /// <param name="icon"> The icon to display. <see cref="XrwBitmap.Icon"/> </param> public XrwMessageBox(XrwApplicationShell parent, string message, string title, X11Graphic.StockIcon icon) : base(parent) { _message = message; _title = title; _image = icon; _appModal = true; InitializeMessageBoxResources(); }
/// <summary> Handle the Leave event. </summary> /// <param name="source"> The widget, the FocusIn event is assigned to. <see cref="XrwRectObj"/> </param> /// <param name="e"> The event data. <see cref="XCrossingEvent"/> </param> /// <remarks> Set XrwCrossingEvent. Set result to nonzero to stop further event processing. </remarks> private void HandleLeaveDefault(XrwRectObj source, XrwCrossingEvent e) { _focused = false; XrwApplicationShell appShell = ApplicationShell; if (appShell != null) { if (XrwObject.SendExposeEvent(_display, _window, _window) == 0) { Console.WriteLine(CLASS_NAME + "::HandleFocusOut () ERROR. Can not send expose event."); } } else { Console.WriteLine(CLASS_NAME + "::HandleFocusOut () ERROR. Can not investigate application shell."); } e.Result = 1; }
/// <summary> Handle the FocusOut event. </summary> /// <param name="source"> The widget, the FocusOut event is assigned to. <see cref="XrwRectObj"/> </param> /// <param name="e"> The event data. <see cref="XawFocusChangeEvent"/> </param> /// <remarks> Set XrwFocusChangeEvent. Set result to nonzero to stop further event processing. </remarks> void HandleFocusOutDefault(XrwRectObj source, XrwFocusChangeEvent e) { XrwApplicationShell appShell = ApplicationShell; if (appShell != null) { appShell.RemoveChild(this); _parent = appShell; } else { Console.WriteLine(CLASS_NAME + "::HandleFocusOut () ERROR. Can not investigate application shell."); } if (this._shown) { this.Hide(); } e.Result = 1; }
/// <summary> Initializing constructor. </summary> /// <param name="parent"> The parent (associated top-level) shell (a menu shell can't be a top-level shell. <see cref="IntPtr"/> </param> /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). Passed as reference to avoid structure copy constructor calls. <see cref="TPoint"/> </param> public XrwSimpleMenu(XrwApplicationShell parent, ref TPoint assignedPosition) : base(parent, ref assignedPosition) { InitializeSimpleMenuResources(); }
// ############################################################################### // ### C O N S T R U C T I O N A N D I N I T I A L I Z A T I O N // ############################################################################### #region Construction /// <summary> Initializing constructor. </summary> /// <param name="parent"> The parent (associated top-level) shell (a menu shell can't be a top-level shell. <see cref="IntPtr"/> </param> public XrwSimpleMenu(XrwApplicationShell parent) : base(parent) { InitializeSimpleMenuResources(); }
/// <summary> Initializing constructor. </summary> /// <param name="diaplay">The display pointer, that specifies the connection to the X server. <see cref="IntPtr"/> </param> /// <param name="screenNumber"> The appropriate screen number on the host server. <see cref="System.Int32"/> </param> /// <param name="parentWindow"> The X11 *** parent *** window for X11 calls. This widget has no X11 *** own *** window. <see cref="IntPtr"/> </param> /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). Passed as reference to avoid structure copy constructor calls. <see cref="TPoint"/> </param> /// <param name="fixedSize"> The fixed size, that ist to use (if set) rather than the calcualated size. <see cref="TSize"/> </param> public XrwDialogShell(XrwApplicationShell parent, ref TPoint assignedPosition, ref TSize fixedSize) : base(parent, ref assignedPosition, ref fixedSize) { ; }
/// <summary> Initializing constructor. </summary> /// <param name="diaplay">The display pointer, that specifies the connection to the X server. <see cref="IntPtr"/> </param> /// <param name="screenNumber"> The appropriate screen number on the host server. <see cref="System.Int32"/> </param> /// <param name="parentWindow"> The X11 *** parent *** window for X11 calls. This widget has no X11 *** own *** window. <see cref="IntPtr"/> </param> /// <param name="fixedSize"> The fixed size, that ist to use (if set) rather than the calcualated size. <see cref="TSize"/> </param> public XrwDialogShell(XrwApplicationShell parent, ref TSize fixedSize) : base(parent, ref fixedSize) { ; }
/// <summary> Initializing constructor. </summary> /// <param name="parent"> The parent (associated top-level) shell (an override shell can't be a top-level shell. <see cref="IntPtr"/> </param> /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). Passed as reference to avoid structure copy constructor calls. <see cref="TPoint"/> </param> public XrwDialogShell(XrwApplicationShell parent, ref TPoint assignedPosition) : base(parent, ref assignedPosition) { ; }
// ############################################################################### // ### C O N S T R U C T I O N A N D I N I T I A L I Z A T I O N // ############################################################################### #region Construction /// <summary> Initializing constructor. </summary> /// <param name="parent"> The parent (associated top-level) shell (an override shell can't be a top-level shell. <see cref="IntPtr"/> </param> public XrwDialogShell(XrwApplicationShell parent) : base(parent) { ; }
// ############################################################################### // ### M E T H O D S // ############################################################################### #region Methods #endregion #region Event handler /// <summary> Handle the ButtonPress event. </summary> /// <param name="source"> The widget, the ButtonPress event is assigned to. <see cref="XrwRectObj"/> </param> /// <param name="e"> The event data. <see cref="XawButtonEvent"/> </param> /// <remarks> Set XawButtonEvent. Set result to nonzero to stop further event processing. </remarks> private new void HandleButtonPressDefault(XrwRectObj source, XrwButtonEvent e) { if (_menu != null) { // Set position and size. TPoint position = new TPoint(20, 20); X11lib.XWindowAttributes menuButtonAttributes = new X11lib.XWindowAttributes(); if (this.GetWindowAttributes(ref menuButtonAttributes) == true) { position.X = (int)menuButtonAttributes.x; position.Y = (int)menuButtonAttributes.y + (int)menuButtonAttributes.height; } else { Console.WriteLine(CLASS_NAME + "::HandleButtonPress () ERROR: Unable to determine window attributes."); } XrwObject parent = this.Parent; while (parent != null && (parent is XrwVisibleRectObj)) { if (parent is XrwWmShell) { position.X += (parent as XrwWmShell).AssignedPosition.X; position.Y += (parent as XrwWmShell).AssignedPosition.Y; } else if (parent.HasOwnWindow) { if ((parent as XrwVisibleRectObj).GetWindowAttributes(ref menuButtonAttributes) == true) { position.X += (int)menuButtonAttributes.x; position.Y += (int)menuButtonAttributes.y; } else { Console.WriteLine(CLASS_NAME + "::HandleButtonPress () ERROR: Unable to determine parent window attributes."); } } else { // Windowless widgets positions must not be added! } parent = (parent as XrwVisibleRectObj).Parent; } TSize size = _menu.AssignedSize; _menu.MoveResize(ref position, ref size); // Register menu shell to her application shell for integrating into their event loop. XrwApplicationShell appShell = _menu.ApplicationShell; if (appShell != null) { if (!appShell.HasChild(_menu)) { appShell.AddChild(_menu); } } else { Console.WriteLine(CLASS_NAME + "::HandleButtonPress () ERROR. Can not investigate menu's application shell."); } _menu.Show(); } else { Console.WriteLine(CLASS_NAME + "::HandleButtonPress () ERROR: No menu registered."); } e.Result = 1; }