Ejemplo n.º 1
0
void JBtnObj::update(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
  JRect rect = getIExtent(dx, dy, scale), thumb;
  JRegion frgn(rect.shrinkBy(depth, depth));
  if ((rect.width > 0) && (rect.height > 0)) {
    g.setJColor(bkgnd);
    g.fillJRect(rect);
    thumb = rect.shrink(depth, depth);
    if ((thumb.width > 0) && (thumb.height > 0)) {
      switch (type) {
        case TYPE_RECT:
          g.draw3DJRect(thumb, ((value) ? -depth : depth));
          break;
        case TYPE_LEFT:
        case TYPE_RIGHT:
        case TYPE_UP:
        case TYPE_DOWN:
          g.draw3DJTriangle(thumb, 
            ((value) ? -depth : depth), type-1);
          break;
      }
      if (label.length()) {
        g.setJColor(color);
        drawText(g, label, thumb.shrink(depth, depth));
      }
    }
  }
}
Ejemplo n.º 2
0
void JLEDObj::update(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
  JRect rect = getIExtent(dx, dy, scale);
  if (value == 0) g.setJColor(bkgnd);
  else g.setJColor(color);
  if ((rect.width > depth2) && (rect.height > depth2)) {
    g.fillJRect(rect.shrink(depth, depth));
  } else g.fillJRect(rect);
}
Ejemplo n.º 3
0
void J1DSliderObj::paint(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
  JRect rect = getIExtent(dx, dy, scale);
  g.setJColor(moduleColor);
  if ((rect.width > depth2+2) && (rect.height > depth2+2)) {
    g.draw3DJRect(rect, depth);
    g.draw3DJRect(rect.shrink(depth, depth), -1);
  } else g.fillJRect(rect);
  update(g, dx, dy, rgn, scale);
}
Ejemplo n.º 4
0
void JListBox::paint(JGraphics g) {
  int dx = d2+d2, dy;
  int th = getBaseH();
  int ns = section;
  JString text;
  JFontMetrics fm(g);
  JRect clip = g.getClipJRect();
  JRect frame = JRect(0, 0, width-scroller->width, height);
  JRegion rgn(clip &= frame);
  JColor color = getForeground();
  JColor bkgnd = getBackground();
  JColor light = bkgnd.brighter();
  clip &= frame.shrink(d, d);
  if (base+ns > content.size())
    ns = content.size()-base;
  for (int i=0; i<ns; i++) {
    dy = i*th+d2;
    JRect cell(d2, dy, width-scroller->width-d2*2, th-d);
    JRect area = cell & clip;
    JRect inner = cell.shrink(d, d) & clip;
    if (area.isEmpty()) continue;
    JAssociation &obj = *(JAssociation*)content[i+base];
    text = *(JString*)obj.key();
    g.setClipJRect(cell & clip);
    g.setJColor(bkgnd);
    if (!(int)*(JInteger*)obj.value()) {
      g.fill3DJRect(cell, d);
      g.setJColor(light);
      g.setClipJRect(inner);
      g.drawJString(text, dx+1, dy+1);
    } else {
      g.fill3DJRect(cell, -d);
      g.setJColor(light);
      g.setClipJRect(inner);
      g.drawJString(text, dx-1, dy-1);
    }
    g.setJColor(color);
    g.drawJString(text, dx, dy);
    rgn -= JRegion(area);
  }
  g.setJRegion(rgn);
  g.setJColor(bkgnd);
  g.fill3DJRect(frame, -d);
}
Ejemplo n.º 5
0
void J1DMObj::update(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
     JRect frect = getIExtent(dx, dy, scale);
     JRect rect = frect.shrink(depth, depth);
     if ((rect.width > 0) && (rect.height > 0)) {
          g.setJRegion(rgn & rect);

/*  module refresh
          g.setJRegion(rgn);
		  g.setJColor(moduleColor);
		  g.draw3DJRect(rect, depth);
		  g.fillJRect(rect.shrinkBy(depth, depth));
		  g.setJRegion(rgn & rect);
		  g.setJColor(color);
*/
          v[0] = max(0, min(mask, v[0]));
          v[1] = max(0, min(mask, v[1]));
		  int xpos =  v[0]*(rect.width-depth)/mask;
          int ypos =  v[1]*(rect.height-depth)/mask;

		  g.setJColor(color);
          g.drawLine(rect.x+xpos, rect.y+ypos, rect.x+xpos+1, 
			         rect.y+ypos+1);
	 }
}