Adobe Eve ASL: how to render eve file into gui window?
So We have simple .eve
and .adam
files, compiled ASL, and all includes required for boost
and adobe
. We need a crossplatform function to make our layout rendered, and movable as real window on our platform (we need it for Mac OS X, Window开发者_运维知识库s, Linux). How to do such thing?
We have started trying to move in direction of simplifiing some tutorials we found in ASL folder (begin
) and got some results you can see here. But our approach is not crossplatform or any way eazy to get=( So we ask for your halp in getting how to display a simple window with ok button defined by adam and eve files?
Here is example of simple Adam and simple eve files
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 };
}
that shall generate a window like this on windows:
Please help.
We have done it here!) it is really simple.
Source:
#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;
}
精彩评论