Package org.gudy.azureus2.ui.swt.shells

Examples of org.gudy.azureus2.ui.swt.shells.GCStringPrinter


            width, height);
      }
    }

    if (text != null && text.length() > 0) {
      GCStringPrinter sp = new GCStringPrinter(gc, text, bounds, true, false,
          wrapText?( orientation | SWT.WRAP ):orientation );
      sp.printString();
      hadMore = sp.isCutoff();
    }

    invokeSWTPaintListeners(gc);
  }
View Full Code Here


              gc.fillRectangle(bounds);
              String title = MessageText.getString(
                  tableColumn.getTitleLanguageKey(), tableColumn.getName());
              String s = title
                  + " Column will be placed at the location you drop it, shifting other columns down";
              GCStringPrinter sp = new GCStringPrinter(gc, s, bounds, false, false,
                  SWT.CENTER | SWT.WRAP);
              sp.calculateMetrics();
              if (sp.isCutoff()) {
                GCStringPrinter.printString(gc, title, bounds, false, false,
                    SWT.CENTER | SWT.WRAP);
              } else {
                sp.printString();
              }
            } finally {
              gc.dispose();
            }
          } catch (Throwable t) {
View Full Code Here

          }
        }

        gc.setAlpha(alpha);

        GCStringPrinter sp = new GCStringPrinter(gc, sDisplayText,
            new Rectangle(0, 0, wHint == -1 ? 3000 : wHint, hHint == -1
                ? 3000 : hHint), true, false, style & SWT.WRAP);
        sp.calculateMetrics();
        pt = sp.getCalculatedSize();
        pt.x += border + hpadding * 2;
        pt.y += border + vpadding * 2;
        gc.dispose();

        if (isUnderline) {
View Full Code Here

      GCStringPrinter.printString(gc, sDisplayText, r, true, false, style);
      gc.setForeground(foreground);
    }

    gc.setAlpha(alpha);
    lastStringPrinter = new GCStringPrinter(gc, sDisplayText, clientArea, true,
        false, style);
    if (colorUrl != null) {
      lastStringPrinter.setUrlColor(colorUrl);
    }
    if (colorUrl2 != null && mouseDown) {
View Full Code Here

        gc.setForeground(ColorCache.getColor(gc.getDevice(), 255, 255, 255));
        gc.setAlpha(100);
        clipping.x++;
        clipping.y++;
        //style = SWT.TOP;
        GCStringPrinter sp = new GCStringPrinter(gc, text, clipping, true, false,
            style);
        sp.printString();
        gc.setAlpha(255);

        clipping.x--;
        clipping.y--;
        gc.setForeground(fgText);
      } else {
        gc.setForeground(fgText);
      }
      //gc.setClipping(clipping);

      GCStringPrinter sp = new GCStringPrinter(gc, text, clipping, true, false,
          style);
      sp.printString();
      clipping.x += sp.getCalculatedSize().x + 5;
      //gc.setClipping((Rectangle) null);
    }
   
    // Vitality Images
View Full Code Here

          Color oldColor = e.gc.getForeground();

          Rectangle printArea = ((Composite) e.widget).getClientArea();
          int fullWidth = printArea.width;
          int fullHeight = printArea.height;
          GCStringPrinter sp = new GCStringPrinter(e.gc,
              MessageText.getString("remote.pairing.accesscode"), printArea,
              false, false, SWT.NONE);
          sp.calculateMetrics();
          Point sizeAccess = sp.getCalculatedSize();

          String drawAccessCode = accessCode == null ? "      " : accessCode;

          int numBoxes = drawAccessCode == null ? 0 : drawAccessCode.length();
          int boxSize = 25;
          int boxSizeAndPadding = 30;
          int allBoxesWidth = numBoxes * boxSizeAndPadding;
          int textPadding = 15;
          printArea.x = (fullWidth - (allBoxesWidth + sizeAccess.x + textPadding)) / 2;
          printArea.width = sizeAccess.x;

          sp.printString(e.gc, printArea, 0);
          e.gc.setBackground(Colors.white);
          e.gc.setForeground(Colors.blue);

          int xStart = printArea.x + sizeAccess.x + textPadding;
          int yStart = (fullHeight - boxSize) / 2;
