Пример #1
0
KeyLayout::KeyLayout() : Fl_Button(0, 0, 30, 25) {
	should_show_flag = true;
	curr_layout      = "us"; /* default layout */
	img              = NULL;

	box(FL_FLAT_BOX);
	labelfont(FL_HELVETICA_BOLD);
	labelsize(10);
	label("??");
	align(FL_ALIGN_CLIP);

	tooltip(_("Current keyboard layout"));
	callback(click_cb);
	foreign_callback_add(window(), PANEL_APPLET_ID, update_flag_cb, this);

	path = Resource::find_data("icons/kbflags/21x14", RES_SYS_ONLY, NULL);

	do_key_layout();
	update_flag(true);

	/* TODO: lock this */
	keylayout_objects.push_back(this);

	/* with this, kb layout chages will be catched */
#if HAVE_XKBRULES
	if(!_XA_XKB_RF_NAMES_PROP_ATOM)
		_XA_XKB_RF_NAMES_PROP_ATOM = XInternAtom(fl_display, _XKB_RF_NAMES_PROP_ATOM, False);
#endif

	Fl::add_handler(xkb_events);
}
Пример #2
0
void GLWindow::draw() {
    // prevent nested calls to draw from creating infinite loops
    // Also prevents threads from creating invalid data
	// This is not atomic, so not perfect, but it should do the job for now
    if (isDrawing)
        return;
    isDrawing = true;

    // Set up fonts for drawing text
    float fColBack[4];
    glGetFloatv( GL_COLOR_CLEAR_VALUE, fColBack );

    gl_color( FL_BLACK );

    gl_font(labelfont(), labelsize());

    if (currentUI != 0) {
        gl_color( currentUI->fontColor() );

        currentUI->draw();
        
    } else {
        glClear(GL_COLOR_BUFFER_BIT);
    }

	// We're done, so allow other calls into this method.
	isDrawing = false;
}
Пример #3
0
BankSlot::BankSlot(int x,int y, int w, int h, const char *label)
:Fl_Button(x,y,w,h,label), nslot(-1)
{
    memset(labelstr, 0, sizeof(labelstr));
    box(FL_THIN_UP_BOX);
    labelfont(0);
    labelsize(13);
    align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
}
Пример #4
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();
 }
Пример #5
0
gResizerBar::gResizerBar(int X,int Y,int W,int H)
	: Fl_Box(X,Y,W,H)
{
	orig_h = H;
	last_y = 0;
	min_h  = 30;
	align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
	labelfont(FL_COURIER);
	labelsize(H);
	visible_focus(0);
	box(FL_FLAT_BOX);
}
Пример #6
0
DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) : 
	Fl_Widget(is->x, is->y, ICON_SIZE_MIN_W, ICON_SIZE_MIN_H) {

	E_ASSERT(gs != NULL);

	lwidth = lheight = 0;
	focus = false;
	micon = NULL;
	darker_img = NULL;

	/*
	 * GlobalIconSettings is shared from desktop so we only
	 * reference it. On other hand IconSettings is not shared
	 * and we must construct a copy from given parameter
	 */
	globals = gs;

	settings = new IconSettings;
	settings->name = is->name;
	settings->cmd  = is->cmd;
	settings->icon = is->icon;
	settings->icon2 = is->icon2;
	settings->type = is->type;
	settings->key_name= is->key_name;
	settings->full_path = is->full_path;

	// x,y are not needed since x(), y() are filled with it
	
	// setting fonts is TODO :P
#if 0	
	Fl::set_font((Fl_Font)20, "-windows-*-medium-r-*-*-14-*-*-*-*-*-*-*");
	labelfont((Fl_Font)20);
#endif

	label(settings->name.c_str());

	imenu = new Fl_Menu_Button(0, 0, 0, 0);
	if(settings->type == ICON_TRASH)
		imenu->menu(icon_trash_menu);
	else
		imenu->menu(icon_menu);

	load_icon(ICON_FACE_ONE);
	fix_position(x(), y());

	//Use desktop color as color for icon background
	color(bg);

	align(FL_ALIGN_WRAP);
	update_label_size();
}
Пример #7
0
        internals_graphics::Drawable2DObject * Plot2DAxes::inserted(Fl_Group * & optionWin, int reqWidth)
            {
            /* create the option window */
            optionWin = new Fl_Group(0, 0, reqWidth,60); // create the option group

            _gradButton = new Fl_Check_Button(25, 10, 90, 15, "Graduations.");
            _gradButton->labelfont(0);
            _gradButton->labelsize(11);
            _gradButton->color2(FL_RED);
            _gradButton->callback(_gradButtonCB_static, this);
            _gradButton->when(FL_WHEN_CHANGED);
            _gradButton->value(_gradStatus ? 1 : 0);

            _numButton = new Fl_Check_Button(25, 35, 90, 15, "Numbers.");
            _numButton->labelfont(0);
            _numButton->labelsize(11);
            _numButton->color2(FL_RED);
            _numButton->callback(_numButtonCB_static, this);
            _numButton->when(FL_WHEN_CHANGED);
            _numButton->value(_numStatus ? 1 : 0);

            _gradColorButton = new Fl_Button(10, 10, 15, 15);
            _gradColorButton->color2(_gradColor);
            _gradColorButton->color(_gradColor);
            _gradColorButton->callback(_gradColorButtonCB_static, this);

            _numColorButton = new Fl_Button(10, 35, 15, 15);
            _numColorButton->color2(_numColor);
            _numColorButton->color(_numColor);
            _numColorButton->callback(_numColorButtonCB_static, this);

            _scaleSlider = new Fl_Value_Slider(reqWidth - 150, 30, 140, 15);
            _scaleSlider->align(Fl_Align(FL_ALIGN_TOP));
            _scaleSlider->box(FL_FLAT_BOX);
            _scaleSlider->type(FL_HOR_NICE_SLIDER);
            _scaleSlider->range(0.1, 5.0);
            _scaleSlider->step(0.1);
            _scaleSlider->value(_scaling);
            _scaleSlider->color2(FL_RED);
            _scaleSlider->callback(_scaleSliderCB_static, this);
              
            auto b = new Fl_Box(reqWidth - 105, 10, 80, 15, "scaling");
            b->labelfont(0);
            b->labelsize(11);

            optionWin->end();
        
            return this; 
            }
