Click here to Skip to main content
11,719,753 members (87,985 online)
Click here to Skip to main content

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

, 9 Mar 2015 CPOL 17.7K 10
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 simple widgets.

Introduction

This article contains the description of simple 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,
  •  available from version 0.7,
  •  disabled with version 0.8 and
  •  available from version 0.8.

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, ∅]
      ⌊ 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 described within this article. They include:

XrwObject:IDisposable ultimate base object[1, ∅]
⌊ 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 tree 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 the article Programming the Roma Widget Set (C# X11) - a zero dependency GUI application framework - Composite widgets. 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
        | ⌊ XrwFrame container[2/3], arranging just one single child
        | ⌊ 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[3], 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

XrwSimple

The XrwSimple class is a universal widget. It might be a good superclass to use for application specific widgets to write. It is comparable to Athena's "Simple" widget.

The Athena's description for "Simple" says (X Window System Athena Widgets, Quick Reference Guide):
The Simple widget is not very useful by itself, as it has no semantics of its own. It main purpose is to be used as a common superclass for the other simple Athena widgets. This widget adds five resources to the resource list provided by the Core widget and its superclasses.

This class has no public constructor, but two factory methods. NewSimpleWidget/NewSimpleGadget creates a new XrwSimple.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple

New event definitions

XrwSimple 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

None.

Overridden public properties

None.

New public methods

None.

Overridden public methods

None.

New event handler

None.

Overridden event handler

None.

Preregistered event delegates

None.

XrwColorChooserComb

The XrwColorChooserComb class arranges 127 colors and 26 gray shades as comb to choose the desired color. Such a class is unknown to Athena and GTK, it's prototype is the System.Windows.Forms "ColorDialog" available standard colors tab page.

The XrwColorChooserComb class is a widget that offers 127 colors and 26 gray shades, all are named X11 colors, to allow the user to choose a predefined color.

This class has no public constructor, but one static factory method. NewColorChooserCombWidget creates a new XrwColorChooserComb widget.

The image shows a XrwColorChooserComb with color moroon highlighted.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwColorChooderComb

New event definitions

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

  • 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.
  • SelectedColorHTML get the currently selected color as HTML name.

Overridden public properties

None.

New public methods

None.

Overridden methods (XrwRectObj)

  • 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.

Preregistered event delegates

  • Motion += HandleMotionDefault realizes highlighting effects.
  • ButtonPress+= HandleButtonPressDefault realizes color selection.

Usage

The sample code shows how to use a XrwColorChooserComb.

// Create a color chooser comb.
XrwColorChooserComb combStandardColors =
    XrwColorChooserComb.NewChooserColorCombWidget (parent, initialColorValue);
parent.AddChild (combStandardColors);

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

XrwImage

The XrwImage class shows, different to the XrwLabel,  one image only. It can show a marker, that points to a specific position inside the image. Such a class is unknown to Athena and GTK, it's prototype is the System.Windows.Forms "ColorDialog" hue and saturation selector.

The XrwImage shows one image only and, optionally a position marker.

This class has no public constructor, but two static factory methods. NewImageGadget/NewImageWidget create a new XrwImage.

The image shows a XrwImage with a marker inside the green color range.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwImage

New event definitions

XrwImage 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
Bitmap X11Graphic get null
BitmapShared bool get false
ImageOffset Point get  
MarkerPosition Point get, set {0, 0}
ShowMarker bool get, set false
  • Bitmap get the bitmap.
  • BitmapShared get the bitmap shared flag. Not shared bitmaps will be disposed by the XrwImage's Dispose(), shared bitmaps won't. Always use true for stock icons.
  • ImageOffset get the left top offset of the (centered) image (the image is always centered).
  • MarkerPosition get or set the marker position.
  • ShowMarker get or set whether to draw a marker at any image position.

Overridden public properties

None.

New public methods

  • SetBitmap() set the left bitmap and bitmap shared flag.

Overridden public methods (XrwRectObj)

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

New event handler

None.

Overridden event handler

None.

Preregistered event delegates

None.

Usage

The sample code shows how to use a XrwImage.

// Create the graphic to display.
X11Graphic    panelGraphic    = null;
byte[]        panelImage64k   = AlternativeBase64.Decode (COLORPANEL_BMP);
using (System.IO.Stream bmpStream = new System.IO.MemoryStream (panelImage64k, false))
{
    panelGraphic = new X11Graphic (parent.Surface.Display, parent.Surface.ScreenNumber,
                                   IntPtr.Zero, (TInt)_parent.Surface.Depth, bmpStream);
    bmpStream.Close ();
}

// Create an image.
XrwImage imageHueSaturation = XrwImage.NewImageWidget (parent, panelGraphic, false);
imageHueSaturation.ShowMarker = true;
parent.AddChild (imageHueSaturation);
            
// Register the delegate to get informed about any marker position change.
imageHueSaturation.Motion += delegate(XrwRectObj source, XrwMotionEvent e)
{
    if (e.Event.state != (TUint)EventMask.Button1MotionMask)
        return;
                
    // Process the new marker position.
    ...
};

XrwLabelBase

The XrwLabelBase class is the base class for static text display widgets and gadgets.

The XrwLabelBase class implements the fundamental functionality of a static text display. Such a class is unknown to Athena and GTK, but there are a lot of Xrw classes, that benefit from the fundamental functionality of a static text display, e.g. XrwLabel, XrwToggle, XrwComboBox or XrwTextSpinButton.

This class is abstract and can not be instantiated.

The XrwLabelBase can have different TextOverflowBehaviours, that define how to process text overflows:

  • Clip just clips the part of the text, that can't be displayed,
  • Ellipsis clips the part of the text, that can't be displayed, and draws the ellipsis sign ("..."),
  • AutolinebreakClip creates automatic linebreaks, if there is sufficient height, and clips the part of the text, that can't be displayed and
  •  AutolinebreakEllipsis creates automatic linebreaks, if there is sufficient height, clips the part of the text, that can't be displayed, and draws the ellipsis sign ("..."). 

The image shows the TextOverflowBehaviour.Ellipsis for a XrwMenuButton with poped up menu, that shows the complete text.

This version introduces markup, widely comparable with GTK's Pango Markup Language. The root tag of a marked-up text is <markup>, this allows to use markup and non-markup sections within one text. The supported markup tags are:

  • <span> with the attributes
    • foreground (an RGB color specification such as '#00FF00' or a color name such as 'red'),
    • background (an RGB color specification such as '#00FF00' or a color name such as 'red'),
    • underline (the values 'single', 'double' and 'low' are treated the same way like <u> and the value 'none' is treted like </u>),
    • strikethrough (the value 'true' is treted like <s> and the value 'false' is treted like </s>),
    • style (the values 'oblique' and 'italic' are treted like <i> and the value 'normal', is treted like </i>),
    • weight (the values 'bold', 'ultrabold' and 'heavy' are treted like <b> and the values 'normal', 'light' and 'ultralight' are treted like </b>),
    • size (the value 'larger' is treted like <big>, the value 'smaller' is treted like <small>, the values 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large' and 'xx-large' are transferred to the sizes 7, 8, 10, 12, 14, 18 and 24),
  • <u> for underline,
  • <s> for strikeout,
  • <i> for oblige (oblige is more common than italic for X11 fonts/fontsets),
  • <b> for bold,
  • <big> for a relatively larger font size and
  • <small> for a relatively smaller font size.

To process the markup, the text is tranformed into and stored as a styled character array. The styled character array can be transformed back to a markup. This process preferres

  • <u> over <span underline="single">, <span underline="double"> and <span underline="low">,
  • </u> over <span underline="none">,
  • <s> over <span strikethrough="true">,
  • </s> over <span strikethrough="false">,
  • <i> over <span style="oblique"> and <span style="italic">,
  • </i> over <span style="normal">,
  • <b> over <span weight="bold">, <span weight="ultrabold"> and <span weight="heavy">,
  • </b> over <span weight="normal">, <span weight="light"> and <span weight="ultralight">,
  • <big> over <span size="larger"> and
  • <small> over <span size="smaller">.

Most of the derived classes can utilize the markup, e. g. XrwLabel (as well as XrwToggle, XrwRadio, XrwComboBox, XrwTextSpinButton and XrwLabelAndColor):

The markup to achive this styled text looks like:

string markup = "<markup><i>Hello <b>App</b>!</i>\nWith<span strikethrough=\"true\">out</span> " +
                "<span foreground=\"#AA0000\" background=\"#AADDDD\">markup</span>, " +
                "<span foreground=\"#006600\" background=\"#DDCCDD\">multi lines</span> " +
                "<span underline=\"single\">and</span> " +
                "<span foreground=\"#6600AA\" background=\"#DDDDAA\">icons</span>!</markup>"

The markup, transformed back from styled character array, looks like:

"<i><span foreground="#000000">Hello <b>App</b>!</span></i>\n" +
"<span foreground="#000000">With<s>out</s> </span>" +
"<span foreground="#AAAA00" background="#AAAADD">markup</span>" +
"<span foreground="#000000">, </span>" +
"<span foreground="#000066" background="#DDDDCC">multi lines</span>" +
"<span foreground="#000000"> <u>and</u> </span>" +
"<span foreground="#666600" background="#DDDDDD">icons</span>" +
"<span foreground="#000000">!</span>

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase

New event definitions

None.

New public properties

Name Type Access Default/Fallback
Label string get, set  
Lines Multiline
StyleText
get != null
HorzTextAlign float get, set 0.5
VertTextAlign float get, set 0.5
Space int get 4
TextColor TPixel
TColor
get, set XrwTheme.TextColor
  FontData
DefaultFontData
X11FontData get != null
FontId IntPtr get != IntPtr.Zero
FontSpecification string get != ""
  • Label get or set the (multiple lines) label text to display (\n delimited lines).
  • Lines get the (multiple lines) label of style characters to display (\n has been transformed into lines).
  • HorzTextAlign get or set the horizontal text alignment. 0.0 aligns left, 0.5 aligns center and 1.0 right.
  • VertTextAlign get or set the vertical text alignment. 0.0 aligns top, 0.5 aligns middle and 1.0 bottom.
  • Space get the spacing around the label. Used from left bitmap to label (if != null), from label to right bitmap (if != null) and from label to top/bottom.
  • TextColor get or set the text color of the label.
  • FontData  DefaultFontData get the default font data. To set the default font data use SetDefaultFont() method.
  • FontId get the current font id.
  • FontSpecification get the current font specification.

Overridden public properties

None.

New public methods

None.

Overridden public methods (XrwCore)

  •   SetFont() SetDefaultFont() Call the base method and update the text measurements.

New event handler

None.

Overridden event handler

None.

Preregistered event delegates

None.

XrwComboBox

The XrwComboBox class implements a drop down selection calling button widget, that pops up an XrwSpinMenu via the button press event. It is comparable to Gtk's ComboBoxText.

A XrwComboBox is a widget that allows the user to choose from a list of valid choices. The XrwComboBox displays the selected choice. When activated, the XrwComboBox displays a XrwSpinMenu popup which allows the user to make a new choice.

This class has no public constructor, but one factory method. NewComboBoxWidget creates a new XrwComboBox.

This class incorporates a XrwSpinMenu to realize the selection popup (creation and disposal is handled automatically).

The image shows a XrwComboBox with left and right (transparent multicolor) bitmap as well as delimiter and right arrow.

This version introduces markup. See XrwLabelBase for details.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwComboBox

New event definitions

XrwComboBox 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
LeftMargin int get, set true
RightMargin int get, set true
FocusedBackground-
ColorDark
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorDark
FocusedBackground-
ColorLight
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorLight
FocusedBackground-
ColorMedium
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorMedium
DelimiterColorDark   TPixel
TColor
get, set XrwTheme.TextColor
DelimiterColorLight   TPixel
TColor
get, set XrwTheme.InverseTextColor
Focused bool get false
Pressed bool get, set false
Dropdown XrwSpinMenu get  
Selection int get, set false
  • LeftMargin get or set the space (in pixels) that will be lef free between the left edge and the content.
  • RightMargin get or set the space (in pixels) that will be lef free between the right edge and the content.
  • FocusedBackgroundColorDark get or set the focused background color 3/3.
  • FocusedBackgroundColorLight get or set the focused background color 1/3.
  • FocusedBackgroundColorMedium get or set the focused background color 2/3.
  • DelimiterColorDark get or set the delimiter color 2/2.
  • DelimiterColorLight get or set the delimiter color 1/2.
  • Focused get the focused indicator. A XrwComboBox is focused if it has input focus and the mouse pointer is placed inside the widget.
  • Pressed get or set the pressed indicator.
  • Dropdown get the associated XrwSpinMenu dropdown.
  • Selection get or set the index of the selected entry.

Overridden public properties

None.

New public methods

None.

Overridden public methods (XrwRectObj)

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

New event handler

None.

Overridden event handler

None.

Preregistered event delegates

  • Enter += HandleEnterDefault set focused.
  • Leave += HandleLeaveDefault unset focused.
  • ButtonPress+= HandleButtonPressDefault set pressed.
  • _dropdown.ChildAdded += HandleChildAddedDefault performs some configuration for XrwSme menu panes, added to the associated XrwSpinMenu dropdown.

For every added child of type XrwSme.

  • sme.ButtonRelease += HandleChildButtonRelease performs the button release action for XrwSme menu panes, added to the associated XrwSpinMenu dropdown.

Usage

The sample code shows how to create a XrwComboBox including four XrwSpinMenu entries.

// Prepare graphics for spin menu entries.
X11Graphic dropdownEntryGraphicA = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.Network16);
X11Graphic dropdownEntryGraphicB = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.Computer16);
X11Graphic dropdownEntryGraphicC = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.FolderClose16);
X11Graphic dropdownEntryGraphicD = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.FileGeneric16);

