Example #1
0
void gMuteChannel::draw() {

	baseDraw();

	/* print label */

	fl_color(COLOR_BG_1);
	fl_font(FL_HELVETICA, 12);
	fl_draw("mute", x()+4, y(), w(), h(), (Fl_Align) (FL_ALIGN_LEFT | FL_ALIGN_CENTER));

	/* draw "on" and "off" labels. Must stay in background */

	fl_color(COLOR_BG_1);
	fl_font(FL_HELVETICA, 9);
	fl_draw("on",  x()+4, y(),        w(), h(), (Fl_Align) (FL_ALIGN_LEFT | FL_ALIGN_TOP));
	fl_draw("off", x()+4, y()+h()-14, w(), h(), (Fl_Align) (FL_ALIGN_LEFT | FL_ALIGN_TOP));

	/* draw on-off points. On = higher rect, off = lower rect. It always
	 * starts with a note_off */

	fl_color(COLOR_BG_2);

	int pxOld = x()+1;
	int pxNew = 0;
	int py    = y()+h()-5;
	int pyDot = py-6;

	for (unsigned i=0; i<points.size; i++) {

		/* next px */

		pxNew = points.at(i).x+x();

		/* draw line from pxOld to pxNew.
		 * i % 2 == 0: first point, mute_on
		 * i % 2 != 0: second point, mute_off */

		fl_line(pxOld, py, pxNew, py);
		pxOld = pxNew;

		py = i % 2 == 0 ? y()+4 : y()+h()-5;

		/* draw dots (handles) */

		fl_line(pxNew, y()+h()-5, pxNew, y()+4);

		if (selectedPoint == (int) i) {
			fl_color(COLOR_BD_1);
			fl_rectf(pxNew-3, pyDot, 7, 7);
			fl_color(COLOR_BG_2);
		}
		else
			fl_rectf(pxNew-3, pyDot, 7, 7);
	}

	/* last section */

	py = y()+h()-5;
	fl_line(pxNew+3, py, pParent->coverX+x()-1, py);
}
Example #2
0
	void Box::draw_lines() const{
		if(fill_color().visibility()) {    // fill
			fl_color(fill_color().as_int());
			fl_rectf(point(0).x + r, point(0).y, w - r - r, h);								// 丸角四角形内の縦の長方形
			fl_rectf(point(0).x, point(0).y + r, w, h - r - r);								// 丸角四角形内の横の長方形
			fl_pie(point(0).x + w - r - r, point(0).y, r + r, r + r, 0, 90);				// 右上円
			fl_pie(point(0).x, point(0).y, r + r, r + r, 90, 180);							// 左上円
			fl_pie(point(0).x, point(0).y + h - r - r, r + r, r + r, 180, 270);				// 左下円
			fl_pie(point(0).x + w - r - r, point(0).y + h - r - r, r + r, r + r, 270, 360);	// 右下円
			fl_color(color().as_int());    // reset color
		}

		if(color().visibility()) {    // lines on top of fill
			fl_color(color().as_int());
			fl_line(point(0).x + r, point(0).y, point(0).x + w - r, point(0).y);			// 上線
			fl_line(point(0).x + r, point(0).y + h, point(0).x + w - r, point(0).y + h);	// 下線
			fl_line(point(0).x, point(0).y + r, point(0).x, point(0).y + h - r);			// 左線
			fl_line(point(0).x + w, point(0).y + r, point(0).x + w, point(0).y + h - r);	// 右線
			fl_arc(point(0).x + w - r - r, point(0).y, r + r, r + r, 0, 90);				// 右上角丸
			fl_arc(point(0).x, point(0).y, r + r, r + r, 90, 180);							// 左上角丸
			fl_arc(point(0).x, point(0).y + h - r - r, r + r, r + r, 180, 270);				// 左下角丸
			fl_arc(point(0).x + w - r - r, point(0).y + h - r - r, r + r, r + r, 270, 360);	// 右下角丸
		}

		int ofnt = fl_font();
		int osz = fl_size();
		fl_font(fnt.as_int(), fnt_sz);
		fl_draw(lab.c_str(), point(0).x + r, point(0).y + h - r);
		fl_font(ofnt, osz);
	}