Пример #8
0
geResizerBar::geResizerBar(int X, int Y, int W, int H, int minSize, bool type)
	: Fl_Box   (X, Y, W, H), 
	  m_type   (type),
	  m_minSize(minSize),
	  m_lastPos(0),
	  m_hover  (false)
{
	if (m_type == VERTICAL) {
		m_origSize = H;
		labelsize(H);
	}
	else {
		m_origSize = W;
		labelsize(W);
	}
	align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE);
	labelfont(FL_COURIER);
	visible_focus(0);
}
Пример #9
0
void DesktopIcon::update_label_size(void) {
	labelsize(gsettings->label_fontsize);
    lwidth = gsettings->label_maxwidth;
    lheight= 0;

	/*
	 * make sure current font size/type is set (internaly to fltk)
	 * so fl_measure() can correctly calculate label width and height
	 */
	int old = fl_font();
	int old_sz = fl_size();
	fl_font(labelfont(), labelsize());

	fl_measure(label(), lwidth, lheight, align());

	fl_font(old, old_sz);

    lwidth += 12;
	lheight += 5;
}
Пример #10
0
DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) : 
	Fl_Widget(is->x, is->y, ICON_SIZE_MIN_W, ICON_SIZE_MIN_H) {

	E_ASSERT(gs != NULL);

	lwidth = lheight = 0;
	focus = false;
	micon = NULL;
	darker_img = NULL;

	gsettings = gs;
	settings = is;

	/* setting fonts is TODO :P */
#if 0	
	Fl::set_font((Fl_Font)20, "-windows-*-medium-r-*-*-14-*-*-*-*-*-*-*");
	labelfont((Fl_Font)20);
#endif

	label(settings->name.c_str());

	imenu = new MenuButton(0, 0, 0, 0);
	if(settings->type == ICON_TRASH)
		imenu->menu(icon_trash_menu);
	else {
		icon_menu[2].image(IconLoader::get("edit-delete", ICON_SIZE_TINY));
		imenu->menu(icon_menu);
	}

	load_icon(ICON_FACE_ONE);
	fix_position(x(), y());

	/* use desktop color as color for icon background */
	color(bg);

	align(FL_ALIGN_WRAP);
	update_label_size();
}
Пример #11
0
void TaskButton::draw(void) {
	Fl_Color col = value() ? selection_color() : color();
	draw_box(value() ? (down_box() ? down_box() : fl_down(box())) : box(), col);

	if(image()) {
		int X, Y, lw, lh;

		X = x() + 5;
		Y = (y() + h() / 2) - (image()->h() / 2);
		image()->draw(X, Y);

		X += image()->w() + 5;

		if(label()) {
			fl_font(labelfont(), labelsize());
			fl_color(labelcolor());

			lw = lh = 0;
			fl_measure(label(), lw, lh, 0);

			/* use clipping so long labels do not be drawn on the right border, which looks ugly */
			fl_push_clip(x() + Fl::box_dx(box()), 
						 y() + Fl::box_dy(box()), 
						 w() - Fl::box_dw(box()) - 5, 
						 h() - Fl::box_dh(box()));

			Y = (y() + h() / 2) - (lh / 2);
			fl_draw(label(), X, Y, lw, lh, align(), 0, 0);

			fl_pop_clip();
		}
	} else {
		draw_label();
	}

	if(Fl::focus() == this)
		draw_focus();
}
Пример #12
0
            /**
             * Override of the inserted method
             **/
            virtual internals_graphics::Drawable2DObject * inserted(Fl_Group * & optionWin, int reqWidth)
                {
                /* create the option window */
                optionWin = new Fl_Group(0, 0, reqWidth, 110); // create the option group
                Fl_Group * gr1 = new Fl_Group(0, 0, reqWidth, 110); // create the option group
                _checkButtonColor = new Fl_Round_Button(10, 5, reqWidth - 20, 15, "Use the getColor() method.");
                _checkButtonColor->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT));
                _checkButtonColor->labelfont(0);
                _checkButtonColor->labelsize(11);
                _checkButtonColor->color2(FL_RED);
                _checkButtonColor->type(102);
                _checkButtonColor->callback(_roundButtonCB_static, this);
                _checkButtonColor->when(FL_WHEN_CHANGED);

                _checkButtonImage = new Fl_Round_Button(10, 85, reqWidth - 20, 15, "Use the getImage() method.");
                _checkButtonImage->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT));
                _checkButtonImage->labelfont(0);
                _checkButtonImage->labelsize(11);
                _checkButtonImage->color2(FL_RED);
                _checkButtonImage->type(102);
                _checkButtonImage->callback(_roundButtonCB_static, this);
                _checkButtonImage->when(FL_WHEN_CHANGED);
                if (_LD->imageType() == _LD->TYPEIMAGE) { _checkButtonImage->setonly(); } else { _checkButtonColor->setonly();  }
                if (!_LD->hasImage()) _checkButtonImage->deactivate();
                gr1->end();

                auto label1 = new Fl_Box(30, 25, 50, 15, "Opacify");
                label1->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT));
                label1->labelfont(0);
                label1->labelsize(11);
                _opacifySlider = new Fl_Value_Slider(80, 25, reqWidth - 80 - 30, 15, nullptr);
                _opacifySlider->labelfont(0);
                _opacifySlider->labelsize(11);
                _opacifySlider->align(Fl_Align(FL_ALIGN_RIGHT));
                _opacifySlider->box(FL_FLAT_BOX);
                _opacifySlider->type(FL_HOR_NICE_SLIDER);
                _opacifySlider->range(1.0, 4.0);
                _opacifySlider->step(0.05);
                _opacifySlider->value(_LD->opacify());
                _opacifySlider->color2(FL_RED);
                _opacifySlider->callback(_opacifySliderCB_static, this);
                auto label2 = new Fl_Box(30, 45, 145, 15, "Remove transparent pixels :");
                label2->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT));
                label2->labelfont(0);
                label2->labelsize(11);
                int rem = _LD->transparentColor();
                _checkWhite = new Fl_Check_Button(180, 45, reqWidth - 175 - 30, 15, "white");
                _checkWhite->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT));
                _checkWhite->labelfont(0);
                _checkWhite->labelsize(11);
                _checkWhite->value((rem == REMOVE_WHITE) ? 1 : 0);
                _checkWhite->callback(_checkWhiteCB_static, this);
                _checkBlack = new Fl_Check_Button(180, 65, reqWidth - 175 - 30, 15, "black");
                _checkBlack->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT));
                _checkBlack->labelfont(0);
                _checkBlack->labelsize(11);
                _checkBlack->value((rem == REMOVE_BLACK) ? 1 : 0);
                _checkBlack->callback(_checkBlackCB_static, this);
                optionWin->end();
                return _LD;
                }