// Create combo box.
XrwComboBox comboBox = XrwComboBox.NewComboBoxWidget (parent);
comboBox.ExpandToAvailableHeight = true;
parent.AddChild (comboBox);
comboBox.Dropdown.AddChild (XrwSme.NewSmeGadget (comboBox.Dropdown,
    "A", dropdownEntryGraphicA, true, dropdownEntryGraphicA, true));
comboBox.Dropdown.AddChild (XrwSme.NewSmeGadget (comboBox.Dropdown,
    "B", dropdownEntryGraphicB, true, dropdownEntryGraphicB, true));
comboBox.Dropdown.AddChild (XrwSme.NewSmeGadget (comboBox.Dropdown,
    "C", dropdownEntryGraphicC, true, dropdownEntryGraphicC, true));
comboBox.Dropdown.AddChild (XrwSme.NewSmeGadget (comboBox.Dropdown,
    "D", dropdownEntryGraphicD, true, dropdownEntryGraphicD, true));
comboBox.Selection = 0; 

XrwLabel

The XrwLabel class implements a static label. It is comparable to Athena's "Label" widget.

The Athena's description for "Label" says (X Window System Athena Widgets, Quick Reference Guide):
A Label widget holds a graphic displayed within a rectangular region of the screen. The graphic may be a text string containing multiple lines of characters in an 8 bit or 16 bit character set (to be displayed with a font), or in a multi-byte encoding (for use with a fontset). The graphic may also be a bitmap or pixmap. The Label widget will allow its graphic to be left, right, or center justified. Normally, this widget can be neither selected nor directly edited by the user. It is intended for use as an output device only.

This class has no public constructor, but two factory methods. NewLabelWidget/NewLabelGadged create a new XrwLabel.

Use the XrwLabel WIDGET in case of of ANY changes (font, text, color, ...) during an uninterrupted display.
Use the XrwLabel GADGET in case of of NO changes (font, text, color, ...) during an uninterrupted display.   

The image shows a multi line XrwLabel with left and right (transparent multicolor) bitmap.

This version introduces four special string constants

  • TextToArrowString.Up,
  • TextToArrowString.Down,
  • TextToArrowString.Left and
  • TextToArrowString.Right,

that are - set as the widget/gadget's label - drawn as an arrow instead of a string. This behaviour is applied especially for XrwSpinBox and XrwSpinMenu but can also be useful for any other purpose.

This version introduces markup. See XrwLabelBase for details.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwLabel

New event definitions

XrwLabel 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
LeftMargin int get, set 4
RightMargin int get, set 4
LeftBitmap X11Graphic get null
LeftBitmapShared bool get false
LeftBitmapVertAlign float get, set 0.5
RightBitmap X11Graphic get null
RightBitmapShared bool get false
RightBitmapVertAlign float get, set 0.5
  • LeftMargin get or set the space (in pixels) that will be lef free between the left edge and the content.
  • RightMargin get or set the space (in pixels) that will be lef free between the right edge and the content.
  • LeftBitmap get the left bitmap.
  • LeftBitmapShared get the left bitmap shared flag. Not shared bitmaps will be disposed by the XrwLabel's Dispose(), shared bitmaps won't. Always use true for stock icons.
  • VertLeftBitmapAlign get or set the vertical left bitmap alignment. 0.0 aligns top, 0.5 aligns middle and 1.0 bottom.
  • LeftBitmapVertAlign get or set the vertical left bitmap alignment. 0.0 aligns top, 0.5 aligns middle and 1.0 bottom.
  • RightBitmap get the right bitmap.
  • RightBitmapShared get the right bitmap shared flag. Not shared bitmaps will be disposed by the XrwLabel's Dispose(), shared bitmaps won't. Always use true for stock icons.
  • VertRightBitmapAlign get or set the vertical right bitmap alignment. 0.0 aligns top, 0.5 aligns middle and 1.0 bottom.
  • RightBitmapVertAlign get or set the vertical right bitmap alignment. 0.0 aligns top, 0.5 aligns middle and 1.0 bottom.

Overridden public properties

None.

New public methods

  • SetLeftBitmap() set the left bitmap and bitmap shared flag.
  • SetRightBitmap() set the right bitmap and bitmap shared flag.

Overridden public methods (XrwRectObj)

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

New event handler

None.

Overridden event handler

  • OnClicked() handle the Clicked event.

Preregistered event delegates

None.

Usage

The sample code shows how to create a XrwLabe including four XrwSpinMenu entries.

// Prepare graphics for label.
X11Graphic labelGraphic = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.Information16);

// Create simple label and set individual properties.
XrwLabel labelStatus = XrwLabel.NewLabelWidget (parent,
    "Hello App!\nWith multi lines and icons.", labelGraphic, true, labelGraphic, true);
labelStatus.FrameType = TFrameType.Sunken;
labelStatus.FrameWidth = 1;
labelStatus.HorzTextAlign = 0.0F;
labelStatus.BorderWidth = 0;
labelStatus.VertTextAlign = 0.5F;
labelStatus.ExpandToAvailableWidth = true;
labelStatus.SetFont ("-misc-fixed-medium-r-semicondensed--13-*-*-*-*-*-iso10646-1");
parent.AddChild (labelStatus); 

XrwCommand

The XrwCommand class implements a command button widget, that calls a callback via the clicked event. It is comparable to Athena's "Command" widget.

The Athena's description for "Command" says (X Window System Athena Widgets, Quick Reference Guide):
The Command widget is an area, often rectangular, that contains text or a graphical image. Command widgets are often referred to as ‘‘push buttons.’’ When the pointer is over a Command widget, the widget becomes highlighted by drawing a rectangle around its perimeter. This highlighting indicates that the widget is ready for selection. When mouse button 1 is pressed, the Command widget indicates that it has been selected by reversing its foreground and background colors.
When the mouse button is released, the Command widget’s notify action is invoked, calling all functions on its callback list. If the pointer is moved off of the widget before the pointer button is released, the widget reverts to its normal foreground and background colors, and releasing the pointer button has no effect. This behavior allows the user to cancel an action.

This class has no public constructor, but one factory method. NewCommandWidget creates a new XrwCommand.

The first image shows a XrwCommand with left and right (transparent multicolor) bitmap.

The second image shows typical Gtk2 styled "Cancel" XrwCommand buttons - one with normal state and one highlighted - with -misc-fixed- font output, gradient background appearance and frame.

The third image shows "Cancel" XrwCommand buttons - one with normal state and one highlighted - with -*-helvetica- font output, flat background appearance (background without gradient) and frameless.

This version introduces markup. See XrwLabelBase for details. The fourth image shows "Cancel" XrwCommand buttons - one with normal state and one highlighted - with markup text, flat background appearance (background without gradient) and frameless.

To draw a command button with flat appearance, the SetBackgroundFlatHighlighting() method can be called. To draw a command button with gradient appearance, the SetBackgroundGradientHighlighting() method can be called. The gradient background appearance is the default.

The markup to achive this styled text looks like:

string markup = "<markup><u>C</u><span foreground=\"#AA0000\" background=\"#AADDDD\">an</span>" +
                "<b>c</b><span foreground=\"#6600AA\" background=\"#DDDDAA\">el</span></markup>"

If there is a need to provide an active link, this can be achieved by a flat borderless command button with markup text. The next image shows the same command button with an active link in normal state, highlighted and visited.

The code to achieve this looks like:

XrwCommand activeLink = XrwCommand.NewCommandWidget (hboxSpinNbTab,
    "<markup><span foreground=\"#2222FF\">Link</span></markup>", null, false, null, false);
hboxSpinNbTab.AddChild (activeLink);
activeLink.SetBackgroundFlatHighlighting ();
activeLink.FrameType   = TFrameType.None;
activeLink.FrameWidth  = 0;
activeLink.Clicked    += delegate(XrwRectObj source)
{
    string label = activeLink.Lines.TotalMarkupText (activeLink.Styles, activeLink.Surface);
    activeLink.Label = "<markup>" + label.Replace ("2222FF", "884488") + "</markup>";
};

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwLabel --> XrwCommand

New event definitions

XrwCommand 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
Focused bool get false
FocusedBackground-
ColorDark
TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorDark
FocusedBackground-
ColorLight
TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorLight
FocusedBackground-
ColorMedium
TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorMedium
  • Focused get the focused indicator. A XrwCommand is focused if it has input focus and the mouse pointer is placed inside the widget.
  • FocusedBackgroundColorDark get or set the focused background color 3/3.
  • FocusedBackgroundColorLight get or set the focused background color 1/3.
  • FocusedBackgroundColorMedium get or set the focused background color 2/3.

Overridden public properties

None.

New public methods

None.

New event handler

  • OnClicked() handle the Clicked event.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

Preregistered event delegates

  • Enter += HandleEnterDefault set focused.
  • Leave += HandleLeaveDefault unset focused.
  • ButtonPress+= HandleButtonPressDefault set pressed.
  • ButtonRelease+= HandleButtonReleaseDefault unset pressed and call OnClicked().
  • Execute_CommandDefault = new RelayCommand(Command_Execute_ActionDefault, Command_Execute_CanActionDefault) prepare default behaviour for key gesture binding.

Usage

The sample code shows how to create a simple XrwCommand including left (transparent multicolor) bitmap.

// Prepare graphics for command.
X11Graphic okGraphic = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.Ok16);

// Create command and set individual properties.
XrwCommand cbOk = XrwCommand.NewCommandWidget (parent, "OK", okGraphic, true, null, false);
cbOk.ExpandToMaxSiblingWidth = true;
cbOk.HorzTextAlign = 0.5F;
cbOk.ButtonRelease += HandleCbOkButtonRelease;
parent.AddChild (cbOk); 

XrwMenuButton

The XrwMenuButton class implements a popup menu calling button widget, that pops up an XrwSimpleMenu via the button press event. It is comparable to Athena's "MenuButton".

The X Toolkit Intrinsics's description for "MenuButton" says (Athena Widget Set — C Language Interface):
The MenuButton widget is an area, often rectangular, that displays a graphic. The graphic may be a text string containing multiple lines of characters in an 8 bit or 16 bit character set (to be displayed with a font), or in a multi-byte encoding (for use with a fontset). The graphic may also be a bitmap or pixmap.
When the pointer cursor is on a MenuButton widget, the MenuButton becomes highlighted by drawing a rectangle around its perimeter. This highlighting indicates that the MenuButton is ready for selection. When a pointer button is pressed, the MenuButton widget will pop up the menu named in the menuName resource.

This class has no public constructor, but one factory method. NewMenuButtonWidget creates a new XrwMenuButton.

This class incorporates a XrwSimpleMenu to realize the popup menu (creation and disposal is handled automatically).

The image shows a simple XrwMenuButton with left and right (transparent multicolor) bitmap - including it's poped up menu.

For details about background appearance and frame see XrwCommand.

This version introduces markup. See XrwLabelBase for details.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwLabel --> XrwCommand --> XrwMenuButton

New event definitions

XrwMenuButton 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
Menu XrwSimpleMenu get != null
  • Menu get or set the menu to pop up.
  • Menu get the associated menu to pop up. Starting with the menu is integral part of the XrwMenuButton, it will be automatically created and disposed with the XrwMenuButton.

Overridden public properties

None.

New public methods

None.

New event handler

None.

Overridden event handler

None.

Preregistered event delegates

Inherited from XrwCommand.

  • Enter += HandleEnterDefault set focused.
  • Leave += HandleLeaveDefault unset focused.
  • ButtonPress += HandleButtonPressDefault pop up registered XrwSimpleMenu.
  • ButtonRelease+= HandleButtonReleaseDefault unset pressed and call OnClicked().
  • Execute_CommandDefault = new RelayCommand(MenuButton_Execute_ActionDefault, MenuButton_Execute_CanActionDefault) prepare default behaviour for key gesture binding.

Usage

A XrwMenuButton is typically used in conjunction with a XrwSimpleMenu. See XrwSimpleMenu for class details.