Example #3
0
void Text::draw_lines() const
{
    int ofnt = fl_font();
    int osz = fl_size();
    fl_font(fnt.as_int(),fnt_sz);
    fl_draw(lab.c_str(),point(0).x,point(0).y);
    fl_font(ofnt,osz);
}
Example #4
0
// FLTK.font
// FLTK.font(font_face, font_size)
// Gets or sets the current font, which is then used in various drawing routines.
mrb_value mrb_fltk_font_module_method( mrb_state *mrb, mrb_value self ) {
  mrb_value mrb_face, mrb_size;
  mrb_get_args( mrb, "|ii", &mrb_face, &mrb_size );

  if( mrb_nil_p( mrb_face ) || mrb_nil_p( mrb_size ) ) {
    fl_font( mrb_fixnum( mrb_face ), mrb_fixnum( mrb_size ) );

    return self;
  } else {
    return mrb_fixnum_value( fl_font() );
  }
}
Example #5
0
static void
label_draw(const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align)
{
  fl_font(o->font, o->size);
  fl_color((Fl_Color)o->color);
  fl_draw(o->value, X+MENU_ICON_W+3, Y, W-MENU_ICON_W-3, H, align);
}
Example #6
0
	void draw(){
		int wt, wb, wc;
		wt = y() + 24;// wave top
		wb = y() + h() - 10;// wave bottom
		wc = (w() - 20) * sh / (sh + sl) + x() + 10;// wave change

		fl_color(FL_BLACK);
		fl_rectf(x(), y(), w(), h());
		if(sh == 0 && sl == 0){
			return;
		}
		fl_color(FL_GREEN);
		fl_xyline(x(), wb, x() + 10);
		fl_yxline(x() + 10, wt, wb);
		fl_xyline(x() + 10, wt, wc);
		fl_yxline(wc, wt, wb);
		fl_xyline(wc, wb, x() + w() - 10);
		fl_yxline(x() + w() - 10, wt, wb);
		fl_xyline(x() + w() - 10, wt, x() + w());
		
		fl_color(FL_WHITE);
		fl_font(FL_HELVETICA, 10);
		fl_draw(t, x(), y() + 10);
		sprintf(buf, "%dusec", sh);
		fl_draw(buf, x() + 12, wt - 2);
		sprintf(buf, "%dusec", sl);
		fl_draw(buf, wc + 2, wb - 2);
	}
