# Copyright (c) 2018-2020, NVIDIA CORPORATION.  All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
"""The documentation for Scrolling Frame"""

from omni import ui
from .doc_page import DocPage
import inspect

SPACING = 5

TEXT = (
    "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut "
    "labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco "
    "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in "
    "voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat "
    "non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
)


def simple_canvasframe():
    IMAGE = "resources/icons/ov_logo_square.png"
    with ui.CanvasFrame(height=256):
        with ui.VStack(height=0, spacing=10):
            ui.Label(TEXT, name="text", word_wrap=True)
            ui.Button("Button")
            ui.Image(IMAGE, width=128, height=128)


class CanvasFrameDoc(DocPage):
    """ document for Menu"""

    def create_doc(self, navigate_to=None):
        self._section_title("CanvasFrame")

        self._text(
            "CanvasFrame is the widget that allows the user to pan and zoom its children with a mouse. It has the layout "
            "that can be infinitely moved in any direction."
        )

        with ui.Frame(style=self._style_system):
            simple_canvasframe()

        self._code(inspect.getsource(simple_canvasframe).split("\n", 1)[-1])

        ui.Spacer(height=10)
