本文整理汇总了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;
}
示例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_);
}
示例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", "");
}
}
示例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);
}
}
示例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 */
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}