Example #7
0
void 
SpectrumView::draw_semilog ( void )
{
    int W = w() - padding_right;
    int H = h() - padding_bottom;
    char label[50];

    fl_line_style(FL_SOLID,0);
    fl_font( FL_HELVETICA_ITALIC, 7 );

    //Db grid is easy, it is just a linear spacing
    for(int i=0; i<16; ++i) {
        int level = y()+H*i/16.0;
        fl_line(x(), level, x()+W, level);

        float value = (1-i/16.0)*(_dbmax-_dbmin) + _dbmin;
        sprintf(label, "%.1f", value);
        fl_draw(label, x() + 4, level + 3, w() - 8, 7, FL_ALIGN_LEFT );
    }

    //The frequency grid is defined with points at
    //10,11,12,...,18,19,20,30,40,50,60,70,80,90,100,200,400,...
    //Thus we find each scale that we cover and draw the nine lines unique to
    //that scale
    float lb = 1.0f / logf( 10 );
    const int min_base = logf(_fmin)*lb;
    const int max_base = logf(_fmax)*lb;
    const float b = logf(_fmin)*lb;
    const float a = logf(_fmax)*lb-b;
    for(int i=min_base; i<=max_base; ++i) {
        for(int j=1; j<10; ++j) {
            const float freq = pow(10.0, i)*j;
            const float xloc = (logf(freq)*lb-b)/a;
            if(xloc<1.0 && xloc > -0.001)
            {
                fl_line(xloc*W+x(), y(), xloc*W+x(), y()+H);
            
                if ( j == 1 || j == 2 || j == 5 )
                {
                    sprintf(label, "%0.f%s", freq < 1000.0 ? freq : freq / 1000.0, freq < 1000.0 ? "" : "k" );
                    int sx = x() + xloc*W + 1;
                    if ( sx < x() * W - 20 )
                        fl_draw(label, sx, y()+h());
                }
            }
        }
    }

    /* draw 0dB line */
    {
        fl_line_style(FL_DASH,0);
        float i = ((_dbmax-_dbmin)+_dbmin) / (_dbmax-_dbmin);
        
        int level = y()+H*i;
                
        fl_color(fl_color_add_alpha(fl_rgb_color(240,240,240), 60 ));
        fl_line(x(), level, x()+W, level);
        fl_line_style(FL_SOLID,0);
    }
}
Example #8
0
void MessageBox::add_button(Fl_Button* b, MessageBoxButtonType bt) {
	E_RETURN_IF_FAIL(nbuttons < MSGBOX_MAX_BUTTONS);
	E_RETURN_IF_FAIL(b != NULL);

	int W = 0, H = 0;

	fl_font(b->labelfont(), b->labelsize());
	fl_measure(b->label(), W, H);

	if(W > 90) {
		W += 10; // some spaces between label an button edges
		if(bt == MSGBOX_BUTTON_RETURN)
			W += 30; // increase again since Fl_Return_Button have that stupid marker
		else
			W += 10; // ordinary button
		b_start -= W;
	} else {
		W = 90;
		b_start -= W;
	}

	b->resize(b_start, 75, W, 25);
	b_start -= 5; // space between buttons

	gr->add(b);
	buttons[nbuttons] = b;
	nbuttons++;
}
Example #9
0
void Fl_TooltipBox::layout()
{
    fl_font(label_font(), label_size());
    int ww, hh;
    ww = MAX_WIDTH;
    fl_measure(tip, ww, hh, FL_ALIGN_LEFT|FL_ALIGN_WRAP|FL_ALIGN_INSIDE);
    ww += 6; hh += 6;

    // find position on the screen of the widget:
    int ox = Fl::event_x_root();
    //int ox = X+W/2;
    int oy = Y + H+2;
    for (Fl_Widget* p = widget; p; p = p->parent())
    {
        //ox += p->x();
        oy += p->y();
    }
    if (ox+ww > Fl::w()) ox = Fl::w() - ww;
    if (ox < 0) ox = 0;
    if (H > 30)
    {
        oy = Fl::event_y_root()+13;
        if (oy+hh > Fl::h()) oy -= 23+hh;
    }
    else
    {
        if (oy+hh > Fl::h()) oy -= (4+hh+H);
    }
    if (oy < 0) oy = 0;

    resize(ox, oy, ww, hh);
    Fl_Menu_Window::layout();
}
Example #10
0
void shape_window::draw() {
  fl_color(0);
  fl_rectf(0,0,w(),h());
  fl_font(0,20);
  fl_color(7);
  fl_draw("This requires GL",0,0,w(),h(),FL_ALIGN_CENTER);
}
Example #11
0
void Icon::update_all()
{
    Fl_Config &iconConfig = *cfg;
    iconConfig.read_file(false);
    iconConfig.set_section("Desktop Entry");

    // Icon Label:
    icon_name = get_localized_name(iconConfig);
    tooltip(icon_name);
    label(icon_name);

    label_color(label_foreground);
    label_size(label_fontsize);

    lwidth = label_maxwidth; // This is a bit strange, but otherwise we get mysterious crashes...
    lheight= 0;
    fl_font(label_font(), label_size());
    fl_measure(icon_name, lwidth, lheight, FL_ALIGN_WRAP);
    lwidth += 4; //  height+= 4;

    // Icon file:
    iconConfig.read("Icon", icon_file, "folder.png");

    update_icon();

    redraw();
    //desktop->redraw();
}
Example #12
0
File: draw.C Project: imv/non
int
gui_draw_string ( int x, int y, int w, int h, int color, const char *s, bool draw )
{
    int rw;

    if ( ! s )
        return 0;

    fl_font( FL_COURIER, min( h, 18 ) );

    rw = fl_width( s );

    if ( fl_not_clipped( x, y, rw, h ) && draw )
    {
        gui_clear_area( x, y, w, h );

        if ( color )
            fl_color( velocity_colors[ color ] );
        else
            fl_color( FL_DARK_CYAN );

        fl_draw( s, x, y + h / 2 + fl_descent() );
    }

    return rw;
}
Example #13
0
void Fl_ProgressBar::draw()
{
    int bdx, bdy;
    double pct;
    if(damage() & FL_DAMAGE_ALL) draw_box();

    int X = 0, Y = 0;
    bdx = box()->dx();
    bdy = box()->dy();

    fl_color(selection_color());
    if(mPresent > mMax)
        mPresent = mMax;
    if(mPresent < mMin)
        mPresent = mMin;
    pct = (mPresent - mMin) / mMax;
    fl_rectf(X + bdx, Y + bdy, (int)(((double)w() - 2*bdx) * pct), h() - (2*bdy + 1));
    if(mShowPct)
    {
        char buffer[30];
        sprintf(buffer, "%d%%", (int) (pct * 100));
        fl_color(textcolor());
        fl_font(this->label_font(), this->label_size());
        fl_draw(buffer, X + (w() - fl_width(buffer))/2, Y + fl_height() + (((h() - 2*bdy) - fl_height())/2));
    }
}
Example #14
0
void FontDisplay::draw() {
  draw_box();
  int ix = 0, iy = 0, iw = w(), ih = h();
  box()->inset(ix, iy, iw, ih);
  fl_push_clip(ix, iy, iw, ih);
  const char* saved_encoding = fl_encoding();
  if (encoding) fl_encoding(encoding);
  fl_font(font, size);
  fl_color(FL_BLACK);
  char buffer[32];
//#if HAVE_XUTF8
  char outbuf[64];
//#endif
  for (int Y = 1; Y < 8; Y++) {
      for (int X = 0; X < 32; X++) buffer[X] = (32*Y+X);
//#if HAVE_XUTF8
      int len = fl_latin12utf((uint8*)buffer, 32, outbuf);
      fl_draw(outbuf, len, 3, 3+fl_height()*Y);
//#else
//      fl_draw(buffer, 32, 3, 3+fl_height()*Y);
//#endif
  }
  fl_encoding(saved_encoding);
  fl_pop_clip();
}
Example #15
0
void Ca_Text::draw(){
  uchar align_=align;
  double X,Y,W,H;
  double X1,Y1;

  X = x_axis_->position(x1);
  X1 = x_axis_->position(x2);
  if(X1>X)
    W=X1-X;
  else{
    W=X-X1;
    X=X1;
  }
  Y = y_axis_->position(y1);
  Y1 = y_axis_->position(y2);
  if(Y1>Y)
    H = Y1-Y;
  else{
    H = Y-Y1;
    Y = Y1;
  }
  fl_color(label_color);
  fl_font(label_font,label_size);
  ca_text(label,X,Y,W,H,(Fl_Align)align_);
};
Example #16
0
	void draw(){
		int i;
		int pitch, level;

		fl_color(FL_BLACK);
		fl_rectf(x(), y(), w(), h());
		if(c <= 0){
			return;
		}
		pitch = w() / c;

		fl_color(FL_GREEN);
		for(i = 0; i < c; i++){
			level = (center - s[i]) / 2 + h() / 2 + y();
			fl_rectf(
				i * pitch + x(),
				level,
				pitch > 1 ? pitch - 1 : pitch,
				h() + y() - level);
		}
		fl_color(FL_WHITE);
		fl_line(x(), h() / 2 + y(), w() + x(), h() / 2 + y());
		fl_font(FL_HELVETICA, 10);
		fl_draw(buf, x(), y() + 10);
	}
