Ejemplo n.º 1
0
/**************************************************************************
 MUIM_Draw
**************************************************************************/
IPTR Numericbutton__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    IPTR  val;
    char *buf;
    int   width;

    DoSuperMethodA(cl,obj,(Msg)msg);

    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE)))
        return FALSE;

    DoMethod(obj,MUIM_DrawBackground,_mleft(obj),_mtop(obj),_mwidth(obj),_mheight(obj),
             _mleft(obj),_mtop(obj),0);

    SetFont(_rp(obj),_font(obj));
    SetABPenDrMd(_rp(obj),_pens(obj)[MPEN_TEXT],_pens(obj)[MPEN_BACKGROUND],JAM1);

    get(obj, MUIA_Numeric_Value, &val);
    buf = (char*)DoMethod(obj,MUIM_Numeric_Stringify,val);
    width = TextLength(_rp(obj),buf,strlen(buf));

    Move(_rp(obj), _mleft(obj) + (_mwidth(obj) - width) / 2,
         _mtop(obj) + _font(obj)->tf_Baseline);

    Text(_rp(obj), buf, strlen(buf));

    return TRUE;
}
Ejemplo n.º 2
0
IPTR IconImage__MUIM_Draw
(
    Class *CLASS, Object *self, struct MUIP_Draw *message
)
{
    struct IconImage_DATA *data = INST_DATA(CLASS, self); 
    IPTR                   rc   = DoSuperMethodA(CLASS, self, (Msg) message);
    IPTR                   selected;
    
    DoMethod
    (
        self, MUIM_DrawParentBackground,  
        _mleft(self), _mtop(self), _mwidth(self), _mheight(self), 0, 0, 0
    );
    
    get(self, MUIA_Selected, &selected);
    
    DrawIconState
    (
        _rp(self), data->iid_DiskObject, NULL, 
        _mleft(self), _mtop(self), selected ? IDS_SELECTED : IDS_NORMAL, 
        
        ICONDRAWA_Frameless,       TRUE,
        ICONDRAWA_Borderless,      TRUE,
        ICONDRAWA_EraseBackground, FALSE,
        TAG_DONE
    );
    
    return rc;
}
Ejemplo n.º 3
0
IPTR Colorfield__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    struct Colorfield_DATA *data = INST_DATA(cl,obj);

    DoSuperMethodA(cl,obj,(Msg)msg);
    
    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE)))
        return FALSE;

    if (data->flags & FLAG_NO_PEN)
    {
    	static UWORD pat[] = {0x1111,0x2222,0x4444,0x8888};
	
    	SetAfPt(_rp(obj), pat, 2);
	SetABPenDrMd(_rp(obj), _pens(obj)[MPEN_SHADOW], _pens(obj)[MPEN_BACKGROUND],JAM2);

    }
    else
    {
	SetABPenDrMd(_rp(obj), data->pen, 0,JAM1);
    }
    
    RectFill(_rp(obj), _mleft(obj), _mtop(obj), _mright(obj), _mbottom(obj));
    
    SetAfPt(_rp(obj), NULL, 0);
    
    return 0;
}
Ejemplo n.º 4
0
IPTR Register__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    struct Register_DATA *data = INST_DATA(cl, obj);

    /* Before all the current page is drawn erase the part of the area covered
     * by tabs which is not erased (between _left(obj) and _mleft(obj) and so on */
    if (data->oldactive != data->active && (msg->flags & MADF_DRAWUPDATE) && (data->active/data->columns != data->oldactive/data->columns))
    {
        int left,top,width,height;

        left = _mright(obj)+1;
        top = _mtop(obj);
        width = _right(obj) - left; /* +1 - 1*/
        height = _mheight(obj);

        DoMethod(obj, MUIM_DrawBackground, left, top, width, height, left, top, 0);

        left = _left(obj)+1; /* +1 because the register frame shouldn't be ereased */
        width = _mleft(obj) - left; /* + 1 - 1 */

        DoMethod(obj, MUIM_DrawBackground, left, top, width, height, left, top, 0);

        top = _top(obj) + data->tab_height;
        height = _mtop(obj) - top; /* + 1 - 1 */
        width = _width(obj)-2;

        if (height > 0 && width > 0)
            DoMethod(obj, MUIM_DrawBackground, left, top, width, height, left, top, 0);

        top = _mbottom(obj);
        height = _bottom(obj) - top; /* + 1 - 1 */

        if (height > 0 && width > 0)
            DoMethod(obj, MUIM_DrawBackground, left, top, width, height, left, top, 0);
    }

    DoSuperMethodA(cl,obj,(Msg)msg);

    /*      D(bug("Register_Draw : flags = %d\n", msg->flags)); */
    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE)))
        return(0);

    RenderRegisterTab(cl, obj, msg->flags);

    data->oldactive = data->active;
    return TRUE;
}
Ejemplo n.º 5
0
IPTR mDraw(Class *cl, Object *obj, struct MUIP_Draw *msg) {
    mybug(0, ("mDraw gets called\n"));

    struct InstData *data = INST_DATA(cl, obj);

    WORD    	      y;
    IPTR    	      retval;

    static ULONG sec=0, mic=0, lastTick=0, currTick=0;
    
    retval = DoSuperMethodA(cl, obj, (Msg)msg);
    
    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE))) return 0;

    if(data->ps3eye_ep1pipe) {        
        for(y= 0; y < _mheight(obj); y++) {
            WORD col;
            col = ((y + data->pos) / 8) % 2;
            SetAPen(_rp(obj), _pens(obj)[col ? MPEN_SHADOW : MPEN_SHINE]);
            RectFill(_rp(obj), _mleft(obj), _mtop(obj) + y, _mright(obj), _mtop(obj) + y);
        }
        data->pos++;
    } else {
        /* Add static distortion or old crt-monitor effect */
        if(data->resolutionvga) {
            DoEffect(kitty640_pure, kitty, 640, 480);
            WritePixelArray(kitty, 0, 0, 640*4, _rp(obj), _mleft(obj), _mtop(obj), _mwidth(obj), _mheight(obj), RECTFMT_RGB032);
//          WritePixelArray(kitty640_pure, 0, 0, 640*4, _rp(obj), _mleft(obj), _mtop(obj), _mwidth(obj), _mheight(obj), RECTFMT_RGB032); //+(rand() % (10))
        } else {

            DoEffect(kitty320_pure, kitty, 320, 240);
            WritePixelArray(kitty, 0, 0, 320*4, _rp(obj), _mleft(obj), _mtop(obj), _mwidth(obj), _mheight(obj), RECTFMT_RGB032);
        }
    }


    //lastTick = currTick;
    //CurrentTime(&sec, &mic);
    //currTick = ((sec * 1000) + (mic / 1000));
    //mybug(-1, ("Delta %d mS\n", currTick-lastTick));

    return retval;
}
Ejemplo n.º 6
0
static IPTR mLampDraw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    struct lampData *data = INST_DATA(cl,obj);
    IPTR            res;

    res = DoSuperMethodA(cl,obj,(APTR)msg);

    if(hasFlag(msg->flags, (MADF_DRAWOBJECT|MADF_DRAWUPDATE)))
    {
        WORD l, t, r, b;

        /* Don't ask or modify ! */

        l = _mleft(obj);
        r = _mright(obj);
        t = _mtop(obj)+(_mheight(obj)+data->delta)/2-1;
        b = t-data->delta;

        if (r-l>2)
        {
            l += 1;
            r -= 1;
        }

        if (b-t>2)
        {
            t += 1;
            b -= 1;
        }

        SetAPen(_rp(obj), MUIPEN(isFlagSet(data->flags, FLG_LampDisabled) ? data->disabled : data->enabled));
        RectFill(_rp(obj),l,t,r,b);

        SetAPen(_rp(obj),MUIPEN(data->detail));
        Move(_rp(obj),l,t);
        Draw(_rp(obj),r,t);
        Draw(_rp(obj),r,b);
        Draw(_rp(obj),l,b);
        Draw(_rp(obj),l,t);
    }

    return res;
}
Ejemplo n.º 7
0
    /*
    ** Layout function. Here, we have to call MUI_Layout() for each
    ** our children. MUI wants us to place them in a rectangle
    ** defined by (0,0,lm->lm_Layout.Width-1,lm->lm_Layout.Height-1)
    ** You are free to put the children anywhere in this rectangle.
    */
