Click here to Skip to main content
Click here to Skip to main content

Programming the Roma Widget Set (C# X11) - a zero dependency GUI application framework - Composite widgets

, 15 Aug 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
How to develop Linux/Unix (X11) GUI applications in C# efficiently without dependencies to GUI frameworks like GTK or KDE. Description of composite widgets.

Introduction

This article contains the description of composite widgets of the Roma Widget Set (Xrw) only. It has been created because the whole topic grows beyond 50 pages, and i decided to split it into three parts with and into four parts with .

All features, described later on, can be marked as:

  • available from version 0.1,
  • disabled with version 0.2,
  • available from version 0.2,
  • disabled with version 0.3,
  • available from version 0.3,
  • disabled with version 0.4,
  • available from version 0.4,
  • disabled with version 0.5,
  • available from version 0.5,
  • disabled with version 0.6,
  • available from version 0.6,
  •  disabled with version 0.7 and
  •  available from version 0.7.

Widget set

The widget names and functionality follow the ideas of the "Athena widget set" with a little influence of the "Motif widget set" and GTK. The widget set is not complete, but continuously growing. Starting with version the widget set contains advanced widgets influenced by modern GUI toolkits. The widget hierarchy looks as follows:

Intrinsic widgets

The simple widgest are, starting with , described within the article Programming the Roma Widget Set (C# X11) - a zero dependency GUI application framework - Intrinsic widgets. They include:

XrwObject:IDisposable ultimate base object[1, ∅] of this widget set
⌊ XrwRectObject fundamental base object[1, ∅] with geometry
  ⌊ XrwVisibleRectObject fundamental base object[1, ∅] with drawing
    ⌊ XrwCore universal base gadget/widget[2/3, ∅]
      ⌊ XrwSimple universal object[2/3]
      ⌊ XrwComposite container[2/3, ∅], managing many children
        ⌊ XrwConstraint container[2/3, ∅], with geometry management
        ⌊ XrwShell fundamental shell widget[3]
          ⌊ XrwOverrideShell base popup shell, not interacting with the WM[4]
          ⌊ XrwWmShell base shell, interacting with the WM[4]
            ⌊ XrwApplicationShell the common code of an X11 application
            ⌊ XrwTransientShell base class for popups, interacting with WM[4]

[1] object = invisible and windowless, uses neither the ***parent*** window nor an ***onw*** window
[2] gadget = uses the ***parent*** window instead of an ***onw*** window, saves resources compared to widget, but can receive events only if forwarded from the widget it is contained in
[3] widget = has an ***onw*** window, can creceive events directly from the WM[4]
[4] WM = Windows Manager
[∅] do not instantiate

Simple widgets

The simple widgest are, starting with , described within the new article Programming the Roma Widget Set (C# X11) - a zero dependency GUI application framework - Simple widgets. They include:

XrwObject:IDisposable ultimate base object[1, ∅] of this widget set
⌊ XrwRectObject fundamental base object[1, ∅] with geometry
  ⌊ XrwVisibleRectObject fundamental base object[1, ∅] with drawing
    ⌊ XrwCore universal base gadget/widget[2/3, ∅]
      ⌊ XrwSimple universal object[2/3]
        ⌊ XrwColorChooserComb named color choser widget[3], colors arranged as comb
        ⌊ XrwImage image object[2/3]
        ⌊ XrwLabelBase static label base object[2/3, ∅]
        | ⌊ XrwComboBox drop down selection widget[3]
        | ⌊ XrwLabel static label[2/3]
        | | ⌊ XrwCommand command button widget[3]
        | | | ⌊ XrwMenuButton button widget[3], to pop up a simple menu
        | | ⌊ XrwSme simple menu entry gadget[2]
        | ⌊ XrwLabelAndColor label and color rectangle widget[3], select a color
        | ⌊ XrwTextSpinButton spin button widget[3], to spin text constants
        | ⌊ XrwToggle toggle button widget[3]
        |   ⌊ XrwRadio radio button widget[3]
        |     ⌊ XrwNotebookTab notebook tab button widget[3]
        ⌊ XrwList list widget[3]
        ⌊ XrwRange generic base for scroll bar and scale[3]
        | ⌊ XrwScale scale widget[3]
        | ⌊ XrwScrollbar scroll bar widget[3]
        ⌊ XrwRibbonCommandBase base object[2, ∅] of ribbon command gadgets
        | ⌊ XrwRibbonButton command button gadget[2] for ribbon
        | | ⌊ XrwRibbonSplitButton button gadget[2] for ribbon, to pop up a simple menu
        | ⌊ XrwRibbonControlGroup gadget[2] for ribbon, to organize control group nodes
        ⌊ XrwText single line text edit widget[3]
        ⌊ XrwTree toggle button widget[3]
        ⌊ XrwViewportGridViewHeader column header widget for viewport embedded grids[3]

[1] object = invisible and windowless, uses neither the ***parent*** window nor an ***onw*** window
[2] gadget = uses the ***parent*** window instead of an ***onw*** window, saves resources compared to widget, but can receive events only if forwarded from the widget it is contained in
[3] widget = has an ***onw*** window, can creceive events directly from the WM[4]
[4] WM = Windows Manager
[∅] do not instantiate

Composite widgets

The composite widgets are, starting with , described within this article. They include:

XrwObject:IDisposable ultimate base object[1, ∅]
⌊ XrwRectObject fundamental base object[1, ∅] with geometry
  ⌊ XrwVisibleRectObj fundamental base object[1, ∅] with drawing
    ⌊ XrwCore universal base gadget/widget[2/3, ∅]
      ⌊ XrwComposite container[2/3, ∅], managing many children
        ⌊ XrwConstraint container[2/3, ∅], with geometry management
        | ⌊ XrwBox container[2/3], arranging children horiz./vert.
        | | ⌊ XrwHslColorPanel hue, saturation, lighness color chooser gadget[2]
        | | ⌊ XrwNotebook container[2/3], arranging children on pages
        | | ⌊ XrwRadioBox gadget[2], arranging XrwRadio children horiz./vert.
        | | ⌊ XrwSpinBox gadget[2], spinning invisible children to visible
        | ⌊ XrwGridForm container[2/3], arranging children in a column/row grid
        | | ⌊ XrwColorSelector-
        | |      GridForm
container[2/3], XrwGridForm for XrwLabelAndColor children
        | | ⌊ XrwCustomColorChooser-
        | |      GridForm
container[2], XrwGridForm for children to choose a custom color via HSL or RGB color model
        | | ⌊ XrwRgbColorPanel red, green, blue color chooser gadget[2]
        | ⌊ XrwPaned widget[2], controlling two or more paned children
        | ⌊ XrwPorthole gadget[2], display only ***one*** child at any time
        | ⌊ XrwPropertyGrid widget[3], browse and edit the properties of an object
        | ⌊ XrwRibbon widget[3], that realizes the ribbon GUI
        | ⌊ XrwRibbonPanel gadget[2], organizing command objects for ribbons
        | ⌊ XrwRibbonTab gadget[2], arranging XrwRibbonPanel children horiz.
        | ⌊ XrwViewport container[2/3], enabling ***one*** child to scroll
        ⌊ XrwShell fundamental shell widget[3]
          ⌊ XrwOverrideShell base popup shell, not interacting with the WM[4]
          | ⌊ XrwBaseCellEditorShell popup editor shell[2] base class
          |   ⌊ XrwGenericCell-
          |        EditorShell
popup editor shell[2] for generic purpose
          | ⌊ XrwRibbonAppMenu popup application menu shell[2] of a XrwRibbon
          | ⌊ XrwSimpleMenu popup menu shell[2] for XrwSme gadget
          |   ⌊ XrwDropDownCell-
          |   |    EditorShell
popup editor shell[2] for drop down
          |   ⌊ XrwSpinMenu popup scrollable menu shell of XrwSme gadgets[2]
          ⌊ XrwWmShell base shell, interacting with the WM[4]
            ⌊ XrwApplicationShell the common code of an X11 application
            ⌊ XrwTransientShell base class for popups, interacting with WM[4]
              ⌊ XrwDialogShell base class for dialogs, interacting with WM[4]

[1] object = invisible and windowless, uses neither the ***parent*** window nor an ***onw*** window
[2] gadget = uses the ***parent*** window instead of an ***onw*** window, saves resources compared to widget, but can receive events only if forwarded from the widget it is contained in
[3] widget = has an ***onw*** window, can creceive events directly from the WM[4]
[4] WM = Windows Manager
[∅] do not instantiate

XrwBox

The XrwBox class arranges children horizontally or vertically. It is comparable to GTK's Box. It is not comparable to Athena's "Box", that only moves but does not resize its children.

The XrwBox class is a sublass of XrwConstraint. It evaluates its children's constraints ExpandToAvailableHeight, ExpandToMaxSiblingHeight, ExpandToAvailableWidth, and ExpandToMaxSiblingWidth and resizes the children, if apprpriate.

This class has no public constructor, but four static factory methods. NewHBoxWidget/NewHBoxGadged create a new XrwBox with horizontally oriented cild placement, NewVBoxWidget/NewVBoxGadged create a new XrwBox with vertically oriented child placement.

The image shows two horizontally oriented XrwCommand cildren inside a XrwBox. The child align is 1.0.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwBox

New event definitions

XrwBox can be instantiated as widget or gadget. The widget can receive events on it's own (has a window on X server side). The gadget can only receive events that are forwarded from a parent widget.

None.

New public properties

Name Type Access Default/Fallback
ChildAlign float get, set 0.5
Orientation TOrientation get Horizontal
  • ChildAlign get or set the child alignment. 0.0 aligns left, 0.5 aligns center and 1.0 right. The value can not underflow 0.0 or overflow 1.0. The alignment is operative only if there is space left to align. (That means expand-to-max-siblings-* doesn't use the complete space and expand-to-available-* is not set for any child.)
  • Orientation get the orientation of child placement.

Overridden public properties (XrwVisibleRectObj)

  • ExpandToAvailableHeight distinguish whether to expand height equal to the available height (defined by the XrwComposite it is contained).
  • ExpandToAvailableWidth distinguish whether to expand width equal to the available width (defined by the XrwComposite it is contained).

New public methods

None.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (if any) with regard to their PreferredSize, ExpandToAvailableHeight, ExpandToMaxSiblingHeight, ExpandToAvailableWidth, and ExpandToMaxSiblingWidth and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

None.

Usage

The sample code shows how to use a XrwBox as action area of a dialog shell.

// Define the action area.
XrwBox hboxActionArea = XrwBox.NewHBoxGadget (vboxMain);
hboxActionArea.BorderWidth = 2;
hboxActionArea.ChildAlign = 1.0F;
hboxActionArea.HorzSpacing = XrwTheme.DlgShellPrimaryChildSpacing;
hboxActionArea.BorderColor = hboxActionArea.BackgroundColorDark;
vboxMain.AddChild (hboxActionArea);

// Add two buttons right aligned (hbox.ChildAlign == 1.0F).
X11Graphic cancelGraphic = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.Cancel16);
XrwCommand cbCancel = XrwCommand.NewCommandWidget (hboxActionArea,
     "Cancel", cancelGraphic, true, null, false);
cbCancel.ExpandToMaxSiblingWidth = true;
cbCancel.HorzTextAlign = 0.5F;
cbCancel.ButtonRelease += HandleCbCancelButtonRelease;
hboxActionArea.AddChild (cbCancel);

X11Graphic okGraphic = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.Ok16);
XrwCommand cbOk = XrwCommand.NewCommandWidget (hboxActionArea,
    "OK", okGraphic, true, null, false);
cbOk.ExpandToMaxSiblingWidth = true;
cbOk.HorzTextAlign = 0.5F;
cbOk.ButtonRelease += HandleCbOkButtonRelease;
hboxActionArea.AddChild (cbOk); 

The sample code shows how to use a XrwBox as manager gadget of a dialog shell.

public class XrwBitmapAndVectorFontSelectionDialog : XrwDialogShell
{
    // Define constants and member attributes.
    ...
 
    // Implement the constructor.
    public XrwBitmapAndVectorFontSelectionDialog (XrwApplicationShell parent,
                                                  ref Point assignedPosition,
                                                  ref Size assignedSize, string title)
        : base (parent, ref assignedPosition, ref assignedSize)
    {
        // Initialize member attributes.
        ...
 
        // Create shell's primary layout manager.
        XrwBox vboxMain = XrwBox.NewVBoxGadget (this);
        vboxMain.BorderWidth = XrwTheme.DlgShellPrimaryChildBorderWidth;
        vboxMain.BorderColor = _backgroundColorPixel;
        vboxMain.VertSpacing = XrwTheme.DlgShellPrimaryChildSpacing;
        AddChild (vboxMain);
 
        // Create shell's grandchildren.
        ...
    }
 
    // Implement the destructor, properties and methods.
    ...   
} 

XrwHslColorPanel

The XrwHslColorPanel class arranges a bitmap for hue and saturation selection and a scrollbar for lightness selection. Such a class is unknown to Athena and GTK, it's prototype is the System.Windows.Forms "ColorDialog" custom colors tab page.

The XrwHslColorPanel class is a gadget that allows the user to choose a custom color value from hue, saturation and lightness color components.

This class has no public constructor, but one static factory method.  NewHslColorPanelGadget creates a new XrwHslColorPanel.

The image shows a XrwHslColorPanel with color white selected.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwBox --> XrwHslColorPanel

New event definitions

XrwHrsColorPanel is always instantiated as gadget. It can only receive events that are forwarded from a parent widget.

To receive events, a window on server side is required (the object must be a widget, not a gadget). Otherwise events can only be forwarded from widgets to child gadgets. (Athena uses this approach as well, to forward events from "SimpleMenu" to "Sme*".)

  • ColorSelected occures after any color has been selected and is calling registered event handler delegates.

New public properties

Name Type Access Default/Fallback
SelectedColor int get, set 0xFFFFFF
SelectedColorHTML string get #FFFFFF
SelectedColorHSL int get 0x0000FF
  • SelectedColor get or set currently selected color as read, green and blue color component values, each in the range of 0 ... 255 (0x00 ... 0xFF).
  • SelectedColorHTML get the currently selected color as HTML name.
  • SelectedColorHSL get or set the currently selected color as hue, saturation and lightness color component values, each in the range of 0 ... 255 (0x00 ... 0xFF).

Overridden public properties

None.

Specific static methods

  • RgbToHsl convert an RGB color value to a HSL color value.
  • HslToRgb onvert an HSL color value to a RGB color value.

New public methods

None.

Overridden public methods

None.

New event handler

None.

Overridden event handler

None.

New preregistered event delegates

None.

Usage

The sample code shows how to use a XrwRgbColorPanel.

// Create a HSL color panel.
XrwHslColorPanel hslColorPanel = XrwHslColorPanel.NewHslColorPanelGadget (parent);
parent.AddChild (hslColorPanel);
parent.SetChildConstraints (hslColorPanel, "2", "0", "2", "0", "0");
parent.Rows[2].FixedDimension = 2 * MARGIN + hslColorPanel.PreferredSize().Height;

// Register the delegate to get informed about any color selection.
hslColorPanel.ColorSelected += delegate(XrwRectObj source, int newValue, string newValueHtml)
{
    // Process the color selection.
    ...
};

XrwNotebook

The XrwNotebook class arranges children on pages. It is comparable to GTK's Notebook.

The XrwNotebook class is a sublass of XrwConstraint whose children are pages that can be switched between, using tab labels along one edge.

This class has no public constructor, but two static factory method. NewTopTabedNotebookGadget creates a new XrwNotebook where tabs are placed on the top. NewBottomTabbedNotebookGadget creates a new XrwNotebook where tabs are placed at the bottom.

This class introduces four special constants

  • CaptionbarPosition.Top,
  • CaptionbarPosition.Left,
  • CaptionbarPosition.Right and
  • CaptionbarPosition.Bottom,

that define the position of the notebook's caption bar.

The next image shows a notebook with four CaptionbarPosition.Top tabs inside the tab-box ("File", "Dialog test", "Toggle test" and "Radio test"). The first tab "File" is selected and shows the first page inside the page-stack (with the four buttons "File", "Close menu", "Message box" and "Close app").

The next image shows a notebook with five CaptionbarPosition.Bottom tabs inside the tab-box ("Menu", "Toggle", "Radio", "Spin" and "Edit"). The fourth tab "Spin" is selected and shows the fourth page inside the page-stack (with one text spin button "Spin text 1" and a combo box "A", that has a spin menu).

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwBox --> XrwNotebook

New event definitions

XrwNotebook is always instantiated as gadget. It can only receive events that are forwarded from a parent widget.

To receive events, a window on server side is required (the object must be a widget, not a gadget). Otherwise events can only be forwarded from widgets to child gadgets. (Athena uses this approach as well, to forward events from "SimpleMenu" to "Sme*".)

  • TabSelectionChanged occures after the selected tab has changed and is calling registered event handler delegates.

New public properties

Name Type Access Default/Fallback
CountPages int get 0
PageStack XrwPorthole get != null
TabBox XrwRadioBox get != null
TabPosition CaptionbarPosition get CaptionbarPosition.Top
  • CountPages get the number of pages.
  • PageStack get the porthole widget, that contains the pages.
  • TabBox get the box widget, that contains the tabs.
  • TabPosition get the position of the notebook's caption bar.

Overridden public properties

None.

New public methods

  • PageWidget get the page widget of indicated page. Throws IndexOutOfRangeException on index underflow/overflow.
  • TabWidget get the tab widget of indicated page. Throws IndexOutOfRangeException on index underflow/overflow.

Overridden public methods (XrwCore)

  • Realize() allocate and map the resources of the associated window (if object is a widget/has own window) on the X server. Makes the object visible.

Overridden public methods (XrwComposite)

  • AddChild() add the indicated XrwCore to the list of children at list tail. There is no check to prevent multiple additions of the same child. Ignores null poiter.
  • AddChild() add the indicated XrwCore to the list of children at list tail. There is no check to prevent multiple additions of the same child. Ignores null poiter. This method calls the OnChildAdded() event handler.
  • InsertChild() add the indicated XrwCore to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter.
  • InsertChild() add the indicated XrwCore to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter. This method calls the OnChildAdded() event handler.
  • RemoveChild() is not implemented.

New event handler

  • OnTabSelectionChanged() handle the TabSelectionChanged event.

Overridden event handler

None.

New preregistered event delegates

The XrwNotebook registers no event handler on it's own, but it registeres a SwitchedOn event handler to every tab's XrwRadio child.

  • SwitchedOn += HandleTabSwitchedOnDefault on any tab's XrwRadio child makes the according page visible, switches off all other tab's XrwRadio children and hides their according pages.

Usage

The XrwNotebook is designed to create a notebook with minimum effort.

This sample code creates a top tabbed notebook, adds a ribbon and places a command button as sample content into the added robbon.

// Create a top tabbed notebook.
XrwNotebook notebookTopTabbed = XrwNotebook.NewTopTabbedNotebookGadget (vboxMain);
notebookTopTabbed.FrameType = TFrameType.RaisedBottomOnly;
notebookTopTabbed.FrameWidth = XrwTheme.InteractiveFrameWidth;
vboxMain.AddChild (notebookTopTabbed);

// Create a ribbon tab "Dialog test".
XrwBox hboxToggleNbTab = XrwBox.NewHBoxGadget (notebookTopTabbed);
hboxToggleNbTab.BorderWidth = 0;
hboxToggleNbTab.ChildAlign = 0.0F;
hboxToggleNbTab.VertSpacing = 0;
notebookTopTabbed.AddChild (hboxToggleNbTab);

// Name the notebook tab's caption.
XrwNotebookTab firstTabWidget = notebookTopTabbed.TabWidget (notebookTopTabbed.CountPages - 1);
if (firstTabWidget != null)
    firstTabWidget.Label = " Dialog test ";

// Create a sample content (command button) into the ribbon tab.
X11Graphic fontGraphic = XrwTheme.GetGraphic ( _display,_screenNumber,
                                               X11Graphic.StockIcon.FontBitmapFont16);
XrwCommand fontDialog = XrwCommand.NewCommandWidget (hboxFileRibbon, "Font dialog",
                                                     fontGraphic, true, null, false);
fontDialog.FrameType  = XrwTheme.StaticFrameType;
fontDialog.FrameWidth = XrwTheme.StaticFrameWidth;
fontDialog.ExpandToAvailableHeight = true;
fontDialog.ButtonRelease += HandleFontDialogButtonRelease;
hboxToggleNbTab.AddChild (fontDialog); 

This sample code creates a bottom tabbed notebook, adds a ribbon and places a text spin button as sample content into the added robbon.

// Create a bottom tabbed notebook.
XrwNotebook notebookBottomTabbed = XrwNotebook.NewBottomTabbedNotebookGadget (vboxMain);
notebookBottomTabbed.FrameType = TFrameType.RaisedTopOnly;
notebookBottomTabbed.FrameWidth = XrwTheme.InteractiveFrameWidth;
vboxMain.AddChild (notebookBottomTabbed);

// Create a ribbon tab "Spin".
XrwBox hboxSpinNbTab = XrwBox.NewHBoxGadget (notebookBottomTabbed);
hboxSpinNbTab.BorderWidth = 0;
hboxSpinNbTab.ChildAlign = 0.0F;
hboxSpinNbTab.VertSpacing = 0;
notebookBottomTabbed.AddChild (hboxSpinNbTab);

// Name the ribbon tab's caption.
XrwNotebookTab firstTabWidget = notebookBottomTabbed.TabWidget (notebookBottomTabbed.CountPages - 1);
if (firstTabWidget != null)
    firstTabWidget.Label = " Spin ";

// Create a sample content (text spin button) into the ribbon tab.
XrwTextSpinButton textSpinner = XrwTextSpinButton.NewHXrwTextSpinButton
    (hboxSpinNbTab, "Spin text 1\nText 2\nText 3\nText 4\nSpin text 5");
textSpinner.ExpandToAvailableWidth = false;
textSpinner.HorzTextAlign = 0.5F;
textSpinner.ExpandToMaxSiblingHeight = true;
hboxSpinNbTab.AddChild (textSpinner); 

XrwRadioBox

The XrwRadioBox class arranges XrwRadio children horizontally or vertically. It is comparable to GTK's representation of groups of radio buttons, that has no frame.

The XrwRadioBox class is a sublass of XrwConstraint that realizes that only one of its radio button children can be selected at any time.

This class has no public constructor, but two static factory methods. NewHRadioBoxGadget creates a new XrwRadioBox with horizontally oriented cildren, NewVRadioBoxGadget creates a new XrwRadioBox with vertically oriented children.

The image shows a horizontally oriented XrwRadioBox with three radio buttons.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwBox --> XrwRadioBox

New event definitions

XrwRadioBox is always instantiated as gadget. It can only receive events that are forwarded from a parent widget.

None.

New public properties

None.

Overridden public properties

None.

New public methods

  • GetSelected() get the currently selected radio button.
  • GetSelectedIndex() get the currently selected radio button's index.

Overridden public methods (XrwComposite)

  • AddChild() add the indicated XrwCore to the list of children at list tail. There is no check to prevent multiple additions of the same child. Ignores null poiter.
  • AddChild() add the indicated XrwCore to the list of children at list tail. There is no check to prevent multiple additions of the same child. Ignores null poiter. This method calls the OnChildAdded() event handler.
  • InsertChild() add the indicated XrwCore to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter.
  • InsertChild() add the indicated XrwCore to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter. This method calls the OnChildAdded() event handler.
  • RemoveChild()is not implemented.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

The XrwRadioBox registers no event handler on it's own, but it registeres a SwitchedOn event handler to every XrwRadio child.

  • SwitchedOn += HandleChildSwitchedOnDefault on any XrwRadio child switches off all other XrwRadio children of this XrwRadioBox.

Usage

This sample code creates a radio box containing three radio buttons.

// Define the radio box.
XrwRadioBox hboxRadioNbTab = XrwRadioBox.NewHRadioBoxGadget (notebookBar);
hboxRadioNbTab.BorderWidth = 0;
hboxRadioNbTab.ChildAlign = 0.0F;
hboxRadioNbTab.VertSpacing = 0;

// Add three radio buttons left aligned (hbox.ChildAlign == 0.0F).
X11Graphic radioOffGraphic = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.RadioOff16TrueColor);
X11Graphic radioOnGraphic = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.RadioOn16TrueColor);
XrwRadio radio1 = XrwRadio.NewRadioWidget (hboxRadioNbTab,
    "Radio test 1", radioOffGraphic, true, radioOnGraphic, true);