Example #17
0
void
Sequence_Region::draw_label ( const char *label, Fl_Align align, Fl_Color color, int xo, int yo )
{
    fl_color( FL_WHITE );
    fl_font( FL_HELVETICA_ITALIC, 10 );
    fl_draw( label, line_x() + Fl::box_dx( box() ), y() + Fl::box_dy( box() ), abs_w() - Fl::box_dw( box() ), h() - Fl::box_dh( box() ), align );
}
void CInstaller::SetTitle(const std::string &t)
{
    int w = m_pTitle->w(), h = 0;
    int minheaderh = (m_pLogoBox) ? (m_pLogoBox->y() + m_pLogoBox->h() + HeaderSpacing()) : 50;
    fl_font(m_pTitle->labelfont(), m_pTitle->labelsize());
    fl_measure(t.c_str(), w, h);
    minheaderh = std::max(minheaderh, h);

    m_pTitle->size(m_pTitle->w(), minheaderh);
    m_pTitle->label(MakeCString(t));

    if (m_pHeaderGroup->h() != minheaderh)
    {
        // Center logo (if any)
        if (m_pLogoBox)
        {
            const int y = ((minheaderh - m_pLogoBox->h()) / 2);
            m_pLogoBox->position(m_pLogoBox->x(), y);
        }

        m_pHeaderGroup->size(m_pHeaderGroup->w(), minheaderh);
        
        m_pWizard->size(m_pWizard->w(), m_pCancelButton->y()-minheaderh-ButtonHSpacing());
    }
}
Example #19
0
void
Fl_Arc_Dial::draw ( void )
{
    int X = x();
    int Y = y();
    int W = w();
    int H = h();

    draw_box();
    draw_label();

    X += Fl::box_dx(box());
    Y += Fl::box_dy(box());
    W -= Fl::box_dw(box());
    H -= Fl::box_dh(box());

    double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();

    fl_line_style( FL_SOLID, W / 6 );

    X += W / 8;
    Y += H / 8;
    W -= W / 4;
    H -= H / 4;

    if ( box() == FL_NO_BOX )
    {
        /* draw backgrond arc */
        fl_color( fl_color_average( FL_BLACK, selection_color(), 0.80f ) );
        fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle2() );
    }

    fl_color( selection_color() );
