Exemplo n.º 1
0
widget_node_t make_checkbox(const dictionary_t&     parameters, 
                            const widget_node_t&    parent, 
                            const factory_token_t&  token,
                            const widget_factory_t& factory)
    { return create_and_hookup_widget<checkbox_t, poly_placeable_t>(parameters, parent, token, 
        factory.is_container(static_name_t("checkbox")), 
        factory.layout_attributes(static_name_t("checkbox"))); }
Exemplo n.º 2
0
void create_widget(const dictionary_t& parameters,
                   size_enum_t         size,
                   checkbox_t*&        checkbox)
{
    std::string          name;
    std::string          alt_text;
    any_regular_t        true_value(true);
    any_regular_t        false_value(false);
    GG::Clr              color(GG::CLR_GRAY);
    GG::Clr              text_color(GG::CLR_BLACK);
    GG::Clr              interior_color(GG::CLR_ZERO);
    name_t               style_name("xbox");
    name_t               signal_id;

    implementation::get_localized_string(parameters, key_name, name);
    implementation::get_localized_string(parameters, key_alt_text, alt_text);
    get_value(parameters, key_value_on, true_value);
    get_value(parameters, key_value_off, false_value);
    implementation::get_color(parameters, static_name_t("color"), color);
    implementation::get_color(parameters, static_name_t("text_color"), text_color);
    implementation::get_color(parameters, static_name_t("interior_color"), interior_color);
    get_value(parameters, static_name_t("style"), style_name);
    get_value(parameters, static_name_t("signal_id"), signal_id);

    checkbox = new checkbox_t(name,
                              true_value,
                              false_value,
                              color,
                              text_color,
                              interior_color,
                              implementation::name_to_style(style_name),
                              alt_text,
                              signal_id);
}
Exemplo n.º 3
0
void window_server_t::dispatch_window_action(iterator window, name_t action, const any_regular_t& parameter)
{
    if (action == static_name_t("reset"))
    {
        sheet_m.set((*window)->contributing_m);
        sheet_m.update();
    }
    else if (action == static_name_t("dialog"))
    {
        push_back(parameter.cast<std::string>().c_str(), size_normal_s);
    }
    else if (action == static_name_t("cancel"))
    {
        sheet_m.set((*window)->contributing_m);
        sheet_m.update();

        general_deferred_proc_queue().insert(boost::bind(&window_server_t::erase, boost::ref(*this), window));
    }
    else if (action == static_name_t("ok"))
    {
        general_deferred_proc_queue().insert(boost::bind(&window_server_t::erase, boost::ref(*this), window));
    }

    if (fallback_m)
        fallback_m(action, parameter); 
}
Exemplo n.º 4
0
void create_widget(const dictionary_t& parameters,
                   size_enum_t         size,
                   progress_bar_t*&    widget)
{
    name_t orientation(key_horizontal);
    int length(100);
    int width(14);
    GG::Clr color(GG::CLR_BLACK);
    GG::Clr bar_color(GG::CLR_BLUE);
    GG::Clr interior_color(GG::CLR_ZERO);

    dictionary_t::const_iterator it(parameters.find(key_format));
    value_range_format_t format;
    if (it != parameters.end())
        format.set(it->second.cast<dictionary_t>());

    get_value(parameters, key_orientation, orientation);
    get_value(parameters, static_name_t("length"), length);
    get_value(parameters, static_name_t("width"), width);
    implementation::get_color(parameters, static_name_t("color"), color);
    implementation::get_color(parameters, static_name_t("bar_color"), bar_color);
    implementation::get_color(parameters, static_name_t("interior_color"), interior_color);

    widget = new progress_bar_t(orientation == key_vertical,
                                format,
                                length,
                                width,
                                color,
                                bar_color,
                                interior_color);
}
Exemplo n.º 5
0
void pdf_format::stack_event(stream_type& os, bool is_push)
{
    const format_element_t& top(stack_top());
    name_t                  self(top.tag());
    name_t                  parent(stack_depth() >= 2 ? stack_n(1).tag() : name_t());
    name_t                  grandparent(stack_depth() >= 3 ? stack_n(2).tag() : name_t());

    if (self == atom_name_g)
    {
        handle_atom(os, is_push);
    }
    else if (is_push)
    {
        if (self == static_name_t("pdf"))
        {
            os << "% start pdf" << std::endl;
        }
        else if (self == bag_name_g)
        {
            os << "<<";

            up();
        }
        else if (self == seq_name_g && parent != bag_name_g)
        {
            os << "[ ";
        }
    }
    else
    {
        if (self == static_name_t("pdf"))
        {
            os << "\n% end pdf";
        }
        else if (self == bag_name_g)
        {
            down();

            if (top.num_out_m > 0)
                os << '\n' << indents(depth());
            else
                os << ' ';

            os << ">>";
        }
        else if (self == seq_name_g && parent != bag_name_g)
        {
            if (top.num_out_m > 0)
                os << ' ';

            os << ']';
        }
    }
}
Exemplo n.º 6
0
void attach_view_and_controller(checkbox_t&            control,
                                const dictionary_t&    parameters,
                                const factory_token_t& token,
                                adobe::name_t,
                                adobe::name_t,
                                adobe::name_t)
{
    if (parameters.count(key_bind) != 0) {
        name_t cell(get_value(parameters, key_bind).cast<name_t>());
        attach_view_and_controller_direct(control, parameters, token, cell);
    }

    any_regular_t checked_binding;
    name_t cell;
    array_t expression;
    if (get_value(parameters, static_name_t("bind_checked_signal"), checked_binding)) {
        implementation::cell_and_expression(checked_binding, cell, expression);
    }
    control.checked_proc_m = boost::bind(&handle_checked_signal,
                                         token.signal_notifier_m,
                                         control.signal_id_m,
                                         boost::ref(token.sheet_m),
                                         cell,
                                         expression,
                                         _1);

#define BIND_COLOR(name)                                                \
    adobe::attach_view(control.name##_proxy_m, parameters, token, adobe::static_name_t("bind_" #name))
    BIND_COLOR(color);
    BIND_COLOR(text_color);
    BIND_COLOR(interior_color);
#undef BIND_COLOR
}
Exemplo n.º 7
0
widget_node_t make_optional_panel(const dictionary_t&     parameters,
                                  const widget_node_t&    parent,
                                  const factory_token_t&  token,
                                  const widget_factory_t& factory)
{
   size_enum_t   size(parameters.count(key_size) ?
                       implementation::enumerate_size(get_value(parameters, key_size).cast<name_t>()) :
                       parent.size_m);

    optional_panel_t* widget(NULL);
    create_widget(parameters, size, widget);
    token.client_holder_m.assemblage_m.cleanup(boost::bind(delete_ptr<optional_panel_t*>(), widget));
  
    //
    // Call display_insertion to embed the new widget within the view heirarchy
    //
    platform_display_type display_token(insert(get_main_display(), parent.display_token_m, *widget));

    //
    // As per SF.net bug 1428833, we want to attach the poly_placeable_t
    // to Eve before we attach the controller and view to the model
    //

    eve_t::iterator eve_token;
    eve_token = attach_placeable<poly_placeable_t>(parent.eve_token_m, 
        *widget, parameters, token, 
        factory.is_container(static_name_t("optional")), 
        factory.layout_attributes(static_name_t("optional")));

    widget->set_optional_display_procs(boost::bind(&optional_display_show,
                                                   boost::ref(token.client_holder_m.visible_change_queue_m),
                                                   boost::ref(token.client_holder_m.eve_m),
                                                   eve_token,
                                                   _1),
                                       boost::bind(&optional_display_hide,
                                                   boost::ref(token.client_holder_m.visible_change_queue_m),
                                                   boost::ref(token.client_holder_m.eve_m),
                                                   eve_token,
                                                   _1));

    attach_view_and_controller(*widget, parameters, token);

    //
    // Return the widget_node_t that comprises the tokens created for this widget by the various components
    //
    return widget_node_t(size, eve_token, display_token, parent.keyboard_token_m);
}
Exemplo n.º 8
0
void replace_placeholders(array_t& expression,
                          const any_regular_t& _,
                          const any_regular_t& _1,
                          name_t _1_name/* = name_t()*/,
                          const any_regular_t& _2/* = any_regular_t()*/,
                          name_t _2_name/* = name_t()*/,
                          const any_regular_t& _3/* = any_regular_t()*/,
                          name_t _3_name/* = name_t()*/,
                          const any_regular_t& _4/* = any_regular_t()*/,
                          name_t _4_name/* = name_t()*/)
{
    replace_placeholder(expression, static_name_t("_"), _);
    replace_placeholder(expression, static_name_t("_1"), _1);
    replace_placeholder(expression, static_name_t("_2"), _2);
    replace_placeholder(expression, static_name_t("_3"), _3);
    replace_placeholder(expression, static_name_t("_4"), _4);
}
Exemplo n.º 9
0
widget_node_t make_edit_number(const dictionary_t&     parameters,
                               const widget_node_t&    parent,
                               const factory_token_t&  token,
                               const widget_factory_t& factory)
{
    bool is_container(factory.is_container(static_name_t("edit_number")));
    const layout_attributes_t& layout_attributes(
        factory.layout_attributes(static_name_t("edit_number")));

    size_enum_t   size(parameters.count(key_size) ?
                       implementation::enumerate_size(get_value(parameters, key_size).cast<name_t>()) :
                       parent.size_m);

    edit_number_t* widget(NULL);
    create_widget(parameters, size, widget);
    assemblage_cleanup_ptr(token.client_holder_m.assemblage_m, widget);

    //
    // Call display_insertion to embed the new widget within the view heirarchy
    //
    platform_display_type display_token(insert(get_main_display(), parent.display_token_m, *widget));

    //
    // As per SF.net bug 1428833, we want to attach the poly_placeable_t
    // to Eve before we attach the controller and view to the model
    //

    eve_t::iterator eve_token;
    eve_token = attach_placeable<poly_placeable_t>(parent.eve_token_m, *widget, parameters, token, is_container, layout_attributes);

    attach_edit_num_view_and_controller(*widget, parameters, token);

    keyboard_t::iterator keyboard_token = keyboard_t::get().insert(parent.keyboard_token_m, poly_key_handler_t(boost::ref(*widget)));

    //
    // Return the widget_node_t that comprises the tokens created for this widget by the various components
    //

    return widget_node_t(size, eve_token, display_token, keyboard_token);
}
Exemplo n.º 10
0
GG::ListBox::Row* item_to_row(const dictionary_t& item,
                              const row_factory_t* row_factory,
                              const GG::Clr& default_item_color)
{
    const bool contains_color = item.count(static_name_t("color"));
    dictionary_t colorful_dictionary;
    if (!contains_color) {
        colorful_dictionary = item;
        colorful_dictionary[static_name_t("color")] = any_regular_t(default_item_color);
    }
    const dictionary_t& dictionary = contains_color ? item : colorful_dictionary;
    name_t type;
    get_value(dictionary, static_name_t("type"), type);
    row_factory_t::const_iterator it;
    GG::ListBox::Row* retval = 0;
    if (row_factory && (it = row_factory->find(type)) != row_factory->end())
        retval = it->second(dictionary);
    else
        retval = GG::DefaultRowFactoryFunction(dictionary);
    retval->SetItem(item);
    return retval;
}
Exemplo n.º 11
0
any_regular_t asl_standard_array_function_lookup(name_t         function_name,
                                                 const array_t& argument_set)
{
    if (function_name == static_name_t("image"))
    {
        return implementation::vm_array_image_proc(argument_set);
    }
    else
    {
        throw_function_not_defined(function_name);
    }

    return any_regular_t(empty_t());
}
Exemplo n.º 12
0
inline widget_node_t
create_and_hookup_widget<control_button_t, poly_placeable_t>(const dictionary_t&        parameters,
                                                             const widget_node_t&       parent,
                                                             const factory_token_t&     token,
                                                             bool                       is_container,
                                                             const layout_attributes_t& layout_attributes)
{
    size_enum_t   size(parameters.count(key_size) ?
                       implementation::enumerate_size(get_value(parameters, key_size).cast<name_t>()) :
                       parent.size_m);
    std::string   name;
    std::string   alt_text;
    std::string   expression_string;

    get_value(parameters, key_name, name);
    get_value(parameters, key_alt_text, alt_text);
    get_value(parameters, static_name_t("expression"), expression_string);

    control_button_t* widget(NULL);

    widget = new control_button_t(name,
                                  alt_text,
                                  boost::bind(&sheet_t::inspect, boost::ref(token.sheet_m), _1),
                                  parse_adam_expression(expression_string),
                                  implementation::size_to_theme(size));

    assemblage_cleanup_ptr(token.client_holder_m.assemblage_m, widget);

    //
    // Call display_insertion to embed the new widget within the view heirarchy
    //
    platform_display_type display_token(insert(get_main_display(), parent.display_token_m, *widget));

    eve_t::iterator eve_token;

    eve_token = attach_placeable<poly_placeable_t>(parent.eve_token_m,
                                                   *widget,
                                                   parameters,
                                                   token,
                                                   is_container,
                                                   layout_attributes);

    attach_view_and_controller(*widget, parameters, token);

    //
    // Return the widget_node_t that comprises the tokens created for this widget by the various components
    //
    return widget_node_t(size, eve_token, display_token, parent.keyboard_token_m);
}
Exemplo n.º 13
0
bool asl_standard_array_function_lookup(name_t         function_name,
                                        const array_t& argument_set,
                                        any_regular_t& result)
{
    if (function_name == static_name_t("image"))
    {
        result = implementation::vm_array_image_proc(argument_set);
        return true;
    }
    else
    {
        return false;
    }

    result = any_regular_t(empty_t());
    return false;
}
Exemplo n.º 14
0
    void attach_view_and_controller(listbox_t&             control,
                                    const dictionary_t&    parameters,
                                    const factory_token_t& token,
                                    adobe::name_t,
                                    adobe::name_t,
                                    adobe::name_t)
    {
        basic_sheet_t& layout_sheet(token.client_holder_m.layout_sheet_m);
        assemblage_t&  assemblage(token.client_holder_m.assemblage_m);

        if (parameters.count(key_bind) != 0) {
            name_t cell(get_value(parameters, key_bind).cast<name_t>());
            attach_view_and_controller_direct(control, parameters, token, cell);
        }

        control.row_factory_m = token.row_factory_m;

        if (parameters.count(key_items) &&
            get_value(parameters, key_items).type_info() == type_info<name_t>()) {
            name_t cell(get_value(parameters, key_items).cast<name_t>());
            listbox_t::item_set_view_controller_t& tmp = control.item_set_view_controller_m;
            if (layout_sheet.count_interface(cell)) {
                attach_view(assemblage, cell, tmp, layout_sheet);
                attach_controller_direct(tmp, parameters, token, cell);
            } else {
                attach_view(assemblage, cell, tmp, token.sheet_m);
                attach_controller_direct(tmp, parameters, token, cell);
            }
        }

        {
            any_regular_t selection_changed_binding;
            name_t cell;
            array_t expression;
            if (get_value(parameters, static_name_t("bind_selection_changed_signal"), selection_changed_binding))
                implementation::cell_and_expression(selection_changed_binding, cell, expression);
            control.selection_changed_proc_m =
                boost::bind(&handle_selection_changed_signal,
                            _1,
                            token.signal_notifier_m,
                            static_name_t("selection_changed"),
                            control.signal_id_m,
                            boost::ref(token.sheet_m),
                            cell,
                            expression,
                            _2);
        }

        {
            any_regular_t dropped_binding;
            name_t cell;
            array_t expression;
            if (get_value(parameters, static_name_t("bind_dropped_signal"), dropped_binding))
                implementation::cell_and_expression(dropped_binding, cell, expression);
            control.dropped_proc_m =
                boost::bind(&handle_row_signal,
                            _1,
                            token.signal_notifier_m,
                            static_name_t("dropped"),
                            control.signal_id_m,
                            boost::ref(token.sheet_m),
                            cell,
                            expression,
                            _2);
        }

        {
            any_regular_t drop_acceptable_binding;
            name_t cell;
            array_t expression;
            if (get_value(parameters, static_name_t("bind_drop_acceptable_signal"), drop_acceptable_binding))
                implementation::cell_and_expression(drop_acceptable_binding, cell, expression);
            control.drop_acceptable_proc_m =
                boost::bind(&handle_drop_acceptable_signal,
                            _1,
                            token.signal_notifier_m,
                            static_name_t("drop_acceptable"),
                            control.signal_id_m,
                            boost::ref(token.sheet_m),
                            cell,
                            expression,
                            _2,
                            _3);
        }

        {
            any_regular_t left_clicked_binding;
            name_t cell;
            array_t expression;
            if (get_value(parameters, static_name_t("bind_left_clicked_signal"), left_clicked_binding))
                implementation::cell_and_expression(left_clicked_binding, cell, expression);
            control.left_clicked_proc_m =
                boost::bind(&handle_row_click_signal,
                            _1,
                            token.signal_notifier_m,
                            static_name_t("left_clicked"),
                            control.signal_id_m,
                            boost::ref(token.sheet_m),
                            cell,
                            expression,
                            _2,
                            _3);
        }

        {
            any_regular_t right_clicked_binding;
            name_t cell;
            array_t expression;
            if (get_value(parameters, static_name_t("bind_right_clicked_signal"), right_clicked_binding))
                implementation::cell_and_expression(right_clicked_binding, cell, expression);
            control.right_clicked_proc_m =
                boost::bind(&handle_row_click_signal,
                            _1,
                            token.signal_notifier_m,
                            static_name_t("right_clicked"),
                            control.signal_id_m,
                            boost::ref(token.sheet_m),
                            cell,
                            expression,
                            _2,
                            _3);
        }

        {
            any_regular_t double_clicked_binding;
            name_t cell;
            array_t expression;
            if (get_value(parameters, static_name_t("bind_double_clicked_signal"), double_clicked_binding))
                implementation::cell_and_expression(double_clicked_binding, cell, expression);
            control.double_clicked_proc_m =
                boost::bind(&handle_row_signal,
                            _1,
                            token.signal_notifier_m,
                            static_name_t("double_clicked"),
                            control.signal_id_m,
                            boost::ref(token.sheet_m),
                            cell,
                            expression,
                            _2);
        }

        {
            any_regular_t erased_binding;
            name_t cell;
            array_t expression;
            if (get_value(parameters, static_name_t("bind_erased_signal"), erased_binding))
                implementation::cell_and_expression(erased_binding, cell, expression);
            control.erased_proc_m =
                boost::bind(&handle_row_signal,
                            _1,
                            token.signal_notifier_m,
                            static_name_t("erased"),
                            control.signal_id_m,
                            boost::ref(token.sheet_m),
                            cell,
                            expression,
                            _2);
        }

        {
            any_regular_t browsed_binding;
            name_t cell;
            array_t expression;
            if (get_value(parameters, static_name_t("bind_browsed_signal"), browsed_binding))
                implementation::cell_and_expression(browsed_binding, cell, expression);
            control.browsed_proc_m =
                boost::bind(&handle_row_signal,
                            _1,
                            token.signal_notifier_m,
                            static_name_t("browsed"),
                            control.signal_id_m,
                            boost::ref(token.sheet_m),
                            cell,
                            expression,
                            _2);
        }

        adobe::attach_view(control.name_m.color_proxy_m, parameters, token, adobe::static_name_t("bind_label_color"));
#define BIND_COLOR(name)                                                \
        adobe::attach_view(control.name##_proxy_m, parameters, token, adobe::static_name_t("bind_" #name))
        BIND_COLOR(color);
        BIND_COLOR(interior_color);
        BIND_COLOR(hilite_color);
        BIND_COLOR(item_text_color);
#undef BIND_COLOR
    }
Exemplo n.º 15
0
void preview_t::display(const view_model_type& value)
{
    sublayout_m.sublayout_sheet_set_update(static_name_t("image"), value);
}
Exemplo n.º 16
0
    void create_widget(const dictionary_t& parameters,
                       size_enum_t,
                       listbox_t*& listbox)
    {
        std::string name;
        std::string alt_text;
        long characters(25);
        long rows(0);
        bool sort(false);
        name_t sort_order("ascending");
        name_t selections("single");
        bool user_delete(false);
        bool browse_updates(false);
        array_t items;
        listbox_t::item_set_t item_set;
        GG::Clr color(GG::CLR_GRAY);
        GG::Clr interior_color(GG::CLR_ZERO);
        GG::Clr hilite_color(GG::CLR_SHADOW);
        GG::Clr label_color(GG::CLR_BLACK);
        GG::Clr item_text_color(GG::CLR_BLACK);
        name_t signal_id;
        array_t allowed_drop_types;

        implementation::get_localized_string(parameters, key_name, name);
        implementation::get_localized_string(parameters, key_alt_text, alt_text);
        get_value(parameters, key_characters, characters);
        get_value(parameters, static_name_t("rows"), rows);
        get_value(parameters, static_name_t("sort"), sort);
        get_value(parameters, static_name_t("sort_order"), sort_order);
        get_value(parameters, static_name_t("selections"), selections);
        get_value(parameters, static_name_t("user_delete"), user_delete);
        get_value(parameters, static_name_t("browse_updates"), browse_updates);
        get_value(parameters, key_items, items);
        implementation::get_color(parameters, static_name_t("color"), color);
        implementation::get_color(parameters, static_name_t("interior_color"), interior_color);
        implementation::get_color(parameters, static_name_t("hilite_color"), hilite_color);
        implementation::get_color(parameters, static_name_t("label_color"), label_color);
        implementation::get_color(parameters, static_name_t("item_text_color"), item_text_color);
        get_value(parameters, static_name_t("signal_id"), signal_id);
        get_value(parameters, static_name_t("allowed_drop_types"), allowed_drop_types);

        GG::Flags<GG::ListBoxStyle> style;
        if (!sort)
            style |= GG::LIST_NOSORT;

        get_sort_order_style(sort_order, style);
        get_selection_style(selections, style);

        if (user_delete)
            style |= GG::LIST_USERDELETE;

        if (browse_updates)
            style |= GG::LIST_BROWSEUPDATES;

        for (array_t::iterator first(items.begin()), last(items.end()); first != last; ++first) {
            item_set.push_back(any_regular_t(first->cast<dictionary_t>()));
            dictionary_t& back = item_set.back().cast<dictionary_t>();
            get_value(back, key_value);
            dictionary_t::iterator it = back.find(key_name);
            if (it != back.end() && it->second.type_info() == type_info<adobe::string_t>()) {
                it->second.assign(localization_invoke(it->second.cast<std::string>()));
            }
        }

        if (!rows && items.empty())
            rows = 8;

        std::vector<std::string> drop_types;
        for (array_t::iterator first(allowed_drop_types.begin()), last(allowed_drop_types.end()); first != last; ++first) {
            drop_types.push_back(first->cast<std::string>());
        }

        listbox = new listbox_t(name,
                                alt_text,
                                characters,
                                rows,
                                style,
                                item_set,
                                color,
                                interior_color,
                                hilite_color,
                                label_color,
                                item_text_color,
                                drop_types,
                                signal_id);
    }
Exemplo n.º 17
0
std::pair<const char*, bool> alert(const char*                    message_text,
                                   const char*                    window_name,
                                   const char*                    button_0_name,
                                   const char*                    button_1_name,
                                   const char*                    button_2_name,
                                   const char*                    checkbox_name,
                                   const boost::filesystem::path& icon_path,
                                   std::size_t                    default_button_index,
                                   std::size_t                    cancel_button_index)
{
    if ((button_0_name || button_1_name || button_2_name) == false)
        return std::make_pair<const char*, bool>(0, false);

    std::stringstream       sheet;
    std::stringstream       layout;
    boost::filesystem::path icon_directory_path;

    // The sheet for the alert dialog
    sheet <<
        "sheet alert_sheet\n"
        "{\n"
        "interface:\n"
        "   checkbox_value: false;\n"
        "output:\n"
        "   result <== { checkbox_value: checkbox_value };\n"
        "}\n"
    ;

    // Start by filling out the header for the layout of the alert
    layout <<
        "layout alert_layout\n"
        "{\n"
        "   view dialog(name: '" << window_name << "', placement: place_row, spacing: 10)\n"
        "   {\n";

    if (icon_path != boost::filesystem::path())
    {
        icon_directory_path = icon_path.branch_path();

        layout <<
            "       label_t(image: '" << icon_path.leaf() << "')\n"
        ;
    }

    layout <<
        "       column()\n"
        "       {\n"
        "           static_text(name:'" << message_text << "', horizontal: align_fill, characters: 25);\n"
        ;

    // add the checkbox if we have a name for one
    if (checkbox_name)
    {
        layout <<
            "checkbox(name: '" << checkbox_name << "', bind: @checkbox_value);\n"
            ;
    }

    // add the button set
    layout <<
        "row(horizontal: align_right)\n"
        "{\n"
        ;

    // add the buttons in *reverse* order, so the first is rightmost
    append_button_to_layout(layout, button_2_name, 2, default_button_index == 2, cancel_button_index == 2);
    append_button_to_layout(layout, button_1_name, 1, default_button_index == 1, cancel_button_index == 1);
    append_button_to_layout(layout, button_0_name, 0, default_button_index == 0, cancel_button_index == 0);

    // close out the rest of the layout
    layout << 
        "           }\n" // row
        "       }\n"     // column
        "   }\n"         // dialog
        "}\n"            // layout
        ;

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

    bool is_checked(get_value(result.command_m, static_name_t("checkbox_value")).cast<bool>());

    // NOTE (fbrereto) : Here is why we require the name of the action to be "bN", where N is the index
    std::size_t index(std::atoi(&result.terminating_action_m.c_str()[1]));

    if (index == 0)
        return std::make_pair(button_0_name, is_checked);
    else if (index == 1)
        return std::make_pair(button_1_name, is_checked);

    return std::make_pair(button_2_name, is_checked);
}