コード例 #1
0
ファイル: iv3text.cpp プロジェクト: PNCG/neuron
void TextLineAdjuster::addButtons() 
{
	WidgetKit* kit = WidgetKit::instance();
	LayoutKit* lkit = LayoutKit::instance();
	Style* style = kit->style();

	Stepper* left = kit->left_mover(adjustable_);
	Stepper* right = kit->right_mover(adjustable_);

	Coord mover_size = 15.0;
	style->find_attribute("mover_size", mover_size);

	box_->prepend(lkit->h_fixed_span(left, mover_size));
	box_->append(lkit->h_fixed_span(right, mover_size));
}
コード例 #2
0
ファイル: iv3text.cpp プロジェクト: PNCG/neuron
TextRegion::TextRegion() 
{
  line1_ = 0;
  column1_ = 0;
  line2_ = 0;
  column2_ = 0;

  WidgetKit* kit = WidgetKit::instance();
  Style* style = kit->style();
  String gui("monochrome");
  if (gui == kit->gui()) {
    color_ = new Color(*kit->foreground(), 0.25);
  } else {
    color_ = new Color(.7, .8, 1, 1);
  }
  Resource::ref(color_);
}
コード例 #3
0
ファイル: glyphviewer.c プロジェクト: barak/ivtools-cvs
void GlyphViewer::grab_scroll () {
    Window* w = canvas()->window();
    WidgetKit* kit = WidgetKit::instance();
    
    Coord dx = _lx - _x;
    Coord dy = _ly - _y;
    
    if (dx != 0.0 || dy != 0.0) {
        Coord l, b, r, t;
        w->cursor(kit->hand_cursor());
        _root->getbounds(l, b, r, t);
        canvas()->damage(l, b, r, t);
        _root->translate(dx, dy);
        _root->getbounds(l, b, r, t);
        canvas()->damage(l, b, r, t);
        _x += dx;
        _y += dy;
    }
}
コード例 #4
0
ファイル: main.c プロジェクト: jmzaleski/ivtools-1.2
int main(int argc, char** argv) {
    Session* session = new Session("Drag", argc, argv, options, properties);
    Style* style = session->style();
    WidgetKit* kit = WidgetKit::instance();
    boolean useCursor = style->value_is_on("useCursor");
    boolean useGlyph = style->value_is_on("useGlyph");
    ApplicationWindow* window = new ApplicationWindow(
	new DragZoneSink(
	    new Background(
		LayoutKit::instance()->hbox(
		    new DragDemo(kit, useCursor, useGlyph),
		    new DragZoneDemo(kit)
		),
		kit->background()
	    )
	)
    );
    window->map();
    session->run();

    return 0;
}
コード例 #5
0
ファイル: glyphviewer.c プロジェクト: barak/ivtools-cvs
void GlyphViewer::rate_scroll () {        
    Window* w = canvas()->window();
    WidgetKit* kit = WidgetKit::instance();
    
    Coord dx = _x - _lx;
    Coord dy = _y - _ly;
    
    if (dx != 0.0 && dy != 0.0) {
        double angle = atan2(dy, dx)*180/M_PI;
        
        if (angle < -157.5) {
            w->cursor(kit->rfast_cursor());
        } else if (angle < -112.5) {
            w->cursor(kit->rufast_cursor());
        } else if (angle < -67.5) {
            w->cursor(kit->ufast_cursor());
        } else if (angle < -22.5) {
            w->cursor(kit->lufast_cursor());
        } else if (angle < 22.5) {
            w->cursor(kit->lfast_cursor());
        } else if (angle < 67.5) {
            w->cursor(kit->ldfast_cursor());
        } else if (angle < 112.5) {
            w->cursor(kit->dfast_cursor());
        } else if (angle < 157.5) {
            w->cursor(kit->rdfast_cursor());
        } else {
            w->cursor(kit->rfast_cursor());
        }
    }
    
    Coord l, b, r, t;
    _root->getbounds(l, b, r, t);
    canvas()->damage(l, b, r, t);
    _root->translate(dx, dy);
    _root->getbounds(l, b, r, t);
    canvas()->damage(l, b, r, t);
}
コード例 #6
0
ファイル: main.c プロジェクト: barak/ivtools-cvs
main(int argc, char *argv[]) {
  Session * session =  new Session("strchooser", argc, argv, options, properties);
  LayoutKit &    lk = *LayoutKit::instance();
  WidgetKit *    wk =  MFKit::instance();

  PolyGlyph * mainglyph = lk.vbox();

  ApplicationWindow * mainwin = new ApplicationWindow(mainglyph);

  App * tryme = new App(mainwin);

  Menu * top_menu = wk->menubar();
  MenuItem *quit = wk->menubar_item("Quit");
  quit->action(new ActionCallback(Session)(Session::instance(),
					   &Session::quit));
  top_menu->append_item(quit);

  MenuItem *post = wk->menubar_item("Post");
  post->action(new ActionCallback(App)(tryme, &App::post_the_file_chooser));
  top_menu->append_item(post);

    mainglyph->append(
	new Background(
	    lk.vcenter(
		lk.vbox(
		    top_menu,
		    lk.fixed(nil, 200, 200)
		    )
	    ),
	    wk->background()
	)
    );

  return session->run_window(mainwin);

}
コード例 #7
0
ファイル: field.c プロジェクト: jmzaleski/ivtools-1.2
void FieldStringEditor::Reconfig() {
    kit_->push_style();
    kit_->style(style_);
    Painter* p = new Painter(output_);
    p->SetColors(kit_->foreground(), kit_->background());
    p->SetFont(kit_->font());
    Resource::unref(output_);
    output_ = p;
    StringEditor::Reconfig();
    kit_->pop_style();
}
コード例 #8
0
ファイル: field.c プロジェクト: jmzaleski/ivtools-1.2
void FieldStringEditor::do_grab_scroll(Event& e) {
    Window* w = canvas->window();
    Cursor* c = w->cursor();
    w->cursor(kit_->hand_cursor());
    int origin = display->Left(0, 0);
    int width = display->Width();
    Poll(e);
    int x = e.x;
    do {
	origin += e.x - x;
	origin = Math::min(
	    0, Math::max(Math::min(0, xmax - width), origin)
	);
	display->Scroll(0, origin, ymax);
	x = e.x;
	Poll(e);
    } while (e.middlemouse);
    w->cursor(c);
}
コード例 #9
0
ファイル: iv3text.cpp プロジェクト: PNCG/neuron
Text::Text(unsigned initialLines, unsigned initialColumns, TextBuffer* t)
{
	handler_ = new TextHandler(this);
	Resource::ref(handler_);
	dirty_ = false;
	text_ = t;
	insertion_.line_ = 0;
	insertion_.column_ = 0;
	WidgetKit* kit = WidgetKit::instance();
	Style* s = kit->style();
	String gui("monochrome");

	if (gui == kit->gui()) 
		insertion_.color_ = new Color(*kit->foreground());
	else 
		insertion_.color_ = new Color(1, .5, .5, 1);
	Resource::ref(insertion_.color_);
	insertion_.width_ = 2;

	initialLines_ = Math::max(initialLines, 1u);
	initialColumns_ = Math::max(initialColumns, 1u);

	font_ = kit->font();
	Resource::ref(font_);
	textColor_ = new Color(*kit->foreground());
	Resource::ref(textColor_);

	readOnly_ = false;

	canvas_ = 0;
	allocation_ = 0;

	curLowerX_ = 0;
	curUpperX_ = 0;
	curLowerY_ = 0;
	curUpperY_ = 0;

	textBuffer_ = 0;

	needWidth_ = false;
	width_ = 0;

	ctl_pn_col_ = -1;
	escape_ = 10;
}
コード例 #10
0
ファイル: main.c プロジェクト: jmzaleski/ivtools-1.2
Glyph* DragDemo::glyph() {
    return kit_->outset_frame(kit_->label("drag"));
}
コード例 #11
0
ファイル: main.c プロジェクト: jmzaleski/ivtools-1.2
void DragZoneDemo::leave(Event&) {
    body(kit_->inset_frame(kit_->label("zone")));
    reallocate();
}
コード例 #12
0
ファイル: main.c プロジェクト: jmzaleski/ivtools-1.2
void DragZoneDemo::enter(Event&, const char*, int) {
    body(kit_->outset_frame(kit_->label("zone")));
    reallocate();
}