The sample code shows how to create a menu button (that automatically creates it's associated simple menu), and to add three XrwSme entries.

// Create a menu button.
XrwMenuButton commandFileMenu = XrwMenuButton.NewMenuButtonWidget (hboxFileRibbon,
    "File", cbw0GraphicA, true, cbw0GraphicB, true);
hboxFileRibbon.AddChild (commandFileMenu);

// Prepare graphics for menu entries.
X11Graphic menuEntryGraphicA = XrwTheme.GetGraphic ( _display, _screenNumber,
    X11Graphic.StockIcon.Information16);
X11Graphic menuEntryGraphicB = XrwTheme.GetGraphic ( _display, _screenNumber,
    X11Graphic.StockIcon.Question16);
X11Graphic menuEntryGraphicC = XrwTheme.GetGraphic ( _display, _screenNumber,
    X11Graphic.StockIcon.Warning16);

// Create the associated simple menu entries.
XrwSme menuEntry1 = XrwSme.NewSmeGadget (commandFileMenu.Menu, "File menu entry 1",
    menuEntryGraphicA, true, menuEntryGraphicB, true);
commandFileMenu.Menu.AddChild (menuEntry1);
menuEntry1.ButtonRelease += HandleMenuEntry1ButtonRelease;
XrwSme menuEntry2 = XrwSme.NewSmeGadget (commandFileMenu.Menu, "File menu entry 2",
    menuEntryGraphicA, true, menuEntryGraphicB, true);
commandFileMenu.Menu.AddChild (menuEntry2);
menuEntry2.ButtonRelease += HandleMenuEntry2ButtonRelease;
XrwSme menuEntry3 = XrwSme.NewSmeGadget (commandFileMenu.Menu, "Close app",
    menuEntryGraphicC, true, null, false);
commandFileMenu.Menu.AddChild (menuEntry3);
menuEntry3.ButtonRelease += HandleCloseButtonRelease; 

It is recommended to add any XrwSme instance to the simple menu first and connect the ButtonRelease event handler second. This is because the AddChild() mehtod invokes the XrwConposite's ChildAdded event. This event has a default handler for XrwSimpleMenu, that registers the XrwSimpleMenu.HandleChildButtonReleaseDefault to the new child and this event handler calls Unrealize() for the XrwSimpleMenu on XrwSme's ButtonRelease event.

It must be guaranteed, that Unrealize() for the XrwSimpleMenu ist the first action that takes place on a XrwSme's ButtonRelease event. Otherwise, an 'application close' command would clean up the application's widget hierarchy first and Unrealize() for the XrwSimpleMenu would be called after that, which would be too late.

If any XrwSme instance is addeed to the simple menu after the ButtonRelease event handler has been connected to this XrwSme instance, the invocation sequence of the ButtonRelease event handler has to be adopted. This is done automatically by XrwSimpleMenu.HandleChildAddedDefault, but requires additional effort (that can be avoided by a propper sequence of child registration - parent.AddChild() - and button release handler registration - child.ButtonRelease):

/// <summary> Handle the ChildAdded event. </summary>
/// <param name="source"> The menu, that the menu entry has been added to. <see cref="XrwCore"/> </param>
/// <param name="added"> The menu entry, that has been added to the menu. <see cref="XrwCore"/> </param>
void HandleChildAddedDefault (XrwCore source, XrwCore added)
{
    XrwSme sme = added as XrwSme;
    if (sme == null)
        return;
    
    // Add the default handler to singnal selection on FIRST POSITION.
    // This ensures the menu's Unrealize() BEFORE any other processing.
    // It is important to keep the right sequence of Unrealize() calls in case of application close.
    System.Delegate[]    delegates = sme.ButtonReleaseInvocationList;
    for (int count = 0; count < delegates.Length; count++)
        sme.ButtonRelease -= (Xrw.ButtonReleaseDelegate)delegates[count];
    sme.ButtonRelease += HandleChildButtonReleaseDefault;
    for (int count = 0; count < delegates.Length; count++)
        sme.ButtonRelease += (Xrw.ButtonReleaseDelegate)delegates[count];
}

XrwSme

The XrwSme class implements a simple menu entry gadget. It is comparable to Athena's "SmeBSB" object.

The X Toolkit Intrinsic's description for "SmeBSB" says (Athena Widget Set — C Language Interface):
The SmeBSB object is used to create a menu entry that contains a string, and optional bitmaps in its left and right margins. Since each menu entry is an independent object, the application is able to change the font, color, height, and other attributes of the menu entries, on an entry by entry basis. The format of the string may either be the encoding of the 8 bit font utilized, or in a multibyte encoding for use with a fontSet.

This class has no public constructor, but one factory method. NewSmeGadget creates a new XrwSme.

The image shows two XrwSme with left and right (transparent multicolor) bitmap contained in a XrwDialogShell poped up from a XrwMenuButton.

This version introduces markup. See XrwLabelBase for details.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwLabel --> XrwSme

New event definitions

XrwSme 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
Focused bool get false
FocusedBackground-
ColorDark
TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorDark
FocusedBackground-
ColorLight
TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorLight
FocusedBackground-
ColorMedium
TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorMedium
FocusedSelectedBackground-
ColorDark
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-SelectedBackgroundColorDark
FocusedSelectedBackground-
ColorLight
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-SelectedBackgroundColorLight
FocusedSelectedBackground-
ColorMedium
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-SelectedBackgroundColorMedium
Selected bool get, set false
SelectedBackground-
ColorDark
  TPixel
TColor
get, set XrwTheme.InteractiveSelected-BackgroundColorDark
SelectedBackground-
ColorLight
  TPixel
TColor
get, set XrwTheme.InteractiveSelected-BackgroundColorLight
SelectedBackground-
ColorMedium
  TPixel
TColor
get, set XrwTheme.InteractiveSelected-BackgroundColorMedium
  • Focused get the focused indicator. A XrwSme is focused if it has input focus and the mouse pointer is placed inside the widget.
  • FocusedBackgroundColorDark get or set the focused background color 3/3.
  • FocusedBackgroundColorLight get or set the focused background color 1/3.
  • FocusedBackgroundColorMedium get or set the focused background color 2/3.
  • FocusedSelectedBackgroundColorDark get or set the selected and focused sme's background color 3/3.
  • FocusedSelectedBackgroundColorLight get or set the selected and focused sme's background color 1/3.
  • FocusedSelectedBackgroundColorMedium get or set the selected and focused sme's background color 2/3.
  • Selected get or set the selected indicator. A XrwSme is selected if it has been set to selected by application's code.
  • SelectedBackgroundColorDark get or set the selected item's background color 3/3.
  • SelectedBackgroundColorLight get or set the selected item's background color 1/3.
  • SelectedBackgroundColorMedium get or set the selected item's background color 2/3.

Overridden public properties

None.

New public methods

None.

New event handler

None.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

Preregistered event delegates

  • Enter += HandleEnterDefault set focused.
  • Leave += HandleLeaveDefault unset focused.

Usage

See XrwMenuButton for a code sample.

XrwLabelAndColor

 The XrwLabelAndColor class implements an optional static label and static color rectangle.

The XrwLabelAndColor displays a color filled rectangle and optionally a static text.

This class has no public constructor, but two factory methods. NewLabelAndColorWidget/NewLabelAndTextGadget create a new XrwLabelAndColor.

The image shows a XrwLabelAndColor with a green filled rectangle and the color name text.

This version introduces markup. See XrwLabelBase for details.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwLabelAndColor

New event definitions

XrwLabelAndColor 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
LeftMargin int get, set 4
RightMargin int get, set 4
ColorRectLeft bool get true
HtmlColorName string get  
  •  LeftMargin get or set the space (in pixels) that will be lef free between the left edge and the content.
  •  RightMargin get or set the space (in pixels) that will be lef free between the right edge and the content.
  •  ColorRectLeft get wether the color rectangle is displayed left (or right) from the label.
  •  HtmlColorName get the HTML color name, e.g. #FFFFFF.

Overridden public properties (XrwLabelBase)

  • Space get or set or set (0 ... 8) the spacing around the label. Used from left color rectangle to label (if ColorRectLeft), from label to right color rectangle (if !ColorRectLeft) and from label to top/bottom..

New public methods

None.

Overridden public methods (XrwRectObj)

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

New event handler

None.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

Preregistered event delegates

None.

Usage

The sample code shows how to create a simple XrwLabelAndColor.

// Create and register a label and color gadget.
XrwLabelAndColor colorGadget;

colorGadget = XrwLabelAndColor.NewLabelAndColorGadget (colorSelectorGridForm, colorName,
                                                       true, colorHtml.ToUpper());
colorSelectorGridForm.AddChild (colorGadget);

XrwTextSpinButton

The XrwTextSpinButton class implements a spin button widget, that can spin text constants via the clicked event. It is roughly comparable to GTK's SpinButton widget, but doesn't spin an integer or floating point number.

The XrwTextSpinButton is the ideal way to allow the user to set the value of some attribute. Rather than having to directly type a string into a XrwText, the XrwTextSpinButton allows the user to click on one of two arrows to increment or decrement the displayed text constant. The user can not type in any text, but has to select one of the predefined text constants.

This class has no public constructor, but two factory methods. NewHTextSpinButton/NewVTextSpinButton create a new horizintal/vertical spinning XrwTextSpinButton.

The image shows a XrwTextSpinButton with horizontal (left and right) navigators as well as a XrwTextSpinButton with vertical (top and bottom) navigators.

This version introduces markup. See XrwLabelBase for details.

The markup to achive this styled text looks like:

string markup = "<markup>Sp<b><span foreground=\"#006600\" background=\"#DDCCDD\">in</span> " +
                "<span foreground=\"#AA0000\" background=\"#AADDDD\">te</span>" +
                "<span foreground=\"#4400CC\" background=\"#DDDDAA\">xt</span></b> " +
                "<u>1</u></markup>"

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwSpinButton

New event definitions

XrwTextSpinButton 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
ArrowColor   TPixel
TColor
get, set XrwTheme.TextColor
FocusedBackground-
ColorDark
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorDark
FocusedBackground-
ColorLight
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorLight
FocusedBackground-
ColorMedium
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorMedium
DelimiterColorDark   TPixel
TColor
get, set XrwTheme.TextColor
DelimiterColorLight   TPixel
TColor
get, set XrwTheme.InverseTextColor
IsHorizontal bool get  
SelectedIndex int get, set 0
SelectedValue string get  
  • ArrowColor get or set the color of the navigator arrows.
  • FocusedBackgroundColorDark get or set the focused background color 3/3.
  • FocusedBackgroundColorLight get or set the focused background color 1/3.
  • FocusedBackgroundColorMedium get or set the focused background color 2/3.
  • DelimiterColorDark get or set the delimiter color 2/2.
  • DelimiterColorLight get or set the delimiter color 1/2.
  • IsHorizontal determine whether the navigator buttons are arranged horizontal (left and right) to the spinnable text.
  • SelectedIndex get or set the selected value's index.
  • SelectedValue get the selected value.

Overridden public properties

None.

New public methods

None.

Overridden public methods (XrwRectObj)

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

New event handler

  • OnClicked() handle the Clicked event.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

Preregistered event delegates

  • Enter += HandleEnterDefault set focused.
  • Leave += HandleLeaveDefault unset focused.
  • ButtonPress+= HandleButtonPressDefault set pressed.
  • ButtonRelease += HandleButtonReleaseDefault unset pressed and call OnClicked().

Usage

The sample code shows how to create a simple XrwTextSpinButton.

    // Create text spin button, set individual properties and register event handler.
    XrwTextSpinButton textSpinner = XrwTextSpinButton.NewHTextSpinButton
        (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);
    textSpinner.Clicked += HandleTextSpinnerClicked;

...

/// <summary> Handle the Clicked event. </summary>
/// <param name="source"> The widget, the Clicked event is
/// assigned to. <see cref="XrwRectObj"/> </param>
void HandleTextSpinnerClicked (XrwRectObj source)
{
    XrwTextSpinButton textSpinner = source as XrwTextSpinButton;
    if (textSpinner != null)
    {
        string s = textSpinner.SelectedValue;
    }
}

XrwToggle

The XrwToggle class implements a toggle button widget. It is comparable to Athena's "Toggle" widget.

The Athena's description for "Toggle" says (X Window System Athena Widgets, Quick Reference Guide):
The Toggle widget is an area, often rectangular, containing a text label or bitmap image. This widget maintains a boolean state (e.g. True/False or On/Off) and changes state whenever it is selected. When the pointer is on the button, the button may become highlighted by drawing a rectangle around its perimeter. This highlighting indicates that the button is ready for selection. When pointer button 1 is pressed and released, the Toggle widget indicates that it has changed state by reversing its foreground and background colors, and its notify action is invoked, calling all functions on its callback list. If the pointer is moved out of the widget before the button is released, the widget reverts to its normal foreground and background colors, and releasing the button has no effect. This behavior allows the user to cancel an action.

This class has no public constructor, but one factory method. NewToggleWidget creates a new XrwToggle.

The first image shows three simple XrwToggles - one switched on, two switched off - with -misc-fixed- font output, gradient background appearance and frame.

To draw the toggle buttons witha  frame,

  • the FrameType property can be set to (TFrameTypeExt)XrwTheme.InteractiveFrameType and the FrameWidth property can be set to XrwTheme.InteractiveFrameWidth or
  • the SetButtonAppearance() method can be called (that sets gradient background appearance as well).

The second image shows the same three XrwToggles frameless with -*-helvetica- font output, flat background appearance (background without gradient) and frameless.

To draw the toggle buttons frameless the FrameType property can be set to TFrameTypeExt.None and the FrameWidth property can be set to 0. The frameless appearance is the default.

This version introduces markup. See XrwLabelBase for details. The third image shows the three XrwToggles with markup text, flat background appearance (background without gradient) and frameless.

To draw the toggle buttons with flat background appearance, the SetBackgroundFlatHighlighting() method can be called. To draw the toggle buttons with gradient background appearance, the SetBackgroundGradientHighlighting() method can be called. The flat background appearance is the default.

The markup to achive these styled texts looks like:

string markup = "<markup>Toggle <span foreground=\"#AA0000\" background=\"#AADDDD\">test " +
                "<u>1</u></span></markup>"
string markup = "<markup>Toggle <span foreground=\"#006600\" background=\"#DDCCDD\">test " +
                "<u>2</u></span></markup>"
string markup = "<markup>Toggle <span foreground=\"#6600AA\" background=\"#DDDDAA\">test " +
                "<u>3</u></span></markup>"

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwToggle

New event definitions

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

  • SwitchedOff occures after the toggle has been switched off and is calling registered event handler delegates.
  • SwitchedOn occures after the toggle has been switched on and is calling registered event handler delegates.

New public properties

Name Type Access Default/Fallback
LeftMargin int get, set 4
RightMargin int get, set 4
OffBitmap X11Graphic get X11Graphic.StockIcon.Toggle-
Off16
OffBitmapShared bool get true
OnBitmap X11Graphic get X11Graphic.StockIcon.Toggle-
Off16
OnBitmapShared bool get true
VertBitmapAlign float get, set 0.5
Focused bool get false
FocusedBackground-
ColorDark
TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorDark
FocusedBackground-
ColorLight
TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorLight
FocusedBackground-
ColorMedium
TPixel
TColor
get, set XrwTheme.InteractiveFocused-BackgroundColorMedium
Pressed bool get, set false
  • LeftMargin get or set the space (in pixels) that will be lef free between the left edge and the content.
  • RightMargin get or set the space (in pixels) that will be lef free between the right edge and the content.
  • OffBitmap get toggle off bitmap.
  • OffBitmapShared get the toggle off bitmap shared flag. Not shared bitmaps will be disposed by the XrwToggle's Dispose(), shared bitmaps won't.
  • OnBitmap get toggle on bitmap.
  • OnBitmapShared get the toggle on bitmap shared flag. Not shared bitmaps will be disposed by the XrwToggle's Dispose(), shared bitmaps won't.
  • VertBitmapAlign get or set the vertical bitmap alignment. 0.0 aligns top, 0.5 aligns middle and 1.0 bottom.
  • Focused get the focused indicator. A XrwToggle is focused if it has input focus and the mouse pointer is placed inside the widget.
  • FocusedBackgroundColorDark get or set the focused background color 3/3.
  • FocusedBackgroundColorLight get or set the focused background color 1/3.
  • FocusedBackgroundColorMedium get or set the focused background color 2/3.
  • Pressed get or set the pressed indicator.

Overridden public properties

None.

New public methods

  • SetOffBitmap() set the off bitmap and bitmap shared flag.
  • SetOnBitmap() set the on bitmap and bitmap shared flag.
  • SetButtonAppearance() set the appearance showing a frame and the background with gradient and highlighting.

Overridden public methods (XrwRectObj)

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

New event handler

  • SwitchedOff occures after the command has been switched off and is calling registered event handler delegates.
  • SwitchedOn occures after the command has been switched on and is calling registered event handler delegates

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

Preregistered event delegates

  • Enter += HandleEnterDefault set focused. The handler is reused by XrwRadio and XrwNotebookTab.
  • Leave += HandleLeaveDefault unset focused. The handler is reused by XrwRadio and XrwNotebookTab.
  • ButtonPress += HandleButtonPressDefault switch on (if behaviour is radio button). The handler is reused by XrwRadio and XrwNotebookTab.
  • ButtonRelease += HandleButtonReleaseDefault switch on (if behaviour is radio button) or toggle (if behaviour is toggle button). The handler is reused by XrwRadio and XrwNotebookTab.
  • Execute_CommandDefault = new RelayCommand(Toggle_Execute_ActionDefault, Toggle_Execute_CanActionDefault) prepare default behaviour for key gesture binding.

Usage

The sample code shows how to create a XrwToggle including ON/OFF images. There is a second, more convenient NewToggleWidget factory method, hat prevents from any bitmap handling.

// Prepare graphics for toggles.
X11Graphic toggleOffGraphic = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.ToggleOff16TrueColor);
X11Graphic toggleOnGraphic  = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.ToggleOn16TrueColor);

    
// Create toggles.
XrwToggle toggle1 = XrwToggle.NewToggleWidget (hboxToggle,
    "Toggle test 1", toggleOffGraphic, true, toggleOnGraphic, true);
