/*!
    \ingroup modal_dialog_kit

    One function call to display a model dialog (or playback a script).
    We might also want to consider a preview function call back (that
    will get called with the same command dictionary anytime something
    in the sheet changes).

    \param input contains the input values for input cells as they are
    defined in the sheet. Each key in this dictionary should correspond
    to an input cell in the sheet to which the relevant value will be
    imposed. This can be a default-constructed dictionary, in which case
    input cells will be set to the values defined in their sheet
    initializers.

    \param record is the previously recorded script information for the
    dialog, to be used to execute the dialog when running from an action
    or to retain the previoud instance of the dialog's values for the
    new dialog instance.

    \param display_state is the previously recorded layout state
    information for the dialog.

    \param display_options is one of the three enumerations specified
    above, according to which semantic behavior you would like to get
    out of this routine.

    \param layout_definition is a stream that will be parsed as the Eve
    definition for this dialog.

    \param sheet_definition is a stream that will be parsed as the Adam
    definition for this dialog. Note that the only requirement on the
    Adam sheet is that there exist an output cell called result that is
    defined to be a dictionary of values. The value of the result cell
    will be handed back in the command_m field of the dialog_result_t
    upon return from this procedure.

    \param callback is the function proc that is called when a button in
    the modal dialog is invoked by the user. The two parameters to the
    callback are the action name of the button as defined in the Eve
    definition, along with the contents of the Adam cell to which the
    button is bound. The boolean return value specifies whether or not
    the modal dialog interface should terminate the dialog.

    \param working_directory is the directory from which the dialog
    widgets should use to fetch disk-based resources. Whether or not
    this is necessary is predicated on the resource requirements of the
    widgets used in the dialog.

    \param parent is the parent widget that will 'own' the dialog that
    is about to be created. This notion is purely a platform-specific
    one, and is not a requirement as far as ASL goes.

    \return a filled in dialog_result_t.
*/
inline dialog_result_t handle_dialog(const dictionary_t&            input,
                                     const dictionary_t&            record,
                                     const dictionary_t&            display_state,
                                     display_options_t              display_options,
                                     std::istream&                  layout_definition,
                                     std::istream&                  sheet_definition,
                                     action_callback_t              callback,
                                     const boost::filesystem::path& working_directory,
                                     platform_display_type          parent=platform_display_type())
{
    assert ( !layout_definition.fail() );
    assert ( !sheet_definition.fail() );

    modal_dialog_t dialog;

    dialog.input_m = input;
    dialog.record_m = record;
    dialog.display_state_m = display_state;
    dialog.display_options_m = display_options;
    dialog.callback_m = callback;
    dialog.working_directory_m = working_directory;
    dialog.parent_m = parent;

    return dialog.go(layout_definition, sheet_definition);
}
platform_display_type display_t::insert<platform_display_type>(platform_display_type& parent, const platform_display_type& element)
{
    static const platform_display_type null_parent_s = platform_display_type();

    if (parent != null_parent_s)
        ADOBE_REQUIRE_STATUS(::HIViewAddSubview(parent, element));

    return element;
}
Exemple #3
0
platform_display_type display_t::insert(platform_display_type& parent, const platform_display_type& element)
{
    static const platform_display_type null_parent_s = platform_display_type();

    if (parent != null_parent_s && parent != get_main_display().root())
    {
#ifndef ADOBE_PLATFORM_WT
        if (::SetWindowPos(element, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE ) == 0)
	        ADOBE_THROW_LAST_ERROR;

        ::SendMessage(parent,
				      WM_CHANGEUISTATE,
				      UISF_HIDEACCEL| UISF_HIDEFOCUS | UIS_INITIALIZE,
				      0);  
#endif
        assert(get_parent_control(element) == parent);
    }

    return element;
}
namespace implementation {

/**************************************************************************************************/

#if ADOBE_PLATFORM_WIN || (ADOBE_PLATFORM_MAC && !defined(__LP64__))

/****************************************************************************************************/

/*!
    \ingroup apl_widgets

    A utility function that hooks into a platform-specific
    implementation to provide for alt-text behavior for a widget.
    Typically this is a "ToolTip" -- a small window that shows up when a
    user hovers over a control with the mouse that gives further detail
    about the property the widget modifies. The implementation is
    platform-specific.

    \param control is the platform widget that will receive the alt-text
    \param alt_text is the text to have shown when further widget description is warranted
*/
void set_control_alt_text(platform_control_type control, const std::string& alt_text);

/****************************************************************************************************/

#endif

/****************************************************************************************************/

/*!
    \ingroup apl_widgets

    A utility function that will open a dialog allowing the user to pick
    a file. The picked file must already exist.The implementation is
    platform-specific.

    \param path is the resultant path to the file picked by the user
    \param dialog_parent is an optional display variable to be used as the parent to the file dialog.

    \return whether or not \c path is a valid, user-selected path.
*/
bool pick_file(boost::filesystem::path& path, platform_display_type dialog_parent = platform_display_type());

/****************************************************************************************************/

/*!
    \ingroup apl_widgets

    A utility function that will open a dialog allowing the user to pick
    a path (typically to save a file). The picked file need not already
    exist. The implementation is platform-specific.

    \param path is the resultant path to the file picked by the user
    \param dialog_parent is an optional display variable to be used as the parent to the file dialog.

    \return whether or not \c path is a valid, user-selected path.
*/
bool pick_save_path(boost::filesystem::path& path, platform_display_type dialog_parent = platform_display_type());

/****************************************************************************************************/

} // namespace implementation
Exemple #5
0
 display_t() :
     root_m(platform_display_type())
 { }