classWidget

Constructors

note_add Widget( parent, isDarkWindow )

Fields

keyboard_double_arrow_right MouseClickkeyboard_double_arrow_right MouseLeftPresskeyboard_double_arrow_right MouseMiddlePresskeyboard_double_arrow_right MouseMovekeyboard_double_arrow_right MouseReleasekeyboard_double_arrow_right MouseRightClickkeyboard_double_arrow_right MouseRightPresskeyboard_double_arrow_right OnPaintOverride

Properties

data_array Cursordata_array ProvidesDebugModedata_array ReadOnlydata_array WindowTitledata_object AcceptDropsdata_object Childrendata_object ContentMarginsdata_object ContentRectdata_object DebugModeEnableddata_object DeleteOnClosedata_object DpiScaledata_object Enableddata_object FixedHeightdata_object FixedWidthdata_object FocusModedata_object FocusProxydata_object HasMaximizeButtondata_object Heightdata_object IsActiveWindowdata_object IsBeingDroppedOndata_object IsDraggabledata_object IsFocuseddata_object IsFramelessWindowdata_object IsMaximizeddata_object IsMinimizeddata_object IsPopupdata_object IsPresseddata_object IsTooltipdata_object IsUnderMousedata_object IsWindowdata_object Layoutdata_object LocalRectdata_object MaximumHeightdata_object MaximumSizedata_object MaximumWidthdata_object MinimumHeightdata_object MinimumSizedata_object MinimumWidthdata_object MouseTrackingdata_object Namedata_object NoSystemBackgrounddata_object Parentdata_object Positiondata_object ScreenGeometrydata_object ScreenPositiondata_object ScreenRectdata_object ShowWithoutActivatingdata_object Sizedata_object StatusTipdata_object ToolTipdata_object TranslucentBackgrounddata_object TransparentForMouseEventsdata_object UpdatesEnableddata_object Visibledata_object Widthdata_object WindowOpacity

Methods

integration_instructions ChildValuesChanged( source ) integration_instructions Close() integration_instructions DoLayout() integration_instructions FocusNext() integration_instructions FocusPrevious() integration_instructions Hide() integration_instructions OnBlur( reason ) integration_instructions OnClose() integration_instructions OnClosed() integration_instructions OnContextMenu( e ) integration_instructions OnDoubleClick( e ) integration_instructions OnDragDrop( ev ) integration_instructions OnDragHover( ev ) integration_instructions OnDragLeave() integration_instructions OnDragStart() integration_instructions OnFocus( reason ) integration_instructions OnKeyPress( e ) integration_instructions OnKeyRelease( e ) integration_instructions OnMouseClick( e ) integration_instructions OnMouseEnter() integration_instructions OnMouseLeave() integration_instructions OnMouseMove( e ) integration_instructions OnMousePress( e ) integration_instructions OnMouseReleased( e ) integration_instructions OnMouseRightClick( e ) integration_instructions OnMoved() integration_instructions OnPaint() integration_instructions OnResize() integration_instructions OnShortcutPressed( e ) integration_instructions OnVisibilityChanged( visible ) integration_instructions OnWheel( e ) integration_instructions SetWindowIcon( name ) integration_instructions SetWindowIcon( icon ) integration_instructions Show() integration_instructions Signal( signal ) integration_instructions SizeHint() integration_instructions Update() code AdjustSize() code Blur() code ClearContext( key ) code ConstrainTo( parentRect ) code ConstrainToScreen() code DestroyChildren() code DisableWindowActivation() code Focus( activateWindow ) code FromScreen( p ) code GetContext<T>( key, defaultIfMissing ) code IsModal() code Lower() code MakeMaximized() code MakeMinimized() code MakeSignal( name ) code MakeWindowed() code PostKeyEvent( key ) code Raise() code RestoreGeometry( state ) code SaveGeometry() code SetContentHash( hash, secondsDebounce ) code SetContext( key, value ) code SetEffectOpacity( f ) code SetModal( on, application ) code SetSizeMode( horizontal, vertical ) code SetStyles( sheet ) code SetStylesheetFile( filename ) code SignalValuesChanged() code ToScreen( p )

Events

event OnChildValuesChangedevent VisibilityChanged
Widget
Derives from QObject
[Expose, ]

Summary

A generic widget.

Constructors

Widget( Widget parent, bool isDarkWindow = false, )

The default widget constructor

Fields

Action MouseClick

Called when this widget is left clicked (on mouse release).

Called when this widget is left clicked (on mouse press).

Called when this widget is clicked with the mouse wheel (on mouse press).

Called when the mouse cursor is moved while being over this widget.

Action MouseRelease

Called when mouse is released over this widget.

Called when this widget is right clicked (on mouse release).

Called when this widget is right clicked (on mouse press).

Func<bool> OnPaintOverride

Override the widget's paint process.

Return true to prevent the default paint action, which is to call Widget.OnPaint.

Properties

virtual CursorShape Cursor { get; set; }

Cursor override for this widget.

virtual bool ProvidesDebugMode { get; }