toggle1.ExpandToAvailableWidth = false;
toggle1.FrameWidth = XrwTheme.InteractiveFrameWidth;
hboxToggle.AddChild (toggle1);

XrwToggle toggle2 = XrwToggle.NewToggleWidget (hboxToggle,
    "Toggle test 2", toggleOffGraphic, true, toggleOnGraphic, true);
toggle2.ExpandToAvailableWidth = false;
toggle2.FrameWidth = XrwTheme.InteractiveFrameWidth;
hboxToggle.AddChild (toggle2);

XrwToggle toggle3 = XrwToggle.NewToggleWidget (hboxToggle,
    "Toggle test 3", toggleOffGraphic, true, toggleOnGraphic, true);
toggle3.ExpandToAvailableWidth = false;
toggle3.FrameWidth = XrwTheme.InteractiveFrameWidth;
hboxToggle.AddChild (toggle3);

XrwRadio

The XrwRadio class implements a radio button widget. It is comparable to Gtk's "RadioButton".

Radio buttons are typically grouped by a XrwRadioBox and at any time only one radio button of a group is set on, all others are set off. A single radio button performs the same basic function as a XrwToggle.
Every radio button is a member of some group of radio buttons. When one is selected, all other radio buttons in the same group are deselected.

This class has no public constructor, but one factory method. NewRadioWidget creates a new XrwRadio.

The first image shows a horizontally oriented XrwRadioBox with three simple XrwRadios - one switched on, two switched off - with -misc-fixed- font output, gradient background appearance and frame.

To draw the radio buttons with a frame,

  • the FrameType property can be set to (TFrameTypeExt)XrwTheme.InteractiveFrameType and the FrameWidth property can be set to XrwTheme.InteractiveFrameWidth or
  • the SetButtonAppearance() method can be called (that sets gradient background appearance as well).

The second image shows the same three XrwRadios frameless with -*-helvetica- font output, flat background appearance (background without gradient) and frameless.

To draw the radio buttons frameless the FrameType property can be set to TFrameTypeExt.None and the FrameWidth property can be set to 0. The frameless appearance is the default.

This version introduces markup. See XrwLabelBase for details. The third image shows the three XrwRadios  with markup text, flat background appearance (background without gradient) and frameless.

To draw the radio buttons with flat background appearance, the SetBackgroundFlatHighlighting() method can be called. To draw the radio buttons with gradient background appearance, the SetBackgroundGradientHighlighting() method can be called. The flat background appearance is the default.

The markup to achive these styled texts looks like:

string markup = "<markup>Radio <span foreground=\"#AA0000\" background=\"#AADDDD\">test " +
                "<u>1</u></span></markup>"
string markup = "<markup>Radio <span foreground=\"#006600\" background=\"#DDCCDD\">test " +
                "<u>2</u></span></markup>"
string markup = "<markup>Radio <span foreground=\"#6600AA\" background=\"#DDDDAA\">test " +
                "<u>3</u></span></markup>"

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwToggle --> XrwRadio

New event definitions

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

None.

New public properties

None.

Overridden public properties

None.

New public methods

None.

Overridden public methods

None.

New event handler

None.

Overridden event handler

None.

Preregistered event delegates

  • Enter += HandleEnterDefault set focused. Reuses the handler of XrwToggle.
  • Leave += HandleLeaveDefault unset focused. Reuses the handler of XrwToggle.
  • ButtonPress += HandleButtonPressDefault switch on. Reuses the handler of XrwToggle.
  • ButtonRelease += HandleButtonReleaseDefault switch on. Reuses the handler of XrwToggle.

Usage

The sample code shows how to create a XrwRadio including ON/OFF images. There is a second, more convenient NewRadioWidget factory method, hat prevents from any bitmap handling.

// Prepare graphics for radios.
X11Graphic radioOffGraphic = XrwTheme.GetGraphic ( _display,
    _screenNumber, X11Graphic.StockIcon.RadioOff16TrueColor);
X11Graphic radioOnGraphic  = XrwTheme.GetGraphic ( _display,
    _screenNumber, X11Graphic.StockIcon.RadioOn16TrueColor);

    
// Create radios.
XrwRadio radio1 = XrwRadio.NewRadioWidget (hboxRadio,
    "Radio test 1", radioOffGraphic, true, radioOnGraphic, true);
radio1.ExpandToAvailableWidth = false;
radio1.FrameType  = XrwTheme.InteractiveFrameType;
radio1.FrameWidth = XrwTheme.InteractiveFrameWidth;
hboxRadio.AddChild (radio1);

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

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

XrwNotebookTab

The XrwNotebookTab class implements a notebook tab button widget.

Notebook tabs are used only by a XrwNotebook and at any time only one notebook tab of a notebook is set on, all others are set off. A single notebook tab performs the same basic function as a XrwRadio.
Every notebook tab is a member of a notebook. When one is selected, all other notebook tabs in the notebook are deselected.

This class has no public constructor, but one factory method NewNotebookTabWidget creates a new XrwNotebookTab.

The image shows a notebook with four 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").

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwLabelBase --> XrwToggle --> XrwRadio --> XrwNotebookTab

New event definitions

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

None.

New public properties

None.

Overridden public properties

None.

New public methods

None.

Overridden public methods

None.

New event handler

None.

Overridden event handler

None.

Preregistered event delegate

  • Enter += HandleEnterDefault set focused. Reuses the handler of XrwToggle.
  • Leave += HandleLeaveDefault unset focused. Reuses the handler of XrwToggle.
  • ButtonPress += HandleButtonPressDefault switch on. Reuses the handler of XrwToggle.
  • ButtonRelease += HandleButtonReleaseDefault switch on. Reuses the handler of XrwToggle.

Usage

The sample code shows the typical use of XrwNotebookTab. It is neither necessary nor recommended to create a XrwNotebookTab explicitly, because XrwNotebook.AddChild() creates automatically the appropriate XrwNotebookTab. All that is to do with a XrwNotebookTab is to set it's properties.

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

XrwList

The XrwList class implements a list widget. It is comparable to Athena's "List" widget.

The Athena's description for "List" says (X Window System Athena Widgets, Quick Reference Guide):
The List widget contains a list of strings formatted into rows and columns. When one of the strings is selected, it is highlighted, and the List widget’s Notify action is invoked, calling all routines on its callback list. Only one string may be selected at a time.

This class has no public constructor, but one factory method. NewListWidget creates a new XrwList.

The image shows a simple XrwList with one selected list item. Every list item shows an image and a text.

