예제 #1
0
void FileChooserImpl::init(
    FileChooser* chooser, Style* s, FileChooserAction* a
) {
    fchooser_ = chooser;
    fbrowser_ = nil;
    editor_ = nil;
    filter_ = nil;
    directory_filter_ = nil;
    filter_map_ = nil;
    dir_ = Directory::open(*name_);
    if (dir_ == nil) {
	dir_ = Directory::current();
	/* and what if we can't read the current directory? */
    }
    Resource::ref(a);
    action_ = a;
    style_ = new Style(s);
    Resource::ref(style_);
    style_->alias("FileChooser");
    style_->alias("Dialog");
    update_ = new ActionCallback(FileChooserImpl)(
	this, &FileChooserImpl::build
    );
    style_->add_trigger_any(update_);
    build();
}
예제 #2
0
파일: session.c 프로젝트: barak/ivtools-cvs
void SessionRep::init_style(const char* name, const PropertyData* props) {
    classname_ = name;
    name_ = find_name();
    style_ = new Style(*name_);
    Resource::ref(style_);
    style_->alias(classname_);
    props_ = props;
}
예제 #3
0
void SymChooserImpl::init(
    SymChooser* chooser, Style* s, SymChooserAction* a
) {
    fchooser_ = chooser;
    filter_map_ = nil;
    Resource::ref(a);
    action_ = a;
    style_ = new Style(s);
    Resource::ref(style_);
    style_->alias("FileChooser");
    style_->alias("Dialog");
    update_ = new ActionCallback(SymChooserImpl)(
	this, &SymChooserImpl::build
    );
    style_->add_trigger_any(update_);
    build();
}
예제 #4
0
void FrameKit::InitLayout(OverlayKit* kit, const char* name) {
    FrameEditor* ed = (FrameEditor*) kit->GetEditor();
    Catalog* catalog = unidraw->GetCatalog();
    const char* stripped_string = catalog->GetAttribute("stripped");
    boolean stripped_flag = stripped_string ? strcmp(stripped_string, "true")==0 : false;
    if (ed->GetWindow() == nil) {
        TextObserver* mousedoc_observer = new TextObserver(ed->MouseDocObservable(), "");
	WidgetKit& wk = *WidgetKit::instance();
	const LayoutKit& layout = *LayoutKit::instance();
	PolyGlyph* topbox = layout.vbox();

	Glyph* menus = kit->MakeMenus();
	Glyph* states = kit->MakeStates();
	Glyph* toolbar = kit->MakeToolbar();

	if (stripped_flag) {

	  Target* viewer = 
	    new Target(new Frame(ed->Interior()), TargetPrimitiveHit);
	  ed->body(viewer);
	  topbox->append(ed);

	} else {
	  if (states)
	    menus->append(states);
	  Target* viewer = 
	    new Target(new Frame(kit->Interior()), TargetPrimitiveHit);
	  Catalog* catalog = unidraw->GetCatalog();
	  if (const char* toolbarloca = catalog->GetAttribute("toolbarloc")) {
	    if (strcmp(toolbarloca, "r") == 0) 
	      toolbar->prepend(layout.vcenter(viewer));
	    else /* if (strcmp(toolbarloca, "l") == 0) */
	      toolbar->append(layout.vcenter(viewer));
	  } else 
	    toolbar->append(layout.vcenter(viewer));
	  menus->append(toolbar);
	  
	  
	  Style* style = Session::instance()->style();
	  boolean bookgeom = style->value_is_on("bookgeom");
	  
	  ed->body(menus);
	  ed->GetKeyMap()->Execute(CODE_SELECT);
	  topbox->append(ed);
	  if (!bookgeom) {
	    boolean set_flag = kit->set_button_flag();
	    boolean clr_flag = kit->clr_button_flag();
	    EivTextEditor* texteditor = nil;
	    if(!set_flag && !clr_flag) {
	      texteditor = new ComTextEditor(wk.style(), ed->comterp());
	    }
	    else
	      texteditor = new EivTextEditor(wk.style());
	    ((FrameEditor*)ed)->_texteditor = texteditor;
	    Button* set = set_flag ? 
	      wk.push_button("Set", new ActionCallback(FrameEditor)
			     ((FrameEditor*)ed, &FrameEditor::SetText)) : 
	      nil;
	    Button* clear = clr_flag ? 
	      wk.push_button("Clear", new ActionCallback(FrameEditor)
			     ((FrameEditor*)ed, &FrameEditor::ClearText)) : 
	      nil;
	    Glyph* buttonbox = nil;
	    if (set && !clear) {
	      buttonbox = 
		layout.vbox(layout.hcenter(set));
	    } else if (!set && clear) { 
	      buttonbox = 
		layout.vbox(layout.hcenter(clear));
	    } else if (set && clear) {
	      buttonbox = 
		layout.vbox(
			    layout.hcenter(set),
			    layout.vspace(10),
			    layout.hcenter(clear)
			    );
	    }
	    if (buttonbox) {
	      topbox->append(
		wk.outset_frame(
		  layout.hbox(
		    layout.vcenter(
		      layout.margin(
			buttonbox,
			10
		      )
		    ),
   		    layout.vcenter(texteditor)
		  )
   	        )
	      );
	    } else {
	      topbox->append(
   	        wk.outset_frame(
		  layout.hbox(
		    layout.vcenter(
		      layout.margin(
			layout.vbox(
#if 0
			  wk.label("type help"),
			  layout.vspace(10),
			  wk.label("to print"),
			  layout.vspace(10),
		          wk.label("info to stdout")
#else
			  kit->appicon()
#endif
		        ),
			10
		      )
   		    ),
  		    layout.vcenter(texteditor)
		  )
   	        )
	      );
	    }
	  }
	}
	  
	ManagedWindow* w = new ApplicationWindow(topbox);
	ed->SetWindow(w);
	Style* s = new Style(Session::instance()->style());
	s->alias(name);
	w->style(s);
    }
}