Adobe Eve ASL:如何将eve文件渲染到gui窗口?

时间:2011-06-23 16:12:32

标签: c++ user-interface boost cross-platform adobe

因此,我们有简单的.eve.adam个文件,compiled ASL以及boostadobe所需的所有内容。我们需要一个跨平台函数来渲染我们的布局,并在我们的平台上作为真实窗口移动(我们需要它用于Mac OS X,Windows,Linux)。怎么做这个?

我们已经开始尝试简化我们在ASL文件夹(begin)中找到的一些教程,并得到一些结果you can see here。但我们的方法不是跨平台或任何方式得到=(所以我们要求你在如何使用adam和eve文件定义的ok按钮显示一个简单的窗口时停下来?

这是简单的亚当和简单的前夕文件的例子

layout my_dialog
{
    view dialog(name: localize(\"<xstr id='my_dialog_name'>My Dialog</xstr>\"))
    {
        slider(bind: @my_value, format: {first: 0, last: 100});
        edit_number(name: 'Value:', bind: @my_value, format: '#', alt: 'Alters the value of the slider');
        button (items: [
                           { name: localize(\"<xstr id='ok'>OK</xstr>\"), action: @ok, bind: @result, alt: 'Perform the command with the current settings' },
                           { name: localize(\"<xstr id='reset'>Reset</xstr>\"), action: @reset, modifiers: @opt, alt: 'Reset the dialog settings' }
                       ]);
    }
}

sheet my_sheet
{
interface:
   my_value: 42;
output:
   result <== { value: my_value };
}

将在windows上生成这样的窗口:

enter image description here

请帮忙。

1 个答案:

答案 0 :(得分:1)

We have done it here!)这很简单。

来源:

#include <boost/thread/tss.hpp>
#include <adobe/future/modal_dialog_interface.hpp>
#include <boost/filesystem/path.hpp>

using namespace std;

inline bool always_break(adobe::name_t, const adobe::any_regular_t&)
    { return true; }

void dialog()
{
    stringstream       sheet;
    stringstream       layout;
    boost::filesystem::path icon_directory_path;

    // The sheet for the dialog
    sheet <<
                        "sheet my_sheet\n"
                        "{\n"
                        "interface:\n"
                        "   my_value: 42;\n"
                        "output:\n"
                        "   result <== { value: my_value };\n"
                        "}\n"
    ;

    // the layout
    layout <<
                                "layout my_dialog\n"
                                "{\n"
                                "    view dialog(name: 'My Dialog')\n"
                                "    {\n"
                                "        slider(bind: @my_value, format: {first: 0, last: 100});\n"
                                "        edit_number(name: 'Value:', bind: @my_value, format: '#', alt: 'Alters the value of the slider');\n"
                                "        button (items: [\n"
                                "                           { name: 'OK', action: @ok, bind: @result, alt: 'Perform the command with the current settings' },\n"
                                "                           { name: 'Reset', action: @reset, modifiers: @opt, alt: 'Reset the dialog settings' }\n"
                                "                       ]);\n"
                                "    }\n"
                                "}\n"
        ;

    // finally set up the params for the modal dialog interface call
    adobe::dialog_result_t result(adobe::handle_dialog(adobe::dictionary_t(),
                                                       adobe::dictionary_t(),
                                                       adobe::dictionary_t(),
                                                       adobe::dialog_display_s,
                                                       layout,
                                                       sheet,
                                                       &always_break,
                                                       icon_directory_path));

    int is_checked(result.command_m[adobe::static_name_t("value")].cast<int>());
        cout << "return value: " << is_checked << endl;
}

int  main(  )
{
        dialog();
        cin.get();
    return 0;
}