Пример #13
0
FolderWindow::FolderWindow(int x, int y, int wid, int hgt, 
		           const char *label, int folderIndex) : 
	      Fl_Group(x, y, wid, hgt, label), 
	      folderScroll(NULL), folderPack(NULL), 
	      fileOpsLabel(NULL), fileLabel(NULL)
{

    // label configuration:  
    //labelcolor(GUI_TEXT_COLOR);
    labelfont(LOCAL_BFFONT);
    labelsize(LOCAL_TEXT_SIZE);    

    // icon configuration:
    structureIcon = new Fl_RGB_Image(StructureOperationIcon.pixel_data, 
		    StructureOperationIcon.width, StructureOperationIcon.height, 
		    StructureOperationIcon.bytes_per_pixel);
    Fl_Box *structIconBox = new Fl_Box(x, y - 39, structureIcon->w(), structureIcon->h());
    structIconBox->image(structureIcon);
    
    int dividerTextHeight = 0, spacingHeight = NAVBUTTONS_SPACING;
    int fileOpsLabelHeight = 2 * NAVBUTTONS_BHEIGHT; 
    int fileOpsLabelWidth = 2 * NAVBUTTONS_BWIDTH + 2 * NAVBUTTONS_SPACING;
    int initYOffset = NAVBUTTONS_OFFSETY + RNAStructVizLogo.height + 5; // y + 36 + dividerTextHeight
    const char *fileOpsLabelText = "@reload Structure Operations.\nEach operation opens a new window.";
    fileOpsLabel = new Fl_Box(x + NAVBUTTONS_SPACING, initYOffset, 
		              fileOpsLabelWidth, fileOpsLabelHeight, 
			      fileOpsLabelText);
    fileOpsLabel->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);  
    fileOpsLabel->color(GUI_BGCOLOR);
    fileOpsLabel->labelcolor(GUI_BTEXT_COLOR);
    fileOpsLabel->labelfont(LOCAL_BFFONT);
    fileOpsLabel->labelsize(LOCAL_TEXT_SIZE);
    fileOpsLabel->box(FL_RSHADOW_BOX);

    int opButtonWidth = 110;
    int yOffset = initYOffset + fileOpsLabelHeight;
    Fl_Button* diagramButton = new Fl_Button(x + 20, yOffset + spacingHeight,
		                             opButtonWidth, 30,
		                             "Diagram @>|");
    diagramButton->callback(DiagramCallback);
    diagramButton->labelcolor(GUI_BTEXT_COLOR);

    Fl_Button* statsButton = new Fl_Button(x + 20 + opButtonWidth + 
		             spacingHeight, yOffset + spacingHeight, 
	                     opButtonWidth, 30,
		             "Statistics @>|");
    statsButton->callback(StatsCallback);
    statsButton->labelcolor(GUI_BTEXT_COLOR);

    const char *fileInstText = "@filenew Files.\nClick on the file buttons to view\nCT file contents in new window.";
    fileLabel = new Fl_Box(x + NAVBUTTONS_SPACING, y + yOffset + spacingHeight, 
			   fileOpsLabelWidth, fileOpsLabelHeight, fileInstText);
    fileLabel->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
    fileLabel->color(GUI_BGCOLOR);
    fileLabel->labelcolor(GUI_BTEXT_COLOR);
    fileLabel->labelfont(LOCAL_BFFONT);
    fileLabel->labelsize(LOCAL_TEXT_SIZE);
    fileLabel->box(FL_RSHADOW_BOX);

    folderScroll = new Fl_Scroll(x+10, y + yOffset + fileOpsLabelHeight + 
		                 dividerTextHeight + 3 * spacingHeight, 
			         280, 310 - 2 * fileOpsLabelHeight - dividerTextHeight - 
				 2 * spacingHeight - NAVBUTTONS_BHEIGHT);
    folderScroll->type(Fl_Scroll::VERTICAL_ALWAYS);

    folderPack = new Fl_Pack(x+10, y + yOffset + fileOpsLabelHeight + 
		             dividerTextHeight + 3 * spacingHeight, 260, 
			     290 - 2 * fileOpsLabelHeight - dividerTextHeight - 
			     2 * spacingHeight - NAVBUTTONS_BHEIGHT);
    folderPack->type(Fl_Pack::VERTICAL);

    folderScroll->color((Fl_Color) GUI_WINDOW_BGCOLOR);
    folderScroll->labelcolor((Fl_Color) GUI_BTEXT_COLOR);

    this->resizable(folderScroll);
    this->color(GUI_WINDOW_BGCOLOR);
    
    SetStructures(folderIndex);

}
Пример #14
0
 void draw() {
     draw_box(FL_BORDER_BOX, 0, 0, w(), h(), Fl_Color(175));
     fl_color(FL_BLACK);
     fl_font(labelfont(), labelsize());
     fl_draw(tip, 3, 3, w()-6, h()-6, Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_WRAP));
 }
