因此,我们有简单的.eve
和.adam
个文件,compiled ASL以及boost
和adobe
所需的所有内容。我们需要一个跨平台函数来渲染我们的布局,并在我们的平台上作为真实窗口移动(我们需要它用于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上生成这样的窗口:
请帮忙。
答案 0 :(得分:1)
来源:
#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;
}