Starting with this version the XrwList.ListItem don't contain the display string directly but a bound data object instead (which still can be a System.String). And the XrwList class implements the XrwIGridView interface.

  • The XrwList.ListItem's bound data object must be a System.Object to support the ToString() method for a fallback display member binding.
  • The XrwIGridView interface enables the list to display multiple columns, even if embedded in a XrwViewport. A XrwIGridView defines the columns to display by a XrwGridViewColumnCollection.
  • For easy application and backward compatibility a newly created XrwList instance already contains one default XrwGridViewColumn (inside it's XrwGridViewColumnCollection) without any display member binding - so the display string falls back to the bound data object's ToString() method result.

The image shows a XrwList inside a XrwViewport containing five columns and column headers with one selected list item. Every list item shows an image and a text inside the Name column. The columns 2 ... 5 are text only columns.

Starting with this version the XrwList provides the View property and supports the display of it's list items not only organized as ViewType.Details but also as ViewType.List, ViewType.SmallIcon or ViewType.LargeIcon.

The next three images demonstrate the new display capabilities.

 To be compatible to the Microsoft (R) naming, all "node" namings have been changed to "item" namings. This affects:

  • XrwList.ListNode ==> XrwList.ListItem
  • Nodes ==> Items
  • NodeCommandInvoke ==> ItemCommandInvoke
  • OnNodeCommandInvoke ==> OnItemCommandInvoke
  • FindListNode() ==> FindListItem()

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwList

New event definitions

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

  • EntrySelectionChanged occures after any item selection change or item deselection without corresponding selection or item selection without corresponding deselection.
  • SizePreferenceChanged occures after the preferred size has been changed, e.g. by expand or collapse content or by a change of display type. Typically used to signal a viewport the necessity to recalculate the scroll positions. A XrwViewport should listen to this event.
  •  NodeCommandInvoke occures after a item's associated command was requested, e. g. by a double click.
  • ItemCommandInvoke occures after a item's associated command was requested, e. g. by a double click.

New public properties

Name Type Access Default/Fallback
Columns XrwGridViewColumn-
Collection
get != null
TextColor TPixel
TColor
get, set XrwTheme.TextColor
InsensitiveTextColor   TPixel
TColor
get, set XrwTheme.InsensitiveTextColor
InverseTextColor   TPixel
TColor
get, set XrwTheme.InverseTextColor
  FontData
DefaultFontData
X11FontData get != null
InsensitiveFontData X11FontData get != null
InverseFontData X11FontData get != null
FocusedSelectedBackground-
ColorDark
TPixel
TColor
get, set XrwTheme.InteractiveFocused-
SelectedBackgroundColorDark
FocusedSelectedBackground-
ColorLight
TPixel
TColor
get, set XrwTheme.InteractiveFocused-
SelectedBackgroundColorLight
FocusedSelectedBackground-
ColorMedium
TPixel
TColor
get, set XrwTheme.InteractiveFocused-
SelectedBackgroundColorMedium
InsensitiveBackgroundColor   TPixel
TColor
get, set XrwTheme.EditableInsensitive-
BackgroundColor
MultiSelect bool get, set false
 Nodes List<ListNode>
NodeCollection
get != null
Items  StrongTyped-
GridViewElementList
get != null
OffBitmap X11Graphic get X11Graphic.StockIcon.Toggle-
Off16
OffBitmapShared bool get true
OnBitmap X11Graphic get X11Graphic.StockIcon.Toggle-
On16
OnBitmapShared bool get true
SelectedBackground-
ColorDark
TPixel
TColor
get, set XrwTheme.InteractiveSelected- BackgroundColorDark
SelectedBackground-
ColorLight
TPixel
TColor
get, set XrwTheme.InteractiveSelected- BackgroundColorLight
SelectedBackground-
ColorMedium
TPixel
TColor
get, set XrwTheme.InteractiveSelected-
BackgroundColorMedium
Styles StyleList get != null
InsensitiveStyles StyleList get != null
InverseStyles StyleList get != null
UnsetBitmap X11Graphic get X11Graphic.StockIcon.Toggle-
Unset16
UnsetBitmapShared bool get true
View ViewType get, set ViewType.Details
  • Columns get the list of columns, that define the data display characteristics for each item's column display.
  • TextColor get or set the text color of a list item's label.
  •  InsensitiveTextColor get or set the text color of an insensitive list item's label.
  •  InverseTextColor get or set the text color of an ininverse list item's label.
  • FontData  DefaultFontData get the default font data. To set the default font data use SetDefaultFont() method.
  • InsensitiveFontData get the insensitive font data. To set the insensitive font data use SetInsinsitiveFont() method.
  • InverseFontData get the inverse font data. To set the inverse font data use SetInverseFont() method.
  • InverseTextColor get or set the text color of a selected list item's label.
  • FocusedSelectedBackgroundColorDark get or set the selected and focused item's background color 3/3.
  • FocusedSelectedBackgroundColorLight get or set the selected and focused item's background color 1/3.
  • FocusedSelectedBackgroundColorMedium get or set the selected and focused item's background color 2/3.
  • InsensitiveBackgroundColor get or set the widget's background color on insensitivity. The InsensitiveBackgroundColor  doesn't support gradient colors, because an editable square has typically no gradient.
  • MultiSelect get or set whether multiple items can be selected.
  • Nodes get the list of list items.
  • Items get the list of list items.
  • OffBitmap get off bitmap used for boolean and three-state value display.
  • OffBitmapShared get the off bitmap shared flag. Not shared bitmaps will be disposed by the XrwListode's Dispose(), shared bitmaps won't.
  • OnBitmap get on bitmap used for boolean and three-state value display.
  • OnBitmapShared get the on bitmap shared flag. Not shared bitmaps will be disposed by the XrwList's Dispose(), shared bitmaps won't.
  • SelectedBackgroundColorDark get or set the selected item's background color 3/3.
  • SelectedBackgroundColorLight get or set the selected item's background color 1/3.
  • SelectedBackgroundColorMedium get or set the selected item's background color 2/3.
  • Styles get the list of styles, used for drawing list item text.
  • InsensitiveStyles get the list of styles, used for drawing insensitive list item text.
  • InverseStyles get the list of styles, used for drawing inverse list item text.
  • UnsetBitmap get on bitmap used for three-state value display.
  • UnsetBitmapShared get the on bitmap shared flag. Not shared bitmaps will be disposed by the XrwList's Dispose(), shared bitmaps won't.
  • View get or set the view type that can be one of: ViewType.Details, ViewType.List, ViewType.SmallIcon or ViewType.LargeIcon.

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

Overridden public properties

None.

Specific static methods (delegates to measure and draw)

To calculate the preferred size and to draw the widget, each cell must be measured and drawn. There are some predefined delegates, that are registered by default. Individual implementations can define their own measure and draw delegated and register them.

  • MeasureHeaderCell() measure the preferred size of a header cell.
  • MeasureIconTextCell() measure the preferred size of a list cell. Typically the first column contains icon and text - this method measures the first column's cells by default.
  • MeasureTextCell() measure the preferred size of a list cell. Typically the second and subsequent columns contain text - this method measures the second and subsequent column's cells by default.
  • DrawIconTextCell() draw a cell, that contaions icon and text - this method draws the first column's cells by default.
  • DrawTextCell() draw a cell, that contaions a text or an image alternatively - this method draws the second and subsequent column's cells by default.

New public methods

  •  FindListNode() find a list item by a pointer position.
  • FindListItem() find a list item by a pointer position.
  • IndexOf() get the index of indicated item.
  • SetSelectionForList() set the indicated selection state for all list items.
  • SetFocusedForList() set the indicated focused state for all list items.
  • GetSelections() get all currently selected list items.
  • SelectedItem() get the first currently selected item.
  • SelectedItems() get all currently selected items.
  • GetValue() get the display value string of the indicated item for the indicated column. Evaluates the XrwList.ListItem's bound data object and the XrwGridViewColumn's display member binding.
  •  SetInsensitiveFont() set a new insensitive font.
  •  SetInverseFont() set a new inverse font.
  • SetOffBitmap() set the off bitmap and bitmap shared flag.
  • SetOnBitmap() set the on bitmap and bitmap shared flag.
  • SetUnsetBitmap() set the unset bitmap and bitmap shared flag.

Overridden public methods (XrwRectObj)

  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  •   SetFont()  SetDefaultFont() set a new default font.

New event handler

  • OnEntrySelectionChanged() occures after any item selection has been changed or any item has been deselected without corresponding selection or any item has been selected without corresponding deselection and is calling registered event handler delegates.
  • OnSizePreferenceChanged() occures after the list preferres a new size (e. g. the content or the type of view has hanged) and is calling registered event handler delegates.
  •  OnNodeCommandInvoke() occures after a double click, indicating that item wants to execute a command, happened and is calling registered event handler delegates.
  • OnItemCommandInvoke() occures after a double click, indicating that item wants to execute a command, happened and is calling registered event handler delegates

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

Preregistered event delegates

  • ButtonRelease += HandleButtonReleaseDefault select a list item and call the item command on double click.
  • Motion += HandleMotionDefault focus or unfocus a list item.

For every change at the item's collection.

  • Items.CollectionChanged += HandleItemsCollectionChanged recalculate the preferred size.

Usage

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

XrwRange

 The XrwRange class implements common funftionality for XrwScale and XrwScrollbar widgets. It is comparable to GTK's "Range".

The GTK's description for "Range" says:
The GtkRange is a base class for widgets which visualize an adjustment.

This class is abstract and can not be instantiated.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwRange

New event definitions

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

  •  ThumbMoved occures after any adjustment has been done.

New public properties

Name Type Access Default/Fallback
IsHorizontal bool get      
SlideAreaBackgroundColor   TPixel
TColor
get, set XrwTheme.Scroll- BackgroundColorDark
SlideAreaFocused-
BackgroundColor
  TPixel
TColor
get, set XrwTheme.ScrollFocused- BackgroundColorDark
ThumbBackground-
ColorDark
  TPixel
TColor
get, set XrwTheme.ScrollThumb- BackgroundColorDark
ThumbBackground-
ColorLight
  TPixel
TColor
get, set XrwTheme.ScrollThumb- BackgroundColorLight
ThumbBackground- ColorMedium   TPixel
TColor
get, set XrwTheme.ScrollThumb-BackgroundColorMedium
ThumbFocused- BackgroundColorDark   TPixel
TColor
get, set XrwTheme.ScrollThumbFocused- BackgroundColorDark
ThumbFocused- BackgroundColorLight   TPixel
TColor
get, set XrwTheme.ScrollThumbFocused- BackgroundColorLight
ThumbFocused- BackgroundColorMediumt   TPixel
TColor
get, set XrwTheme.ScrollThumbFocused-
BackgroundColorMedium
ThumbFrameType TFrameType get, set TFrameType.Raised
ThumbFrameWidth int get, set XrwTheme.InteractiveFrameWidth
ThumbMaxValue float get 100.0
ThumbMinValue float get 0.0
ThumbValue float get, set ThumbMinValue
ThumbStepWidth float get, set (ThumbMaxValue -  ThumbMinValue) / 100
  •  IsHorizontal get whether the range is oriented horizontal.
  •  SlideAreaBackgroundColor get or set the slide area background color.
  •  SlideAreaFocusedBackgroundColor get or set the focused slide area background color.
  •  ThumbBackgroundColorDark get or set the thumb background color 3/3.
  •  ThumbBackgroundColorLight get or set the thumb background color 1/3.
  •  ThumbBackgroundColorMedium get or set the thumb background color 2/3.
  •  ThumbFocusedBackgroundColorDark get or set the focused thumb background color 3/3.
  •  ThumbFocusedBackgroundColorLight get or set the focused thumb background color 1/3.
  •  ThumbFocusedBackgroundColorMedium get or set the focused thumb background color 2/3.
  •  ThumbFrameType get or set the thumb frame type.
  •  ThumbFrameWidth get or set the thumb frame width.
  •  ThumbMaxValue get or set the max thumb position value.
  •  ThumbMinValue get or set the min thumb position value.
  •  ThumbValue get or set the current thumb position value.
  •  ThumbStepWidth get or set the thumb position change value for a step jump.

Overridden public properties

None.

New public methods

None.

New public methods

None.

Overridden public methods (XrwRectObj)

None.

New event handler

None.

Overridden event handler (XrwRectObj)

None.

Preregistered event delegates

None.

XrwScale

 The XrwScale class implements a slider widget. It is comparable to GTK's "Scale".

The GTK's description for "Scale" says:
The GtkScale is a slider control used to select a numeric value. To use it, you'll probably want to investigate the methods on its base class, GtkRange, in addition to the methods for GtkScale itself.
...

This class has no public constructor, but two factory methods. NewHScaleWidget/NewVScaleWidget create a new XrwScale.

The image shows a horizontally oriented XrwScale.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwRange --> XrwSale

New event definitions

XrwScale 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
SlideAreaFrameType TFrameType get, set XrwTheme.Sunken
SlideAreaFrameWidth int get, set XrwTheme.InteractiveFrameWidth
  •  SlideAreaFrameType get or set the slide area frame type.
  •  SlideAreaFrameWidth get or set the slide area frame width.

Overridden public properties

None.

New public methods

None.

Overridden public methods (XrwRectObj)

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

New event handler

  •  OnThumbMoved occures after any scroll has been done and is calling registered event handler delegates.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

Preregistered event delegates

  •  Enter += HandleEnterDefault set focused.
  •  Leave += HandleLeaveDefault unset focused.
  •  Motion += HandleMotionDefault highlight or unhighlight buttons, background or thumb. Moves the thumb on pressed button.

Usage

The sample code shows how to create a simple XrwScale including a delegate, receiving movement notification.

// Create scale.
XrwScale scale = XrwScale.NewVScaleWidget (parent, 0, 255);
scale.ThumbStepWidth = 1;
parent.AddChild (scale);

// Connect delegate.
scale.ThumbMoved += delegate(XrwRectObj source, float oldValue, float newValue,
                             float minValue, float maxValue)
{
     // Text output shall be integer, not float!
     textScaleValue.Text = ((int)(0.5F + newValue)).ToString ();
     textScaleValue.InvokeRedraw ();
};

XrwScrollbar

The XrwScrollbar class implements a scroll bar widget. It is comparable to Athena's "Scrollbar".

The Athena's description for "Scrollbar" says (X Window System Athena Widgets, Quick Reference Guide):
The Scrollbar widget is a rectangular area containing a slide region and a thumb (also known as a slide bar). A Scrollbar can be used alone, as a value generator, or it can be used within a composite widget (for example, a Viewport). A Scrollbar can be oriented either vertically or horizontally.
When a Scrollbar is created, it is drawn with the thumb in a contrasting color. The thumb is normally used to scroll client data and to give visual feedback on the percentage of the client data that is visible.
...
While scrolling is in progress, the application receives notification through callback procedures.
...

To use the XrwScrollbar class with all it's features, methods on its base class, XrwRange, in addition to the methods for XrwScrollbar itself are required.

The XrwScrollbar supports continuous scrolling through auto repeat of ButtonPress event.
Permanent pointer button press on up or down button repeat the step move.
Permanent pointer button press on the slide region repeat the page move.

This class has no public constructor, but two factory methods. NewHScrollWidget/NewVScrollWidget create a new XrwScrollbar.

The image shows a horizontally oriented XrwScrollbar.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwRange --> XrwScrollbar

New event definitions

XrwScrollBar 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
ArrowColor   TPixel
TColor
get, set XrwTheme.TextColor
ButtonBackgroundColor   TPixel
TColor
get, set XrwTheme.Interactive- BackgroundColorDark
FocusedButton-
BackgroundColor
  TPixel
TColor
get, set XrwTheme.InteractiveFocused- BackgroundColorDark
ButtonFrameType TFrameType get, set XrwTheme.InteractiveFrameType
ButtonFrameWidth int get, set XrwTheme.InteractiveFrameWidth
ThumbWidth int get, set 100000 (XrwScrollbar.ThumbMaxValue / 10)
ThumbPageWidth int get, set 100000 (XrwScrollbar. ThumbMaxValue / 10)
  • ArrowColor get or set the arrow color.
  • ButtonBackgroundColor get or set the scroll area background color.
  • FocusedButtonBackgroundColor get or set the scroll area focused background color.
  •  ThumbBackgroundColorDark get or set the thumb background color 3/3. Moved to XrwRange.
  •  ThumbBackgroundColorLight get or set the thumb background color 1/3. Moved to XrwRange.
  •  ThumbBackgroundColorMedium get or set the thumb background color 2/3. Moved to XrwRange.
  • ThumbFocusedBackgroundColorDark get or set the focused thumb background color 3/3. Moved to XrwRange.
  • ThumbFocusedBackgroundColorLight get or set the focused thumb background color 1/3. Moved to XrwRange.
  • ThumbFocusedBackgroundColorMedium get or set the focused thumb background color 2/3. Moved to XrwRange.
  • IsHorizontal get whether the scroll bar is oriented horizontal. Moved to XrwRange.
  • ButtonFrameType get or set the button (left right for horizontal scroll or up/down for vertical scroll) frame type.
  • ButtonFrameWidth get or set the button (left right for horizontal scroll or up/down for vertical scroll) frame width.
  • ThumbFrameType get or set the thumb frame type. Moved to XrwRange.
  • ThumbFrameWidth get or set the thumb frame width. Moved to XrwRange.
  • ThumbWidth get or set the current thumb width - as a percentage value, multiplied with 10,000, of the movable width.
  • ThumbValue get or set the current thumb position value. Moved to XrwRange and changed from int to float.
  • ThumbStepWidth get or set the thumb position change value for step jump - as a percentage value, multiplied with 10,000, of the movable width. Moved to XrwRange and changed from int to float.
  • ThumbPageWidth get or set the thumb position change value for page jump - as a percentage value, multiplied with 10,000, of the movable width.

Overridden public properties

None.

New public methods

None.

Overridden public methods (XrwRectObj)

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

New event handler

  • OnThumbMoved occures after any scroll has been done and is calling registered event handler delegates.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

New preregistered event delegates

  • Enter += HandleEnterDefault set focused.
  • Leave += HandleLeaveDefault unset focused.
  • Motion += HandleMotionDefault highlight or unhighlight buttons, background or thumb. Moves the thumb on pressed button.
  • ButtonPress += HandleButtonPressDefault realize step scroll (prssed on a button) or page scroll (pressed on the background). Can repeat on continuous press.

Usage

The sample code shows how to create a simple XrwScrollbar including a delegate, receiving movement notification.

// Create scroll bar.
XrwScrollbar scroll = XrwScrollbar.NewHScrollWidget (parent, 0, 255);
scroll.ThumbStepWidth = 1;
scroll.ThumbPageWidth = 16;
parent.AddChild (scroll);

// Connect delegate.
scroll.ThumbMoved += delegate(XrwRectObj source, float oldValue, float newValue,
                              float minValue, float maxValue)
{
     // Text output shall be integer, not float!
     textScrollValue.Text = ((int)(0.5F + newValue)).ToString ();
     textScrollValue.InvokeRedraw ();
};

XrwRibbonCommandBase

The XrwRibbonCommandBase is the base class for objects within the ribbon, calling a callback via button press event or clicked event.

Because the ribbon is implemented as one integral widget, almost all of its children (including the ribbon command base) are implemented as gadgets. The ribbon command base consolidates the common functionality of ribbon children, that call a callback.

This class is abstract and can not be instantiated.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwRibbonCommandBase

New event definitions

None.

New public properties

Name Type Access Default/Fallback
FocusedBackground-
ColorDark
  TPixel
TColor
get, set XrwTheme.RibbonCommand-
GadgetFocused-
BackgroundColorDark
FocusedBackground-
ColorLight
  TPixel
TColor
get, set XrwTheme.RibbonCommand-
GadgetFocused-
BackgroundColorLight
FocusedBackground-
ColorMedium
  TPixel
TColor
get, set XrwTheme.RibbonCommand-
GadgetFocused-
BackgroundColorMedium
FocusedSelectedBackground-
ColorDark
  TPixel
TColor
get, set XrwTheme.RibbonCommand-
GadgetFocusedSelected-
BackgroundColorDark
FocusedSelectedBackground-
ColorlLight
  TPixel
TColor
get, set XrwTheme.RibbonCommand-
GadgetFocusedSelected-
BackgroundColorLight
FocusedSelectedBackground-
ColorMedium
  TPixel
TColor
get XrwTheme.RibbonCommand-
GadgetFocusedSelected-
BackgroundColorMedium
SelectedBackground-
ColorDark
  TPixel
TColor
get, set XrwTheme.RibbonCommand-
GadgetSelected-
BackgroundColorDark
SelectedBackground-
ColorLight
  TPixel
TColor
get, set XrwTheme.RibbonCommand-
GadgetSelected-
BackgroundColorLight
SelectedBackground-
ColorMedium
  TPixel
TColor
get, set XrwTheme.RibbonCommand-
GadgetSelected-
dBackgroundColorMedium
  • FocusedBackgroundColorDark get or set the focused command gadget's background color 3/3.
  • FocusedBackgroundColorLight get or set the focused command gadget's background color 1/3.
  • FocusedBackgroundColorMedium get or set the focused command gadget's background color 2/3.
  • FocusedSelectedBackgroundColorDark get or set the selected and focused command gadget's background color 3/3.
  • FocusedSelectedBackgroundColorLight get or set the selected and focused command gadget's background color 1/3.
  • FocusedSelectedBackgroundColorMedium get or set the selected and focused command gadget's background color 2/3.
  • SelectedBackgroundColorDark get or set the selected command gadget's background color 3/3.
  • SelectedBackgroundColorLight get or set the selected command gadget's background color 1/3.
  • SelectedBackgroundColorMedium get or set the selectedd command gadget's background color 2/3.

Overridden public properties (XrwRectObj)

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

New public methods

None.

Overridden public methods

None.

New event handler

None.

Overridden event handler

None.

Preregistered event delegates

None.

XrwRibbonButton

The XrwRibbonButton is a command button gadget to be used within the ribbon, that calls a callback via the click event. Because it is a gadget, it's ribbon is responsible for any event processing (highlight, button press, expose, ...).

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

A XrwRibbonButton can be displayed in different size modes, according to it's CurrentSizeMode property.

  • RibbonPanelSizePolicy.Large displays the XrwRibbonButton with a 32px x 32px image and the label text beneath the image.
  • RibbonPanelSizePolicy.Medium displays the XrwRibbonButton with a 16px x 16px image and the label text aside the image.
  • RibbonPanelSizePolicy.Small displays the XrwRibbonButton with a 16px x 16px image and no label text.

This class has no public constructor, but one factory method. NewRibbonButton creates a new XrwRibbonButton.

The image shows two XrwRibbonPanels including the dialog launcher right beside the ribbon panel's label, one XrwRibbonPanel containing three XrwRibbonButtons with CurrentSizeMode == RibbonPanelSizePolicy.Large and another XrwRibbonPanel containing three XrwRibbonButtons with CurrentSizeMode == RibbonPanelSizePolicy.Medium. The first ribbon button is focused.

the XrwRibbonButton can adopt it's size, if XrwRibbonTab has insufficient width to display all XrwRibbonButtons within all  XrwRibbonPanels with it's PreferredSizeMode.

Rule 1A) The first attempt to reduce the XrwRibbonButton's PreferredSizeMode is always made for the  XrwRibbonButtons within the last XrwRibbonPanel.