//    fl_color( fl_color_average( FL_RED, selection_color(), ( value() - minimum() ) / ( maximum() - minimum() ) ) );


    if ( type() == FL_FILL_DIAL )
        fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle  );
    else
    {
        const int d = 6;

        /* account for edge conditions */
        angle = angle < angle1() + d ? angle1() + d : angle;
        angle = angle > angle2() - d ? angle2() - d : angle;

        fl_arc( X, Y, W, H, 270 - (angle - d), 270 - (angle + d) );
    }

    fl_line_style( FL_SOLID, 0 );

    fl_color( labelcolor() );

    char s[10];

    fl_font( FL_HELVETICA, 8 );

    snprintf( s, sizeof( s ), "%.1f", value() );
    fl_draw( s, X, Y, W, H, FL_ALIGN_BOTTOM );
}
Example #20
0
void
Module::draw_label ( void )
{
    int tw, th, tx, ty;

    bbox( tx, ty, tw, th );

    const char *lp = label();

    int l = strlen( label() );

    Fl_Color c = FL_FOREGROUND_COLOR;

    if ( bypass() || ! active() )
        c = FL_BLACK;

    fl_color( fl_contrast( c, is_default() ? FL_BLACK : color() ) );

    char *s = NULL;

    if ( l > 10 )
    {
        s = new char[l];
        char *sp = s;

        for ( ; *lp; ++lp )
            switch ( *lp )
            {
                case 'i': case 'e': case 'o': case 'u': case 'a':
                    break;
                default:
                    *(sp++) = *lp;
            }
        *sp = '\0';

    }

    if ( l > 20 )
        fl_font( FL_HELVETICA, 10 );
    else
        fl_font( FL_HELVETICA, 14 );

    fl_draw( s ? s : lp, tx, ty, tw, th, (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP ) );

    if ( s )
        delete[] s;
}
Example #21
0
void SetButtonWidth(Fl_Button *button)
{
    const int spacing = 50;
    int w = 0, h = 0;
    fl_font(button->labelfont(), button->labelsize());
    fl_measure(button->label(), w, h);
    button->size(w+spacing, button->h());
}
void Fl_Value_Slider_Input::draw() {

  int sxx = x(); 
	int syy = y();
	int sww = w();
	int shh = h();

  int bxx = x();
	int byy = y();
	int bww = w();
	int bhh = h();

  int X = x();
	int Y = y();
	int W = w();
	int H = h();

	UNUSED(bxx); 
	UNUSED(byy);
	UNUSED(bhh);

  int border_size=Fl::box_dx(box());

  if (horizontal())
  {
    bww = textboxsize();
    UNUSED(bww);
    sxx += textboxsize(); 
    sww -= textboxsize();
    input.resize(X,Y,W-sww,shh);
  }
  else
  {
    fl_font(input.textfont(), input.textsize());
    syy += fl_height()+(border_size+1)*2; shh -= fl_height()+(border_size+1)*2;
    input.resize(X,Y,W,H-shh);
  }
  if (damage()&~FL_DAMAGE_CHILD)  input.clear_damage(FL_DAMAGE_ALL);
  input.box(box());
  input.color(FL_WHITE, selection_color());
  input.doDraw();
  input.resize(X,Y,W,H);
  input.clear_damage();
//  if (horizontal())   input.doDraw();
  clear_damage();
  draw_box(box(),sxx,syy,sww,shh,color());
  sxx+=border_size;
  syy+=border_size; 
  sww-=border_size*2;  
  shh-=border_size*2;
  if(border_size<2) {
    sxx++;
    syy++;
    sww--;
    shh--;
  }  
  Fl_Slider::draw(sxx,syy,sww,shh);
}
Example #23
0
void WidgetTable::draw_cell(TableContext context,
	int R, int C, int X, int Y, int W, int H)
{
	switch (context)
	{
	case CONTEXT_STARTPAGE:
		fl_font(FL_HELVETICA, 12);		// font used by all headers
		col_width_all(50);				// sets the width of the columns
		break;

	case CONTEXT_RC_RESIZE:
	{
		int X, Y, W, H;
		int index = 0;
		for (int r = 0; r<rows(); r++)
		{
			for (int c = 0; c<cols(); c++)
			{
				if (index >= children()) break;
				find_cell(CONTEXT_TABLE, r, c, X, Y, W, H);
				child(index++)->resize(X, Y, W, H);
			}
		}
		init_sizes();			// tell group children resized
		return;
	}

	case CONTEXT_ROW_HEADER:
		fl_push_clip(X, Y, W, H);
		{
			static char s[40];
			sprintf(s, "Row %d", R);
			fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, row_header_color());
			fl_color(FL_BLACK);
			fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
		}
		fl_pop_clip();
		return;

	case CONTEXT_COL_HEADER:
		fl_push_clip(X, Y, W, H);
		{
			static char s[40];
			sprintf(s, "Column %d", C);
			fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, col_header_color());
			fl_color(FL_BLACK);
			fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
		}
		fl_pop_clip();
		return;

	case CONTEXT_CELL:
		return;		// fltk handles drawing the widgets

	default:
		return;
	}
}
void Fl_Rotated_Text::set(const char *text, Fl_Font font, int size, uchar align, int rotation){

  uncache();
  if(alloc_array) delete[] ar2;
  ar2 = 0;
  array = 0;
  alloc_array = 0;


  delete[] text_;
  text_=0;
  font_ = font;
  size_ = size;
  align_ = align;

  if(!text || !(*text)){
    w(0);
    h(0);
    return;
  }

  text_ = new char[strlen(text) + 1];
  strcpy(text_, text);

  if(rotation >9)
    rot_ = (uchar)(((rotation+45)/90) % 4);
  else
    rot_ = (uchar) (rotation & 3);
  int w_ = 0;
  int h_ = 0;
  int old_font = fl_font();
  int old_size = fl_size();
  fl_font(font,size);
  fl_measure(text_,w_,h_,0); // assure that w() and h() are always available
  fl_font(old_font,old_size);
  h_ += fl_height()/2;
  if(rot_ & 1){
    w(h_);
    h(w_);
  }else{
    w(w_);
    h(h_);
  }
 
};
Example #25
0
static void
label_measure(const Fl_Label* o, int& W, int& H)
{
  fl_font(o->font, o->size);
  fl_measure(o->value, W, H);
  W += MENU_ICON_W+3;
  if (W > MAX_MENU_WIDTH) W = MAX_MENU_WIDTH;
  if (H < MENU_ICON_H) H = MENU_ICON_H;
}
Example #26
0
void Icon::draw()
{
    Fl_Flags f=0;
    Fl_Image *im = icon_im;
    if(focused()) {
        f=FL_SELECTED;
    }

    if(im)
        im->draw(0, 0, w(), h(),f);
    else {
        fl_color(FL_RED);
        fl_rect(0,0,w(),h());
        fl_color(FL_BLACK);
        fl_rectf(1,1,w()-2,h()-2);
        fl_color(FL_WHITE);
        fl_font(label_font()->bold(), 10);
        fl_draw("NO ICON FOUND!", 1, 1, w()-2, h()-2, FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_WRAP);
    }

    int X = w()-(w()/2)-(lwidth/2);
    int Y = h()+2;

    if(!label_trans) {
        fl_color(label_background);
        fl_rectf(X,Y,lwidth,lheight);
    }

    if(focused()) {
        focus_box()->draw(X, Y, lwidth, lheight, color(), 0);
    }

    fl_font(label_font(), label_size());

    // A little shadow, from Dejan's request :)
    // SUCKS!
    /*fl_color(fl_darker(label_color()));
    fl_draw(label(), X-1, Y+1, lwidth, lheight, flags());
    fl_draw(label(), X, Y+1, lwidth, lheight, flags());
    */

    fl_color(label_color());
    fl_draw(label(), X, Y, lwidth, lheight, flags());
}
Example #27
0
 void value(float f) {
     sprintf(tip, "%.2f", f);
     // Recalc size of window
     fl_font(labelfont(), labelsize());
     int W = w(), H = h();
     fl_measure(tip, W, H, 0);
     W += 8;
     size(W, H);
     redraw();
 }
Example #28
0
void NotifyBox::update_label_size(void) {
    lwidth = MAX_LABEL_WIDTH;
    lheight= 0;

	fl_font(txt_box->labelfont(), txt_box->labelsize());
	fl_measure(txt_box->label(), lwidth, lheight, txt_box->align());

    lwidth  += 10;
	lheight += 10;
}
Example #29
0
void Fl_Input_Browser::preferred_size(int& w, int& h) const
{
    fl_font(text_font(), float(text_size()));
    h = int(fl_height()+fl_descent()) + box()->dh() + 2;
    if(m_input.maximum_size()>0) {
        int ms = m_input.maximum_size() + 1;
        if (ms > 50) ms = 50;
        w = ms * (int)fl_width((unsigned int)'W') + h;
    }
}
Example #30
0
void MapsWindow::MapArea::MapInfoWin::info(std::string const& info)
{
    info_ = info;
    fl_font(Fl_Tooltip::font(), Fl_Tooltip::size());
    int W = 0;
    int H = 0;
    fl_measure(info_.c_str(), W, H, 0);
    size(W + 2*MARGIN, H + 2*MARGIN);
    redraw();
}