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


C++ Style::attribute方法代码示例

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


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

示例1: PostDialog

GraphicComp* ImportCmd::PostDialog () {
    bool imported = false;
    GraphicComp* comp = nil;
    Editor* ed = GetEditor();

    Style* style;
    bool reset_caption = false;
    if (chooser_ == nil) {
	style = new Style(Session::instance()->style());
	style->attribute("subcaption", "Import graphic from file:");
	style->attribute("open", "Import");
	chooser_ = DialogKit::instance()->file_chooser(".", style);
	Resource::ref(chooser_);
    } else {
	style = chooser_->style();
    }
    while (chooser_->post_for(ed->GetWindow())) {
	const String* str = chooser_->selected();
	if (str != nil) {
	    NullTerminatedString ns(*str);
	    comp = Import(ns.string());
	    if (comp != nil) {
		break;
	    }
	    style->attribute("caption", "Import failed!");
	    reset_caption = true;
	}
    }
    if (reset_caption) {
	style->attribute("caption", "");
    }
    return comp;
}
开发者ID:PNCG,项目名称:neuron,代码行数:33,代码来源:import.cpp

示例2: Style

Chooser::Chooser(const char* name, const char* prompt) {
    Style* s = new Style(Session::instance()->style());
    s->attribute("name", name);
    s->attribute("subcaption", prompt);
    chooser_ = DialogKit::instance()->file_chooser(".", s, nil);
    Resource::ref(chooser_);
    style_ = s;
    Resource::ref(style_);
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:9,代码来源:dialogs.c

示例3: Execute

void ViewCompCmd::Execute () {
    Editor* ed = GetEditor();

    if (OnlyOneEditorOf(ed->GetComponent()) && !ReadyToClose(ed)) {
        return;
    }

    Style* style;
    boolean reset_caption = false;
    if (chooser_ == nil) {
	style = new Style(Session::instance()->style());
	chooser_ = DialogKit::instance()->file_chooser(".", style);
	Resource::ref(chooser_);
	char buf[CHARBUFSIZE];
	const char* domain = unidraw->GetCatalog()->GetAttribute("domain");
	domain = (domain == nil) ? "component" : domain;
	sprintf(buf, "Select a %s to open:", domain);
	style->attribute("caption", "");
	style->attribute("subcaption", buf);
    } else {
	style = chooser_->style();
    }
    while (chooser_->post_for(ed->GetWindow())) {
        const String* s = chooser_->selected();
	NullTerminatedString ns(*s);
	const char* name = ns.string();
        Catalog* catalog = unidraw->GetCatalog();
        GraphicComp* comp;

        if (catalog->Retrieve(name, (Component*&) comp)) {
	    ModifStatusVar* modif = (ModifStatusVar*) ed->GetState(
		"ModifStatusVar"
	    );
            Component* orig = ed->GetComponent();
            ed->SetComponent(comp);
            unidraw->Update();

            StateVar* sv = ed->GetState("CompNameVar");
            CompNameVar* cnv = (CompNameVar*) sv;

            if (cnv != nil) cnv->SetComponent(comp);
            if (modif != nil) modif->SetComponent(comp);

            if (orig != nil && unidraw->FindAny(orig) == nil) {
                Component* root = orig->GetRoot();
                delete root;
            }
	    break;
        } else {
	    style->attribute("caption", "Open failed!");
	    reset_caption = true;
        }
    }
    if (reset_caption) {
	style->attribute("caption", "");
    }
}
开发者ID:neurodebian,项目名称:iv-hines,代码行数:57,代码来源:catcmds.cpp

示例4: MonoKitImpl

MonoKit::MonoKit() {
    impl_ = new MonoKitImpl(this);
    Style* s = Session::instance()->style();
    for (PropertyData* p = kit_props; p->path != nil; p++) {
        s->attribute(p->path, p->value, -5);
    }
}
开发者ID:thickforest,项目名称:SLS-1.02,代码行数:7,代码来源:mono_kit.c

示例5: scons

static void* scons(Object*) {
#if HAVE_IV
	SymChooser* sc = nil;
IFGUI
	const char* caption = "Choose a Variable Name or";
	if (ifarg(1)) {
		caption = gargstr(1);
	}
	Style* style = new Style(Session::instance()->style());
	style->attribute("caption", caption);
	if (ifarg(2)) {
		Symbol* sym = hoc_lookup(gargstr(2));
		int type = RANGEVAR;
		if (sym) {
			type = sym->type;
		}
		sc = new SymChooser(new SymDirectory(type), WidgetKit::instance(), style, nil, 1);
	}else{
		sc = new SymChooser(nil, WidgetKit::instance(), style);
	}
	Resource::ref(sc);
ENDGUI
	return (void*)sc;
#else
	return (void*)0;
#endif /* HAVE_IV */
}
开发者ID:bhache,项目名称:pkg-neuron,代码行数:27,代码来源:symchoos.cpp

示例6: match

boolean SessionRep::match(
    const String& arg, const OptionDesc& o, int& i, int argc, char** argv
) {
    String opt(o.name);
    if (arg != opt) {
	if (o.style == OptionValueAfter) {
	    int n = opt.length();
	    if (opt == arg.left(n)) {
		style_->attribute(String(o.path), arg.right(n));
		return true;
	    }
	}
	return false;
    }
    String name, value;
    extract(arg, o, i, argc, argv, name, value);
    style_->attribute(name, value);
    return true;
}
开发者ID:barak,项目名称:ivtools-cvs,代码行数:19,代码来源:session.c

示例7: open

void Application::open (DocumentViewer* viewer) {
    long index = viewer_info(viewer, _viewer);
    if (index < 0) {
        index = _viewer->count();
        ApplicationViewerInfo info;
        info._dialogs = new DialogManager();
        info._viewer = viewer;
        info._viewer->ref();
        info._viewer->map();
        info._window_name = nil;
        info._icon_name = nil;
        _viewer->append(info);
    }
    ApplicationViewerInfo& info = _viewer->item_ref(index);
    const char* name = viewer->document()->name();
    if (info._window_name == nil || strcmp(info._window_name, name) != 0) {
        delete info._window_name;
        delete info._icon_name;
        if (name != nil) {
            info._window_name = strcpy(new char[strlen(name) + 1], name);
            const char* icon_name = strrchr(name, '/');
            if (icon_name != nil) {
                icon_name += 1;
            } else {
                icon_name = name;
            }
            info._icon_name = strcpy(new char[strlen(name) + 1], name);
	    Style* s = info._viewer->style();
	    if (s == nil) {
		s = new Style(Session::instance()->style());
		info._viewer->style(s);
	    }
	    s->attribute("name", info._window_name);
	    s->attribute("iconName", info._icon_name);
        } else {
            info._window_name = nil;
            info._icon_name = nil;
        }
    }
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:40,代码来源:Application.c

示例8: main

int main (int argc, char** argv) {
    World world("iclass", argc, argv, options, properties);
    const char* recursive = world.GetAttribute("recursive");
    const char* verbose = world.GetAttribute("verbose");
    const char* CPlusPlusFiles = world.GetAttribute("CPlusPlusFiles");
    ClassBuffer* buffer = new ClassBuffer(
        strcmp(recursive, "true") == 0, strcmp(verbose, "true") == 0,
	strcmp(CPlusPlusFiles, "true") == 0
    );

    for (int i = 1; i < argc; ++i) {
        buffer->Search(argv[i]);
    }

    IClass* iclass = new IClass(buffer);
    ApplicationWindow* window = new ApplicationWindow(iclass);
    Style* s = new Style(Session::instance()->style());
    s->attribute("name", "InterViews class browser");
    s->attribute("iconName", "iclass");
    window->style(s);
    window->map();
    iclass->Run();
    return 0;
}
开发者ID:neurodebian,项目名称:iv-hines,代码行数:24,代码来源:main.cpp

示例9: Execute

void GraphExportCmd::Execute () {
    Editor* ed = GetEditor();

    Style* style;
    boolean reset_caption = false;
    if (chooser_ == nil) {
	style = new Style(Session::instance()->style());
	style->attribute("subcaption", "Export selected graphics to file:");
	style->attribute("open", "Export");
	const char *formats_svg[] = {"EPS", "idraw EPS", "drawtool", "SVG"};
	const char *formats_nosvg[] = {"EPS", "idraw EPS", "drawtool", "dot"};
        const char *svg_arg = unidraw->GetCatalog()->GetAttribute("svgexport");
        const boolean svg_flag = svg_arg && strcmp(svg_arg, "true")==0;
	const char **formats = svg_flag ? formats_svg : formats_nosvg;
	int nformats = (svg_flag ? sizeof(formats_svg) : sizeof(formats_nosvg)) / sizeof(char*);
	const char *commands_svg[] = {"ghostview %s", "idraw %s", "drawtool %s", "firefox %s"};
	const char *commands_nosvg[] = {"ghostview %s", "idraw %s", "drawtool %s", "dot %s"};
	const char **commands = svg_flag ? commands_svg : commands_nosvg;
	chooser_ = new ExportChooser(".", WidgetKit::instance(), style,
				     formats, nformats, commands, nil, true);
	Resource::ref(chooser_);
    } else {
	style = chooser_->style();
    }
    boolean again; 
    while (again = chooser_->post_for(ed->GetWindow())) {
	const String* str = chooser_->selected();
	if (str != nil) {
	    NullTerminatedString ns(*str);
	    const char* name = ns.string();
	    style->attribute("caption", "              " );
	    chooser_->twindow()->repair();
	    chooser_->twindow()->display()->sync();

	    Catalog* catalog = unidraw->GetCatalog();
	    boolean ok = true;

	    if (!chooser_->to_printer() && catalog->Exists(name) && catalog->Writable(name)) {
		char buf[CHARBUFSIZE];
		sprintf(buf, "\"%s\" already exists,", name);
		GConfirmDialog* dialog = new GConfirmDialog(buf, "Overwrite?");
	    	Resource::ref(dialog);
	    	ok = dialog->post_for(ed->GetWindow());
	    	Resource::unref(dialog);
	    }

	    if (ok) { 
		ed->GetWindow()->cursor(hourglass);
		chooser_->twindow()->cursor(hourglass);
		if (Export(ns.string())) {
		    again = false;
		    break;
		}
		style->attribute("caption", "Export failed!" );
		reset_caption = true;
		ed->GetWindow()->cursor(arrow);
		chooser_->twindow()->cursor(arrow);
	    }
	}
    }

    chooser_->unmap();
    if (reset_caption) {
      style->attribute("caption", "              " );
    }
    if (!again)
	ed->GetWindow()->cursor(arrow);
    return;
}
开发者ID:jmzaleski,项目名称:ivtools-1.2,代码行数:69,代码来源:graphexport.c


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