View Full Code Here

      }
      gc.setFont(font);

      Rectangle bounds = getDrawBounds(cell);

      GCStringPrinter sp = new GCStringPrinter(gc, text, bounds, true, true,
          SWT.WRAP | SWT.CENTER);

      sp.calculateMetrics();

      if (sp.hasHitUrl()) {
        URLInfo[] hitUrlInfo = sp.getHitUrlInfo();
        for (int i = 0; i < hitUrlInfo.length; i++) {
          URLInfo info = hitUrlInfo[i];
            // handle fake row when showing in column editor
         
          info.urlUnderline = cell.getTableRow() == null || cell.getTableRow().isSelected();
          if (info.urlUnderline) {
            info.urlColor = null;
          } else {
            info.urlColor = colorLinkNormal;
          }
        }
        int[] mouseOfs = cell.getMouseOffset();
        if (mouseOfs != null) {
          Rectangle realBounds = cell.getBounds();
          URLInfo hitUrl = sp.getHitUrl(mouseOfs[0] + realBounds.x, mouseOfs[1]
              + realBounds.y);
          if (hitUrl != null) {
            hitUrl.urlColor = colorLinkHover;
          }
        }
      }

      sp.printString();
    }
  }
View Full Code Here

    String text = (String) event.cell.getTableRow().getData("text");
    if (text == null) {
      return;
    }

    GCStringPrinter sp = null;
    GC gc = new GC(Display.getDefault());
    try {
      if (font != null) {
        gc.setFont(font);
      }
      Rectangle drawBounds = getDrawBounds((TableCellSWT) event.cell);
      sp = new GCStringPrinter(gc, text, drawBounds, true, true, SWT.WRAP
          | SWT.CENTER);
      sp.calculateMetrics();
    } catch (Exception e) {
      Debug.out(e);
    } finally {
      gc.dispose();
    }

    if (sp != null) {
      URLInfo hitUrl = sp.getHitUrl(event.x + bounds.x, event.y + bounds.y);
      int newCursor;
      if (hitUrl != null) {
        if (event.eventType == TableCellMouseEvent.EVENT_MOUSEUP) {
          if (hitUrl.url.equals("download")) {
            String referal = null;
View Full Code Here

      String sPercent = DisplayFormatters.formatPercentFromThousands(percentDone);

      Rectangle area = new Rectangle(xStart + xRelProgressFillStart + 3, yStart
          + yRelProgressFillStart, xRelProgressFillEnd - xRelProgressFillStart
          - 6, yRelProgressFillEnd - yRelProgressFillStart);
      GCStringPrinter sp = new GCStringPrinter(gc, sPercent + sSpeed, area,
          true, false, SWT.LEFT);
      if (cTextDrop != null) {
        area.x++;
        area.y++;
        gc.setForeground(cTextDrop);
        sp.printString();
        area.x--;
        area.y--;
      }
      gc.setForeground(cText);
      sp.printString();
      Point pctExtent = sp.getCalculatedSize();

      area.width -= (pctExtent.x + 3);
      area.x += (pctExtent.x + 3);

      if (!showSecondLine && sETALine != null) {
View Full Code Here

    colorLinkHover = skinProperties.getColor("color.links.hover");
  }

  // @see org.gudy.azureus2.ui.swt.views.table.TableCellSWTPaintListener#cellPaint(org.eclipse.swt.graphics.GC, org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void cellPaint(GC gc, TableCellSWT cell) {
    GCStringPrinter sp = setupStringPrinter(gc, cell);

    if (sp.hasHitUrl()) {
      URLInfo[] hitUrlInfo = sp.getHitUrlInfo();
      for (int i = 0; i < hitUrlInfo.length; i++) {
        URLInfo info = hitUrlInfo[i];
        info.urlUnderline = cell.getTableRow().isSelected();
        if (info.urlUnderline) {
          info.urlColor = null;
        } else {
          info.urlColor = colorLinkNormal;
        }
      }
      int[] mouseOfs = cell.getMouseOffset();
      if (mouseOfs != null) {
        Rectangle realBounds = cell.getBounds();
        URLInfo hitUrl = sp.getHitUrl(mouseOfs[0] + realBounds.x, mouseOfs[1]
            + realBounds.y);
        if (hitUrl != null) {
          hitUrl.urlColor = colorLinkHover;
        }
      }
    }

    sp.printString();
    gc.setFont(null);
  }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.ui.swt.shells.GCStringPrinter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.