Ejemplo n.º 1
0
void VectorialFunction::clear()
{
  m_is_parsed = false;
  m_result.resize(0);
  for(Uint i = 0; i < m_parsers.size(); i++) {
      delete_ptr(m_parsers[i]);
  }
  vector<FunctionParser*>().swap(m_parsers);
}
void attach_popup_menu_item_set(popup_t&           control,
                                name_t             cell,
                                Sheet&             sheet,
                                assemblage_t&      assemblage,
                                eve_client_holder& /*client_holder*/)
{
    dynamic_menu_item_set_view_t* tmp = new dynamic_menu_item_set_view_t(control);

    assemblage.cleanup(boost::bind(delete_ptr(), tmp));

    attach_view(assemblage, cell, *tmp, sheet);
}
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(), 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("optional"_name), 
        factory.layout_attributes("optional"_name));

    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);
}
void subscribe_view_to_model(toggle_t&               control,
                             name_t                  cell, 
                             sheet_t*                layout_sheet,
                             sheet_t*                model_sheet,
                             assemblage_t&           assemblage,
                             visible_change_queue_t& visible_queue)
{
    typedef force_relayout_view_adaptor<toggle_t> adaptor_type;

    adaptor_type* view_adaptor(new adaptor_type(control, visible_queue));

    assemblage.cleanup(boost::bind(delete_ptr(), view_adaptor));

    if (layout_sheet)
    {
        attach_view(assemblage, cell, *view_adaptor, *layout_sheet);
        return;
    }

    attach_view(assemblage, cell, *view_adaptor, *model_sheet);
}
widget_node_t make_button(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);

    button_t* widget = implementation::create_button_widget(parameters, token, size);
    token.client_holder_m.assemblage_m.cleanup(boost::bind(delete_ptr(),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));

    // set up key handler code. We do this all the time because we want the button to be updated
    // when modifier keys are pressed during execution of the dialog.

    keyboard_t::iterator keyboard_token(keyboard_t::get().insert(parent.keyboard_token_m, poly_key_handler_t(boost::ref(*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("button"_name),
        factory.layout_attributes("button"_name));

    //
    // 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);
}
Ejemplo n.º 6
0
		void clearFilms()
		{
			for(size_t i = 0;i < films.size(); ++i)
				delete_ptr(films[i]);
			films.clear();
		}
Ejemplo n.º 7
0
		~BSDF(){
			while(nBxDFs--)delete_ptr(bxdfs[nBxDFs]);
		}
Ejemplo n.º 8
0
AssFile::AssFile(const AssFile &from) {
	Line.clone_from(from.Line, std::mem_fun_ref(&AssEntry::Clone), delete_ptr());
}
Ejemplo n.º 9
0
void Component::removeChildren()
{
  for_each(m_children.begin(), m_children.end(), delete_ptr());
  m_children.clear();
}