{
  "name": "View",
  "component": "gui",
  "header": "nativeui/view.h",
  "type": "Class",
  "namespace": "nu",
  "inherit": {
    "name": "Responder",
    "id": "responder"
  },
  "description": "Base class for GUI components.",
  "detail": "`View` provides methods to receive and change various style properties.\n",
  "methods": [
    {
      "signature": {
        "returnType": {
          "name": "Vector2dF",
          "id": "vector2df"
        },
        "name": "offsetfromview",
        "parameters": [
          {
            "type": {
              "name": "View",
              "id": "view"
            },
            "name": "view"
          }
        ],
        "shortStr": "offsetfromview(view)",
        "str": "offsetfromview(view)"
      },
      "description": "Return offset from `view`.",
      "id": "offsetfromview-view"
    },
    {
      "signature": {
        "returnType": {
          "name": "Vector2dF",
          "id": "vector2df"
        },
        "name": "offsetfromwindow",
        "parameters": [],
        "shortStr": "offsetfromwindow()",
        "str": "offsetfromwindow()"
      },
      "description": "Return offset from the window that owns the view.",
      "id": "offsetfromwindow"
    },
    {
      "signature": {
        "returnType": {
          "name": "RectF",
          "id": "rectf"
        },
        "name": "getbounds",
        "parameters": [],
        "shortStr": "getbounds()",
        "str": "getbounds()"
      },
      "description": "Return the position and size of the view, relative to its parent.",
      "id": "getbounds"
    },
    {
      "signature": {
        "returnType": {
          "name": "RectF",
          "id": "rectf"
        },
        "name": "getboundsinscreen",
        "parameters": [],
        "shortStr": "getboundsinscreen()",
        "str": "getboundsinscreen()"
      },
      "description": "Return the position and size of the view in the screen.",
      "id": "getboundsinscreen"
    },
    {
      "signature": {
        "name": "layout",
        "parameters": [],
        "shortStr": "layout()",
        "str": "layout()"
      },
      "description": "Make the view re-recalculate its layout.",
      "id": "layout"
    },
    {
      "signature": {
        "name": "schedulepaint",
        "parameters": [],
        "shortStr": "schedulepaint()",
        "str": "schedulepaint()"
      },
      "description": "Schedule to repaint the whole view.",
      "id": "schedulepaint"
    },
    {
      "signature": {
        "name": "schedulepaintrect",
        "parameters": [
          {
            "type": {
              "name": "RectF",
              "id": "rectf"
            },
            "name": "rect"
          }
        ],
        "shortStr": "schedulepaintrect(rect)",
        "str": "schedulepaintrect(rect)"
      },
      "description": "Schedule to repaint the `rect` area in view.",
      "id": "schedulepaintrect-rect"
    },
    {
      "signature": {
        "name": "setvisible",
        "parameters": [
          {
            "type": {
              "name": "boolean"
            },
            "name": "visible"
          }
        ],
        "shortStr": "setvisible(visible)",
        "str": "setvisible(visible)"
      },
      "description": "Show/Hide the view.",
      "id": "setvisible-visible"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "isvisible",
        "parameters": [],
        "shortStr": "isvisible()",
        "str": "isvisible()"
      },
      "description": "Return whether the view is visible.",
      "id": "isvisible"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "isvisibleinhierarchy",
        "parameters": [],
        "shortStr": "isvisibleinhierarchy()",
        "str": "isvisibleinhierarchy()"
      },
      "description": "Return whether the view and its ancestors are visible.",
      "id": "isvisibleinhierarchy"
    },
    {
      "signature": {
        "name": "setenabled",
        "parameters": [
          {
            "type": {
              "name": "boolean"
            },
            "name": "enable"
          }
        ],
        "shortStr": "setenabled(enable)",
        "str": "setenabled(enable)"
      },
      "description": "Set whether the view is enabled.",
      "detail": "The enabled state of each view is not affected by its parent, disabling\na container-like view does not have any effect.\n",
      "id": "setenabled-enable"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "isenabled",
        "parameters": [],
        "shortStr": "isenabled()",
        "str": "isenabled()"
      },
      "description": "Return whether the view is enabled.",
      "id": "isenabled"
    },
    {
      "signature": {
        "name": "focus",
        "parameters": [],
        "shortStr": "focus()",
        "str": "focus()"
      },
      "description": "Move the keyboard focus to the view.",
      "id": "focus"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "hasfocus",
        "parameters": [],
        "shortStr": "hasfocus()",
        "str": "hasfocus()"
      },
      "description": "Return whether the view has keyboard focus.",
      "id": "hasfocus"
    },
    {
      "signature": {
        "name": "setfocusable",
        "parameters": [
          {
            "type": {
              "name": "boolean"
            },
            "name": "focusable"
          }
        ],
        "shortStr": "setfocusable(focusable)",
        "str": "setfocusable(focusable)"
      },
      "description": "Set whether the view can be focused on.",
      "id": "setfocusable-focusable"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "isfocusable",
        "parameters": [],
        "shortStr": "isfocusable()",
        "str": "isfocusable()"
      },
      "description": "Return whether the view can be focused on.",
      "id": "isfocusable"
    },
    {
      "signature": {
        "name": "setmousedowncanmovewindow",
        "parameters": [
          {
            "type": {
              "name": "boolean"
            },
            "name": "can"
          }
        ],
        "shortStr": "setmousedowncanmovewindow(can)",
        "str": "setmousedowncanmovewindow(can)"
      },
      "description": "Set whether dragging mouse would move the window.",
      "detail": "For most platforms this method only works for frameless windows, having\nthis feature may also prevent mouse events to happen.\n\nOn macOS the `Container` view has this feature turned on by default. To\nturn this feature on for the view, the view's parent view must also has\nthis feature turned on.\n\nOn Windows the view with this feature will be treated as titlebar, e.g.\ndouble-clicking would maximize the window, right-clicking may show the\nsystem menu.\n",
      "id": "setmousedowncanmovewindow-can"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "ismousedowncanmovewindow",
        "parameters": [],
        "shortStr": "ismousedowncanmovewindow()",
        "str": "ismousedowncanmovewindow()"
      },
      "description": "Return whether dragging the view would move the window.",
      "id": "ismousedowncanmovewindow"
    },
    {
      "signature": {
        "returnType": {
          "name": "integer"
        },
        "name": "dodrag",
        "parameters": [
          {
            "type": {
              "name": "table"
            },
            "name": "data"
          },
          {
            "type": {
              "name": "integer"
            },
            "name": "operations"
          }
        ],
        "shortStr": "dodrag(data, operations)",
        "str": "dodrag(data, operations)"
      },
      "description": "Like `DoDragWithOptions` but do not set drag image.",
      "id": "dodrag-data-operations"
    },
    {
      "signature": {
        "returnType": {
          "name": "integer"
        },
        "name": "dodragwithoptions",
        "parameters": [
          {
            "type": {
              "name": "table"
            },
            "name": "data",
            "description": "An array of `<!type>Clipboard::Data` that will be passed to drop\ntarget.\n"
          },
          {
            "type": {
              "name": "integer"
            },
            "name": "operations",
            "description": "Must be one or more of `<!type>DragOperation` masks, indicates which\ndrag operations are supported.\n"
          },
          {
            "type": {
              "name": "DragOptions",
              "id": "dragoptions"
            },
            "name": "options"
          }
        ],
        "shortStr": "dodragwithoptions(data, operations, options)",
        "str": "dodragwithoptions(data, operations, options)"
      },
      "description": "Start a drag session.",
      "detail": "The return value is a `<!type>DragOperation` indicating the result of\ndragging.\n\nThis method should only be called in the `on_mouse_down` event, when user\nstarts to drag the cursor.\n\nThis method is blocking that it does not return until the drag session is\nfinished or cancelled. During the call a nested UI message loop will run\nand other events will still be emitted.\n\nNote that on macOS certain views may have `IsMouseDownCanMoveWindow`\ndefaulting to `true`, which will prevent drag session to start. Make sure\nto call `SetMouseDownCanMoveWindow(false)` for drag sources.\n",
      "id": "dodragwithoptions-data-operations-options"
    },
    {
      "signature": {
        "name": "canceldrag",
        "parameters": [],
        "shortStr": "canceldrag()",
        "str": "canceldrag()"
      },
      "description": "Cancel current drag session if the view is being used as drag source.",
      "id": "canceldrag"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "isdragging",
        "parameters": [],
        "shortStr": "isdragging()",
        "str": "isdragging()"
      },
      "description": "Return whether the view is being used as drag source.",
      "id": "isdragging"
    },
    {
      "signature": {
        "name": "registerdraggedtypes",
        "parameters": [
          {
            "type": {
              "name": "table"
            },
            "name": "types",
            "description": "An array of `<!type>Clipboard::Data::Type`."
          }
        ],
        "shortStr": "registerdraggedtypes(types)",
        "str": "registerdraggedtypes(types)"
      },
      "description": "Make the view a drag destination that accepets `types`.",
      "id": "registerdraggedtypes-types"
    },
    {
      "signature": {
        "name": "setcursor",
        "parameters": [
          {
            "type": {
              "name": "Cursor",
              "id": "cursor"
            },
            "name": "cursor"
          }
        ],
        "shortStr": "setcursor(cursor)",
        "str": "setcursor(cursor)"
      },
      "description": "Set the cursor to show when hovering the view.",
      "detail": "On Linux, setting cursor would force the view to own its own GDK window.\nFor certain views like `Label`, this may have remove the view's background\ncolor.\n",
      "id": "setcursor-cursor"
    },
    {
      "signature": {
        "name": "settooltip",
        "parameters": [
          {
            "type": {
              "name": "string"
            },
            "name": "tooltip"
          }
        ],
        "shortStr": "settooltip(tooltip)",
        "str": "settooltip(tooltip)"
      },
      "description": "Set the `tooltip` for the view.",
      "detail": "This method will clear all tooltips added by `<!name>AddTooltipForRect`.\n",
      "id": "settooltip-tooltip"
    },
    {
      "signature": {
        "returnType": {
          "name": "integer"
        },
        "name": "addtooltipforrect",
        "parameters": [
          {
            "type": {
              "name": "string"
            },
            "name": "tooltip"
          },
          {
            "type": {
              "name": "RectF",
              "id": "rectf"
            },
            "name": "rect"
          }
        ],
        "shortStr": "addtooltipforrect(tooltip, rect)",
        "str": "addtooltipforrect(tooltip, rect)"
      },
      "description": "Add `tooltip` for a defined `rect` in the view and return an ID for it.",
      "id": "addtooltipforrect-tooltip-rect"
    },
    {
      "signature": {
        "name": "removetooltip",
        "parameters": [
          {
            "type": {
              "name": "integer"
            },
            "name": "id"
          }
        ],
        "shortStr": "removetooltip(id)",
        "str": "removetooltip(id)"
      },
      "description": "Remove tooltip added by `<!name>AddTooltipForRect` with `id`.",
      "id": "removetooltip-id"
    },
    {
      "signature": {
        "name": "setfont",
        "parameters": [
          {
            "type": {
              "name": "Font",
              "id": "font"
            },
            "name": "font"
          }
        ],
        "shortStr": "setfont(font)",
        "str": "setfont(font)"
      },
      "description": "Change the font used for drawing text in the view.",
      "detail": "This methods only works for `View`s that display text, like `Label` or\n`Entry`.\n",
      "id": "setfont-font"
    },
    {
      "signature": {
        "name": "setcolor",
        "parameters": [
          {
            "type": {
              "name": "Color",
              "id": "color"
            },
            "name": "color"
          }
        ],
        "shortStr": "setcolor(color)",
        "str": "setcolor(color)"
      },
      "description": "Change the color used for drawing text in the view.",
      "detail": "This methods only works for `View`s that display text, like `Label` or\n`Entry`.\n",
      "id": "setcolor-color"
    },
    {
      "signature": {
        "name": "setbackgroundcolor",
        "parameters": [
          {
            "type": {
              "name": "Color",
              "id": "color"
            },
            "name": "color"
          }
        ],
        "shortStr": "setbackgroundcolor(color)",
        "str": "setbackgroundcolor(color)"
      },
      "description": "Change the background color of the view.",
      "id": "setbackgroundcolor-color"
    },
    {
      "signature": {
        "name": "setstyle",
        "parameters": [
          {
            "type": {
              "name": "table"
            },
            "name": "styles",
            "description": "A key-value dictionary that defines the name and value of the style\nproperties, key must be string, and value must be either string or\nnumber.\n"
          }
        ],
        "shortStr": "setstyle(styles)",
        "str": "setstyle(styles)"
      },
      "description": "Change the styles of the view.",
      "detail": "Available style properties can be found at\n[Layout System](../guides/layout_system.html).\n",
      "id": "setstyle-styles"
    },
    {
      "signature": {
        "returnType": {
          "name": "string"
        },
        "name": "getcomputedlayout",
        "parameters": [],
        "shortStr": "getcomputedlayout()",
        "str": "getcomputedlayout()"
      },
      "description": "Return string representation of the view's layout.",
      "id": "getcomputedlayout"
    },
    {
      "signature": {
        "returnType": {
          "name": "SizeF",
          "id": "sizef"
        },
        "name": "getminimumsize",
        "parameters": [],
        "shortStr": "getminimumsize()",
        "str": "getminimumsize()"
      },
      "description": "Return the minimum size needed to show the view.",
      "id": "getminimumsize"
    },
    {
      "signature": {
        "returnType": {
          "name": "View",
          "id": "view"
        },
        "name": "getparent",
        "parameters": [],
        "shortStr": "getparent()",
        "str": "getparent()"
      },
      "description": "Return parent view.",
      "id": "getparent"
    },
    {
      "signature": {
        "returnType": {
          "name": "Window",
          "id": "window"
        },
        "name": "getwindow",
        "parameters": [],
        "shortStr": "getwindow()",
        "str": "getwindow()"
      },
      "description": "Return the window that the view belongs to.",
      "id": "getwindow"
    }
  ],
  "events": [
    {
      "signature": {
        "name": "ondragleave",
        "parameters": [
          {
            "type": {
              "name": "View",
              "id": "view"
            },
            "name": "self"
          },
          {
            "type": {
              "name": "DraggingInfo",
              "id": "dragginginfo"
            },
            "name": "info"
          }
        ],
        "shortStr": "ondragleave(self, info)",
        "str": "ondragleave(self, info)"
      },
      "description": "Emitted when cursor leaves the view while dragging.",
      "detail": "This event will also be emitted before the `handle_drop` event when user\ndrops the data on the view.\n",
      "id": "ondragleave-self-info"
    },
    {
      "signature": {
        "name": "onsizechanged",
        "parameters": [
          {
            "type": {
              "name": "View",
              "id": "view"
            },
            "name": "self"
          }
        ],
        "shortStr": "onsizechanged(self)",
        "str": "onsizechanged(self)"
      },
      "description": "Emitted when the view's size has been changed.",
      "id": "onsizechanged-self"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "onfocusin",
        "parameters": [
          {
            "type": {
              "name": "View",
              "id": "view"
            },
            "name": "self"
          }
        ],
        "shortStr": "onfocusin(self)",
        "str": "onfocusin(self)"
      },
      "description": "Emitted when the view gets keyboard focus.",
      "id": "onfocusin-self"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "onfocusout",
        "parameters": [
          {
            "type": {
              "name": "View",
              "id": "view"
            },
            "name": "self"
          }
        ],
        "shortStr": "onfocusout(self)",
        "str": "onfocusout(self)"
      },
      "description": "Emitted when the view loses keyboard focus.",
      "id": "onfocusout-self"
    }
  ],
  "delegates": [
    {
      "signature": {
        "returnType": {
          "name": "integer"
        },
        "name": "handledragenter",
        "parameters": [
          {
            "type": {
              "name": "View",
              "id": "view"
            },
            "name": "self"
          },
          {
            "type": {
              "name": "DraggingInfo",
              "id": "dragginginfo"
            },
            "name": "info"
          },
          {
            "type": {
              "name": "PointF",
              "id": "pointf"
            },
            "name": "point"
          }
        ],
        "shortStr": "handledragenter(self, info, point)",
        "str": "handledragenter(self, info, point)"
      },
      "description": "Called when user drags the cursor over the view for the first time.\n",
      "detail": "A `<!type>DragOperation` should be returned, indicating which dragging\noperation the destination will perform when cursor is released.\n\nThis delegate will not be called if the view has not registered dragged\ntypes, or if the dragged data does not belong to the registered type.\n\nOn Linux the dragged data is not yet available when this is called, you\nshould usually only read data in the `handle_drop` delegate.\n",
      "id": "handledragenter-self-info-point"
    },
    {
      "signature": {
        "returnType": {
          "name": "integer"
        },
        "name": "handledragupdate",
        "parameters": [
          {
            "type": {
              "name": "View",
              "id": "view"
            },
            "name": "self"
          },
          {
            "type": {
              "name": "DraggingInfo",
              "id": "dragginginfo"
            },
            "name": "info"
          },
          {
            "type": {
              "name": "PointF",
              "id": "pointf"
            },
            "name": "point"
          }
        ],
        "shortStr": "handledragupdate(self, info, point)",
        "str": "handledragupdate(self, info, point)"
      },
      "description": "Called when user moves the cursor over the view while dragging.\n",
      "detail": "A `<!type>DragOperation` should be returned, indicating which dragging\noperation the destination will perform when cursor is released.\n\nIf this delegate is not implemented, the return value of previous\n`handle_drag_enter` call will be returned.\n\nThis delegate is usually used when implementing a custom view with\nmultiple dropping areas, you only need to implement `handle_drag_enter`\nfor simple tasks.\n\nOn Linux the dragged data is not yet available when this is called, you\nshould usually only read data in the `handle_drop` delegate.\n",
      "id": "handledragupdate-self-info-point"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "handledrop",
        "parameters": [
          {
            "type": {
              "name": "View",
              "id": "view"
            },
            "name": "self"
          },
          {
            "type": {
              "name": "DraggingInfo",
              "id": "dragginginfo"
            },
            "name": "info"
          },
          {
            "type": {
              "name": "PointF",
              "id": "pointf"
            },
            "name": "point"
          }
        ],
        "shortStr": "handledrop(self, info, point)",
        "str": "handledrop(self, info, point)"
      },
      "description": "Called when user releases the dragged data on the view.",
      "detail": "Returning `true` will inform the drag source that the data has been\naccepted with the drag operation returned by previous `handle_drag_enter`\nor `handle_drag_update` call.\n\nIf the drag operation is `Move`, the drag source may also take actions\nto \"remove\" the data on its side.\n\nReturning `false` will inform the drag source that the drag has been\ncancelled, and operating system may display some visual effects.\n",
      "id": "handledrop-self-info-point"
    }
  ],
  "module": "yue.gui",
  "id": "view"
}