# TinyMCE

Object
TinyMCE_Popup

### Class TinyMCE_Popup

Constructor Summary
TinyMCE_Popup() Constructor for the popup class.

Method Summary
void | close() Closes the current window.
void | execCommand(<string> command, <boolean> user_interface, <mixed> value) Executes the specific command on the parent instance that opened the window.
void | executeOnLoad(<string> str) Executes the specified string onload.
Object | getWindowArg(<string> name, <string> default_value) Returns a window argument, window arguments can be passed from a plugin to a window by using the tinyMCE.
void | importClass(<string> c) Imports the specified class into the current popup.
void | init() Initializes the TinyMCE Popup class.
void | onLoad() Gets executed when the window has finished loading it's contents.
void | openBrowser(<string> element_id, <string> type, <string> option) Opens a filebrowser/imagebrowser this will set the output value from the browser as a value on the specified element.
void | pickColor(<DOMEvent> e, <string> element_id) Executes a color picker on the specified element id.
void | resizeToContent() Resizes the current window to the dimensions of the body.
void | resizeToInnerSize() Resizes the current window to it's inner body size.
void | restoreSelection() Restores the selection back to the one stored after executing a command.

### Constructor Detail

#### TinyMCE_Popup

TinyMCE_Popup()
Constructor for the popup class. This class contains base logic for popup/dialogs and sets up object references to the TinyMCE core.

### Method Detail

#### close

void close()
Closes the current window. This should be used instead of window.close. Since this will also handle inlinepopups closing.

#### execCommand

void execCommand(<string> command, <boolean> user_interface, <mixed> value)
Executes the specific command on the parent instance that opened the window. This method will also take care of the storage and restorage of the current selection in MSIE when using inlinepopups. So we suggest using this method instead of tinyMCE.execCommand when using popup windows.

#### Parameters

command - Command name to execute, for example mceLink or Bold.
user_interface - True/false state if a UI (dialog) should be presented or not.
value - Optional command value, this can be anything.

#### executeOnLoad

void executeOnLoad(<string> str)
Executes the specified string onload. This is a workaround for Opera since it doesn't execute the events in the same order than MSIE and Firefox.

#### Parameters

str - String to evaluate on load.

#### getWindowArg

Object getWindowArg(<string> name, <string> default_value)
Returns a window argument, window arguments can be passed from a plugin to a window by using the tinyMCE.openWindow function.

#### Parameters

name - Argument name to retrive.
default_value - Optional default value to assign if the argument wasn't set.

#### Returns

Argument value object.

#### importClass

void importClass(<string> c)
Imports the specified class into the current popup. This will setup a local class definition by importing from the parent window.

#### Parameters

c - Class name to import to current page.

#### init

void init()
Initializes the TinyMCE Popup class. This will setup the TinyMCE core references and other popup/dialog related functions.

#### onLoad

void onLoad()
Gets executed when the window has finished loading it's contents. This function will then replace language variables with their real values.

#### openBrowser

void openBrowser(<string> element_id, <string> type, <string> option)
Opens a filebrowser/imagebrowser this will set the output value from the browser as a value on the specified element.

#### Parameters

element_id - Id of the element to set value in.
type - Type of browser to open image/file/flash.
option - Option name to get the file_broswer_callback function name from.

#### pickColor

void pickColor(<DOMEvent> e, <string> element_id)
Executes a color picker on the specified element id. When the user then selects a color it will be set as the value of the specified element.

#### Parameters

e - DOM event object.
element_id - Element id to be filled with the color value from the picker.

#### resizeToContent

void resizeToContent()
Resizes the current window to the dimensions of the body.

#### resizeToInnerSize

void resizeToInnerSize()
Resizes the current window to it's inner body size. This function was needed since MSIE makes the visible dialog area diffrent depending on what Theme/Skin you use.

#### restoreSelection

void restoreSelection()
Restores the selection back to the one stored after executing a command. This function was needed in MSIE when using inlinepopups, the selection would otherwice get lost if the user focused another field.