If true then this widget has a debug mode that can be activated

virtual bool ReadOnly { get; set; }

Makes the widget read only. I.e. You can copy text of a text entry, but can't edit it. Applies retroactively to all children.

virtual string WindowTitle { get; set; }
bool AcceptDrops { get; set; }

Accept drag and dropping shit on us

IEnumerable<Widget> Children { get; }

Child widgets of this widget.

Margin ContentMargins { get; set; }
Rect ContentRect { get; }
bool DebugModeEnabled { get; set; }

Enable debug mode on this widget.

bool DeleteOnClose { get; set; }

Delete this widget when close is pressed

float DpiScale { get; }

The scale this widget is using (multiplying Size by this value gives the actual native size)

bool Enabled { get; set; }

Makes the widget not interactable. This is also usually be reflected visually by the widget. The widget will not process any keyboard or mouse inputs. Applies retroactively to all children.

float FixedHeight { set; }
float FixedWidth { set; }
FocusMode FocusMode { get; set; }

Sets the focus mode for this widget. This determines both how it will get focus and whether it will receive keyboard input.

Widget FocusProxy { get; set; }
bool HasMaximizeButton { get; set; }
float Height { get; set; }

Utility to interact with a widget's width - use Size where possible

bool IsActiveWindow { get; }
bool IsBeingDroppedOn { get; }

Whether something is being dragged over this widget.

bool IsDraggable { get; set; }

Whether this widget can be drag and dropped onto other widgets.

bool IsFocused { get; }

Whether this widget has keyboard focus.

bool IsFramelessWindow { get; set; }
bool IsMaximized { get; }
bool IsMinimized { get; }
bool IsPopup { get; set; }
bool IsPressed { get; }

Whether this widget is currently being pressed down or not.

bool IsTooltip { get; set; }
bool IsUnderMouse { get; }
bool IsWindow { get; set; }
Layout Layout { get; set; }

The widget's internal layout, if any. Must be created via SetLayout or otherwise set beforehand.

Rect LocalRect { get; }

This panel's rect at 0,0

float MaximumHeight { get; set; }

This widgets height should never be larger than the given value.

Vector2 MaximumSize { get; set; }

Sets Widget.MaximumWidth and Widget.MaximumHeight simultaneously.

float MaximumWidth { get; set; }

This widgets width should never be larger than the given value.

float MinimumHeight { get; set; }

This widgets height should never be smaller than the given value.

Vector2 MinimumSize { get; set; }

Sets Widget.MinimumWidth and Widget.MinimumHeight simultaneously.

float MinimumWidth { get; set; }

This widgets width should never be smaller than the given value.

bool MouseTracking { get; set; }
string Name { get; set; }

Name of the widget, usually for debugging purposes.

bool NoSystemBackground { get; set; }
Widget Parent { get; set; }

Parent widget. If non null, position of this widget will be relative to the parent widget. Certain events will also propagate to the parent widget if unhandled.

Vector2 Position { get; set; }

Position of this widget, relative to its parent if it has one.

Rect ScreenGeometry { get; }

Returns the geometry of the screen this widget is currently on.

Position of the widget relative to the monitor's top left corner.

Rect ScreenRect { get; }

This panel's rect in screen coordinates

bool ShowWithoutActivating { get; set; }
Vector2 Size { get; set; }

Size of this widget.

string StatusTip { get; set; }

If set, hovering over this widget will set the text of a Editor.StatusBar of the window the widget belongs to.

string ToolTip { get; set; }

If set, this text will be displayed after a certain delay of hovering this widget with the mouse cursor.

bool TranslucentBackground { get; set; }
bool TransparentForMouseEvents { get; set; }
bool UpdatesEnabled { get; set; }

If true, Update will call

bool Visible { get; set; }

Whether this widget is visible or not.

float Width { get; set; }

Utility to interact with a widget's width - use Size where possible

float WindowOpacity { get; set; }

Methods

virtual void ChildValuesChanged( Widget source, )
virtual void Close( )

If a window - will close

protected virtual void DoLayout( )

Called to make sure all child panels are in correct positions and have correct sizes. This is typically called when the size of this widget changes, but there are other cases as well.

protected virtual bool FocusNext( )
protected virtual bool FocusPrevious( )
virtual void Hide( )

Make this widget not visible.

protected virtual void OnBlur( FocusChangeReason reason, )

Called when the widget loses keyboard focus.

protected virtual bool OnClose( )

Called when a window is about to be closed.

protected virtual void OnClosed( )

Called when a window is closed.

protected virtual void OnContextMenu( ContextMenuEvent e, )

Called after Widget.OnMouseRightClick, for the purposes of opening a context menu.

protected virtual void OnDoubleClick( MouseEvent e, )

Called when the widget was double clicked with any mouse button.

virtual void OnDragDrop( DragEvent ev, )

Something was dragged and dropped on this widget. Apply the data here, if its valid.

Requires Widget.AcceptDrops to function.

virtual void OnDragHover( DragEvent ev, )

Cursor with drag and drop data moved on this widget.

Requires Widget.AcceptDrops to function.

