Beispiel #1
0
VOID RenderMessage::Reset (ULONG minx, ULONG miny, ULONG maxx, ULONG maxy, LONG offsetx, LONG offsety, LONG left, LONG top, LONG *pens)
{
  MinX = minx;
  MinY = miny;
  MaxX = maxx;
  MaxY = maxy;
  OffsetX = offsetx;
  OffsetY = offsety;
  Left = left;
  Top = top;

  UL_Nesting = Textstyles = 0;
  Align = Align_None;

  Colours[Col_Background] = MUIPEN(pens[Col_Background]);
  Colours[Col_Text]     = MUIPEN(pens[Col_Text]);
  Colours[Col_Shine]    = MUIPEN(pens[Col_Shine]);
  Colours[Col_Shadow]   = MUIPEN(pens[Col_Shadow]);
  Colours[Col_Halfshine]  = MUIPEN(pens[Col_Halfshine]);
  Colours[Col_Halfshadow] = MUIPEN(pens[Col_Halfshadow]);
  Colours[Col_Link]     = MUIPEN(pens[Col_Link]);
  Colours[Col_VLink]    = MUIPEN(pens[Col_VLink]);
  Colours[Col_ALink]    = MUIPEN(pens[Col_ALink]);

  TargetObj = NULL;
}
Beispiel #2
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;
}
Beispiel #3
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;
}
Beispiel #4
0
static VOID DrawButton(struct TB_Element *tool, struct Toolbar_Data *data, Object *obj, BOOL selected, BOOL three_d)
{
  // This routine depends heavily on selected being either 0 or 1.
  WORD x = tool->DstX, y  = tool->DstY;
  ULONG delta = (data->ButtonWidth - data->IconWidth)/2;
  struct RastPort *rport = &data->RP;
  UBYTE number = tool->Number;
  Object *par;
  ULONG back;

  LONG trans = selected ? data->SelectTrans : data->NormalTrans;
  struct BitMap *bitmap = selected ? data->SelectBM : data->NormalBM;
  PLANEPTR mask =  three_d ? data->GhostMask : ( selected ? data->SelectMask : data->NormalMask );

  // Clear background
  SetAPen(rport, three_d ? data->GhostTrans : trans);
//rf  RectFill(rport,  x+1, y+1, x+data->ButtonWidth-2+selected, y+data->ButtonHeight-2+selected);
  if (data->BorderType == BORDERTYPE_OLD) {
    RectFill(rport,  x+1, y+1, x+data->ButtonWidth-1, y+data->ButtonHeight-1);
  } else if (data->BorderType == BORDERTYPE_OFF) {
    get(obj, MUIA_Parent, (ULONG)&par);
    if (par) {
      get(par, MUIA_Background, &back);
      set(obj, MUIA_Background, back);
    }
    DoMethod(obj, MUIM_DrawBackground, x,   y, data->ButtonWidth, data->ButtonHeight, x, y);
  } else if (data->BorderType == BORDERTYPE_NEW) {
    RectFill(rport,  x+1, y+1, x+data->ButtonWidth-1, y+data->ButtonHeight-1);
  }

  // Borders

  if (data->BorderType == BORDERTYPE_OLD) {
    UpperFrame(rport, x,   y, x+data->ButtonWidth-2, y+data->ButtonHeight-1, _pens(obj)[MPEN_SHADOW]);
    LowerFrame(rport, x+1, y, x+data->ButtonWidth-1, y+data->ButtonHeight-1, _pens(obj)[MPEN_SHADOW]);
  } else  if (data->BorderType == BORDERTYPE_NEW) {
    UpperFrame(rport, x,   y, x+data->ButtonWidth-2, y+data->ButtonHeight-1, _pens(obj)[MPEN_SHINE]);
    LowerFrame(rport, x+1, y, x+data->ButtonWidth-1, y+data->ButtonHeight-1, _pens(obj)[MPEN_SHADOW]);
  }

  if (data->SelectionMode != SELECTIONMODE_OFF) {
    if(selected)
    {
      if (data->SelectionMode == SELECTIONMODE_OLD) {
        UpperFrame(rport, x+1, y+1, x+data->ButtonWidth-2, y+data->ButtonHeight-2, _pens(obj)[MPEN_HALFSHADOW]);
        UpperFrame(rport, x+2, y+2, x+data->ButtonWidth-2, y+data->ButtonHeight-2, _pens(obj)[MPEN_BACKGROUND]);
      } else {
        UpperFrame(rport, x, y, x+data->ButtonWidth-2, y+data->ButtonHeight-1, _pens(obj)[MPEN_SHADOW]);
        LowerFrame(rport, x+1, y, x+data->ButtonWidth-1, y+data->ButtonHeight-1, _pens(obj)[MPEN_SHINE]);
      }
    } else  {
      if (data->BorderType == BORDERTYPE_OLD) {
        UpperFrame(rport, x+1, y+1, x+data->ButtonWidth-3, y+data->ButtonHeight-3, _pens(obj)[MPEN_SHINE]);
        LowerFrame(rport, x+2, y+2, x+data->ButtonWidth-2, y+data->ButtonHeight-2, _pens(obj)[MPEN_HALFSHADOW]);
      }
    }
  } else  {
    if (data->BorderType == BORDERTYPE_OLD) {
      UpperFrame(rport, x+1, y+1, x+data->ButtonWidth-3, y+data->ButtonHeight-3, _pens(obj)[MPEN_SHINE]);
      LowerFrame(rport, x+2, y+2, x+data->ButtonWidth-2, y+data->ButtonHeight-2, _pens(obj)[MPEN_HALFSHADOW]);
    }
  }

  if(data->ToolTexts)
  {
    BOOL parse = tool->ParseUnderscore;
    STRPTR tooltext = data->Desc[number].ToolText;
//    SetFont(rport, data->ToolFont); Flyttet til MUIM_Show
    ULONG width = TextLength(rport, tooltext, strlen(tooltext)) - (parse ? data->UnderscoreSize : 0);

    UWORD horiz_offset = selected + (data->ButtonWidth - width)/2;
    UWORD vert_offset  = selected + data->IconHeight + data->InnerSpace + 3;
    if(three_d)
      Draw3DText(rport, x + horiz_offset, y + vert_offset, tooltext, data->Desc[number].Key, data->HalfShadow, data->HalfShine, parse);
    else
      DrawText(rport, x + horiz_offset, y + vert_offset, tooltext, data->Desc[number].Key, MUIPEN(data->TextPen), parse);
  }

  if(data->ToolImages)
  {
    if(bitmap)
    {
      if(mask && (data->BorderType != BORDERTYPE_OLD))
      {
        MyBltMaskBitMapRastPort((three_d ? data->GhostBM : bitmap), tool->SrcOffset, 0, rport, x+delta+selected, y+data->InnerSpace+2+selected, data->IconWidth, data->IconHeight, 0xc0, mask);
      }
      else
      {
        BltBitMapRastPort((three_d ? data->GhostBM : bitmap), tool->SrcOffset, 0, rport, x+delta+selected, y+data->InnerSpace+2+selected, data->IconWidth, data->IconHeight, 0xc0);
      }
    }
    else
    {
      x += data->ButtonWidth/2 + selected - 3;
      y += data->InnerSpace + data->IconHeight/2 + selected;
      SetAPen(rport, _pens(obj)[MPEN_HALFSHADOW]);
      RectFill(rport, x, y, x+4, y+4);
    }
  }
}