CCKit2
    Preparing search index...

    Class CCWindow

    The CCWindow class represents a window displayed on screen. A CCWindow is backed by a window region on the window server, and can be moved around, stacked, and hidden. It controls all drawing to the window region it owns, holds the view controller and views that are drawn to the region, and handles events sent from the window server to the window.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new window using a view controller for the contents.

      Parameters

      Returns CCWindow

    • Creates a new empty window with the specified parameters.

      Parameters

      • contentRect: CCRect

        The position and size of the new window

      • styleMask: StyleMask

        A combination of style parameters for the window

      • defer: boolean

        Whether to defer creation of the window server's window until the window is moved on-screen

      • Optionalscreen: CCScreen

        The screen to position the window on (defaults to the main screen)

      Returns CCWindow

    Properties

    acceptsFirstResponder: boolean = true

    Whether the object can become the first responder.

    allowsToolTipsWhenApplicationIsInactive: boolean = false

    Whether the window will show tooltips even when the app is in the background.

    backgroundColor: number = CCColor.white

    The background color for the window.

    canBecomeKey: boolean = true

    Whether the window can become the key window.

    canBecomeMain: boolean = true

    Whether the window can become the main window.

    canHide: boolean = true

    Whether the window is able to hide.

    childWindows: CCWindow[] = []

    A list of child windows of the current window.

    colorPalette: number[] = []

    The color palette for the window. (Only relevant in fullscreen or graphics mode.)

    contentView?: CCView

    The main view for the window, if no view controller is used.

    contentViewController?: CCViewController

    The main view controller for the window.

    currentEvent?: CCEvent

    The event that is currently being processed by the window.

    delegate?: CCWindowDelegate

    The delegate for the window.

    hidesOnDeactivate: boolean = false

    Whether the window hides itself when the app is deactivated.

    isExcludedFromWindowsMenu: boolean = false

    Whether the window is excluded from the Window menu.

    isKeyWindow: boolean = false

    Whether the window is the key window for the app.

    isMainWindow: boolean = false

    Whether the window is the main window for the app.

    isMovable: boolean = true

    Whether the screen can be moved.

    isMovableByWindowBackground: boolean = false

    Whether the entire window's background is a move target.

    isVisible: boolean = true

    Whether the window is visible on screen.

    maxSize: CCSize = ...

    The maximum size that the window will allow resizing to.

    minSize: CCSize = ...

    The minimum size that the window will allow resizing to.

    nextResponder?: CCResponder

    The next responder in the responder chain.

    parent?: CCWindow

    The parent window of the current window, if there is one.

    representedFilename?: string

    A file path that the window represents.

    screen?: CCScreen

    The screen the window is on.

    styleMask: StyleMask = ...

    The style mask for the window.

    tabbedWindows?: CCWindow[]

    A list of windows that display as tabs under this one.

    titleVisible: boolean = true

    Whether the title bar is visible.

    viewsNeedDisplay: boolean = false

    Whether any subviews require redrawing.

    Accessors

    • get selectedTab(): number | undefined

      The index of the currently selected window.

      Returns number | undefined

    • set selectedTab(tab: number): void

      Parameters

      • tab: number

      Returns void

    • get title(): string

      The title of the window.

      Returns string

    • set title(value: string): void

      Parameters

      • value: string

      Returns void

    • get worksWhenModal(): boolean

      Whether the window receives key and mouse events when a modal window is in the foreground.

      Returns boolean

    Methods

    • Called when the window becomes the key window. Don't call this.

      Returns void

    • Called when the window becomes the main window. Don't call this.

      Returns void

    • Called when the window will no longer be the key window. Don't call this.

      Returns void

    • Called when the window will no longer be the main window. Don't call this.

      Returns void

    • Adds a window as a child tab of the current window.

      Parameters

      • window: CCWindow

        The window to add

      • Optionalindex: number

        The index to place the new window at

      Returns void

    • Centers the window on screen.

      Returns void

    • Closes the window and removes it from the screen.

      Returns void

    • Returns a rectangle converted from backing store coordinates to window coordinates.

      Parameters

      • rect: CCRect

        The rectangle to convert, in backing store coordinates

      Returns CCRect

      The rectangle converted to window coordinates

    • Returns a rectangle converted from screen coordinates to window coordinates.

      Parameters

      • rect: CCRect

        The rectangle to convert, in screen coordinates

      Returns CCRect

      The rectangle converted to window coordinates

    • Returns a point converted from backing store coordinates to window coordinates.

      Parameters

      • point: CCPoint

        The point to convert, in backing store coordinates

      Returns CCPoint

      The point converted to window coordinates

    • Returns a point converted from screen coordinates to window coordinates.

      Parameters

      • point: CCPoint

        The point to convert, in screen coordinates

      Returns CCPoint

      The point converted to window coordinates

    • Returns a point converted from window coordinates to backing store coordinates.

      Parameters

      • point: CCPoint

        The point to convert, in window coordinates

      Returns CCPoint

      The point converted to backing store coordinates

    • Returns a point converted from window coordinates to screen coordinates.

      Parameters

      • point: CCPoint

        The point to convert, in window coordinates

      Returns CCPoint

      The point converted to screen coordinates

    • Returns a rectangle converted from window coordinates to backing store coordinates.

      Parameters

      • rect: CCRect

        The rectangle to convert, in window coordinates

      Returns CCRect

      The rectangle converted to backing store coordinates

    • Returns a rectangle converted from window coordinates to screen coordinates.

      Parameters

      • rect: CCRect

        The rectangle to convert, in window coordinates

      Returns CCRect

      The rectangle converted to screen coordinates

    • This is used to place a blinking cursor on screen while not drawing. It's only called on the first responder of a window.

      Returns [CCPoint, number] | undefined

      The position and color of the cursor in window coordinates, or undefined to not place a cursor

    • Disables drawing directly to the screen until the next flush.

      Returns void

    • Redraws all subviews in the window.

      Returns void

    • Redraws only views that need to be redrawn.

      Returns void

    • Sends a list of key input events to the input manager, which will send back text input events through insertText(text: string).

      Parameters

      • events: CCEvent[]

        The input events to send

      Returns void

    • Makes the selected responder the window's first responder.

      Parameters

      • Optionalresponder: CCResponder

        The responder that should be first responder

      Returns boolean

      Whether the responder is now the first responder

    • Makes the window the key window of the app.

      Returns void

    • Makes the window the key window of the app, and moves the window to the front of the screen.

      Returns void

    • Makes the window the main window of the app.

      Returns void

    • Moves this tabbed window into its own independent window on screen.

      Returns void

    • Handles when a method action fails to find a responder.

      Parameters

      • method: string

        The method that was attempted

      Returns void

    • Tells the window manager to move the window to the back of the screen.

      Returns void

    • Tells the window manager to move the window to the front of the screen, without making it the key window.

      Returns void

    • Tells the window manager to hide the window.

      Returns void

    • Removes the selected window as a child.

      Parameters

      Returns void

    • Sends an event to the appropriate responder.

      Parameters

      Returns void

    • Sets the represented file for the window, updating the title in the process.

      Parameters

      • path: string

        The path to set

      Returns void

    • Shows a context menu at the specified point.

      Parameters

      • point: CCPoint

        The point to display at, relative to the window

      • menu: CCMenu

        The menu to display

      Returns void

    • Toggles whether the window is in fullscreen.

      Returns void

    • Attempts to call the specified method on the object, passing the call on to the next responder if this object doesn't implement it.

      Parameters

      • method: string

        The name of the method to call

      • ...args: any[]

        Any parameters to pass to the method

      Returns boolean

      Whether a responder was able to respond to the method