Пример #15
0
void DesktopIcon::draw(void) { 
	// draw_box(FL_UP_BOX, FL_BLACK);

	if(image() && (damage() & FL_DAMAGE_ALL)) {
		Fl_Image* im = image();

		/* center image in the box */
		int ix = (w()/2) - (im->w()/2);
		int iy = (h()/2) - (im->h()/2);
		ix += x();
		iy += y();

		/* darker_img is always present if image() is present */
		if(is_focused())
			darker_img->draw(ix, iy);
		else
			im->draw(ix, iy);

		E_DEBUG(E_STRLOC ": DesktopIcon icon redraw\n");
	}

	if(gsettings->label_draw && (damage() & (FL_DAMAGE_ALL | EDAMAGE_CHILD_LABEL))) {
		int X = x() + w()-(w()/2)-(lwidth/2);
		int Y = y() + h() + LABEL_OFFSET;

		Fl_Color old = fl_color();

		if(!gsettings->label_transparent) {
			fl_color(gsettings->label_background);
			fl_rectf(X, Y, lwidth, lheight);
		}

		int old_font = fl_font();
		int old_font_sz = fl_size();

		/* draw with icon's font */
		fl_font(labelfont(), labelsize());

		/* pseudo-shadow */
		fl_color(FL_BLACK);
		fl_draw(label(), X+1, Y+1, lwidth, lheight, align(), 0, 0);

		fl_color(gsettings->label_foreground);
		fl_draw(label(), X, Y, lwidth, lheight, align(), 0, 0);

		/* restore old font */
		fl_font(old_font, old_font_sz);

		if(is_focused()) {
			/* draw focused box on our way so later this can be used to draw customised boxes */
			fl_color(gsettings->label_foreground);
			fl_line_style(FL_DOT);

			fl_push_matrix();
			fl_begin_loop();
				fl_vertex(X, Y);
				fl_vertex(X + lwidth, Y);
				fl_vertex(X + lwidth, Y + lheight);
				fl_vertex(X, Y + lheight);
				fl_vertex(X, Y);
			fl_end_loop();
			fl_pop_matrix();

			/* revert to default line style */
			fl_line_style(0);
		}

		/* revert to old color whatever that be */
		fl_color(old);
		E_DEBUG(E_STRLOC ": DesktopIcon label redraw\n");
	}
}
Пример #16
0
void tabbar::draw() {
    const u32 startx = x();
    const u32 endx = x() + w() - 1;

    const u32 gradarea = h() - 2;
    u32 i, j;

    // bg
    u32 r1 = 63, g1 = 72, b1 = 81;
    u32 r2 = 38, g2 = 48, b2 = 59;
    for (i = 0; i <= gradarea; i++) {
        const float pos = i / (float) gradarea;

        fl_color(mix(r1, r2, pos),
                 mix(g1, g2, pos),
                 mix(b1, b2, pos));

        const u32 posy = y() + 1 + i;
        fl_line(startx, posy, endx, posy);
    }

    // Borders
    fl_color(37, 46, 52);
    fl_line(startx, y(), endx, y());
    fl_line(startx, y() + h() - 1, endx, y() + h() - 1);

    // Tabs
    u32 max;
    u32 tabw = calctabw(&max, w());

    bool highborder = false;
    if ((mousex - x()) % tabw > tabw / 2)
        highborder = true;

    u32 posx = x();
    const u32 lowy = y();
    const u32 highy = y() + h() - 1;
    for (i = 0; i < max; i++) {
        bool hover = false;
        // Borders
        fl_color(FL_BLACK);
        if (!i)
            fl_line(posx, lowy, posx, highy);
        fl_line(posx + tabw, lowy, posx + tabw, highy);

        // Bg
        r1 = 83, g1 = 92, b1 = 101;
        r2 = 58, g2 = 68, b2 = 79;

        if (i == g->curtab) {
            r1 = 100, g1 = 160, b1 = 191;
            r2 = 42, g2 = 100, b2 = 125;
        } else if ((mousein && mousex >= posx && mousex <= (posx + tabw - 1)) ||
                   (!firstpress && longorder.size() && longorder[longpress] == i)) {
            r1 = 150, g1 = 150, b1 = 191;
            r2 = 100, g2 = 100, b2 = 155;
            hover = true;
        }

        if (dragging && mousein && mousex >= posx && mousex <= (posx + tabw - 1)) {
            fl_color(FL_WHITE);
            if (!highborder)
                fl_line(posx, lowy, posx, highy);
            else
                fl_line(posx + tabw, lowy, posx + tabw, highy);
        }

        for (j = 0; j <= gradarea; j++) {
            const float pos = j / (float) gradarea;

            fl_color(mix(r1, r2, pos),
                     mix(g1, g2, pos),
                     mix(b1, b2, pos));

            const u32 posy = y() + 1 + j;
            fl_line(posx + 1, posy, posx + tabw - 1, posy);
        }

        // Icon
        Fl_Image *img = g->tabs[i].icon;
        if (!img)
            img = Fl_Shared_Image::get("newtab.png");

        const u32 imgy = y() + (h() - 16) / 2;
        img->draw(posx + 4, imgy, 16, 16);

        // Text
        fl_color(200, 200, 200);
        if (i == g->curtab)
            fl_color(FL_WHITE);
        else if (hover)
            fl_color(230, 230, 230);
        fl_font(labelfont(), labelsize());

        char tmp[80];
        memset(tmp, 0, 80);
        strncpy(tmp, g->tabs[i].title(), 79);

        int textw = 0, texth = 0;
        fl_measure(tmp, textw, texth, 0);

        const u32 textarea = tabw - 2 - 8 - 16 - 4;
        while ((u32) textw >= textarea) {
            // Shorten it until it fits
            const u32 len = strlen(tmp) - 1;
            tmp[len] = '\0';
            tmp[len - 1] = '.';
            tmp[len - 2] = '.';
            tmp[len - 3] = '.';

            textw = texth = 0;
            fl_measure(tmp, textw, texth, 0);
        }

        const u32 texty = y() - fl_descent() + fl_height() + (h() - fl_height())/2;
        fl_draw(tmp, posx + 2 + 8 + 16, texty);

        posx += tabw;
    }
}
Пример #17
0
// modified explicitly from Fl_Return_Button.cpp
void Flu_Button :: draw()
{
  if( type() == FL_HIDDEN_BUTTON )
    return;

  if( !active() )
    Fl_Button::color( col );

  // draw the link text
  if( linkBtn )
    {
      fl_draw_box( box(), x(), y(), w(), h(), color() );
      labelSize[0] = labelSize[1] = labelSize[2] = labelSize[3] = 0;
      fl_font( labelfont(), labelsize() );
      fl_measure( label(), labelSize[2], labelSize[3], 1 );

      labelSize[0] += 2;
      labelSize[1] += h()/2 - labelsize()/2 - 2;

      fl_color( labelcolor() );
      fl_draw( label(), x()+labelSize[0], y()+labelSize[1],
	       labelSize[2], labelSize[3], FL_ALIGN_LEFT );

      if( !overLink || ( overLink && hover ) )
	{
	  fl_line_style( FL_SOLID );
	  fl_line( x()+labelSize[0], y()+labelSize[1]+labelSize[3]-2,
		   x()+labelSize[0]+labelSize[2], y()+labelSize[1]+labelSize[3]-2 );
	  fl_line_style( 0 );
	}
      return;
    }

  Fl_Image *tmp = 0;
  if( active() && image_follows_value() )
    {
      if( !value() )
	{
	  tmp = Fl_Button::image();
	  Fl_Button::image( Fl_Button::deimage() );
	}
    }
  else if( active() && value() && downImg )
    {
      tmp = Fl_Button::image();
      Fl_Button::image( downImg );
    }

  const char *lbl = label();
  if( retBtn )
    label("");
  if( eBox != FL_NO_BOX && Fl::belowmouse() == this && active() )
    {
      Fl_Boxtype oldbox = box();
      box( eBox );
      Fl_Button::draw();
      box( oldbox );
    }
  else
    Fl_Button::draw();
  if( retBtn )
    {
      int W = h();
      if (w()/3 < W) W = w()/3;
      flu_return_arrow(x()+w()-W-4, y(), W, h());
      label( lbl );
      draw_label(x(), y(), w()-W+4, h());
    }

  if( tmp )
    Fl_Button::image( tmp );
}