Download Now

    Reference TMainWidget

    Declared in Codebot.Render.Widgets.pas on line 418

    TMainWidget should serve as the base parent widget for your layouts
      TMainWidget = class(TWidget)
      protected
        procedure SetModal(Window: TWindow);
        procedure UnsetModal(Window: TWindow);
        { Make the position of a mouse event relative to a widget }
        procedure MouseLocal(Widget: TWidget; var Args: TSceneMouseArgs);
      public
        { The main widget using a theme }
        constructor Create(Theme: TTheme); reintroduce;
        destructor Destroy; override;
        { Modal window message related functions }
        procedure MessageBox(const Message: string);
        { Show a modal message with yes and no buttons, calling OnResult with the
          answer }
        procedure MessageConfirm(const Message: string; OnResult: TModalResultEvent);
        { Show a modal message with a title, a glyph, and a choice of buttons,
          calling OnResult with the button chosen }
        procedure MessageDialog(const Title, Glyph, Message: string; Buttons: TModalButtons; OnResult: TModalResultEvent);
        { Commmunicate events with the widgets }
        procedure DispatchKeyDown(var Args: TSceneKeyArgs);
        procedure DispatchKeyUp(var Args: TSceneKeyArgs);
        procedure DispatchMouseDown(var Args: TSceneMouseArgs);
        procedure DispatchMouseMove(var Args: TSceneMouseArgs);
        procedure DispatchMouseUp(var Args: TSceneMouseArgs);
        procedure DispatchTextInput(var Args: TSceneTextArgs);
        procedure DispatchMouseWheel(var Args: TSceneWheelArgs);
        { The current active window }
        property ActiveWindow: TWindow read FActiveWindow write SetActiveWindow;
        { The current modal window }
        property ModalWindow: TWindow read FModalWindow;
        { The current selected widget with input focus }
        property Selected: TWidget read FSelected;
        { Render all the widgets }
        procedure Render(Width, Height: Integer; Time: Double);
        { The time passed in render above }
        property Time: Double read FTime;
        { The position of the last mouse event dispatched to the widgets }
        property MousePos: TPointF read FMousePos;
        { Map a point from the main widget to where a widget is, which is different
          when the widget is inside of one with a Matrix }
        function WidgetPoint(Widget: TWidget; X, Y: Float): TPointF;
        { MousePos mapped to where a widget is. Compare it with the computed bounds
          of the widget. }
        function MouseFor(Widget: TWidget): TPointF;
        { When show hint is true, hints are displayed if a widget has a hint value }
        property ShowHint: Boolean read FShowHint write FShowHint;
        { The widget which has the mouse while a button is held down }
        property Capture: TWidget read FCapture;
        property OnKeyDown;
        property OnKeyUp;
        property OnMouseDown;
        property OnMouseMove;
        property OnMouseUp;
      end;

    See also

    Float in Codebot.System.pas
    TPointF in Codebot.Graphics.Types.pas
    TSceneKeyArgs in Codebot.Render.Scenes.pas
    TSceneMouseArgs in Codebot.Render.Scenes.pas
    TSceneTextArgs in Codebot.Render.Scenes.pas
    TSceneWheelArgs in Codebot.Render.Scenes.pas