Rule 1B) If no reduction is applicable or if reduction is insufficient, the next attempt is made to the XrwRibbonButtons within the next previous XrwRibbonPanel. As long as reduction is not applicable or insufficient, every next attempt is made to the XrwRibbonButtons within the next previous XrwRibbonPanel until the first panel has been reached.

Rule 1C) If no reduction has been applicable or if all reductions have been insufficient, the contents of the XrwRibbonTab is clipped.

Rule 2A) In the case of a XrwRibbonTab has insufficient width, the XrwRibbonTab tries to reduce the XrwRibbonButton's CurrentSizeMode from RibbonPanelSizePolicy.Large to RibbonPanelSizePolicy.Medium if applicable.

Rule 2B) Otherwise from RibbonPanelSizePolicy.Medium to RibbonPanelSizePolicy.Small if applicable.

The ruleset 1 has priority over the ruleset 2. That means precise, that rule 1B forces the application of rule 2A for all  XrwRibbonPanels (from back to front) before it forces rule 2B to any XrwRibbonPanel.

Rule 3A) The reduction of the XrwRibbonButton's PreferredSizeMode from RibbonPanelSizePolicy.Large to RibbonPanelSizePolicy.Medium is not applicable, if the XrwRibbonPanel contains only two or less XrwRibbonButtons.

Rule 3B) The reduction of the XrwRibbonButton's PreferredSizeMode from RibbonPanelSizePolicy.Medium to RibbonPanelSizePolicy.Small is not applicable, if either the XrwRibbonPanel contains only three or less XrwRibbonButtons or if the XrwRibbonPanel contains any XrwRibbonSplitButton.

The image shows the application of the rules to a sample XrwRibbonTab step by step.

No width reduction is required.





Application of rules 1A and 2A to the right panel.





Application of rules 1A and 2B to the right panel.
(Rule 3B doesn't match for 4 buttons.)




Application of rules 1B and 2A to the left panel.
(Rule 3A doesn't match for 3 buttons.)




Application of rules 3B and 1C.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwRibbonCommandBase --> XrwRibbonButton

New event definitions

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

  • Clicked occures after the button has been switched and is calling registered event handler delegates.

New public properties

Name Type Access Default/Fallback
TextColor   TPixel
TColor
get, set XrwTheme.TextColor
InactiveTextColor   TPixel
TColor
get, set XrwTheme.ShadowFrame-
ColorDark
Label string get, set  
Lines Multiline
StyleText
get  
LargeBitmap X11Graphic get null
LargeBitmapShared bool get false
SmallBitmap X11Graphic get != null
SmallBitmapShared bool get false
PreferredSizeMode RibbonPanelSizePolicy get RibbonPanelSizePolicy.Large
CurrentSizeMode RibbonPanelSizePolicy get RibbonPanelSizePolicy.Large
Focused bool get false
  • 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.
  • Label get or set the (multiple lines) label text to display (\n delimited lines).
  • Lines get the (multiple lines) label of style characters to display (\n has been transformed into lines).
  • LargeBitmap get the large ribbon button's bitmap. If LargeBitmap is provided, the PreferredSizeMode is set to RibbonPanelSizePolicy.Large, otherwise it is set to RibbonPanelSizePolicy.Medium. The bitmap must be of size 32x32 pixel.
  • LargeBitmapShared get the large bitmap shared flag. Not shared bitmaps will be disposed by the XrwRibbonButton's Dispose(), shared bitmaps won't.
  • SmallBitmap get the small ribbon button's bitmap. The SmallBitmap must be provided for every XrwRibbonButton, to support the RibbonPanelSizePolicy.Medium and RibbonPanelSizePolicy.Small, if the bibbon button's parent ribbon panel has been contracted. The bitmap must be of size 16x16 pixel.
  • SmallBitmapShared get the small bitmap shared flag. Not shared bitmaps will be disposed by the XrwRibbonButton's Dispose(), shared bitmaps won't.
  • PreferredSizeMode get the preferred ribbon button's size mode. It will be set automatically to RibbonPanelSizePolicy.Large, if a LargeBitmap is provided, or to RibbonPanelSizePolicy.Medium otherwise.
  • CurrentSizeMode get the current ribbon button's size mode. It will be set equal to PreferredSizeMode initially, but can change to any smaller size mode, if ribbon button's parent ribbon panel has been contracted.
  • Focused get the focused indicator. A XrwRibbonButton is focused if it's windowed parent has input focus and the mouse pointer is placed inside the gadget.

Overridden public properties

None.

New public methods

  • SetLargeBitmap() set the large bitmap and bitmap shared flag.
  • SetSmallBitmap() set the small bitmap and bitmap shared flag.

Overridden public methods (XrwRectObj)

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

Overridden public methods (XrwCore)

  • Redraw() redraw the widget/gadget.

New event handler

  • OnClicked() handle the Clicked event.

Overridden event handler

None.

Preregistered event delegates

  • ButtonRelease += HandleButtonReleaseDefault call OnClicked().

Usage

The sample code shows how to create three simple XrwRibbonButtons including large and small (transparent multicolor) bitmap.

// Prepare graphics for ribbon buttons.
X11Graphic bigFontGraphic     = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.Information32);
X11Graphic bigFolderGraphic   = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.FontBitmapFont32);
X11Graphic bigColorGraphic    = XrwTheme.GetGraphic (_display,
    _screenNumber, X11Graphic.StockIcon.FileGeneric32);
    
// Create ribbon buttons.
XrwRibbonButton bigRib1 = XrwRibbonButton.NewRibbonButton (parent,
    "Message\nbox", bigFontGraphic,   true, smallFontGraphic,   true);
ribbonpanel.AddChild (bigRib1);
bigRib1.Clicked += HandleMessageBoxButtonClicked;

XrwRibbonButton bigRib2 = XrwRibbonButton.NewRibbonButton (parent,
    "Font\ndialog", bigFolderGraphic, true, smallFolderGraphic, true);
ribbonpanel.AddChild (bigRib2);
bigRib2.Clicked += HandleFontDialogButtonClicked;

XrwRibbonButton bigRib3 = XrwRibbonButton.NewRibbonButton (parent,
    "File\ndialog", bigColorGraphic,  true, smallColorGraphic, true);
ribbonpanel.AddChild (bigRib3);
bigRib3.Clicked += HandleFileSelectionDialogButtonClicked; 

XrwRibbonSplitButton

The XrwRibbonSplitButton is a split button gadget to be used within the ribbon, that pops up a menu via the button press event. Because it is a gadget, it's ribbon is responsible for any event processing (highlight, button press, expose, ...).

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

A XrwRibbonSplitButton can be displayed in different size modes, according to it's CurrentSizeMode property.

  • RibbonPanelSizePolicy.Large displays the XrwRibbonButton with a 32px x 32px image. The label text and the arror are beneath the image.
  • RibbonPanelSizePolicy.Medium displays the XrwRibbonButton with a 16px x 16px image. The label text and the arror are aside the image.

This class has no public constructor, but one factory method. NewRibbonSplitButton creates a new XrwRibbonSplitButton.

The image shows two XrwRibbonPanel, one XrwRibbonPanel with one XrwRibbonSplitButton on CurrentSizeMode == RibbonPanelSizePolicy.Large and another XrwRibbonPanel with one XrwRibbonSplitButton on CurrentSizeMode == RibbonPanelSizePolicy.Medium. The second ribbon split button has been clicked and shows it's popup menu.

the XrwRibbonSplitButton can adopt it's size, if XrwRibbonTab has insufficient width to display all XrwRibbonSplitButtons within all  XrwRibbonPanels with it's PreferredSizeMode.

Rule 1A) The first attempt to reduce the XrwRibbonButton's PreferredSizeMode is always made for the  XrwRibbonSplitButtons within the last XrwRibbonPanel.

Rule 1B) If no reduction is applicable or if reduction is insufficient, the next attempt is made to the XrwRibbonSplitButtons within the next previous XrwRibbonPanel. As long as reduction is not applicable or insufficient, every next attempt is made to the XrwRibbonSplitButtons within the next previous XrwRibbonPanel until the first panel has been reached.

Rule 1C) If no reduction has been applicable or if all reductions have been insufficient, the contents of the XrwRibbonTab is clipped.

Rule 2) In the case of a XrwRibbonTab has insufficient width, the XrwRibbonTab tries to reduce the XrwRibbonSplitButton's CurrentSizeMode from RibbonPanelSizePolicy.Large to RibbonPanelSizePolicy.Medium if applicable.

Rule 3) The reduction of the XrwRibbonButton's PreferredSizeMode from RibbonPanelSizePolicy.Large to RibbonPanelSizePolicy.Medium is not applicable, if the XrwRibbonPanel contains only two or less XrwRibbonSplitButtons.

The image shows the application of the rules to a sample XrwRibbonTab step by step.

No width reduction is required.





Application of rules 1A and 2 to the right panel.





Application of rules 1B and 2 to the left panel.





Application of rule 1C.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwRibbonCommandBase --> XrwRibbonButton --> XrwRibbonSplitButton

New event definitions

XrwRibbonSplitButton 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
Menu XrwSimpleMenu get XrwTheme.TextColor
  • Menu get the associated menu to pop up.The menu is integral part of the XrwRibbonSplitButton, it will be automatically created and disposed with the XrwRibbonSplitButton.

Overridden public properties

None.

New public methods

None.

Overridden methods (XrwCore)

  • Redraw() redraw the widget/gadget.

New event handler

None.

Overridden event handler

None.

Pregistered event delegates

  • ButtonPress += HandleButtonPressDefault pop up registered XrwSimpleMenu.

Usage

A XrwRibbonSplitButton is typically used in conjunction with a XrwSimpleMenu. See XrwSimpleMenu for class details.