radio1.ExpandToAvailableWidth = false;
radio1.FrameType  = XrwTheme.InteractiveFrameType;
radio1.FrameWidth = XrwTheme.InteractiveFrameWidth;
hboxRadioNbTab.AddChild (radio1);

XrwRadio radio2 = XrwRadio.NewRadioWidget (hboxRadioNbTab,
    "Radio test 2", radioOffGraphic, true, radioOnGraphic, true);
radio2.ExpandToAvailableWidth = false;
radio2.FrameType  = XrwTheme.InteractiveFrameType;
radio2.FrameWidth = XrwTheme.InteractiveFrameWidth;
hboxRadioNbTab.AddChild (radio2);

XrwRadio radio3 = XrwRadio.NewRadioWidget (hboxRadioNbTab,
    "Radio test 3", radioOffGraphic, true, radioOnGraphic, true);
radio3.ExpandToAvailableWidth = false;
radio3.FrameType  = XrwTheme.InteractiveFrameType;
radio3.FrameWidth = XrwTheme.InteractiveFrameWidth;
hboxRadioNbTab.AddChild (radio3); 

XrwSpinBox

The XrwSpinBox class arranges children horizontally or vertically like the XrwBox class, but it can hide children to meet the requested qeometry. It's prototype is the GTK Nautilus (file manager) path bar.

