Skip to content
Jean-Philippe Bruyère edited this page Aug 19, 2021 · 3 revisions

The base class for all the graphic tree elements.

namespace: Crow

Inheritance Hierarchy

Syntax

public class Widget : ILayoutable, IValueChange

Constructors

prototype description
Widget (Interface iface) This constructor must be used when creating widget from code.

Properties

name description
AllowDrag __
AllowDrop __
ArrangeChildren __
Background background fill of the control, maybe solid color, gradient, image, or svg
CacheEnabled If enabled, resulting bitmap of graphic object is cached speeding up rendering of complex object. Default is enabled.
ClientRectangle __
ClipToClientRect If true, rendering of Widget is clipped inside client rectangle
ContextCommands __
CornerRadius to get rounded corners
DataSource Seek first logical tree upward if logicalParent is set, or seek graphic tree for a not null dataSource that will be active for all descendants having dataSource=null
DataSourceType Fully qualify type name of expected data source. If set, datasource bindings will be speedup by avoiding reflexion in generated dyn methods. If an object of a different type is set as datasource, bindings will be canceled. It accepts all derived type.
Fit Helper property used to set width and height to fit in one call
Focusable Indicate that this object may received focus or not, if not focusable all the descendants are affected.
focusParent __
Font Font being used in many controls, it is defined in the base Widget class.
Foreground Foreground fill of the control, usage may be different among derived controls
ForwardMouseEvents forward mouse events even if an handle is bound
HasFocus True when this control has the focus, only one control per interface may have it.
Height Height of this control, by default inherited from parent. May have special values such as Stretched or Fit. It may be proportionnal or absolute.
HeightPolicy Was Used for binding on dimensions, this property will never hold fixed size, but instead only Fit or Stretched, with inherited state implementation, it is not longer used in binding
HorizontalAlignment Horizontal alignment inside parent, disabled if width is stretched or left coordinate is not null
IsActive true if this control is active, this means that mouse has been pressed in it and not yet released. It could be used for other two states periferic action.
IsDragged __
IsDropTarget __
IsEnabled get or set the enabled state, disabling a control will affect focuability and also it's rendering which will be grayed
IsHover true if this control has the pointer hover
Left x position inside parent
localLogicalParentIsNull __
LogicalParent __
Margin This is a single integer for the 4 direction, a gap between the control and it's container, by default it is filled with the background.
MaximumSize Maximum width and height for this control, unlimited if null.
MinimumSize Minimal width and height for this control
MouseRepeat true if holding mouse button down should trigger multiple click events
Name Name is used in binding to reference other Widgets inside the graphic tree and by template controls to find special element in their template implementation such as a container or a group to put children in.
Parent Parent in the graphic tree, used for rendering and layouting
RegisteredLayoutings __
RootDataLevel If true, rendering of Widget is clipped inside client rectangle
Style Style key to use for this control
Tag Random value placeholder
Tooltip __
Top y position inside parent
VerticalAlignment Vertical alignment inside parent, disabled if height is stretched or top coordinate is not null
Visible set the visible state of the control, invisible controls does reserve space in the layouting system.
Width Width of this control, by default inherited from parent. May have special values such as Stretched or Fit. It may be proportionnal or absolute.
WidthPolicy Was Used for binding on dimensions, this property will never hold fixed size, but instead only Fit or Stretched, with inherited state implementation, it is not longer used in binding

Methods

prototype description
void checkHoverWidget(MouseMoveEventArgs e) __
void ChildrenLayoutingConstraints(ref LayoutingType layoutType) By default in groups, LayoutingType.ArrangeChildren is reset
void ClippingRegistration() Register old and new slot for clipping
bool Contains(Widget goToFind) __
Rectangle ContextCoordinates(Rectangle r) __
void Dispose() __
Widget FindByName(string nameToFind) __
Rectangle getSlot() __
void Initialize() Initialize this Graphic object instance by setting style and default values and loading template if required
bool IsOrIsInside(Widget go) return true if this is contained inside go
void loadDefaultValues() Loads the default values from XML attributes default
bool MouseIsIn(Point m) __
void NotifyValueChanged(string MemberName, object _value) Helper function to raise the value changed event
void OnDataSourceChanged(object sender, DataSourceChangeEventArgs e) __
void onDisable(object sender, EventArgs e) __
void onEnable(object sender, EventArgs e) __
void onKeyDown(object sender, KeyEventArgs e) __
void onKeyPress(object sender, KeyPressEventArgs e) __
void onKeyUp(object sender, KeyEventArgs e) __
void OnLayoutChanges(LayoutingType layoutType) trigger dependant sizing component update
void onMouseClick(object sender, MouseButtonEventArgs e) __
void onMouseDoubleClick(object sender, MouseButtonEventArgs e) __
void onMouseDown(object sender, MouseButtonEventArgs e) __
void onMouseEnter(object sender, MouseMoveEventArgs e) __
void onMouseLeave(object sender, MouseMoveEventArgs e) __
void onMouseMove(object sender, MouseMoveEventArgs e) __
void onMouseUp(object sender, MouseButtonEventArgs e) __
void onMouseWheel(object sender, MouseWheelEventArgs e) __
void Paint(ref Context ctx) Chained painting routine on the parent context of the actual cached version of the widget
bool PointIsIn(ref Point m) Recursive local coordinate point test. After test on parent, point m is in local coord system.
void RegisterClip(Rectangle clip) Add clip rectangle to this.clipping and propagate up to root
void RegisterForGraphicUpdate() Full update, content and layouting, taking care of sizing policy
void RegisterForLayouting(LayoutingType layoutType) __
void RegisterForRedraw() query an update of the content without layouting changes
Rectangle ScreenCoordinates(Rectangle r) __
Point ScreenPointToLocal(Point p) __
string ToString() __
bool UpdateLayout(LayoutingType layoutType) Update layout component only one at a time, this is where the computation of alignement and size take place. The redrawing will only be triggered if final slot size has changed

Events

name description
DataSourceChanged Occurs when DataSource changed
Disabled Occurs when the enabled state this object is set to false
DragEnter __
DragLeave __
Drop __
Enabled Occurs when this control is no longer the Hover one
EndDrag __
Focused Occurs when this object received focus
Hover Occurs when mouse is over
Initialized Occurs when default value and styling are loaded, and for templated control, template is also loaded. Bindings should be functionnal as well.
KeyDown Occurs when key is pressed when this object is active
KeyPress Occurs when translated key event occurs in the host when this object is active
KeyUp Occurs when key is released when this object is active
LayoutChanged Occurs when one part of the rendering slot changed
LogicalParentChanged Occurs when the logical parent has changed
MouseClick Occurs when mouse button has been pressed then relesed in this object. It bubbles to the root
MouseDoubleClick Occurs when mouse button has been pressed then relesed 2 times in this object. It bubbles to the root
MouseDown Occurs when mouse button is pressed in this object. It bubbles to the root
MouseEnter Occurs when mouse enter this object
MouseLeave Occurs when mouse leave this object
MouseMove Occurs when mouse mouve in this object. It bubbles to the root
MouseUp Occurs when mouse button is released in this object. It bubbles to the root
MouseWheelChanged Occurs when mouse wheel is rolled in this object. It bubbles to the root
ParentChanged Occurs when the parent has changed
StartDrag __
Unfocused Occurs when this object loose focus
ValueChanged Raise to notify that the value of a property has changed, the binding system rely mainly on this event. the member name may not be present in the class, this is used in propertyless bindings, this allow to raise custom named events without needing to create an new one in the class or a new property.
Clone this wiki locally