The sample code shows how to create a ribon split button and it's associated simple menu, containing two entries.

// Create a ribbon split button.
X11Graphic bigSplitGraphic = XrwTheme.GetGraphic ( _display,
    _screenNumber, X11Graphic.StockIcon.Information32);
X11Graphic smallSplitGraphic = XrwTheme.GetGraphic ( _display,
    _screenNumber, X11Graphic.StockIcon.Information16);
XrwRibbonSplitButton bigSplit = XrwRibbonSplitButton.NewRibbonSplitButton (ribbonPanel,
    "Info", bigSplitGraphic, true, smallSplitGraphic, true);

// Create the associated simple menu entries.
X11Graphic splitMenuEntryGraphic = XrwTheme.GetGraphic ( _display,
    _screenNumber, X11Graphic.StockIcon.Information16);
XrwSme splitMenuEntry1 = XrwSme.NewSmeGadget (bigSplit.Menu,
    "About", splitMenuEntryGraphic, true, null, false);
bigSplit.Menu.AddChild (splitMenuEntry1);
splitMenuEntry1.ButtonRelease += HandleSplitMenuEntry1ButtonRelease;
XrwSme splitMenuEntry2 = XrwSme.NewSmeGadget (bigSplit.Menu,
    "Help", splitMenuEntryGraphic, true, null, false);
bigSplit.Menu.AddChild (splitMenuEntry2);
splitMenuEntry2.ButtonRelease += HandleSplitMenuEntry2ButtonRelease; 

It is recommended to add any XrwSme instance to the simple menu first and connect the ButtonRelease event handler second. This is because the AddChild() mehtod invokes the XrwConposite's ChildAdded event. This event has a default handler for XrwSimpleMenu, that registers the XrwSimpleMenu.HandleChildButtonReleaseDefault to the new child and this event handler calls Unrealize() for the XrwSimpleMenu on XrwSme's ButtonRelease event.

It must be guaranteed, that Unrealize() for the XrwSimpleMenu ist the first action that takes place on a XrwSme's ButtonRelease event. Otherwise, an 'application close' command would clean up the application's widget hierarchy first and Unrealize() for the XrwSimpleMenu would be called after that, which would be too late.

If any XrwSme instance is addeed to the simple menu after the ButtonRelease event handler has been connected to this XrwSme instance, the invocation sequence of the ButtonRelease event handler has to be adopted. This is done automatically by XrwSimpleMenu.HandleChildAddedDefault, but requires additional effort (that can be avoided by a propper sequence of child registration - parent.AddChild() - and button release handler registration - child.ButtonRelease):

XrwRibbonControlGroup

The XrwRibbonControlGroup is a gadget to be used within the ribbon, that organizes a group of interactive control group nodes and calls a callback via the click event. Because it is a gadget, it's ribbon is responsible for any event processing (highlight, button press, expose, ...).

Because the ribbon is implemented as one integral widget, almost all of its children (including the ribbon control group) are implemented as gadgets. The ribbon control group is a ribbon child, that provides the functionality of a radio box to the ribbon. Different to the XrwRadioBox it also permits to handle toggle and exclusive toggle buttons.

