1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_APPLESCRIPT_WINDOW_APPLESCRIPT_H_
6 #define CHROME_BROWSER_UI_COCOA_APPLESCRIPT_WINDOW_APPLESCRIPT_H_
8 #import <Cocoa/Cocoa.h>
10 #import "chrome/browser/ui/cocoa/applescript/element_applescript.h"
14 @
class TabAppleScript
;
16 // Represents a window class.
17 @interface WindowAppleScript
: ElementAppleScript
{
19 Browser
* browser_
; // weak.
22 // Creates a new window, returns nil if there is an error.
25 // Creates a new window with a particular profile.
26 - (id
)initWithProfile
:(Profile
*)aProfile
;
28 // Does not create a new window but uses an existing one.
29 - (id
)initWithBrowser
:(Browser
*)aBrowser
;
31 // Sets and gets the index of the currently selected tab.
32 - (NSNumber
*)activeTabIndex
;
33 - (void)setActiveTabIndex
:(NSNumber
*)anActiveTabIndex
;
35 // Mode refers to whether a window is a normal window or an incognito window
36 // it can be set only once while creating the window.
38 - (void)setMode
:(NSString
*)theMode
;
40 // Returns the currently selected tab.
41 - (TabAppleScript
*)activeTab
;
43 // Tab manipulation functions.
44 // The tabs inside the window.
45 // Returns |TabAppleScript*| of all the tabs contained
46 // within this particular folder.
49 // Insert a tab at the end.
50 - (void)insertInTabs
:(TabAppleScript
*)aTab
;
52 // Insert a tab at some position in the list.
53 // Called by applescript which takes care of bounds checking, make sure of it
54 // before calling directly.
55 - (void)insertInTabs
:(TabAppleScript
*)aTab atIndex
:(int)index
;
57 // Remove a window from the list.
58 // Called by applescript which takes care of bounds checking, make sure of it
59 // before calling directly.
60 - (void)removeFromTabsAtIndex
:(int)index
;
62 // Set the index of a window.
63 - (void)setOrderedIndex
:(NSNumber
*)anIndex
;
65 // Used to sort windows by index.
66 - (NSComparisonResult
)windowComparator
:(WindowAppleScript
*)otherWindow
;
68 // For standard window functions like zoomable, bounds etc, we dont handle it
69 // but instead pass it onto the NSWindow associated with the window.
70 - (id
)valueForUndefinedKey
:(NSString
*)key
;
71 - (void)setValue
:(id
)value forUndefinedKey
:(NSString
*)key
;
73 // Used to close window.
74 - (void)handlesCloseScriptCommand
:(NSCloseCommand
*)command
;
76 // The index of the window, windows are ordered front to back.
77 - (NSNumber
*)orderedIndex
;
79 // Used to see if the windows is in presentation mode.
80 - (NSNumber
*)presenting
;
82 // Used to enter presentation mode.
83 - (void)handlesEnterPresentationMode
:(NSScriptCommand
*)command
;
85 // Used to exit presentation mode.
86 - (void)handlesExitPresentationMode
:(NSScriptCommand
*)command
;
90 #endif // CHROME_BROWSER_UI_COCOA_APPLESCRIPT_WINDOW_APPLESCRIPT_H_