BOOL MUI_Layout (Object *obj, LONG left, LONG top, LONG width, LONG height,
		 ULONG flags)
{
    static ULONG method = MUIM_Layout;
    Object *parent = _parent(obj);

/*
 * Called only by groups, never by windows
 */
    g_assert(parent != NULL);

    _left(obj) = left + _mleft(parent);
    _top(obj) = top + _mtop(parent);
    _width(obj) = width;
    _height(obj) = height;

    DoMethodA(obj, (Msg)&method);

    return TRUE;
}
Ejemplo n.º 8
0
IPTR Pendisplay__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    struct Pendisplay_DATA *data = INST_DATA(cl,obj);
    LONG    	    	       color;
    
    DoSuperMethodA(cl,obj,(Msg)msg);
    
    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE)))
        return FALSE;

    if (data->refobj)
    {
    	IPTR val;
	
	get(data->refobj, MUIA_Pendisplay_Pen, &val);	
    	color = (LONG)val;
    }
    else
    {
    	color = data->pen;
    }
    
    if (color == -1)
    {
    	static UWORD pat[] = {0x1111,0x2222,0x4444,0x8888};
	
    	SetAfPt(_rp(obj), pat, 2);
	SetABPenDrMd(_rp(obj), _pens(obj)[MPEN_SHADOW], _pens(obj)[MPEN_BACKGROUND],JAM2);

    }
    else
    {
	SetABPenDrMd(_rp(obj), MUIPEN(color), 0,JAM1);
    }
    
    RectFill(_rp(obj), _mleft(obj), _mtop(obj), _mright(obj), _mbottom(obj));
    
    SetAfPt(_rp(obj), NULL, 0);
    
    return 0;
}
Ejemplo n.º 9
0
/**************************************************************************
 MUIM_Draw
**************************************************************************/
IPTR Levelmeter__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    struct Levelmeter_DATA *data = INST_DATA(cl, obj);
    struct RastPort *rp;
    WORD x1, y1, x2, y2;

    DoSuperMethodA(cl,obj,(Msg)msg);

    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE)))
        return FALSE;

    x1 = _mleft(obj);
    y1 = _mtop(obj);
    x2 = _mright(obj);
    y2 = _mbottom(obj);

    rp = _rp(obj);

    if (msg->flags & MADF_DRAWOBJECT)
    {
        /* Transparent edges */

        DoMethod(obj, MUIM_DrawParentBackground, x1, y1, 2, 1, x1, y1, 0);
        DoMethod(obj, MUIM_DrawParentBackground, x1, y1 + 1, 1, 1, x1, y1 + 1, 0);

        DoMethod(obj, MUIM_DrawParentBackground, x2 - 1, y1, 2, 1, x2 - 1, y1, 0);
        DoMethod(obj, MUIM_DrawParentBackground, x2, y1 + 1, 1, 1, x2, y1 + 1, 0);

        DoMethod(obj, MUIM_DrawParentBackground, x1, y2, 2, 1, x1, y2, 0);
        DoMethod(obj, MUIM_DrawParentBackground, x1, y2 - 1, 1, 1, x1, y2 - 1, 0);

        DoMethod(obj, MUIM_DrawParentBackground, x2 - 1, y2, 2, 1, x2 - 1, y2, 0);
        DoMethod(obj, MUIM_DrawParentBackground, x2, y2 - 1, 1, 1, x2, y2 - 1, 0);

        /* Outer frame */

        SetABPenDrMd(rp, _pens(obj)[MPEN_SHINE], 0, JAM1);
        Move(rp, x1 + 1, y2 - 1);
        Draw(rp, x1, y2 - 2);
        Draw(rp, x1, y1 + 2);
        Draw(rp, x1 + 2, y1);
        Draw(rp, x2 - 2, y1);
        Draw(rp, x2 - 1, y1 + 1);

        SetAPen(rp, _pens(obj)[MPEN_SHADOW]);
        Move(rp, x2, y1 + 2);
        Draw(rp, x2, y2 - 2);
        Draw(rp, x2 - 2, y2);
        Draw(rp, x1 + 2, y2);

        SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]);
        Move(rp, x1 + 1, y2 - 2);
        Draw(rp, x1 + 1, y1 + 2);
        Draw(rp, x1 + 2, y1 + 1);
        Draw(rp, x2 - 2, y1 + 1);

        SetAPen(rp, _pens(obj)[MPEN_HALFSHADOW]);
        Move(rp, x2 - 1, y1 + 2);
        Draw(rp, x2 - 1, y2 - 2);
        Draw(rp, x2 - 2, y2 - 1);
        Draw(rp, x1 + 2, y2 - 1);

        /* Border */

        x1 += OUTERFRAME_X;
        x2 -= OUTERFRAME_X;
        y1 += OUTERFRAME_X;
        y2 -= OUTERFRAME_Y;

        SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]);
        RectFill(rp, x1, y1, x2, y1 + BORDERSIZE_Y - 1);
        RectFill(rp, x1, y1 + BORDERSIZE_Y, x1 + BORDERSIZE_X - 1, y2);
        RectFill(rp, x1 + BORDERSIZE_X - 1, y2 - BORDERSIZE_Y + 1, x2, y2);
        RectFill(rp, x2 - BORDERSIZE_X + 1, y1 + BORDERSIZE_Y, x2, y2 - BORDERSIZE_Y);

        /* Inner Frame */

        x1 += BORDERSIZE_X;
        x2 -= BORDERSIZE_X;
        y1 += BORDERSIZE_Y;
        y2 = y1 + LEVEL_HEIGHT + INNERFRAME_H - 1;

        Move(rp, x1, y1);
        Draw(rp, x1 + 2, y1);
        Draw(rp, x1, y1 + 2);
        Draw(rp, x1, y1 + 1);

        Move(rp, x2, y1);
        Draw(rp, x2 - 2, y1);
        Draw(rp, x2, y1 + 2);
        Draw(rp, x2, y1 + 1);

        Move(rp, x1, y2);
        Draw(rp, x1 + 2, y2);
        Draw(rp, x1, y2 - 2);
        Draw(rp, x1, y2 - 1);

        Move(rp, x2, y2);
        Draw(rp, x2 - 2, y2);
        Draw(rp, x2, y2 - 2);
        Draw(rp, x2, y2 - 1);

        SetAPen(rp, _pens(obj)[MPEN_HALFSHADOW]);
        Move(rp, x1 + 2, y2 - 1);
        Draw(rp, x1, y2 - 3);
        Draw(rp, x1, y1 + 3);
        Draw(rp, x1 + 3, y1);
        Draw(rp, x2 - 3, y1);
        Draw(rp, x2 - 1, y1 + 2);

        SetAPen(rp, _pens(obj)[MPEN_SHINE]);
        Move(rp, x2, y1 + 3);
        Draw(rp, x2, y2 - 3);
        Draw(rp, x2 - 3, y2);
        Draw(rp, x1 + 3, y2);

        SetAPen(rp, _pens(obj)[MPEN_SHADOW]);
        Move(rp, x1 + 3, y1 + 1);
        Draw(rp, x2 - 3, y1 + 1);
        Move(rp, x1 + 1, y1 + 3);
        Draw(rp, x1 + 1, y2 - 3);
        Move(rp, x1 + 3, y2 - 1);
        Draw(rp, x2 - 3, y2 - 1);
        Move(rp, x2 - 1, y1 + 3),
             Draw(rp, x2 - 1, y2 - 3);

        /* Levelmeter bg */

        x1 += INNERFRAME_X;
        x2 -= INNERFRAME_X;
        y1 += INNERFRAME_Y;
        y2 -= INNERFRAME_Y;

        SetAPen(rp, data->levelbgpen);
        RectFill(rp, x1 + 1, y1, x2 - 1, y1);
        RectFill(rp, x1, y1 + 1, x2, y2 - 1);
        RectFill(rp, x1 + 1, y2, x2 - 1, y2);

        SetAPen(rp, _pens(obj)[MPEN_SHADOW]);
        WritePixel(rp, x1, y1);
        WritePixel(rp, x2, y1);
        WritePixel(rp, x1, y2);
        WritePixel(rp, x2, y2);

        /* Levelmeter scale */

        DrawScale(rp, x1, y1, x2, y2, _pens(obj)[MPEN_SHINE]);

        /* Level-Label spacing */

        x1 -= INNERFRAME_X;
        x2 += INNERFRAME_X;
        y1 = y2 + INNERFRAME_Y + 1;

        SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]);
        RectFill(rp, x1, y1, x2, y1 + LEVEL_LABEL_SPACING - 1);

        /* Label Frame */

        y1 += LEVEL_LABEL_SPACING;
        y2 = _mbottom(obj) - OUTERFRAME_Y - BORDERSIZE_Y;

        SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]);
        Move(rp, x1, y1);
        Draw(rp, x1 + 1, y1);
        Draw(rp, x1, y1 + 1);
        Move(rp, x2, y1);
        Draw(rp, x2 - 1, y1);
        Draw(rp, x2, y1 + 1);
        Move(rp, x1, y2);
        Draw(rp, x1 + 1, y2);
        Draw(rp, x1, y2 - 1);
        Move(rp, x2, y2);
        Draw(rp, x2 - 1, y2);
        Draw(rp, x2, y2 - 1);

        SetAPen(rp, _pens(obj)[MPEN_HALFSHADOW]);
        Move(rp, x1 + 1, y2 - 1);
        Draw(rp, x1, y2 - 2);
        Draw(rp, x1, y1 + 2);
        Draw(rp, x1 + 2, y1);
        Draw(rp, x2 - 2, y1);
        Draw(rp, x2 - 1, y1 + 1);

        SetAPen(rp, _pens(obj)[MPEN_SHINE]);
        Move(rp, x2, y1 + 2);
        Draw(rp, x2, y2 - 2);
        Draw(rp, x2 - 2, y2);
        Draw(rp, x1 + 2, y2);

        SetAPen(rp, _pens(obj)[MPEN_SHADOW]);
        RectFill(rp, x1 + 1, y1 + 2, x1 + 1, y2 - 2);
        RectFill(rp, x2 - 1, y1 + 2, x2 - 1, y2 - 2);
        RectFill(rp, x1 + 2, y1 + 1, x2 - 2, y1 + 1);
        RectFill(rp, x1 + 2, y2 - 1, x2 - 2, y2 - 1);

        /* Label Bg */

        RectFill(rp, x1 + 2, y1 +2, x2 - 2, y2 - 2);

    }

    x1 = _mleft(obj) + OUTERFRAME_X + BORDERSIZE_X + INNERFRAME_X;
    x2 = _mright(obj) - OUTERFRAME_X - BORDERSIZE_X - INNERFRAME_X;
    y1 = _mtop(obj) + OUTERFRAME_Y + BORDERSIZE_Y + INNERFRAME_Y;
    y2 = y1 + LEVEL_HEIGHT - 1;

    if (msg->flags & MADF_DRAWUPDATE)
    {
        DrawNeedle(rp, x1, y1, x2, y2, data->prevangle, data->levelbgpen);
    }

    data->prevangle = (double)DoMethod(obj, MUIM_Numeric_ValueToScale, 0, 180);

    DrawNeedle(rp, x1, y1, x2, y2, data->prevangle, _pens(obj)[MPEN_SHINE]);

    return TRUE;
}
Ejemplo n.º 10
0
static BOOL MakePopupWin(Object *obj, struct Numericbutton_DATA *data)
{
    const struct ZuneFrameGfx 	*zframe;
    struct RastPort 	    	*rp, *saverp;
    LONG    	    	    	 winx, winy, winw, winh;
    LONG    	    	    	 framew, frameh;
    LONG    	    	    	 min, max;

    zframe = zune_zframe_get_with_state(obj, &muiGlobalInfo(obj)->mgi_Prefs->frames[MUIV_Frame_Slider],
                                        muiGlobalInfo(obj)->mgi_Prefs->frames[MUIV_Frame_Slider].state);

    data->pop_innerx = zframe->ileft;
    data->pop_innery = zframe->itop;

    data->knob_width = data->max_text_width + 4;
    data->knob_height = data->text_height + 2;

    framew = data->pop_innerx + zframe->iright;
    frameh = data->pop_innery + zframe->ibottom;

    longget(obj, MUIA_Numeric_Min, &min);
    longget(obj, MUIA_Numeric_Max, &max);

    winw = max - min + data->knob_width + framew;
    winh = data->knob_height + frameh;

    if (winw > _screen(obj)->Width)
    {
        winw = _screen(obj)->Width;
    }

    if ((winw < data->knob_width + framew) || (winh > _screen(obj)->Height))
    {
        return FALSE;
    }

    data->pop_innerw = winw - framew;
    data->pop_innerh = winh - frameh;

    data->knob_left = DoMethod(obj, MUIM_Numeric_ValueToScale, 0, data->pop_innerw - data->knob_width);

    winx = _window(obj)->LeftEdge + _mleft(obj) -
           data->pop_innerx - 2 -
           data->knob_left;
    winy = _window(obj)->TopEdge + _mtop(obj) - 1-
           data->pop_innery;

    data->popwin = OpenWindowTags(NULL, WA_CustomScreen, (IPTR)_screen(obj),
                                  WA_Left, winx,
                                  WA_Top, winy,
                                  WA_Width, winw,
                                  WA_Height, winh,
                                  WA_AutoAdjust, TRUE,
                                  WA_Borderless, TRUE,
                                  WA_Activate, FALSE,
                                  WA_BackFill, (IPTR)LAYERS_NOBACKFILL,
                                  TAG_DONE);

    if (!data->popwin)
    {
        return FALSE;
    }

    rp = data->popwin->RPort;

    saverp = _rp(obj);
    _rp(obj) = rp;
    zframe->draw(zframe->customframe, muiRenderInfo(obj), 0, 0, winw, winh, 0, 0, winw, winh);

    DrawKnob(obj, data, TRUE);


    _rp(obj) = saverp;

    return TRUE;

}
Ejemplo n.º 11
0
static VOID DrawButtons(struct Toolbar_Data *data, Object *obj, BOOL complete)
{
  struct MUIP_Toolbar_Description *desc = data->Desc;

  Object *par;
  ULONG back;

  get(obj, MUIA_Parent, (ULONG)&par);
  if (par) {
    get(par, MUIA_Background, &back);
    set(obj, MUIA_Background, back);
  }

  if(data->SingleGone) // Just a single button which is going to disappear
  {
    struct TB_Element *tool = data->SingleGone;
    // Should the seperator-lines before and after be deleted?
    UBYTE before = 0;
    UBYTE after = 0;
    WORD x,y;

    if(data->ToolSpace < 0)
    {
      struct MinNode *node = (struct MinNode *)tool;
      struct MinNode *pred = node->mln_Pred;
      struct MinNode *succ = node->mln_Succ;

      if(data->ToolList.mlh_Head != node) // Not the first
        before =     (((struct TB_Element *)pred)->Type == TDT_SPACE && data->GroupSpace != -1)
              ||  (desc[((struct TB_Element *)pred)->Number].Flags & TDF_GONE)     ? 0 : 1;

      after = before + ( (((struct TB_Element *)succ)->Type == TDT_SPACE && data->GroupSpace != -1)
              ||     (desc[((struct TB_Element *)succ)->Number].Flags & TDF_GONE  )    ? 0 : 1);
    }

    x = tool->DstX;
    y = tool->DstY;

    if(data->Horizontal)
      DoMethod(obj, MUIM_DrawBackground, x + before, y, data->ButtonWidth-after, data->ButtonHeight, x+before, y, 0);
    else
      DoMethod(obj, MUIM_DrawBackground, x, y + before, data->ButtonWidth, data->ButtonHeight-after, x, y+before, 0);

    data->SingleGone = NULL;
  }
  else
  {
    UWORD drawback_begin = _mleft(obj);
    UWORD drawback_end = 0;

    struct MinList *list = (struct MinList *)&data->ToolList;
    struct MinNode *node;

    for(node = list->mlh_Head; node->mln_Succ; node = *(struct MinNode **)node)
    {
      struct TB_Element *elem = (struct TB_Element *)node;
      if(complete || elem->Redraw)
      {
        elem->Redraw = FALSE;
        if(elem->Type == TDT_BUTTON)
        {
          struct TB_Element *tool = (struct TB_Element *)elem;
          struct MUIP_Toolbar_Description tdesc = desc[tool->Number];

          if(tdesc.Flags & TDF_GONE)
          {
            drawback_end = tool->DstOffset + 1 + data->ButtonSize;
          }
          else
          {
            BOOL selected;

            if(drawback_begin<drawback_end)
            {
              if(data->Horizontal)
                DoMethod(obj, MUIM_DrawBackground, drawback_begin, _mtop(obj), drawback_end-drawback_begin, data->ButtonHeight, drawback_begin, _mtop(obj), 0);
              else
                DoMethod(obj, MUIM_DrawBackground, _mleft(obj), drawback_begin, data->ButtonWidth, drawback_end-drawback_begin, _mleft(obj), drawback_begin, 0);
            }

            drawback_begin = tool->DstOffset + data->ButtonSize;

            if(data->ToolSpace > 0)
              drawback_end = drawback_begin + data->ToolSpace;

            selected = tdesc.Flags & TDF_SELECTED ? TRUE : FALSE;

            if(tdesc.Flags & TDF_GHOSTED)
                DrawGhosted(tool, data, obj, selected);
            else  DrawButton(tool, data, obj, selected, NOT_THREE_D);
          }
        }
        else // TDT_SPACE
        {
          struct TB_Element *space = (struct TB_Element *)elem;
          if(data->GroupSpace > 0)
            drawback_end = space->DstOffset + space->Size;
        }
      }
    }

    // In case of 'trailing' spaces...
    if(complete)
    {
      if(drawback_begin < (data->Horizontal ? _mright(obj) : _mbottom(obj)))
      {
        if(data->Horizontal)
          DoMethod(obj,MUIM_DrawBackground, drawback_begin, _mtop(obj), _mright(obj)-drawback_begin, data->ButtonHeight, drawback_begin, _mtop(obj), 0);
        else
          DoMethod(obj,MUIM_DrawBackground, _mleft(obj), drawback_begin, data->ButtonWidth, _mbottom(obj)-drawback_begin, _mleft(obj), drawback_begin, 0);
      }
    }
  }
}