The XrwSpinBox class is a sublass of XrwConstraint that can organize more children than displayable on its visible area. In that case it can spin invisible children to the visible area and visible children to the invisible area - wherefore it shows two spin navigators (forth and back) dynamically, if required.

This class has no public constructor, but four static factory methods. NewHSpinBoxWidget/NewHSpinBoxGadget creates a new XrwSpinBox with horizontally oriented cild placement, NewVSpinBoxWidget/NewVSpinBoxGadget creates a new XrwSpinBox with vertically oriented child placement.

The image shows a horizontally oriented XrwSpinBox with back and navigators and eight buttons.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwBox --> XrwSpinBox

New event definitions

XrwSpinBox is always instantiated as widget. It can receive events on it's own (has a window on X server side).

None.

New public properties

Name Type Access Default/Fallback
Back XrwCommand get != null
Forth XrwCommand get != null
ForceNavigators bool get, set false
PreferredSpinOffset int get 0
ShowNavigators bool get false
  • Back get the back navigator button. The button can be invisible (not realized) or inactive.
  • Forth get the forth navigator button. The button can be invisible (not realized) or inactive.
  • ForceNavigators distinguish whether to show the navigator buttons permanently.
  • PreferredSpinOffset get the preferred offset to the first visible child, if spinning is required.
  • ShowNavigators get the current internal state whether to show navigator buttons or not.

Overridden public properties (XrwComposite)

  • Children get the list of all direct children.

New public methods

None.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (if any) with regard to their PreferredSize, ExpandToAvailableHeight, ExpandToMaxSiblingHeight, ExpandToAvailableWidth, and ExpandToMaxSiblingWidth and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • Realize() allocate and map the resources of the associated window (if object is a widget/has own window) on the X server. Makes the object visible.

Overridden public methods (XrwComposite)

  • AddChild() add the indicated XrwCore to the list of children at list tail. There is no check to prevent multiple additions of the same child. Ignores null poiter.
  • AddChild() add the indicated XrwCore to the list of children at list tail. There is no check to prevent multiple additions of the same child. Ignores null poiter. This method calls the OnChildAdded() event handler.
  • HasChild() test whether the the indicated XrwCore is a child.
  • InsertChild() add the indicated XrwCore to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter.
  • InsertChild() add the indicated XrwCore to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter. This method calls the OnChildAdded() event handler.
  • RemoveChild() remove the indicated XrwCore from the list of children.
  • RemoveChild() remove the indicated XrwCore from the list of children. This method calls the OnChildRemoved() event handler.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

  • Clicked += HandleForthButtonClickedDefault on forth spin button recalculate spinned children's layout and redraws.
  • Clicked += HandleBackButtonClickedDefault on back spin button recalculate spinned children's layout and redraws.

XrwGridForm

The XrwGridForm class arranges children using a grid of predefined columns and rows. It is comparable to Motif's "Form" widget but doesn't support alignment with reference to the form's edges or to each other.

The LessTif manpage's description for "Form" says (LessTif Manual):
XmForm is a widget which allows you to specify complicated geometries. The widget is capable of aligning children widgets with reference to each other. Widgets can be linked to each other's positions, hooked to a fixed place, or hooked to the form's edges. Positioning can be relative as well as absolute.
The algorithm used to lay out the children is an iterative one. In development versions of LessTif, the amount of iterations that the widget supports before it wants to have reached a steady state is 200. OSF/Motif® uses a much higher number than this; if the low number in LessTif gives you trouble (it generates a warning message mentioning "bailout") then either the number is too low or you've discovered a bug.

Instead of Motif's XmNfractionBase resource it supports columns and rows with fixed dimension, by calling AddColumn("128") or AddRow("256"), and dynamic dimension, by calling AddColumn("1.0*") or AddRow("1.5*"). Fixed dimensions expect an integer value (in pixels) and dynamic dimensions expect a float followed by "*" (to be multiplied with the remaining available dimension). Fixed dimensions and dynamic dimensions can be used through the same form widget in parallel. XrwGridForm does not calculate the position of it's children iterative, but in one siggle pass.

This class has no public constructor, but one static factory method. NewGridFormGadget creates a new XrwGridForm.

The image shows a XrwGridForm with two dynamic columns ("1.0*" and "2.0*") and three rows (static "36" pixels, dynamic "1.0*" and "1.5*"). Four simple button widgets show column span (no. 1), row span (no. 4) and margin (no 1 ... no. 4).

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwGridForm

New event definitions

XrwGridForm is always instantiated as gadget. It can only receive events that are forwarded from a parent widget.

None.

New public properties

Name Type Access Default/Fallback
CountColumns int get 0
CountRows int get 0
Columns ReadOnlyCollection<LaneData> get !=null
Rows ReadOnlyCollection<LaneData> get !=null
  • CountColumns get the number of columns defined for the grid form.
  • CountRows get the number of rows defined for the grid form.
  •  Columns get the read only list of column's lane data.
  •  Rows get the read only list of row's lane data.

Overridden public properties (XrwComposite)

None.

