当前位置: 首页>>代码示例>>C++>>正文


C++ Document::root方法代码示例

本文整理汇总了C++中xml::Document::root方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::root方法的具体用法?C++ Document::root怎么用?C++ Document::root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml::Document的用法示例。


在下文中一共展示了Document::root方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: extension

/** \brief  Creates a new preference dialog for extension preferences
    \param  name  Name of the Extension whose dialog this is
    \param  help  The help string for the extension (NULL if none)
    \param  controls  The extension specific widgets in the dialog

    This function initializes the dialog with the name of the extension
    in the title.  It adds a few buttons and sets up handlers for
    them.  It also places the passed-in widgets into the dialog.
*/
PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls, Effect * effect) :
#if WITH_GTKMM_3_0
    Gtk::Dialog::Dialog(_(name.c_str()), true),
#else
    Gtk::Dialog::Dialog(_(name.c_str()), true, true),
#endif
    _help(help),
    _name(name),
    _button_ok(NULL),
    _button_cancel(NULL),
    _button_preview(NULL),
    _param_preview(NULL),
    _effect(effect),
    _exEnv(NULL)
{
    Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox());
    if (controls == NULL) {
        if (_effect == NULL) {
            std::cout << "AH!!!  No controls and no effect!!!" << std::endl;
            return;
        }
        controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, NULL);
        _signal_param_change.connect(sigc::mem_fun(this, &PrefDialog::param_change));
    }

    hbox->pack_start(*controls, true, true, 6);
    hbox->show();
    this->get_vbox()->pack_start(*hbox, true, true, 6);

    /*
    Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP);
    if (_help == NULL)
        help_button->set_sensitive(false);
    */
    _button_cancel = add_button(_effect == NULL ? Gtk::Stock::CANCEL : Gtk::Stock::CLOSE, Gtk::RESPONSE_CANCEL);
    _button_cancel->set_use_stock(true);

    _button_ok = add_button(_effect == NULL ? Gtk::Stock::OK : Gtk::Stock::APPLY, Gtk::RESPONSE_OK);
    _button_ok->set_use_stock(true);
    set_default_response(Gtk::RESPONSE_OK);
    _button_ok->grab_focus();

    if (_effect != NULL && !_effect->no_live_preview) {
        if (_param_preview == NULL) {
            XML::Document * doc = sp_repr_read_mem(live_param_xml, strlen(live_param_xml), NULL);
            _param_preview = Parameter::make(doc->root(), _effect);
        }

        Gtk::HSeparator * sep = Gtk::manage(new Gtk::HSeparator());
        sep->show();
        this->get_vbox()->pack_start(*sep, true, true, 4);

        hbox = Gtk::manage(new Gtk::HBox());
        _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview);
        _button_preview->show();
        hbox->pack_start(*_button_preview, true, true,6);
        hbox->show();
        this->get_vbox()->pack_start(*hbox, true, true, 6);

        Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview);
        if (hbox != NULL) {
#if WITH_GTKMM_3_0
            _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->get_children().front());
#else
            _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->children().back().get_widget());
#endif
        }

        preview_toggle();
        _signal_preview.connect(sigc::mem_fun(this, &PrefDialog::preview_toggle));
    }

    // Set window modality for effects that don't use live preview
    if (_effect != NULL && _effect->no_live_preview) {
        set_modal(false);
    }

    GtkWidget *dlg = GTK_WIDGET(gobj());
    sp_transientize(dlg);

    return;
}
开发者ID:Spin0za,项目名称:inkscape,代码行数:91,代码来源:prefdialog.cpp


注:本文中的xml::Document::root方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。