-
-
Notifications
You must be signed in to change notification settings - Fork 10
Crow.Widget
Jean-Philippe Bruyère edited this page Oct 26, 2021
·
3 revisions
The base class for all the ui components.
namespace: Crow
-
Widget
public class Widget : ILayoutable, ICommandHost
⬜ | prototype | description |
---|---|---|
Widget (Interface iface, string style=null) |
This constructor must be used when creating widget from code. |
⬜ | name | description |
---|---|---|
AllowDrag |
If true, allow widget to be dragged and dropped. | |
AllowDrop |
If true, allow widgets of type listed in 'AllowedDropTypes' to be dropped in this widget during drag and drop operations. | |
AllowedDropTypes |
Semicolon separated list of accepted types as dropped widget. | |
ArrangeChildren |
__ | |
Background |
background fill of the control, maybe solid color, gradient, image, or svg | |
BubbleEvents |
if false, prevent mouse events to bubble to the parent in any case. | |
CacheEnabled |
If enabled, resulting bitmap of graphic object is cached speeding up rendering of complex object. Default is enabled. | |
ClientRectangle |
Local coordinates of the client rectangle. The x and y are equal to the margin. | |
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. | |
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 | |
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 | |
IsVisible |
set the visible state of the control, invisible controls does reserve space in the layouting system. | |
Left |
x position inside parent | |
localLogicalParentIsNull |
__ | |
LogicalParent |
Logical parenting is used to override the default Graphic tree hierarchy for datasource resolution. | |
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 | |
MouseCursor |
Determine Cursor when mouse is Hover. | |
MouseRepeat |
true if holding mouse button down should trigger multiple click events | |
Name |
Name is used in binding to reference other GraphicObjects 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 |
Curently queued layouting passes. | |
RequiredLayoutings |
Required layouting passes before this widget may be renderend. | |
RootDataLevel |
If true, lock datasource seeking upward in logic or graphic tree to this widget. | |
StickyMouse |
When StickyMouse value is greater than zero and StickyMouseEnabled is true, mouse will be sticked over the widget until x or y delta is greater than the StickyMouse value. This is usefulle for very thin (1 pixel) border that need to be grabbed with the mouse. | |
StickyMouseEnabled |
Boolean for enabling or not the sticky mouse mechanic | |
Style |
Style key to use for this control | |
Tag |
Random value placeholder | |
Tooltip |
Gets or sets a tooltip to show when mouse stay still over the control. | |
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 |
⬜ | prototype | description |
---|---|---|
bool AcceptDrop(Widget droppedWidget) |
__ | |
void checkHoverWidget(MouseMoveEventArgs e) |
__ | |
void ChildrenLayoutingConstraints(ILayoutable layoutable, ref LayoutingType layoutType) |
Used to prevent some layouting type in children. For example, in the GenericStack, x layouting is dismissed in the direction of the stacking to let the parent arrange children in the x direction. | |
void ClippingRegistration() |
Register old and new slot for clipping | |
bool Contains(Widget goToFind) |
__ | |
Rectangle ContextCoordinates(Rectangle r) |
Compute rectangle position on surface of the context. It ma be the first cached surface in parenting chain, or the top backend surface if no cached widget is part of the current widget tree. | |
void Dispose() |
__ | |
Widget FindByName(string nameToFind) |
__ | |
T FindByType< T >() |
__ | |
Rectangle GetClientRectangleForChild(ILayoutable child) |
__ | |
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 | |
int measureRawSize(LayoutingType lt) |
return size of content + margins | |
bool MouseIsIn(Point m) |
__ | |
void NotifyValueChanged(string MemberName, object _value) |
Helper function to raise the value changed event | |
void NotifyValueChangedAuto(object _value, [CallerMemberName] string caller=null) |
__ | |
void OnDataSourceChanged(object sender, DataSourceChangeEventArgs e) |
__ | |
void onDisable(object sender, EventArgs e) |
__ | |
void onDrag(object sender, MouseMoveEventArgs e) |
equivalent to mouse move for a dragged widget, no bubbling. | |
void onDragLeave(object sender, DragDropEventArgs e) |
__ | |
void onDrop(object sender, DragDropEventArgs e) |
__ | |
void onEnable(object sender, EventArgs e) |
__ | |
void onEndDrag(object sender, DragDropEventArgs e) |
Occured when dragging ends without dropping | |
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) |
Default mouse click method. A click is a press and release without mouving combination. | |
void onMouseDoubleClick(object sender, MouseButtonEventArgs e) |
Default mouse double click method. A double click is two consecutive press and release without mouving combination. within a delay defined by Interface.DOUBLECLICK_TRESHOLD |
|
void onMouseDown(object sender, MouseButtonEventArgs e) |
Default mouse button press method. The MouseDown event is raised from withing it. |
|
void onMouseEnter(object sender, MouseMoveEventArgs e) |
__ | |
void onMouseLeave(object sender, MouseMoveEventArgs e) |
__ | |
void onMouseMove(object sender, MouseMoveEventArgs e) |
__ | |
void onMouseUp(object sender, MouseButtonEventArgs e) |
Default mouse button release method. The MouseUp event is raised from withing it. |
|
void onMouseWheel(object sender, MouseWheelEventArgs e) |
__ | |
void Paint(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, if width or height is 'Fit' a layouting is requested, and a redraw is done in any case. | |
void RegisterForLayouting(LayoutingType layoutType) |
__ | |
void RegisterForRedraw() |
query an update of the content without layouting changes | |
void RegisterForRepaint() |
query a repaint, if control is cached, cache will not be updated and simply repainted. if not cached, repaint will trigger the onDraw method. | |
Rectangle RelativeSlot(Widget target) |
Compute coordintates relative to another widget. | |
Rectangle ScreenCoordinates(Rectangle r) |
Widget coordintate relative to the main drawing surface, normally a GLFW window. | |
Point ScreenPointToLocal(Point p) |
Used to convert top window coordinate to widget local ones (for mouse for example). | |
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 |
⬜ | name | description |
---|---|---|
DataSourceChanged |
Occurs when DataSource changed | |
Disabled |
Occurs when the enabled state this object is set to false | |
Drag |
__ | |
DragEnter |
__ | |
DragLeave |
__ | |
Drop |
__ | |
Enabled |
Occurs when this widget is enabled | |
EndDrag |
__ | |
Focused |
Occurs when this object received focus | |
Hover |
Occurs when this widget is hovered by the mouse | |
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 the bounding rectangle of this object | |
MouseLeave |
Occurs when mouse leave the bounds of 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 | |
Painted |
__ | |
ParentChanged |
Occurs when the parent has changed | |
StartDrag |
__ | |
Unfocused |
Occurs when this object loose focus | |
Unhover |
Occurs when this widget is no longuer the hover one | |
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. |