New public methods

  • AddColumn() add a new column to the grid's columns at tail position and define it's width.
  • AddRow() add a new row to the grid's rows at tail position and define it's height.
  • SetChildConstraints() set an indicated child's constraints (margin, column, row, column span and row span).

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (ribbon tabs with regard to their PreferredSize, ExpandToAvailableWidth and ExpandToMaxSiblingWidth but not ExpandToAvailableHeight and ExpandToMaxSiblingHeight (because the ribbon has a fixed height) and set the AssignedSize and AssignedPosition.
  •  MinimumSize() calculate the minimum size.
  •  PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • Redraw() redraw the widget/gadget

New event handler

None.

Overridden event handler

None.

New preregistered event delegates

None.

Child constraints

Child constraints can be set by SetChildConstraints() and cover margins (left, right, top and bottom), placement hooks (start column and row) and dimension hooks (column span and row span). Depending on the constraints, children may overlap.

XrwColorSelectorGridForm

 The XrwColorSelectorGridForm class arranges XrwLabelAndColor children using a grid of predefined columns and rows. It is intended to be created as widget, to hold the children as gadgets (to save memory and X server communication) and to forward the events to it's children. The layout is taken unchanged from it's base class XrwGridForm.

XmColorSelecrorGridForm is a widget that offers a grid of selectable predefined colors

This class has no public constructor, but several static factory methods. NewColorSelectorGridForm16 creates a new XrwColorSelectorGridForm for 16 selectable predefined colors. NewColorSelectorGridForm140 creates a new XrwColorSelectorGridForm for 140 selectable predefined colors (thre are 140 named colors defined for X11).

The image shows a XrwColorSelectorGridForm with 2 columns (static width) and 8 rows (static height) containing 16 XrwLabelAndColor children, each displaying a color rectangle and the color name.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwGridForm --> XrwColorSelectorGridForm

New event definitions

XrwColorSelectorGridForm is always instantiated as widget. It can receive events on it's own (has a window on X server side).

  • ColorSelected occures after one of the predefined colors has been selected and is calling registered event handler delegates.

New public properties

Name Type Access Default/Fallback
SelectedChildBorderColor TPixel XrwTheme.ShadowFrame-ColorDark XrwTheme.ShadowFrame-ColorDark
SelectedColor int get, set 0xffffff
SelectedColorHtml string get !=null
  •  SelectedChildBorderColor get or set the border color of a selected color gadget.
  •  SelectedColor get or set the currently selected color.
  •  SelectedHolorHrtml get the currently selected color as HTML name.

Overridden public properties

None.

New public methods

None.

Overridden public methods

None.

New event handler

  •  OnColorSelected() handle the ColorSelected event.

Overridden event handler

None.

New preregistered event delegates

  • ButtonPress += HandleButtonPressDefault perform the button press action and forward it to the appropriate child.

Usage

The sample code shows how to use a XrwColorSelectorGridForm.

// Create and register one of the three currently available color selection grid forms.
XrwColorSelectorGridForm colorSelector ;

if (colorArrangement == PredefinedColorArrangement.C07R20Named)
    colorSelector = XrwColorSelectorGridForm.NewColorSelectorGridForm140
                        (parent, colorArrangemen, initialColorValue);
else if (colorArrangement == PredefinedColorArrangement.C08R02)
    colorSelector = XrwColorSelectorGridForm.NewColorSelectorGridForm16
                        (parent, colorArrangemen, initialColorValue);
else if (colorArrangement == PredefinedColorArrangement.C02R08Named)
    colorSelector = XrwColorSelectorGridForm.NewColorSelectorGridForm16
                        (parent, colorArrangemen, initialColorValue);
parent.AddChild (colorSelector); 

XrwCustomColorChooserGridForm

 The XrwCustomColorChooserGridForm class arranges it's children XrwHslColorPanel and XrwHslColorPanel using a grid of predefined columns and rows.

XmColorSelecrorGridForm is a gadget to choose a custom color via HSL or RGB color model

This class has no public constructor, but one static factory method. NewCustomColorChooserGridForm creates a new XrwCustomColorChooserGridForm.

The image shows a XrwCustomColorChooserGridForm with the  XrwHslColorPanel choose a custom color via HSL color model and the XrwHslColorPanel choose a custom color via RGB color model .

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwGridForm --> XrwCustomColorChooserGridForm

New event definitions

XrwCustomColorChooserGridForm is always instantiated as gadget. It can only receive events that are forwarded from a parent widget.

To receive events, a window on server side is required (the object must be a widget, not a gadget). Otherwise events can only be forwarded from widgets to child gadgets. (Athena uses this approach as well, to forward events from "SimpleMenu" to "Sme*".)

  • ColorSelected occures after any color has been choosen and is calling registered event handler delegates.

New public properties

Name Type Access Default/Fallback
SelectedColor int get, set 0xFFFFFF
SelectedColorHTML string get #FFFFFF
  • SelectedColor get or set currently selected color as read, green and blue color component values, each in the range of 0 ... 255 (0x00 ... 0xFF).
  • SelectedColorHTML get the currently selected color as HTML name.

Overridden public properties

None.

New public methods

None.

Overridden public methods

None.

New event handler

None.

Overridden event handler

None.

New preregistered event delegates

None.

Usage

The sample code shows how to use a XrwRgbColorPanel.

// Create a custom color grid form.
XrwCustomColorChooserGridForm gridCustomColors =
    XrwCustomColorChooserGridForm.NewColorChooserGridForm (parent, initialColorValue);
parent.AddChild (gridCustomColors);

// Register the delegate to get informed about any color choose.
gridCustomColors.ColorSelected += delegate(XrwRectObj source, int newValue, string newValueHtml)
{
    // Process the color selection.
    ...
};

XrwRgbColorPanel

The XrwRgbColorPanel class arranges a label, a scrollbar and an editor for each of the three color components red, green and blue. Such a class is unknown to Athena and GTK, it's prototype can be one of the many free color pickers on the internet.

The XrwRgbColorPanel class is a gadget that allows the user to choose a custom color value from red, green and blue color components.

This class has no public constructor, but one static factory method.  NewRgbColorPanelGadget creates a new XrwRgbColorPanel.

The image shows a XrwRgbColorPanel with color white selected.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwGridForm --> XrwRgbColorPanel

New event definitions

XrwRgbColorPanel is always instantiated as gadget. It can only receive events that are forwarded from a parent widget.

To receive events, a window on server side is required (the object must be a widget, not a gadget). Otherwise events can only be forwarded from widgets to child gadgets. (Athena uses this approach as well, to forward events from "SimpleMenu" to "Sme*".)

  • ColorSelected occures after any color has been selected and is calling registered event handler delegates.

New public properties

Name Type Access Default/Fallback
SelectedColor int get, set 0xFFFFFF
SelectedColorHTML string get #FFFFFF
  • SelectedColor get or set currently selected color as read, green and blue color component values, each in the range of 0 ... 255 (0x00 ... 0xFF).
  • SelectedColorHTML get the currently selected color as HTML name.

Overridden public properties

None.

New public methods

None.

Overridden public methods

None.

New event handler

None.

Overridden event handler

None.

New preregistered event delegates

None.

Usage

The sample code shows how to use a XrwRgbColorPanel.

// Create a RGB color panel.
XrwRgbColorPanel rgbColorPanel = XrwRgbColorPanel.NewRgbColorPanelGadget (parent);
parent.AddChild (rgbColorPanel);
parent.SetChildConstraints (rgbColorPanel, "2", "0", "2", "0", "0");
parent.Rows[2].FixedDimension = 2 * MARGIN + rgbColorPanel.PreferredSize().Height;

// Register the delegate to get informed about any color selection.
rgbColorPanel.ColorSelected += delegate(XrwRectObj source, int newValue, string newValueHtml)
{
    // Process the color selection.
    ...
};

XrwPaned

The XrwPaned class arranges children tiled and allows to change their size. It is comparable to Athena's "Paned" widget already including the appropriate Athena "Grip" widget.

The X Toolkit Intrinsics's description for "Paned" says (X Toolkit Intrinsics Reference Manual):
The Paned widget manages children in a vertically or horizontally tiled fashion. The panes may be dynamically resized by the user by using the grips that appear near the right or bottom edge of the border between two panes.
When the pointer is positioned on a grip and pressed, an arrow is displayed that indicates the pane that is being resized. While keeping the pointer button down, the user can move the pointer up and down (or left and right). This, in turn, changes the border between the panes, causing one pane to shrink and some other pane (or panes) to grow. The size of the Paned widget will not change.The Paned widget may accept any widget class as a pane except Grip. Grip widgets have a special meaning for the Paned widget, and adding a Grip as its own pane will confuse the Paned widget.

This class has no public constructor, but two static factory methods. NewHPanedWidget or NewVPanedWidget create a new horizontally or vertically oriented XrwPaned.

The image shows a horizontally oriented XrwPaned with one XrwTree and one XrwPropertyGrid.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwBox --> XrwPaned

New event definitions

XrwPaned is always instantiated as widget. It can receive events on it's own (has a window on X server side).

None.

New public properties

Name Type Access Default/Fallback
ChildAlign float get, set 0.5
Orientation TOrientation get  
PanerBackgroundColorDark TPixel get, set PanerBackgroundColorDark
PanerBackgroundColorLight TPixel get, set PanerBackgroundColorLight
PanerBackgroundColorMedium TPixel get, set PanerBackgroundColorMedium
  • ChildAlign get or set the child alignment. 0.0 aligns left, 0.5 aligns center and 1.0 right. The value can not underflow 0.0 or overflow 1.0. The alignment is operative only if there is space left to align. (That means XrwVisibleRectObj.ExpandToMaxSiblings*, set to any number of children, doesn't use the complete space and XrwVisibleRectObj.ExpandToAvailable* is not set for any child.)
  • Orientation get the orientation of child placement.
  • PanerBackgroundColorDark get or set the paned's border between the panes background color pixel 3/3.
  • PanerBackgroundColorLight get or set the paned's border between the panes background color pixel 1/3.
  • PanerBackgroundColorMedium get or set the paned's border between the panes background color pixel 2/3.

Overridden public properties (XrwComposite)

None.

New public methods

None.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (ribbon tabs with regard to their PreferredSize, ExpandToAvailableWidth and ExpandToMaxSiblingWidth but not ExpandToAvailableHeight and ExpandToMaxSiblingHeight (because the ribbon has a fixed height) and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

None.

New event handler

None.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

New preregistered event delegates

  • Enter += HandleEnterDefault performs noting.
  • Leave += HandleLeaveDefault unset focused child.
  • ChildAdded += HandleChildAddedDefault performs some configuration for the paned child, added to the XrwPane widget's Children collection.

XrwPorthole

The XrwPorthole class arranges children stacked, but displays only one child at any time. It's prototype is Athena's "Porthole" widget.

The X Toolkit Intrinsics's description for "Porthole" says (X Toolkit Intrinsics Reference Manual):
The Porthole widget provides geometry management of a list of arbitrary widgets, only one of which may be managed at any particular time. The managed child widget is reparented within the porthole and is moved around by the application (typically under the control of a Panner widget).
The Porthole widget allows its managed children to request any size that is as large or larger than the Porthole itself and any location so long as the child still obscures all of the Porthole.

This class has no public constructor, but one static factory methods. NewPortholeGadget creates a new XrwPorthole.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwPorthole

New event definitions

XrwPorthole is always instantiated as gadget. It can only receive events that are forwarded from a parent widget.

None.

New public properties

Name Type Access Default/Fallback
RealizedChild int get XrwCore
  • RealizedChild get the currently realized (visible) child.

Overridden public properties

None.

New public methods

  • RealizeChild() realize indicated child and unrealize (hide) formerly realized child.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (if any) with regard to their PreferredSize, ExpandToAvailableHeight, ExpandToMaxSiblingHeight, ExpandToAvailableWidth, and ExpandToMaxSiblingWidth and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • Realize()allocate and map the resources of the associated window (if object is a widget/has own window) on the X server. Makes the object visible.

Overridden public methods (XrwComposite)

  • AddChild() add the indicated XrwCore to the list of children at list tail. There is no check to prevent multiple additions of the same child. Ignores null poiter.
  • AddChild() add the indicated XrwCore to the list of children at list tail. There is no check to prevent multiple additions of the same child. Ignores null poiter. This method calls the OnChildAdded() event handler.
  • InsertChild() add the indicated XrwCore to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter.
  • InsertChild() add the indicated XrwCore to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter. This calls the OnChildAdded() event handler.
  • RemoveChild() remove the indicated XrwCore from the list of children.
  • RemoveChild() remove the indicated XrwCore from the list of children. This method calls the OnChildRemoved() event handler.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

None.

XrwPropertyGrid

The XrwPropertyGrid class enables browsing and editing the properties of an object. It's prototype is System.Windows.Forms "PropertyGrid" control.

A property grid widget is similar to a normal two-column tree widget, except that it provides only two levels of hierarchy (branch nodes and leaf nodes) and leaf nodes are editable. Leaf node editors can support text values, dropdown lists, filename browsers or pretty much other type imaginable.
The PropertyGrid widget displays the properties of a given object (class instance) grouped into categories allowing to edit these properties. The object's properties that are to display and edit are determined using reflection.

The XrwPropertyGrid is more or less a wrapper around a specific configured XrwTree widget with some additional functionality. This includes:

  • a title area displaying the type and name of the currently assigned object
  • the two-column tree with edit capabilities for the leaf nodes at the second column
  • a description area displaying the name and description of the currently selected property

This class has no public constructor, but one static factory method. NewPropertyGridWidget creates a new XrwPropertyGrid.

The image shows an XrwPropertyGrid with two categories (branch nodes "Default" and "Demonstation"), two text properties (leaf nodes "Name" and "Col2"), one boolean property ( leaf node"Col5"), one three-state property (leaf node "Col6") and one enumeration property (leaf node "Col7"). All leaf node are editable. Currently the enumeration property (leaf node "Col7") is in edit mode.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwPropertyGrid

New event definitions

XrwPropertyGrid is always instantiated as widget. It can receive events on it's own (has a window on X server side).

None.

New public properties

Name Type Access Default/Fallback
TextColor TPixel get, set XrwTheme.TextColor
FontSpecification string get  
FontId IntPtr get IntPtr.Zero
BoldFontSpecification string get  
BoldFontId IntPtr get IntPtr.Zero
SelectedBackground-
ColorDark
TPixel get, set XrwTheme.EditableBackground-
Color
SelectedBackground-
ColorLight
TPixel get, set XrwTheme.EditableBackground-
Color
SelectedBackground-
ColorMedium
TPixel get, set XrwTheme.EditableBackground-
Color
SelectedObject object get, set null
ShowDescription bool get, set true
  • TextColor get or set the text color of a ribbon button's label.
  • FontSpecification get the current font specification. An empty string indicates the initially used system default font. To set the font specification use SetFont() method.
  • FontId get the current font id. The IntPtr.Zero indicates the initially used system default font. This font is used to display the name of the currently assigned object in the title area, the leaf nodes in the tree and the description of the currently selected property in the description area.
  • BoldFontSpecification get the current bold font specification. An empty string indicates the initially used system default font. To set the font specification use SetBoldFont() method.
  • BoldFontId get the current bold font id. The IntPtr.Zero indicates the initially used system default font. This font is used to display the type of the currently assigned object in the title area, the branch nodes in the tree and the name of the currently selected property in the description area.
  • SelectedBackgroundColorDark get or set the selected property node's background color pixel 3/3. The SelectedBackgroundColor* colors are typically not discriminative, because an editable square has no gradient.
  • SelectedBackgroundColorLight get or set the selected property node's background color pixel 1/3. The SelectedBackgroundColor* colors are typically not discriminative, because an editable square has no gradient.
  • SelectedBackgroundColorMedium get or set the selected property node's background color pixel 2/3. The SelectedBackgroundColor* colors are typically not discriminative, because an editable square has no gradient.
  • SelectedObject get or set the currently assigned object.
  • ShowDescription get or set whether to show the description area.

Note: The SelectedBackgroundColor* (inherited from XrwVisibleRectObj) colors are typically not discriminative, because an editable square has no gradient.

Overridden public properties

None.

New public methods

  • SetBoldFont() set a new default bold font.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size (title area, tree and description area are integral part of the XrwPropertyGrid and reduce the available size) to the children with regard to their PreferredSize, ExpandToAvailableWidth and ExpandToMaxSiblingWidth but not ExpandToAvailableHeight and ExpandToMaxSiblingHeight (because the ribbon has a fixed height) and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • SetFont() set a new default font (by associating it with the graphics context).

Overridden public methods (XrwComposite)

  • AddChild() add child is not supported. The tree's viewport is the only child.
  • InsertChild() insert child is not supported. The tree's viewport is the only child.
  • RemoveChild() remove child is not supported. The tree's viewport is the only child.

New event handler

None.

Overridden event handler

None.

Preregistered event delegates

  • EntrySelectionChanged += HandleTreeEntrySelectionChanged handle the EntrySelectionChanged event of the property grid's tree.
  • SizePreferenceChanged += XrwViewport.HandleSizePreferenceChangedDefault handle the SizePreferenceChanged event.

XrwRibbon

The XrwRibbon is a command bar that organizes the features of an application into a series of tabs at the top of the application window. The ribbon replaces the traditional menu bar and toolbars. The ribbon UI has a better discoverability of features and functions, enables a quicker learning of the application, and makes users feel more in control of their experience with the application.

A ribbon is made up of several components. Every ribbon has an application menu and an arbitrary number of ribbon tabs. Ribbon tabs contain panels and each panel contains command controls. Related command controls can be combined into control groups.

The XrwRibbon has a fixed height and should always expand to the window's full width.

This class has no public constructor, but a static factory method. NewRibbonWidget creates a new XrwRibbon instance, that already contains an XrwRibbonAppMenu and is ready to accept XrwRibbonTab children.

The image shows a XrwRibbon with application menu button () and three tabs, "Dialog test", "Radio & toggle test" as well as "Split test". The first tab is selected and contains two ribbon panels. Each panel contains three ribbon buttons - the first panel," Large buttons", shows the dialog launcher right beside the ribbon panel's label and it's buttons with CurrentSizeMode == RibbonPanelSizePolicy.Large, the second panel, "Medium buttons", shows as well the dialog launcher right beside the ribbon panel's label and it's buttons with CurrentSizeMode == RibbonPanelSizePolicy.Medium.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwRibbon

New event definitions

XrwRibbon is always instantiated as widget. It can receive events on it's own (has a window on X server side).

None.

New public properties

Name Type Access Default/Fallback
TextColor TPixel get, set XrwTheme.TextColor
InactiveTextColor TPixel get, set XrwTheme.ShadowFrame-
ColorDark
RibbonTabCaption-
BackgroundColorDark
TPixel get, set XrwTheme.RibbonTabCaption-
BackgroundColor
RibbonTabCaption-
BackgroundColorLight
TPixel get, set XrwTheme.RibbonTabCaption-
BackgroundColor
RibbonTabCaption-
BackgroundColorMedium
TPixel get, set XrwTheme.RibbonTabCaption-
BackgroundColor
RibbonTabCaptionFocused-
BackgroundColorDark
TPixel get, set XrwTheme.RibbonTabCaption-
FocusedBackgroundColor
RibbonTabCaptionFocused-
BackgroundColorLight
TPixel get, set XrwTheme.RibbonTabCaption-
FocusedBackgroundColor
RibbonTabCaptionFocused-
BackgroundColorMedium
TPixel get, set XrwTheme.RibbonTabCaption-
FocusedBackgroundColor
ApplicationButtonLabel string get, set  
ApplicationButtonBitmap X11Graphic get != null
ApplicationButtonBitmapShared bool get true
ApplicationMenu XrwRibbonAppMenu get != null
  • TextColor get or set the text color of a ribbon button's label.
  • InactiveTextColor get or set text color of an inactive ribbon button's label.
  • RibbonTabCaptionBackgroundColorDark get or set the ribbon tab's caption background color pixel 3/3.
  • RibbonTabCaptionBackgroundColorLight get or set the ribbon tab's caption background color pixel 1/3.
  • RibbonTabCaptionBackgroundColorMedium get or set the ribbon tab's caption background color pixel 2/3.
  • RibbonTabCaptionFocusedBackgroundColorDark get or set the ribbon tab's caption focused background color pixel 3/3.
  • RibbonTabCaptionFocusedBackgroundColorLight get or set the ribbon tab's caption focused background color pixel 1/3.
  • RibbonTabCaptionFocusedBackgroundColorMedium get or set the ribbon tab's caption focused background color pixel 2/3.
  • ApplicationButtonLabel get or set the label text of the application button.
  • ApplicationButtonBitmap get the application button's bitmap.
  • ApplicationBitmapShared get the application button's bitmap shared flag. Not shared bitmaps will be disposed by the XrwRibbon's Dispose(), shared bitmaps won't.
  • Menu get the associated menu to pop up.

Overridden public properties (XrwRectObj)

  • BorderWidth is now read only.

Overridden public properties (XrwVisibleRectObj)

  • FrameWidth doesn't support set now.
  • ExpandToAvailableHeight doesn't support set now.

New public methods

  • SetApplicationButtonBitmap() set application button's bitmap and bitmap shared flag.
  • GetSelectedTab() get the currently selected tab. Can be null.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (ribbon tabs) with regard to their PreferredSize, ExpandToAvailableWidth and ExpandToMaxSiblingWidth but not ExpandToAvailableHeight and ExpandToMaxSiblingHeight (because the ribbon has a fixed height) and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • AllWindowedWidgets() return the collection of all windowed child widgets
  • Realize() allocate and map the resources of the associated window (if object is a widget/has own window) on the X server. Makes the object visible.
  • Redraw() redraw the widget/gadget.
  • Unrealize() unmap and free the resources of the associated window (if object is a widget/has own window) on the X server. Makes the object invisible.

Overridden public methods (XrwComposite)

  • AddChild() add the indicated XrwRobbonTab to the list of children at list tail. There is no check to prevent multiple additions of the same child. Ignores null poiter. Selects the last added child.
  • InsertChild() add the indicated XrwRibbonTab to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter. Selects the last added child.

New  event handler

None.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

New preregistered event delegates

  • Application button's Click += HandleApplicationButtonClicked pop up the application menu.
  • Enter += HandleEnterDefault performs noting.
  • Leave += HandleLeaveDefault unset focused child.
  • Motion += HandleMotionDefault focus or unfocus the appropriate child.
  • ButtonPress+= HandleButtonPressDefault perform the button press action for the appropriate child.
  • ButtonRelease += HandleButtonReleaseDefault perform the button release action for the appropriate child.

XrwRibbonPanel

The XrwRibbonPanel is the second highest level of application command control arrangement and groups command controls into related sets inside a ribbon tab. The descriptive ribbon panel's label explains the common purpose of its command controls.

Because the ribbon is implemented as one integral widget, almost all of its children (including the ribbon panel) are implemented as gadgets. The ribbon panel is a ribbon child, that provides the functionality of a labeled frame to the ribbon.

The XrwRibbonPanel has a fixed height and expands to the requested width according it's children. The XrwRibbonPanel shows a dialog launcher (), if the ribbon panel has a ButtonRelease event handler registered.

This class has no public constructor, but a static factory method. NewRibbonPanelGadget creates a new empty XrwRibbonPanel instance.

See the image of XrwRibbon for a sample picture of ribbon panels.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwRibbonPanel

New event definitions

XrwRibbonPanel is always instantiated as gadget. It can only receive events that are forwarded from a parent widget.

None.

New public properties

Name Type Access Default/Fallback
Label string get, set  
TextBackgroundColor TPixel get, set XrwTheme.RibbonPanelText-
BackgroundColor
TextColor TPixel get, set XrwTheme.TextColor
  • Label get or set the label text.
  • TextBackgroundColor get or set the background color of the panel's label.
  • TextColor get or set the text color of a panel's label.

Overridden public properties (XrwRectObj)

  • BorderWidth is now read only.
  • FrameWidth is now read only.

New public methods

  • TextBoxArea calculate the panel's label display area.
  • DialogLauncherArea calculate the panel's dialog launcher button area.
  • InsideDialogLauncherBoundings check whether the indicated point is inside the panel's dialog launcher button area.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (command controls and control groups with regard to their PreferredSize, but not ExpandToAvailableWidth, ExpandToMaxSiblingWidth, ExpandToAvailableHeight and ExpandToMaxSiblingHeight and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • Redraw() redraw the gadget.

New  event handler

None.

Overridden event handler (XrwRectObj)

None.

New preregistered event delegates

None.

Usage

The XrwRibbonPanel is designed to create a ribbon panel with minimum effort.

XrwRibbonPanel panelLargeButtons = XrwRibbonPanel.NewRibbonPanel (dialogtestTab,
                                                                     "Large buttons");
if (panelLargeButtons != null)
{
    dialogtestTab.AddChild (panelLargeButtons);
    panelLargeButtons.ButtonRelease += delegate(XrwRectObj source, XrwButtonEvent e)
    {
        ApplicationFramework.WriteStatus ("XrwRibbonPanel '" + panelLargeButtons.Label +
                                          "' dialog launcher clicked.");
    };

    // Add command controls and/or control groups.
}

XrwRibbonTab

The XrwRibbonTab is the highest level of application command control arrangement and should offer a clear, obvious, and unique mapping between the descriptive ribbon tab's label and the command controls that reside inside them. It organizes the features of an application to aid discoverability.

Because the ribbon is implemented as one integral widget, almost all of its children (including the ribbon tab) are implemented as gadgets. The ribbon tab is a ribbon child, that provides the functionality similar to a notebook tab to the ribbon.

Ribbon tabs are used for commands that affect the content of the window. Examples include commands used to present, format, modify, or use the content of a file or storage, or change the view. (By contrast, the application menu is used to present commands that involve doing something to or with a file or storage, such as commands that traditionally go in the file menu to create, open, and save, to print, and to send or publish data.)

The XrwRibbonTab has a fixed height and expands always to the ribbon's full width.

This class has no public constructor, but a static factory method. NewRibbonTabGadget creates a new empty XrwRibbonTab instance.

See the image of XrwRibbon for a sample picture of ribbon tabs.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwRibbonTab

New event definitions

XrwRibbonTab is always instantiated as gadget. It can only receive events that are forwarded from a parent widget.

None.

New public properties

Name Type Access Default/Fallback
Label string get, set  
HeaderFocused bool get, set false
Selected bool get, set false
  • Label get or set the label text.
  • HeaderFocused get or set whether the ribbon tab's header is currently focused.
  • Selected get or set whether the ribbon tab is currently selected.

Overridden public properties (XrwRectObj)

  • BorderWidth is now read only.
  • FrameWidth is now read only.

New public methods

  • TabHeaderPreferredSize get the preferred size of the ribbon tab's header.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (ribbon panels with regard to their PreferredSize, but not ExpandToAvailableWidth, ExpandToMaxSiblingWidth, ExpandToAvailableHeight and ExpandToMaxSiblingHeight and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • Redraw() redraw the gadget.

Overridden public methods (XrwComposite)

  • AddChild() add the indicated XrwRobbonPanel to the list of children at tail position. There is no check to prevent multiple additions of the same child. Ignores null poiter. Selects the last added child.
  • InsertChild() add the indicated XrwRibbonPanel to the list of children at indicated position (or at tail position as fallback). There is no check to prevent multiple additions of the same child. Ignores null poiter. Selects the last added child.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

None.

Usage

The XrwRobbonTab is designed to create a ribbon tab with minimal effort.

XrwRibbonTab dialogtestTab = XrwRibbonTab.NewRibbonTab (ribbon, "Dialog test");
if (dialogtestTab != null)
{
    ribbon.AddChild (dialogtestTab);

    // Add ribbon panels.
} 

XrwViewport

The XrwViewport class is a scrollable viewing area widget. It is comparable to Athena's "Viewport" widget.

The Athena's description for "Viewport" says (X Window System Athena Widgets, Quick Reference Guide):
The Viewport widget consists of a frame window, one or two Scrollbars, and an inner window (usually containing a child widget). The size of the frame window is determined by the viewing size of the data that is to be displayed and the dimensions to which the Viewport is created. The inner window is the full size of the data that is to be displayed and is clipped by the frame window. The Viewport widget controls the scrolling of the data directly. No application callbacks are required for scrolling. When the geometry of the frame window is equal in size to the inner window, or when the data does not require scrolling, the Viewport widget automatically removes any scrollbars. The "forceBars" option causes the Viewport widget to display all scrollbars permanently.

A XrwViewport uses four internal widgets - a Clip widget (realized by an XrwSimple), that clips the invisible area of the controlled Child - a VScroll widget (realized by a vertical XrwScroll), that controlles the vertical position of the Child - a HScroll widget (realized by a horizontal XrwScroll), that controlles the horizontal position of the Child - and the controlled Child. The Child is the only user defined widget and must be assigned via AddChild() or InsertChild() and can be any XrwCore or derived class.

This class has no public constructor, but two factory methods. NewViewportWidget/NewViewportGadged create a new XrwViewport.

The image shows the general capabilities of a XrwViewport.

Starting with this version the XrwViewport has a new integral part, the XrwViewportGridViewHeader widget - it will be created and destroed by the XrwViewport automatically. The XrwViewportGridViewHeader is responsible for the display of the column header names of an XrwViewport's but has no internal header data. It takes the header data from the Child instead. The Child property supports any XrwCore or derived class, but only for a Child implementing the XrwIGridView interface, the XrwViewportGridViewHeader shows column header names, otherwise it remains empty. Irrespective whether the Child is implementing the XrwIGridView interface, the header can be visible, hidden or collpsed, controlled by the HeaderVisibility property, and the header's preferred size can be defined, controlled by the HeaderPreferredHeight property.

Currently the  XrwList and  XrwTree implement the XrwIGridView interface.

The image shows the general capabilities of a XrwViewport including a XrwViewportGridViewHeader.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwConstraint --> XrwViewport

New event definitions

XrwViewport can be instantiated as widget or gadget. The widget can receive events on it's own (has a window on X server side). The gadget can only receive events that are forwarded from a parent widget.

None.

New public properties

Name Type Access Default/Fallback
AllowHoriz bool get, set true
AllowVert bool get, set true
Child XrwCore get null
Clip XrwSimple get != null
ClipFrameType TFrameType get, set TFrameType.None
ClipFrameWidth int get, set 0
ForceBars bool get, set false
HeaderBackground-
ColorDark
TPixel get, set XrwTheme.Interactive-
BackgroundColorDark
HeaderBackground-
ColorLight
TPixel get, set XrwTheme.Interactive-
BackgroundColorLight
HeaderBackground-
ColorMedium
TPixel get, set XrwTheme.Interactive-
BackgroundColorMedium
HeaderPreferredHeight int get, set 16
HeaderVisibility Visibility get, set Visibility.Collapsed
HScroll XrwScroll get != null
VScroll XrwScroll get != null
ScrollFrameType TFrameType get, set TFrameType.None
ScrollFrameWidth int get, set XrwTheme.NonInteracting-
FrameWidth
UseBottom bool get, set true
UseRight bool get, set true
ShowHScroll bool get  
ShowHScroll bool get  
ScrollOffsetX int get  
ScrollOffsetY int get  
  • AllowHorz distinguish between allowed/prohibited visibility of horizontal scroll bar.
  • AllowVert distinguish between allowed/prohibited visibility of vertical scroll bar.
  • Child get the controlled (scrolled) child widget, formerly set with SetChild()/InsertChild() or null.
  • Clip get the widget, that realizes clipping for the child.
  • ClipFrameType get or set the frame type of the clip widget.
  • ForceBars distinguishe between always forced or automatic (if needed) visibility of scroll bars.
  • HeaderBackgroundColorDark get or set the grid view's column header background color pixel 3/3.
  • HeaderBackgroundColorLightm get or set the grid view's column header background color pixel 1/3.
  • HeaderBackgroundColorMedium get or set the grid view's column header background color pixel 2/3.
  • HeaderPreferredHeight get or set the grid view's column header preferred height.
  • HeaderVisibility get or set the grid view's column header visibility.
  • HScroll get the widget, that realizes horizontal scrolling.
  • VScroll get the widget, that realizes vertical scrolling.
  • ScrollFrameType get or set the frame type of the scroll widgets.
  • ScrollFrameWidth get or set the frame width of the scroll widgets.
  • UseBottom distinguish between top or bottom aligned horizontal scroll bar.
  • UseRight distinguish between left or right aligned vertical scroll bar.
  • ShowHScroll get whether horizontal scroll bar is currently visible.
  • ShowVScroll get whether vertical scroll bar is currently visible.
  • ScrollOffsetX get the offset of the child's first column x coordinate. It is negative, if the child has been scrolled horizontally.
  • ScrollOffsetY get the offset of the child's first row y coordinate. It is negative, if the child has been scrolled vertically.

Overridden public properties (XrwComposite)

  • Children get the list of all direct children.

New public methods

  • RealizeChild() realize indicated child and unrealize (hide) formerly realized child.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (if any) with regard to their PreferredSize, ExpandToAvailableHeight, ExpandToMaxSiblingHeight, ExpandToAvailableWidth, and ExpandToMaxSiblingWidth and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore>)

  • Realize() allocate and map the resources of the associated window (if object is a widget/has own window) on the X server. Makes the object visible.

Overridden public methods (XrwComposite)

Although XrwViewport is derived from XrwComposite, only ONE child is supported.

  • AddChild() add the indicated XrwCore to the list of children at tail position. There is no check to prevent multiple additions of the same child. Removes the previous child (only one child as acceptable). Ignores null poiter.
  • InsertChild() add the indicated XrwCore to the list of children at indicated position (or at tail as fallback). There is no check to prevent multiple additions of the same child. Removes the previous child (only one child as acceptable). Ignores null poiter.
  • RemoveChild() remove the indicated XrwCore from the list children. Ignores null poiter.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

The XrwViewport registers no event handler on it's own, but it registeres a ScrollResponse event handler to each XrwScrollbar child.

  • ThumbMoved += HandleHScrollResponseDefault and ThumbMoved += HandleVScrollResponseDefault on the XrwScrollbar children update the position of the controlled child.

Usage

See article Unlesh the power of list and tree widget (X11) for sample code and detailed information about application.

XrwBaseCellEditorShell

 The XrwBaseCellEditorShell is an abstract base class for popup cell editors, that are required for in-place editing of XrwList and XrwTree. It implements XrwICellEditorShell.

The base cell editor shell is used to determine the appropriate cell editor for a list's or tree's column in-place editing. The editor pops up as an overlay to the column's cell to edit and must fit the cell's data type.

This class is abstract and can not be instantiated.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwShell --> XrwOverrideShell --> XrwBaseCellEditorShell.

New event definitions

None.

New public properties

Name Type Access Default/Fallback
Data object get, set != null
DataParent XrwCore get != null
DataBinding XrwBinding get != null
DataType System.Type get != null
InitialDataValue object get != null
  •  Data (implements XrwICellEditorShell) get or set the data to edit.
  •  DataParent (implements XrwICellEditorShell) get or (internal only) set the widget/gadget that ist the source of the data to edit.
  •  DataBinding (implements XrwICellEditorShell) get or (internal only) set the binding to the data's property to edit.
  •  DataType (implements XrwICellEditorShell) get or (internal only) set the data type to edit.
  •  InitialValue (implements XrwICellEditorShell) get or (internal only) set the initial data value (before editing).

Overridden public properties

None.

New public methods

  •  FindCellEditor() determines the appropriate cell editor for a list's or tree's column in-place editing.

Overridden public methods

None.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

None.

XrwGenericCellEditorShell

The XrwGenericCellEditorShell provides a popup cell editor for in-place editing of XrwList's and XrwTree's text value cell.

The generic cell editor shell is used as popup text value editor for in-place editing of list or tree cells.

This class has no public constructor, but a static factory method. NewGenericCellEditorShell creates a new empty XrwGenericCellEditorShell instance. Typically it is not necessary to call the factory method from user code, because the XrwBaseCellEditorShell's static FindCellEditor method creates an instance, if required.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwShell --> XrwOverrideShell --> XrwBaseCellEditorShell --> XrwGenericCellEditorShell.

New event definitions

None.

New public properties

None.

Overridden public properties

None.

New public methods

None.

Overridden public methods (XrwRectObj)

  •  CalculateChildLayout() distribute the available size to the children (text editor). The editor shell pops up as an overlay to the column's cell to edit and must fit the cell's dimension.

New event handler

None.

Overridden event handler

None.

Preregistered event delegates

  • FocusOut += HandleFocusOutDefault unrealize this XrwGenericCellEditorShell.

XrwRibbonAppMenu

The XrwRibbonAppMenu is the popup application menu of a XrwRibbon, displaying XrwSmes.

The application menu is used to present commands that involve doing something to or with a file or storage, such as commands that traditionally go in the file menu to create, open, and save, to print, and to send or publish data. (By contrast, ribbon tabs are used for commands that affect the content of the window. Examples include commands used to present, format, modify, or use the content of a file or storage, or change change the view.)

This class has no public constructor, but a static factory method. NewRibbonAppMenu creates a new empty XrwRibbonAppMenu instance. Typically it is not necessary to call the factory method from user code, because the XrwRibbon class always creates an application menu by default.

Since the XrwRibbonAppMenu is derived from XrwOverrideShell, it uses XrwOverrideShell's mechanism to registeres itself on Realize() to the XrwApplicationShell's associated shells list (as override shell) to get events forwarded and to deregister itself on Unrealize() from the XrwApplicationShell's associated shells list to stop event forwarding.

The image shows a XrwRibbonAppMenu containing a command panel and a details panel.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwShell --> XrwOverrideShell --> XrwRibbonAppMenu

New event definitions

XrwRibbonAppMenu is always instantiated as widget. It can receive events on it's own (has a window on X server side).

None.

New public properties

Name Type Access Default/Fallback
ChildAlign float get, set 0.5
CommandPanel XrwBox get != null
DetailsPanel XrwBox get != null
HorzSpacing long get, set 10
UnrealizeTimeStamp XrwScroll get != null
  • ChildAlign get or set the horizontal alignment of CommandPanel's and DetailPanel's children, that do not expand to available width. 0.0 aligns left, 0.5 aligns center and 1.0 right. The value can not underflow 0.0 or overflow 1.0. The alignment is operative only if there is space left to align. (That means expand-to-max-siblings-* doesn't use the complete space and expand-to-available-* is not set for any child.)
  • CommandPanel get the command pannel (left application menu pannel).
  • DetailsPanelget the details pannel (right application menu pannel).
  • HorzSpacing get or set the horizontal spacing between command panel and a details panel. The value can not underflow 0 or overflow 400.
  • UnrealizeTimeStamp get the timestamp (ms + s * 1000 + m * 60000 + h * 3600000) of the last Unrealize() call. This can be used to distinguish between undesired and desired Realize() calls after a previous Unrealize() call.

Overridden public properties

None.

New public methods

None.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() distribute the available size to the children (command panel and a details panel) with regard to their PreferredSize, ExpandToAvailableHeight, ExpandToMaxSiblingHeight, ExpandToAvailableWidth, and ExpandToMaxSiblingWidth and set the AssignedSize and AssignedPosition.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • Redraw() redraw the widget/gadget.
  • Realize()allocate and map the resources of the associated window (if object is awidget/has own window) on the X server. Makes the object visible.
  • Unrealize()unmap and free the resources of the associated window (if object is a widget/has own window) on the X server. Makes the object in visible.

Overridden public methods (XrwComposite)

  • AddChild() not supported. The only permanant child is the horizontal box containing CommandPanel and DetailPanel.
  • InsertChild() not supported. The only permanant child is the horizontal box containing CommandPanel and DetailPanel
  • RemoveChild() not supported. The only permanant child is the horizontal box containing CommandPanel and DetailPanel.
  •  

New event handler

None.

Overridden event handler (XrwRectObj)

None.

New preregistered event delegates

  • Enter += HandleEnterDefault set focused.
  • Leave += HandleLeaveDefault unset focused.
  • FocusIn += HandleFocusInDefault HandleCommandPannelChildAddedDefault.
  • FocusOut += HandleFocusOutDefault unrealize this XrwSimpleMenu.
  • Motion += HandleMotionDefault set or unset appropriate XrwSme's focus and call InvokeRedraw().
  • ButtonRelease += HandleButtonReleaseDefault all appropriate XrwSme's OnButtonRelease().
  • CommandPanel.ChildAdded += HandleCommandPannelChildAddedDefault register the XrwRibbonAppMenu.HandleCommandButtonReleaseDefault to the new command panel child and adjust the style (colors, margins, ...) if new command panel child is of type XrwSme. The XrwRibbonAppMenu.HandleCommandButtonReleaseDefault event handler calls Unrealize() for the XrwRibbonAppMenu.
  • DetailsPanel.ChildAdded += HandleDetailsPannelChildAddedDefault register the XrwRibbonAppMenu.HandleDetailsPannelChildAddedDefault to the new details panel child and adjust the style (colors, margins, ...) if new details panel child is of type XrwSme. The XrwRibbonAppMenu.HandleCommandButtonReleaseDefault event handler calls Unrealize() for the XrwRibbonAppMenu.

Usage

The XrwRibbonAppMenu is designed to create a ribbon application menu with minimal effort. This is the complete code to create an application menu as shown in the image above.

XrwBox commandPanel = ribbon.ApplicationMenu.CommandPanel;
if (commandPanel != null)
{
    // Prepare the images - except for WinMidori.
    X11Graphic appmenuGraphicNew     = (XrwTheme.Style == XrwTheme.GeneralStyle.WinMidori ?
        null : XrwTheme.GetGraphic ( _display, _screenNumber, X11Graphic.StockIcon.RibbonNew));
    X11Graphic appmenuGraphicOpen    = (XrwTheme.Style == XrwTheme.GeneralStyle.WinMidori ?
        null : XrwTheme.GetGraphic ( _display, _screenNumber, X11Graphic.StockIcon.RibbonOpen));
    X11Graphic appmenuGraphicSave    = (XrwTheme.Style == XrwTheme.GeneralStyle.WinMidori ?
        null : XrwTheme.GetGraphic ( _display, _screenNumber, X11Graphic.StockIcon.RibbonSave));
    X11Graphic appmenuGraphicSaveAs  = (XrwTheme.Style == XrwTheme.GeneralStyle.WinMidori ?
        null : XrwTheme.GetGraphic ( _display, _screenNumber, X11Graphic.StockIcon.RibbonSaveAs));
    X11Graphic appmenuGraphicOptions = (XrwTheme.Style == XrwTheme.GeneralStyle.WinMidori ?
        null : XrwTheme.GetGraphic ( _display, _screenNumber, X11Graphic.StockIcon.RibbonOptions));
    X11Graphic appmenuGraphicClose   = (XrwTheme.Style == XrwTheme.GeneralStyle.WinMidori ?
        null : XrwTheme.GetGraphic ( _display, _screenNumber, X11Graphic.StockIcon.RibbonClose));
    X11Graphic appmenuGraphicExit    = (XrwTheme.Style == XrwTheme.GeneralStyle.WinMidori ?
        null : XrwTheme.GetGraphic ( _display, _screenNumber, X11Graphic.StockIcon.RibbonExit));

    // Menu entry "New".
    XrwSme appmenuNew     = XrwSme.NewSmeGadget (ribbon.ApplicationMenu, "New",
        appmenuGraphicNew,     (appmenuGraphicNew    != null ? true : false), null, false);
    commandPanel.AddChild (appmenuNew);
    
    // Menu entry "Open" and delimiter.
    XrwSme appmenuOpen    = XrwSme.NewSmeGadget (ribbon.ApplicationMenu, "Open",
       appmenuGraphicOpen,    (appmenuGraphicOpen   != null ? true : false), null, false);
    commandPanel.AddChild (appmenuOpen);
    appmenuOpen.ButtonRelease += HandleFileSelectionDialogButtonRelease;
    appmenuOpen.FrameType  = TFrameType.MenuDelimiter;
    appmenuOpen.FrameWidth = (XrwTheme.Style == XrwTheme.GeneralStyle.WinClassic ? 2 : 1);
    
    // Menu entry "Save".
    XrwSme appmenuSave    = XrwSme.NewSmeGadget (ribbon.ApplicationMenu, "Save",
        appmenuGraphicSave,    (appmenuGraphicSave   != null ? true : false), null, false);
    commandPanel.AddChild (appmenuSave);
    
    // Menu entry "Save as" and delimiter.
    XrwSme appmenuSaveAs  = XrwSme.NewSmeGadget (ribbon.ApplicationMenu, "Save as",
        appmenuGraphicSaveAs,  (appmenuGraphicSaveAs != null ? true : false), null, false);
    commandPanel.AddChild (appmenuSaveAs);
    appmenuSaveAs.ButtonRelease += HandleFileSelectionDialogButtonRelease;
    appmenuSaveAs.FrameType  = TFrameType.MenuDelimiter;
    appmenuSaveAs.FrameWidth = (XrwTheme.Style == XrwTheme.GeneralStyle.WinClassic ? 2 : 1);
    
     // Menu entry "Options".
    XrwSme appmenuOptions = XrwSme.NewSmeGadget (ribbon.ApplicationMenu, "Options",
        appmenuGraphicOptions, (appmenuGraphicOptions != null ? true : false), null, false);
    commandPanel.AddChild (appmenuOptions);
    
    // Menu entry "Close" and delimiter.
    XrwSme appmenuClose   = XrwSme.NewSmeGadget (ribbon.ApplicationMenu, "Close",
        appmenuGraphicClose,   (appmenuGraphicClose   != null ? true : false), null, false);
    commandPanel.AddChild (appmenuClose);
    appmenuClose.FrameType  = TFrameType.MenuDelimiter;
    appmenuClose.FrameWidth = (XrwTheme.Style == XrwTheme.GeneralStyle.WinClassic ? 2 : 1);
    
     // Menu entry "Exit".
    XrwSme appmenuExit    = XrwSme.NewSmeGadget (ribbon.ApplicationMenu, "Exit",
        appmenuGraphicExit,    (appmenuGraphicExit    != null ? true : false), null, false);
    commandPanel.AddChild (appmenuExit);
    appmenuExit.ButtonRelease += HandleCloseButtonRelease;
}
XrwBox detailsPanel = ribbon.ApplicationMenu.DetailsPanel;
if (detailsPanel != null)
{
    XrwLabel recentDocuments = XrwLabel.NewLabelGadget (detailsPanel, "Recent documents",
        null, false, null, false);
    detailsPanel.AddChild (recentDocuments);
    XrwSme recentDoc1 = XrwSme.NewSmeGadget (detailsPanel, "File 1", null, false, null, false);
    detailsPanel.AddChild (recentDoc1);
    XrwSme recentDoc2 = XrwSme.NewSmeGadget (detailsPanel, "File 2", null, false, null, false);
    detailsPanel.AddChild (recentDoc2);
}

XrwSimpleMenu

The XrwSimpleMenu class is a popup shell, displaying XrwSmes. It is comparable to Athena's "SimpleMenu".

The Athena's description for "SimpleMenu" says (Athena Widget Set — C Language Interface):
The SimpleMenu widget is a container for the menu panes. It is a direct subclass of shell, and is should be created with XtCreatePopupShell(), not XtCreateManagedWidget(). This is the only part of the menu that actually is associated with a window, since each menu pane is a gadget. The SimpleMenu serves as the glue to bind the individual menu entries together into one menu.

This class has no public constructor, but a static factory method. NewSimpleMenu creates a new empty XrwSimpleMenu instance. Typically it is not necessary to call the factory method from user code, because the XrwMenuButton and XrwRibbonSplitButton class always create an simple menu by default.

Since the XrwSimpleMenu is derived from XrwOverrideShell, it uses XrwOverrideShell's mechanism to registeres itself on Realize() to the XrwApplicationShell's associated shells list (as override shell) to get events forwarded and to deregister itself on Unrealize() from the XrwApplicationShell's associated shells list to stop event forwarding.

The image shows a XrwSimpleMenu containing two XrwSmes.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwShell --> XrwOverrideShell --> XrwSimpleMenu

New event definitions

XrwSimpleMenu is always instantiated as widget. It can receive events on it's own (has a window on X server side).

None.

New public properties

Name Type Access Default/Fallback
UnrealizeTimeStamp long get 0
VertSpacing int get, set 0
  • UnrealizeTimeStamp get the timestamp (ms + s * 1000 + m * 60000 + h * 3600000) of the last Unrealize() call. This can be used to distinguish between undesired and desired Realize() calls after a previous Unrealize() call.
  • VertSpacing get or set the vertical spacing between two neighbouring children.

Overridden public properties

None.

New public methods

  • CalculateChildLayout() calculates the layout of all children and composes the menu geometry thereof. This method doesn't override XrwRectObj's CalculateChildLayout because it requires no parameters.

Overridden public methods (XrwRectObj)

  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • Realize()allocate and map the resources of the associated window (if object is awidget/has own window) on the X server. Makes the object visible.
  • Unrealize()unmap and free the resources of the associated window (if object is a widget/has own window) on the X server. Makes the object in visible.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

  • FocusIn += HandleFocusInDefault nothing.
  • FocusOut += HandleFocusOutDefault unrealize this XrwSimpleMenu.
  • Motion += HandleMotionDefault set or unset appropriate XrwSme's focus and call InvokeRedraw().
  • ButtonPress += HandleButtonPressDefault process all appropriate XrwSme's OnButtonPress().
  • ButtonRelease += HandleButtonReleaseDefault process all appropriate XrwSme's OnButtonRelease().
  • ChildAdded += HandleChildAddedDefault registers the XrwSimpleMenu.HandleChildButtonReleaseDefault to the new child. This event handler calls Unrealize() for the XrwSimpleMenu.

Usage

A XrwSimpleMenu is typically used in conjunction with a XrwMenuButton. See XrwMenuButton for details about the use of XrwSimpleMenu.

XrwDropDownCellEditorShell

 The XrwDropDownCellEditorShell provides a popup cell editor for in-place editing of XrwList's and XrwTree's enumerable value cell. It implements XrwICellEditorShell.

The drop down cell editor shell is used as popup enumerable value editor for in-place editing of list or tree cells.

This class has no public constructor, but a static factory method. NewDropDownCellEditorShell creates a new empty XrwDropDownCellEditorShell instance. Typically it is not necessary to call the factory method from user code, because the XrwBaseCellEditorShell's static FindCellEditor method creates an instance, if required.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwShell --> XrwOverrideShell --> XrwSimpleMenu --> XrwDropDownCellEditorShell.

New event definitions

None.

New public properties

Name Type Access Default/Fallback
Data object get, set != null
DataParent XrwCore get != null
DataBinding XrwBinding get != null
DataType System.Type get != null
InitialDataValue object get != null
  •  Data (implements XrwICellEditorShell) get or set the data to edit.
  •  DataParent (implements XrwICellEditorShell) get or (internal only) set the widget/gadget that ist the source of the data to edit.
  •  DataBinding (implements XrwICellEditorShell) get or (internal only) set the binding to the data's property to edit.
  •  DataType (implements XrwICellEditorShell) get or (internal only) set the data type to edit.
  •  InitialValue (implements XrwICellEditorShell) get or (internal only) set the initial data value (before editing).

Overridden public properties

None.

New public methods

None.

Overridden public methods

None.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

  • FocusOut += HandleFocusOutDefault unrealize this XrwDropDownCellEditorShell.
  • ButtonRelease += HandleMenuButtonReleasetDefault assumes the selected XrwSme's value.

XrwSpinMenu

The XrwSpinMenu class is is a popup shell, displaying XrwSmes. If there is not enough space to display the all XrwSmes, the content can be scrolled.

The XrwSpinMenu class is a subclass of XrwSimpleMenu. It is the only part of the menu that actually is associated with a window, since each menu pane is a gadget. The XrwSpinMenu serves as the glue to bind the individual menu panes together into one menu. Different to XrwSimpleMenu it can organize more menu panes than displayable on its visible area. In that case it can spin invisible menu panes to the visible area and visible menu panes to the invisible area - wherefore it shows two spin navigators (forth and back) dynamically, if required.

This class has no public constructor, but a static factory method. NewSpinMenu creates a new empty XrwSpinMenu instance. Typically it is not necessary to call the factory method from user code, because the XrwComboBox class always creates an spin menu by default.

Since the XrwSpinMenu is derived from XrwOverrideShell (via XrwSimpleMenu), it uses XrwOverrideShell's mechanism to registeres itself on Realize() to the XrwApplicationShell's associated shells list (as override shell) to get events forwarded and to deregister itself on Unrealize() from the XrwApplicationShell's associated shells list to stop event forwarding.

The image shows a XrwSpinMenu containing 10 menu pane XrwSmes and the back and forth navigators.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwShell --> XrwOverrideShell --> XrwSimpleMenu --> XrwSpinMenu

New event definitions

XrwSpinMenu is always instantiated as widget. It can receive events on it's own (has a window on X server side).
None.

New public properties

Name Type Access Default/Fallback
ChildCountWithoutNavigators int get  
Back XrwSme get  
Forth XrwSme get  
ShowNavigators bool get false
VisibilityStartOffset int get, set 0
VisibilityEndOffset int get, set  
  • ChildCountWithoutNavigators get the number of menu panes, excluding the navigators. This is much faster than a call to Children.Count (because the navigators must be excluded fom the list of children).
  • Back get the back navigator XrwSme.
  • Forth get the forth navigator XrwSme.
  • ShowNavigators get the current internal state whether to show navigators or not.
  • VisibilityStartOffset get or set the index of the first non-navigator menu pane to show. This index is not calculated by the XrwSimpleMenu itself, it must be calculated and set by the caller.
  • VisibilityEndOffset get or set the index of the last non-navigator menu pane to show. This index is not calculated by the XrwSimpleMenu itself, it must be calculated and set by the caller.

Overridden public properties (XrwComposite)

  • Children get the list of all direct children, excluding the navigators.

New public methods

  • IndexOfWithoutNavigarors() searches for the specified child and returns the zero-based index of the first occurrence within the entire child list. Since the forth and back navigators are the first two children, the Value chould be equal to IndexOf() - 2.

Overridden public methods (XrwRectObj)

  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.
  • CalculateChildLayout() distribute the available size to the children (if any) with regard to their PreferredSize, ExpandToAvailableHeight, ExpandToMaxSiblingHeight, ExpandToAvailableWidth, and ExpandToMaxSiblingWidth and set the AssignedSize and AssignedPosition.

Overridden public methods (XrwCore)

  • Realize()allocate and map the resources of the associated window (if object is awidget/has own window) on the X server. Makes the object visible.

New  event handler

None.

Overridden event handler

None.

New preregistered event delegates

  • Back.ButtonRelease += HandleBackButtonRelease() scroll the visible menu panes back.
  • Forth.ButtonRelease += HandleForthButtonRelease() scroll the visible menu panes forth.

Usage

A XrwSpinMenu is typically used in conjunction with a XrwComboBox. See XrwComboBox source code for details about the use of XrwSpinMenu within user defined controls.

XrwDialogShell

The XrwDialogShell class is the base class for dialog box popups.

Xrw typically treats a dialog as a window split vertically. The top section is called "content area" and the bottom section is called "action area". A XrwDialogShell can be implemented modal (application blocking) or non-modal.

This class is abstract and must be inherited by an application's dialog window.

The image shows the standard XrwMessageBox, that is a predefined inheritance of the XrwDialogShell. It's "content area" contains a XrwLabel and it's "action area" contains two XrwCommands.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwComposite --> XrwShell --> XrwWmShell --> XrwTransientShell --> XrwDialogShell

New event definitions

XrwDialogShell is always instantiated as widget. It can receive events on it's own (has a window on X server side).
None.

New event definitions

The XrwDialogShell always receives events on it's own.

  • DialogShellEnd occures after the windows manager requests the to XrwDialogShell close or any dialog internal command forces the XrwDialogShell to close.

New public properties

None.

Overridden public properties

None.

New public methods

None.

Overridden public methods

None.

New event handler

  • OnEnd() handle the close ClientMessage event.

Overridden event handler

None.

New preregistered event delegates

None.

Points of Interest

It was surprising how little effort is required to create a simple widget set with an attractive design.
This work should also animate other programmers to deal with Mono on Linux or Linux-like platforms.

History

This article has been split-off from the article Programming the Roma Widget Set (C# X11) - a zero dependency GUI application framework - Part 1, Basics with the third public version of the Roma widget set, version from 07. March 2014.
The fourth public version of the Roma widget set is version from 13. May 2014.
The fifth public version of the Roma widget set is version  from 15. August 2014.
The sixth public version of the Roma widget set is version from 03. October 2014.
The seventh public version of the Roma widget set is version  from 14. December 2014.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Steffen Ploetz
CEO Ploetz + Zeller GmbH
Germany Germany
I am CEO at Ploetz + Zeller GmbH, Munich Germany (www.p-und-z.com)
 
Ploetz + Zeller GmbH is a consulting and software services company committed to pro-active and professional governance and optimization of our clients' company processes. Furthermore it offers Symbio (www.symbioworld.com) software, a very powerful and easy to use business process management suite.
 
My responsibilities range from product ownership of Symbio via responsibility for the architecture of some Symbio software components to implementation of software core parts (e. g. automatic layout).
 
I started programming 1986 with C64 BASIC and came via Pascal, Turbo Pascal, C, Turbo C, C++ and Java to C#. I like the potential of C++ very much, but now my favorite language is C#.
 
I believe a lot in free knowledge sharing. I'm author at German Wikipedia and, after 10 years of passive membership, author at CODE PROJECT.

Comments and Discussions

 
QuestionIs this supported for COSMOS? Pinprofessionaladriancs31-Mar-14 21:55 
AnswerRe: Is this supported for COSMOS? PinprofessionalSteffen Ploetz31-Mar-14 22:32 
AnswerMy vote of 5 PinprofessionalChristian Amado31-Mar-14 12:31 
GeneralRe: My vote of 5 PinprofessionalSteffen Ploetz31-Mar-14 20:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150224.1 | Last Updated 15 Aug 2014
Article Copyright 2014 by Steffen Ploetz
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid