Home | History | Annotate | Download | only in applescript
      1 // Copyright (c) 2010 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.
      4 
      5 #ifndef CHROME_BROWSER_UI_COCOA_APPLESCRIPT_WINDOW_APPLESCRIPT_H_
      6 #define CHROME_BROWSER_UI_COCOA_APPLESCRIPT_WINDOW_APPLESCRIPT_H_
      7 
      8 #import <Cocoa/Cocoa.h>
      9 
     10 #import "chrome/browser/ui/cocoa/applescript/element_applescript.h"
     11 
     12 class Browser;
     13 class Profile;
     14 @class TabAppleScript;
     15 
     16 // Represents a window class.
     17 @interface WindowAppleScript : ElementAppleScript {
     18  @private
     19   Browser* browser_;  // weak.
     20 }
     21 
     22 // Creates a new window, returns nil if there is an error.
     23 - (id)init;
     24 
     25 // Creates a new window with a particular profile.
     26 - (id)initWithProfile:(Profile*)aProfile;
     27 
     28 // Does not create a new window but uses an existing one.
     29 - (id)initWithBrowser:(Browser*)aBrowser;
     30 
     31 // Sets and gets the index of the currently selected tab.
     32 - (NSNumber*)activeTabIndex;
     33 - (void)setActiveTabIndex:(NSNumber*)anActiveTabIndex;
     34 
     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.
     37 - (NSString*)mode;
     38 - (void)setMode:(NSString*)theMode;
     39 
     40 // Returns the currently selected tab.
     41 - (TabAppleScript*)activeTab;
     42 
     43 // Tab manipulation functions.
     44 // The tabs inside the window.
     45 // Returns |TabAppleScript*| of all the tabs contained
     46 // within this particular folder.
     47 - (NSArray*)tabs;
     48 
     49 // Insert a tab at the end.
     50 - (void)insertInTabs:(TabAppleScript*)aTab;
     51 
     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;
     56 
     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;
     61 
     62 // Set the index of a window.
     63 - (void)setOrderedIndex:(NSNumber*)anIndex;
     64 
     65 // Used to sort windows by index.
     66 - (NSComparisonResult)windowComparator:(WindowAppleScript*)otherWindow;
     67 
     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;
     72 
     73 // Used to close window.
     74 - (void)handlesCloseScriptCommand:(NSCloseCommand*)command;
     75 
     76 // The index of the window, windows are ordered front to back.
     77 - (NSNumber*)orderedIndex;
     78 
     79 @end
     80 
     81 #endif  // CHROME_BROWSER_UI_COCOA_APPLESCRIPT_WINDOW_APPLESCRIPT_H_
     82