virtual void OnDragLeave( )

Cursor with drag and drop data left the bounds of this widget.

Requires Widget.AcceptDrops to function.

protected virtual void OnDragStart( )

Called when dragging. Widget.IsDraggable should be true.

protected virtual void OnFocus( FocusChangeReason reason, )

Called when the widget gains keyboard focus.

protected virtual void OnKeyPress( KeyEvent e, )

A key has been pressed. Your widget needs keyboard focus for this to be called - see FocusMode.

protected virtual void OnKeyRelease( KeyEvent e, )

A key has been released.

protected virtual void OnMouseClick( MouseEvent e, )

Called when this widget is left clicked (on mouse release).

protected virtual void OnMouseEnter( )

Mouse cursor entered the bounds of this widget.

protected virtual void OnMouseLeave( )

Mouse cursor exited the bounds of this widget.

protected virtual void OnMouseMove( MouseEvent e, )

Called when the mouse cursor is moved while being over this widget.

protected virtual void OnMousePress( MouseEvent e, )

Called when mouse is pressed over this widget.

protected virtual void OnMouseReleased( MouseEvent e, )

Called when mouse is released over this widget.

protected virtual void OnMouseRightClick( MouseEvent e, )

Called when this widget is right clicked (on mouse release).

protected virtual void OnMoved( )

Called when the widget was moved.

protected virtual void OnPaint( )

Override to custom paint your widget, for example using Editor.Paint. Can be overwritten by Widget.OnPaintOverride.

protected virtual void OnResize( )

Called when the widgets' size was changed.

protected virtual void OnShortcutPressed( KeyEvent e, )

A shortcut has been activated. This is called on the focused control so they can override it.

protected virtual void OnVisibilityChanged( bool visible, )

Called when the visibility of this widget changes.

protected virtual void OnWheel( WheelEvent e, )

Mouse wheel was scrolled while the mouse cursor was over this widget.

virtual void SetWindowIcon( string name, )
virtual void SetWindowIcon( Pixmap icon, )
virtual void Show( )

Make this widget visible.

protected virtual void Signal( WidgetSignal signal, )
protected virtual Vector2 SizeHint( )

Should return the size this widget really wants to be if it can its way. The default is that you don't care - and just to return whatever the base value is.

virtual void Update( )

Tell this widget that shit changed and it needs to redraw

void AdjustSize( )

Adjusts the size of the widget to fit its contents.

void Blur( )

Clear keyboard focus from this widget.

void ClearContext( string key, )

Remove a context on this widget. This will NOT remove contexts set from parent objects.

void ConstrainTo( Rect parentRect, )

Reposition this widget to ensure it is within the given rectangle.

Constrain this widget to the screen it's currently on.

void DestroyChildren( )

Destroys all child widgets of this widget.

Calling this will set the WS_EX_NOACTIVATE flag on the window internally, which will stop it taking focus away from other windows.

void Focus( bool activateWindow = true, )

Transform coordinates relative to the monitors's top left corner, to coordinates relative to panel's top left corner.

T GetContext<T,>( string key, T defaultIfMissing = null, )

Find a context on this widget. If not found, look at the parent. If not found, look at the parent. This is useful for passing information down to child widgets without any effort.

bool IsModal( )

Returns true if this is a modal window. This means it will appear on top of everything and block input to everything else.

void Lower( )

Lowers the widget to the bottom of the parent widget's stack. After this call the widget will be visually behind (and therefore obscured by) any overlapping sibling widgets.

void MakeMaximized( )
void MakeMinimized( )
void MakeSignal( string name, )
void MakeWindowed( )
void PostKeyEvent( KeyCode key, )
void Raise( )

Raises this widget to the top of the parent widget's stack. After this call the widget will be visually in front of any overlapping sibling widgets.

void RestoreGeometry( string state, )

Restore position and size previously stored via Widget.SaveGeometry.

string SaveGeometry( )

Serialize position and size of this widget to a string, which can then be passed to Widget.RestoreGeometry.

bool SetContentHash( int hash, float secondsDebounce = 0.1, )

Call every frame/tick to redraw this Widget on content change

void SetContext( string key, object value, )

Set a context value on this widget. This context will be available to its children via FindContext.

void SetEffectOpacity( float f, )
void SetModal( bool on, bool application = false, )

Set this window to be modal. This means it will appear on top of everything and block input to everything else.

void SetSizeMode( SizeMode horizontal, SizeMode vertical, )
void SetStyles( string sheet, )

Directly set CSS style sheet(s) for this widget. Same format as a .css file.

void SetStylesheetFile( string filename, )

Set a file to load CSS for this widget from.

protected void SignalValuesChanged( )

When a value on this widget changed due to user input (ie, checking a box, editing a form) this is called, which sends a signal up the parent widgets.

Transform coordinates relative to the panel's top left corner, to coordinates relative to monitors's top left corner.

Events

VisibilityChanged( bool obj, )

Called when the visibility of this widget changes.

Nested Types

  • Information about a widget drag and drop event.

Inheriting Types