The XrwRibbonControlGroup introduces four internal classes to provide radio, toggle and exclusive toggle buttons:

  • XrwRibbonControlGroupNode is the abstract base calss for radio, toggle and exclusive toggle button within a XrwRibbonControlGroup.
  • XrwRibbonControlGroupRadioNode is derived from the abstract XrwRibbonControlGroupNode base calss and behaves like a radio button (switches all other radio buttons of it's control group off, if switchted on).
  • XrwRibbonControlGroupToggleNode is derived from the abstract XrwRibbonControlGroupNode base calss and behaves like a toggle button (can be switched on and off indipendently from the state of other toggle buttons of it's control group).
  • XrwRibbonControlGroupExclusiveToggleNode is derived from the abstract XrwRibbonControlGroupNode base calss and behaves like a combination of a toggle button (can be switched off indipendently from the state of other toggle buttons of it's control group) and a radio button (switches other toggle buttons of it's control group off, if switchted on).

XrwRibbonControlGroupRadioNodes, XrwRibbonControlGroupToggleNodes and XrwRibbonControlGroupExclusiveToggleNodes can be used within the same XrwRibbonControlGroup.
In this case XrwRibbonControlGroupRadioNodes only influence XrwRibbonControlGroupRadioNodes and XrwRibbonControlGroupExclusiveToggleNodes only influence XrwRibbonControlGroupToggleNodes and XrwRibbonControlGroupExclusiveToggleNodes.

This class has no public constructor, but one factory method. NewRibbonControlGroup creates a new XrwRibbonControlGroup.

The image shows two XrwRibbonPanels, each of them with two XrwRibbonControlGroups. The first XrwRibbonPanel's upper XrwRibbonControlGroup contains four (align horizontal left, align horizontal center, align horizontal justify and align horizontal right) and the lower XrwRibbonControlGroup contains three (align vertical top, align vertical middle, align vertical bottom) XrwRibbonControlGroupRadioNodes. The second XrwRibbonPanel's upper XrwRibbonControlGroup contains three (markup bold, markup italic and markup underline) XrwRibbonControlGroupToggleNodes and the lower XrwRibbonControlGroup contains two (position sub, position super) XrwRibbonControlGroupExclusiveToggleNodes.

At any time exactly one horizontal alignment and one vertical alignment is selected (this is realized by XrwRibbonControlGroupRadioNodes). The three available markups permit any number (0 ... 3) of them to be selected (this is realized by XrwRibbonControlGroupToggleNodes ). And the two positions permit none or one of them to be selected (this is realized by XrwRibbonControlGroupExclusiveToggleNodes).

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwRibbonCommandBase --> XrwRibbonControlGroup

New event definitions

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

  • Clicked occures after any control group node of the XrwRibbonControlGroup has been switched and is calling registered event handler delegates.

New public properties

Name Type Access Default/Fallback
Nodes List<XrwRibbonControl-
GroupNode>
get != null
  • Nodes get the list of list nodes.

Overridden public properties

None.

New public methods

  • InsideIndicatedNodeBoundings() check whether the indicated point is inside the indicated node.
  • SelectedRadioNodeIndex() get the index of the currently selected radio node. Toggle nodes and exclusive toggle nodes increase the index, if determined before the selected radio node. To establish a defined initial state, if no radio node is selected, the first radio node becoms selected. If multiple radio nodes are relected, all radio nodes except the first selected radio node become unselected.
  • SetSelection() set, according to the indicated position, a node as selected and - in case of a radio node - unset any other radio node's selection.

Overridden public methods (XrwRectObj)

  • CalculateChildLayout() perform no action.
  • MinimumSize() calculate the minimum size.
  • PreferredSize() calculate the preferred size.

Overridden public methods (XrwCore)

  • Redraw() redraw the widget/gadget.

New event handler

  • OnClicked() handle the Clicked event.

Overridden event handler

None.

Peregistered event delegates

  • ButtonRelease += HandleButtonReleaseDefault update the selection (end) and caret position.

Usage

The sample code shows how to create a ribon control group and it's child nodes.

// ---- Prepare the graphics and create a ribbon control group.
X11Graphic radioGraphicAlignLeft      = XrwTheme.GetGraphic ( _display,
    _screenNumber, X11Graphic.StockIcon.TextAlignLeft);
X11Graphic radioGraphicAlignCenter    = XrwTheme.GetGraphic ( _display,
    _screenNumber, X11Graphic.StockIcon.TextAlignCenter);
X11Graphic radioGraphicAlignJustify   = XrwTheme.GetGraphic ( _display,
    _screenNumber, X11Graphic.StockIcon.TextAlignJustify);
X11Graphic radioGraphicAlignRight     = XrwTheme.GetGraphic ( _display,
    _screenNumber, X11Graphic.StockIcon.TextAlignRight);
XrwRibbonControlGroup ribCtrlGrpTextHAlignClicked =
    XrwRibbonControlGroup.NewRibbonControlGroup (panelRadioTest);
panelRadioTest.AddChild (ribCtrlGrpTextHAlignClicked);

// ---- Create four ribbon control group nodes.
ribCtrlGrpTextHAlignClicked.Nodes.Add (new XrwRibbonControlGroup.XrwRibbonControlGroupRadioNode
    ("Align text horizontally to the left.",   radioGraphicAlignLeft,   true));
ribCtrlGrpTextHAlignClicked.Nodes.Add (new XrwRibbonControlGroup.XrwRibbonControlGroupRadioNode
    ("Align text horizontally to the center.", radioGraphicAlignCenter, true));
ribCtrlGrpTextHAlignClicked.Nodes.Add (new XrwRibbonControlGroup.XrwRibbonControlGroupRadioNode
    ("Align text horizontally to the justify.",  radioGraphicAlignJustify, true));
ribCtrlGrpTextHAlignClicked.Nodes.Add (new XrwRibbonControlGroup.XrwRibbonControlGroupRadioNode
    ("Align text horizontally to the right.",  radioGraphicAlignRight,  true));
ribCtrlGrpTextHAlignClicked.Clicked += HandleRibbonControlGroupClicked;

XrwText

The XrwText class implements a single line text edit. It's prototype is a simplified Athena's "Text" widget.

The XrwText is a widget, used to render and edit text.

The XrwText can validate the text using regular expression and exchange text data via clipboard.

Successfully tested are these text transfers:

  • MS Notepad (Win7), Notepad++ (V. 6.4.5), MS Write (Win7), MS WinWord 2013 ==> XrwText
  • XrwText ==> MS Notepad (Win7), Notepad++ (V. 6.4.5), MS Write (Win7), MS WinWord 2013
  • XrwText ==> XrwText
  • gedit (V. 2.30.20), Leafpad (V. 0.8.17) ==> XrwText
  • XrwText ==> gedit (V. 2.30.20), Leafpad (V. 0.8.17)
  • KWrite (V. 4.4.4), Kate (V. 3.4.4) ==> XrwText
  • XrwText ==> KWrite (V. 4.4.4), Kate (V. 3.4.4)

Note: Currently all text transfers use the X11 ICCCM selection mechanism with CLIPBOARD selection and STRING format.

This class has no public constructor, but one factory method. NewTextWidget creates a new XrwText.

The image shows a simple XrwText including a selection of two letters and the caret.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwText

New event definitions

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

  • ValueChanged occures after any valid value change.

New public properties

Name Type Access Default/Fallback
AutoLinebreakOnSingleLine bool get, set true
CaretCharIndex int get, set  
CopybufferText string get, set  
  FontData
DefaultFontData
X11FontData get != null
FocusedBackgroundColor   TPixel
TColor
get, set XrwTheme.EditableFocused-
BackgroundColor
HorzTextAlign float get, set 0.5
VertTextAlign float get, set 0.5
InsensitiveBackgroundColor   TPixel
TColor
get, set XrwTheme.EditableInsensitive-
BackgroundColor
LeftMargin int get, set 4
RightMargin int get, set 4
TopMargin int get, set 4
BottomMargin int get, set 4
SelectionStartIndex int get, set  
SelectionEndIndex int get, set  
Text string get, set false
ValidationPattern string get, set null
  • AutoLinebreakOnSingleLine get or set whether to calculate automatic linebreaks (to fit the display text), if display text has no rigid linebreaks.
  • CaretCharIndex get or set the character index from line start to charet.
  • CopybufferText get the text, selected during the last cut/copy command. (The selection can be moved meanwhile.).
  • FontData  DefaultFontData get the default font data. To set the default font data use SetDefaultFont() method.
  • FocusedBackgroundColor get or set the focused background color.
  • HorzTextAlign get or set the horizontal text alignment. 0.0 aligns left, 0.5 aligns center and 1.0 right.
  • VertTextAlign get or set the vertical text alignment. 0.0 aligns top, 0.5 aligns middle and 1.0 bottom.
  • InsensitiveBackgroundColor get or set the widget's background color on insensitivity. The InsensitiveBackgroundColor  doesn't support gradient colors, because an editable square has typically no gradient.
  • Text get or set the text to handle.
  • Margin set the space (in pixels) that will be lef free between the left, right, top and bottom edge and the content.
  • LeftMargin get or set the space (in pixels) that will be lef free between the left edge and the content.
  • RightMargin get or set the space (in pixels) that will be lef free between the right edge and the content.
  • TopMargin get or set the space (in pixels) that will be lef free between the top edge and the content.
  • BottomMargin get or set the space (in pixels) that will be lef free between the bottom edge and the content.
  • SelectionStartIndex get or set the character index from line start to selection start.
  • SelectionEndIndex get or set the character index from line start to selection end.
  • ValidationPattern get or set a RegEx pattern to validate the XrwText's value. An empty pattern supresses any validation.

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

  • CharIndexOfPosition() calculate character index from pointer position.
  •  ValidatedDo() execute the indicated command's Do() only if validation is successful.
  • Paste() paste the indicated input text.

Overridden public methods (XrwRectObj)

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

Overridden public methods (XrwVisibleRectObj)

  • GetContentArea() calculate the content area (the rectangle inside frame)..

Overridden public methods (XrwCore)

  •   SetFont()  SetDefaultFont() set a new default font.

New event handler

None.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

Preregistered event delegates

  • Enter += HandleEnterDefault set focused.
  • Leave += HandleLeaveDefault unset focused.
  • Motion += HandleMotionDefault update the selection, if button is pressed.
  • ButtonPress += HandleButtonPressDefault update the selection (start and end) and caret position.
  • ButtonRelease += HandleButtonReleaseDefault update the selection (end) and caret position.
  • KeyPress += HandleKeyPressDefault process key stroke, either recognized a predefined short cut or treated as input.
  • ClientMessage += HandleClientMessageDefault process client messages sent to this widget of type XrwApplicationShell.VALUE_CHANGED and is calling registered ValueChanged event handler delegates.

Predefined keyboard shortcusts

  • Pos1 jump to the begin of the line.
  • Shift + Pos1 jump to the begin of the line and expand selection to the begin of the line.
  • End jump to the end of the line.
  • Shift + End jump to the end of the line and expand selection to the begin of the line.
  •  Ctrl + c copy selected text and provide it for clipboard exchange.
  •  Ctrl + v paste text from the clipboard into the current selection.
  •  Ctrl + x cut selected text and provide it for clipboard exchange.
  • Ctrl + y redo last text change undo.
  • Ctrl + z undo last text change.

Usage

The XrwColorChooserDialog has the ValidationPattern set to pattern @"\b(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9][0-9]|[0-9])\b" for the red/green/blue color component editor fields. The dialog also uses the ValueChanged event to update the coosen color value.

XrwTree

The XrwTree class implements a tree widget. It is not comparable to Athena's "Tree" widget.

The Athena's description for "Tree" says (X Window System Athena Widgets, Quick Reference Guide):
The Tree widget provides geometry management of arbitrary widgets arranged in a directed, acyclic graph (i.e., a tree). The hierarchy is constructed by attaching a constraint resource called treeParent to each widget indicating which other node in the tree should be treated as the widget's superior. The structure of the tree is shown by laying out the nodes in the standard format for tree diagrams with lines drawn connecting each node with its children.
The Tree calculates it's size according to the needs of its children and is not intended to be resized by its parent. Instead, it should be placed inside another composite widget (such as the Porthole or Viewport) that can be used to scroll around in the tree.

It is comparable to Gtk's "Tree".

The GtkTree widget is a container that shows users a list of items, in a tree format complete with branches and leafnodes. Branches can be expanded to show their child items, or collapsed to hide them.

This class has no public constructor, but one factory method. NewTreeWidget creates a new XrwTree.

The image shows a simple XrwTree with one selected tree node. Every tree node (branch and leaf) shows the expander (), an image and a text.

Starting with this version the XrwTree.TreeNode don't contain the display string directly but a bound data object instead (which still can be a System.String). And the XrwTree class implements the XrwIGridView interface.

  • The XrwTree.TreeNode's bound data object must be a System.Object to support the ToString() method for a fallback display member binding.
  • The XrwIGridView interface enables the tree to display multiple columns, even if embedded in a XrwViewport. A XrwIGridView defines the columns to display by a XrwGridViewColumnCollection.
  • For easy application and backward compatibility a newly created XrwTree instance already contains one default XrwGridViewColumn (inside it's XrwGridViewColumnCollection) without any display member binding - so the display string falls back to the bound data object's ToString() method result.

The image shows a XrwTree inside a XrwViewport containing five columns and column headers with one selected tree node. Every tree node (branch and leaf) shows the expander, an image and a text inside the Name column. The columns 2 ... 5 are text only columns.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwTree

New event definitions

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

  • EntrySelectionChanged occures after any node selection change or node deselection without corresponding selection or node selection without corresponding deselection.
  • SizePreferenceChanged occures after the preferred size has been changed, e.g. by expand or collapse content or by a change of display type. Typically used to signal a viewport the necessity to recalculate the scroll positions. A XrwViewport should listen to this event.
  • NodeCommandInvoke occures after a node's associated command was requested, e. g. by a double click.

New public properties

Name Type Access Default/Fallback
Alternative-
BackgroundColor
  TPixel
TColor
get, set XrwTheme.EditableAlternative-
BackgroundColor
AlternativeFontData X11FontData get != null
AlternativeFontID IntPtr get != IntPtr.Zero
AlternativeFont-
Specification
string get != ""
Columns XrwGridViewColumn-
Collection
get != null
FocusedSelected-
BackgroundColorDark
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-
SelectedBackgroundColorDark
FocusedSelected-
BackgroundColorLight
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-
SelectedBackgroundColorLight
FocusedSelected-
BackgroundColorMedium
  TPixel
TColor
get, set XrwTheme.InteractiveFocused-
SelectedBackgroundColorMedium
FocusedExpander-
BackgroundColor
  TPixel
TColor
get, set XrwTheme.ExpanderFocused-
BackgroundColor
FocusedSelectedExpander-
BackgroundColor
  TPixel
TColor
get, set XrwTheme.ExpanderFocused-
SelectedBackgroundColor
  FontData
DefaultFontData
X11FontData get != null
InsensitiveFontData X11FontData get != null
InverseFontData X11FontData get != null
FontId IntPtr get != IntPtr.Zero
FontSpecification string get != ""
InsensitiveBackgroundColor   TPixel
TColor
get, set XrwTheme.EditableInsensitive-
BackgroundColor
InsensitiveTextColor   TPixel
TColor
get, set XrwTheme.InsensitiveTextColor
InverseTextColor   TPixel
TColor
get, set XrwTheme.InverseTextColor
OffBitmap X11Graphic get X11Graphic.StockIcon.Toggle-
Off16
OffBitmapShared bool get true
OnBitmap X11Graphic get X11Graphic.StockIcon.Toggle-
On16
OnBitmapShared bool get true
Root TreeNode get, set null
RootNodes ItemCollection get != null
SelectedBackground-
ColorDark
  TPixel
TColor
get, set XrwTheme.InteractiveSelected-BackgroundColorDark
SelectedBackground-
ColorLight
  TPixel
TColor
get, set XrwTheme.InteractiveSelected-
BackgroundColorLight
SelectedBackground-
ColorMedium
  TPixel
TColor
get, set XrwTheme.InteractiveSelected-BackgroundColorMedium
ShowExpander bool get, set true
Space int get 2
TextColor   TPixel
TColor
get, set XrwTheme.TextColor
Styles StyleList get != null
InsensitiveStyles StyleList get != null
InverseStyle StyleList get != null
UnsetBitmap X11Graphic get X11Graphic.StockIcon.Toggle-
Unset16
UnsetBitmapShared bool get true
View ViewType get ViewType.Details
  • AlternativeBackgroundColor get or set the alternative tree node background color. The alternative background color is typically used to algternate the row background or to distinguish branch nodes and leaf nodes.
  •  AlternativeFontData get the current alternative font data. The alternative font is typically used to distinguish branch nodes and leaf nodes. To set the font data use SetAlternativeFont() method.
  •  AlternativeFontID get the current alternative font id. The alternative font is typically used to distinguish branch nodes and leaf nodes.
  • AlternativeFontSpecification get the current alternative font specification. The alternative font is typically used to distinguish branch nodes and leaf nodes.
  • Columns get the list of columns, that define the data display characteristics for each node's column display.
  • FocusedSelectedBackgroundColorDark get or set the selected and focused node's background color 3/3.
  • FocusedSelectedBackgroundColorLight get or set the selected and focused node's background color 1/3.
  • FocusedSelectedBackgroundColorMedium get or set the selected and focused node's background color 2/3.
  • FocusedExpanderBackgroundColor get or set the focused expander background color.
  • FocusedSelectedExpanderBackgroundColor get or set the focused and selected expander background color.
  •   FontData DefaultFontData get the default font data. To set the font data use SetDefaultFont() method.
  • InsensitiveFontData get the insensitive font data. To set the font data use SetInsensitiveFont() method.
  • InverseFontData get the inverse font data. To set the font data use SetInverseFont() method.
  •  FontId get the current font id.
  •  FontSpecification get the current font specification.
  • InsensitiveBackgroundColor get or set the widget's background color on insensitivity.
  •  InsensitiveTextColor ges or set the text color of an insensitive tree node's label.
  • InverseTextColor ges or set the text color of a selected tree node's label.
  • LeftMargin get the space (in pixels) that will be lef free between the left edge and the content.
  • OffBitmap get off bitmap used for boolean and three-state value display.
  • OffBitmapShared get the off bitmap shared flag. Not shared bitmaps will be disposed by the XrwTree's Dispose(), shared bitmaps won't.
  • OnBitmap get on bitmap used for boolean and three-state value display.
  • OnBitmapShared get the on bitmap shared flag. Not shared bitmaps will be disposed by the XrwTree's Dispose(), shared bitmaps won't.
  • Root get or set the root tree node.
  • RootNodes get the list of tree root nodes.
  • SelectedBackgroundColorDark get or set the selected node's background color 3/3.
  • SelectedBackgroundColorLight get or set the selected node's background color 1/3.
  • SelectedBackgroundColorMedium get or set the selected node's background color 2/3.
  •  SetInsensitiveFont() set a new insensitive font.
  •  SetInverseFont() set a new inverse font.
  • ShowExpander get or set hether to show the expander symbols.
  • Space get or set the spacing between bitmap and label as well as left and right inside column.
  • Styles get the list of styles, used for drawing tree node text.
  • InsensitiveStyles get the list of styles, used for drawing insensitive list item text.
  • InverseStyles get the list of styles, used for drawing inverse list item text.
  • TextColor get or set the text color of a tree node's label.
  • UnsetBitmap get on bitmap used for three-state value display.
  • UnsetBitmapShared get the on bitmap shared flag. Not shared bitmaps will be disposed by the XrwTree's Dispose(), shared bitmaps won't.
  • View get or set the spacing between bitmap and label as well as left and right inside column.

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

Overridden public properties

None.

Specific static methods (delegates to measure and draw)

To calculate the preferred size and to draw the widget, each cell must be measured and drawn. There are some predefined delegates, that are registered by default. Individual implementations can define their own measure and draw delegated and register them.

  • MeasureHeaderCell() measure the preferred size of a header cell.
  • MeasureExpanderIconTextCell() measure the preferred size of a list cell. Typically the first column contains the expander, an icon and text - this method measures the first column's cells by default.
  • MeasureTextCell() measure the preferred size of a list cell. Typically the second and subsequent columns contain text - this method measures the second and subsequent column's cells by default.
  • DrawExpanderIconTextCell() draw a cell, that contaions the expander, an icon and text - this method draws the first column's cells by default.
  • DrawTextCell() draw a cell, that contaions a text or an image alternatively - this method draws the second and subsequent column's cells by default.

New public methods

  • FindTreeNode() find a tree node for a given pointer position.
  • FindTreeNodeExpander() find a tree node's expander for a given pointer position.
  •  PathOf() get the path of the indicated node. The string contains the zero-based IndexOf indices from root node to indicated node, separated by ":".
  • SelectedNode() get the first currently selected node.
  • FindSelectedNodes() get all selected items.
  • SelectedNodes() get all selected nodes.
  •  SetAlternativeFont() set the current alternative font. The alternative font is typically used to distinguish branch nodes and leaf nodes.
  • SetOffBitmap() set the off bitmap and bitmap shared flag.
  • SetOnBitmap() set the on bitmap and bitmap shared flag.
  • SetUnsetBitmap() set the unset bitmap and bitmap shared flag.

Overridden public methods (XrwCore)

  •  SetFont()  SetDefaultFont() set a new default font.

New event handler

  • OnEntrySelectionChanged() occures after any node selection has been changed or any node has been deselected without corresponding selection orany node has been selected without corresponding deselection and is calling registered event handler delegates.
  • OnSizePreferenceChanged() occures after the list preferres a new size (e. g. the content or the type of view has hanged) and is calling registered event handler delegates.
  • OnNodeCommandInvoke() occures after a double click, indicating that node wants to execute a command, happened and is calling registered event handler delegates.

Overridden event handler (XrwRectObj)

  • OnExpose() handle the ExposeEvent event.

Preregistered event delegates

  • ButtonRelease += HandleButtonReleaseDefault select a tree node and call the node command on double click. Or expands or collapses on expander.
  • Motion += HandleMotionDefault focus or unfocus a tree node or expander.

Usage

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

XrwViewportGridViewHeader

 The XrwViewportGridViewHeader class implements a header widget for XrwViewPort children, displaying a grid view.

The XrwViewportGridViewHeader is an integral part of the XrwViewport 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 child. It supports column resizing and reordering.

The  XrwViewportGridViewHeader has no internal header data. It takes the header data from the XrwIGridView's Child instead. Only for a XrwIGridView's Child implementing the XrwIGridView interface, the XrwViewportGridViewHeader shows column header names, otherwise it remains empty. Irrespective whether the XrwIGridView's Child is implementing the XrwIGridView interface, the header can be visible, hidden or collpsed, controlled by the XrwViewPort.HeaderVisibility property, and the header's preferred size can be defined, controlled by the XrwViewPort.HeaderPreferredHeight property.

Currently the  XrwList and  XrwTree implement the XrwIGridView interface.

The image shows a XrwViewportGridViewHeader displaying 4 header names.

Inheritance (↑)

IDisposable --> XrwObject --> XrwRectObject --> XrwVisibleRectObj --> XrwCore --> XrwSimple --> XrwViewportGridViewHeader

New event definitions

XrwViewportGridViewHeader can only be instantiated as widget. The widget can receive events on it's own (has a window on X server side).

None.

New public properties

Name Type Access Default/Fallback
CursorState CursorStateType get CursorStateType.Normal
ColumnDrag ColumnDragType get, set ColumnDragType.FullAnimated
  • CursorState get which cursor is currently displayed. It can either be the arrow CursorStateType.Normal, the horizontal double arrow CursorStateType.Resize or the hand 2  CursorStateType.Drag.
  • ColumnDrag get or set the column drag capability. It can either be switched off ColumnDragType.Never, update the column headers while dragging ColumnDragType.HeaderAnimated or update header and grid view while dragging ColumnDragType.FullAnimated.

Overridden public properties

None.

New public methods

None.

Overridden public methods

None.

New event handler

None.

Overridden event handler (XrwRectObj)

  •  OnExpose() handle the ExposeEvent event.

Preregistered event delegates

  • Motion += HandleMotionDefault calculate column to resize or reorder and apply it.
  • ButtonRelease += HandleButtonPressDefault invoke redraw after column resize or reorder.

Usage

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

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 fourth public version of the Roma widget set, 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 05. 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.

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 4 Pin
prashita gupta3-Jul-14 18:20
memberprashita gupta3-Jul-14 18:20 

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
Web03 | 2.8.150901.1 | Last Updated 9 Mar 2015
Article Copyright 2014 by Steffen Ploetz
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid