void Flu_Spinner::draw()
{
  int W = w()*15/100;
  if( W < h()/2 )
    W = h()/2;
  int X = x()+w()-W, Y = y();

  // fltk 2.0 behavior
  bool refresh;
  if( step() >= 1.0 )
    {
      refresh = ( _input.type() != FL_INT_INPUT );
      _input.type( FL_INT_INPUT );
    }
  else
    {
      refresh = ( _input.type() != FL_FLOAT_INPUT );
      _input.type( FL_FLOAT_INPUT );
    }
  if( refresh )
    value_damage();

  // draw the up/down arrow buttons
  fl_draw_box( (Fl_Boxtype)_valbox[0], X, Y, W, h()/2, color() );
  fl_draw_box( (Fl_Boxtype)_valbox[1], X, Y+h()/2, W, h()/2, color() );
  fl_color( active_r() ? FL_FOREGROUND_COLOR : fl_inactive(FL_FOREGROUND_COLOR) );
  fl_polygon( X+4, Y+h()/2-4, X+W/2, Y+4, X+W-4, Y+h()/2-4 );
  Y += h()/2;
  fl_polygon( X+4, Y+4, X+W/2, Y+h()/2-4, X+W-4, Y+4 );

  _input.resize( x(), y(), w()-h()/2-1, h() );
  _input.redraw();
}
//*****************************************************************************
// Vp_Value_Input_Spin::draw() -- Draw widget
void Vp_Value_Input_Spin::draw()
{
  int sxx = x(), syy = y(), sww = w(), shh = h();
  sxx += sww - buttonssize(); sww = buttonssize();
  Fl_Boxtype box1 = FL_BORDER_FRAME;
  //int border_size=Fl::box_dx(FL_BORDER_FRAME);
  int border_size=1;

  if (damage()&~FL_DAMAGE_CHILD) input.clear_damage(FL_DAMAGE_ALL);
  input.box(box());
  input.color(FL_WHITE, selection_color());
  Fl_Widget * draw_hack = &input;
  draw_hack->draw();
  input.clear_damage();
  sxx+=border_size;
  syy+=border_size;
  sww-=border_size*2;
  shh-=border_size*2;

  if (!box1) box1 = (Fl_Boxtype)(box()&-2);

  if((indrag || mouseobj) && deltadir!=0) {
     if(deltadir>0) {
       draw_box(down(box1),sxx,syy,sww,shh/2,color());
       draw_box(box1,sxx,syy+shh/2,sww,shh/2,color());
     } else {
       draw_box(box1,sxx,syy,sww,shh/2,color());
       draw_box(down(box1),sxx,syy+shh/2,sww,shh/2,color());
     }
  } else {
   draw_box(box1,sxx,syy,sww,shh/2,color());
   draw_box(box1,sxx,syy+shh/2,sww,shh/2,color());
  }
  sxx+=border_size;
  syy+=border_size;
  sww-=border_size*2;
  shh-=border_size*2;
  if (active_r()) {
        fl_color(labelcolor());
  } else {
        fl_color(labelcolor() | 8);
  }
  int w1 = (sww-1)|1; // use odd sizes only
  int X = sxx+w1/2;
  int W = w1/3;
  int h1 = shh/2-border_size-2;
  int Y= syy;
  fl_polygon(X, Y, X+W,Y+h1 , X-W, Y+h1);
  Y=syy+shh/2+border_size+1+h1;
  fl_polygon(X, Y, X-W, Y-h1, X+W, Y-h1);
  clear_damage();
}
Beispiel #3
0
void gChoice::draw() {
	fl_rectf(x(), y(), w(), h(), COLOR_BG_0);              // bg
	fl_rect(x(), y(), w(), h(), (Fl_Color) COLOR_BD_0);    // border
	if (angle)
		fl_polygon(x()+w()-8, y()+h()-1, x()+w()-1, y()+h()-8, x()+w()-1, y()+h()-1);

	/* pick up the text() from the selected item (value()) and print it in
	 * the box and avoid overflows */

	fl_color(!active() ? COLOR_BD_0 : COLOR_TEXT_0);
	if (value() != -1) {
		if (fl_width(text(value())) < w()-8) {
			fl_draw(text(value()), x(), y(), w(), h(), FL_ALIGN_CENTER);
		}
		else {
			std::string tmp = text(value());
			int size        = tmp.size();
			while (fl_width(tmp.c_str()) >= w()-16) {
				tmp.resize(size);
				size--;
			}
			tmp += "...";
			fl_draw(tmp.c_str(), x(), y(), w(), h(), FL_ALIGN_CENTER);
		}

	}
}
Beispiel #4
0
void Fl_Spin::draw() {

  int sxx = x(), syy = y(), sww = w(), shh = h(); 
  Fl_Boxtype box1 = (Fl_Boxtype)(box());
  int border_size=Fl::box_dx(box());

  if (damage()&~FL_DAMAGE_CHILD) clear_damage(FL_DAMAGE_ALL);

  if (!box1) box1 = (Fl_Boxtype)(box()&-2);

  if((indrag || mouseobj) && deltadir!=0) {
     if(deltadir>0) {
       draw_box(down(box1),sxx,syy,sww,shh/2,color());
       draw_box(box1,sxx,syy+shh/2,sww,shh/2,color());
     } else {
       draw_box(box1,sxx,syy,sww,shh/2,color());
       draw_box(down(box1),sxx,syy+shh/2,sww,shh/2,color());
     }
  } else {
   draw_box(box1,sxx,syy,sww,shh/2,color());
   draw_box(box1,sxx,syy+shh/2,sww,shh/2,color());
  }
  sxx+=border_size;
  syy+=border_size;
  sww-=border_size*2;  
  shh-=border_size*2;
  if (active_r()) {
        fl_color(selection_color());  
  } else {
        fl_color(selection_color() | 8);
  }    
  int w1 = (sww-1)|1; // use odd sizes only
  int X = sxx+w1/2;
  int W = w1/3;
  int h1 = shh/2-border_size-2;
  int Y= syy;
  fl_polygon(X, Y, X+W,Y+h1 , X-W, Y+h1);
  Y=syy+shh/2+border_size+1+h1; 
  fl_polygon(X, Y, X-W, Y-h1, X+W, Y-h1); 
  clear_damage();  
} 
void Flu_Combo_Box :: draw()
{
  int W = 18, H = h()-4;
  int X = x()+w()-W-2, Y = y()+2;

  fl_draw_box( box(), x(), y(), w(), h(), color() );

  // draw the arrow button
  fl_draw_box( (Fl_Boxtype)_valbox, X, Y, W, H, color() );
  fl_color( active_r() ? FL_FOREGROUND_COLOR : fl_inactive(FL_FOREGROUND_COLOR) );
  fl_polygon( X+W/2-5, Y+H/2-2, X+W/2+3, Y+H/2-2, X+W/2-1, Y+H/2+2 );

  draw_child( input );
  if( Fl::focus() == this )
    draw_focus( FL_NO_BOX, input.x(), input.y(), input.w(), input.h() );
}
Beispiel #6
0
 FL_EXPORT_C(void,flc_polygon_with_x3_y3)(int x,int y,int x1,int y1,int x2,int y2,int x3,int y3){
   fl_polygon(x,y,x1,y1,x2,y2,x3,y3);
 }
Beispiel #7
0
 FL_EXPORT_C(void,flc_polygon)(int x,int y,int x1,int y1,int x2,int y2){
   fl_polygon(x,y,x1,y1,x2,y2);
 }
Beispiel #8
0
void myscroll::draw() {
	draw_box();

	int X = x()+Fl::box_dx(box());
	int Y = y()+Fl::box_dy(box());
	int W = w()-Fl::box_dw(box());
	int H = h()-Fl::box_dh(box());

	if (horizontal()) {
		if (W < 3*H) {Fl_Slider::draw(X,Y,W,H); return;}
		Fl_Slider::draw(X+H,Y,W-2*H,H);

		// Buttons
		draw_box(button1 ? fl_down(slider()) : slider(),
			 X, Y, H, H, selection_color());
		draw_box(button2 ? fl_down(slider()) : slider(),
			 X+W-H, Y, H, H, selection_color());
		if (active_r())
			fl_color(labelcolor());
		else
			fl_color(fl_inactive(labelcolor()));
		int w1 = (H-4)/3; if (w1 < 1) w1 = 1;
		int x1 = X+(H-w1-1)/2;
		int yy1 = Y+(H-2*w1-1)/2;
		if (Fl::scheme_ && !strcmp(Fl::scheme_, "gtk+")) {
			fl_polygon(x1, yy1+w1, x1+w1, yy1+2*w1, x1+w1-1, yy1+w1,
					x1+w1, yy1);
			x1 += (W-H);
			fl_polygon(x1, yy1, x1+1, yy1+w1, x1, yy1+2*w1, x1+w1,
					yy1+w1);
		} else {
			fl_polygon(x1, yy1+w1, x1+w1, yy1+2*w1, x1+w1, yy1);
			x1 += (W-H);
			fl_polygon(x1, yy1, x1, yy1+2*w1, x1+w1, yy1+w1);
		}
	} else { // vertical
		if (H < 3*W) {Fl_Slider::draw(X,Y,W,H); return;}
		Fl_Slider::draw(X,Y+W,W,H-2*W);

		// Buttons
		draw_box(button1 ? fl_down(slider()) : slider(),
			 X, Y, W, W, selection_color());
		draw_box(button2 ? fl_down(slider()) : slider(),
			 X, Y+H-W, W, W, selection_color());
		if (active_r())
			fl_color(labelcolor());
		else
			fl_color(fl_inactive(labelcolor()));
		int w1 = (W-4)/3; if (w1 < 1) w1 = 1;
		int x1 = X+(W-2*w1-1)/2;
		int yy1 = Y+(W-w1-1)/2;
		if (Fl::scheme_ && !strcmp(Fl::scheme_, "gtk+")) {
			fl_polygon(x1, yy1+w1, x1+w1, yy1+w1-1, x1+2*w1, yy1+w1, x1+w1,
					yy1);
			yy1 += H-W;
			fl_polygon(x1, yy1, x1+w1, yy1+1, x1+w1, yy1+w1);
			fl_polygon(x1+w1, yy1+1, x1+2*w1, yy1, x1+w1, yy1+w1);
		} else {
			fl_polygon(x1, yy1+w1, x1+2*w1, yy1+w1, x1+w1, yy1);
			yy1 += H-W;
			fl_polygon(x1, yy1, x1+w1, yy1+w1, x1+2*w1, yy1);
		}
	}
}